mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
d6adcfc058
Summary: This is the spiritual successor to D3302706 which originally wanted to solve this by adding a python extension. That would prove to be too painful for the opensource build so it was shelved. We now need to be able to run our tests in an environment that doesn't have the `attr` rpm installed so this is a good time to fix this in a more portable way. This diff adds a little wrapper around the functions that we already have for consuming extended attribute information and augments them with another to list attributes. The utility emits output in json format and is intended to be fed directly into the helper functions we have in `fs.py`. Reviewed By: chadaustin Differential Revision: D6851182 fbshipit-source-id: 3d1d1a351f2e01405645d45658d1c8bc61a659a4
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#pragma once
|
|
#include <errno.h>
|
|
#include <folly/String.h>
|
|
#include <sys/xattr.h>
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
constexpr int kENOATTR =
|
|
#ifndef ENOATTR
|
|
ENODATA // Linux
|
|
#else
|
|
ENOATTR
|
|
#endif
|
|
;
|
|
|
|
constexpr folly::StringPiece kXattrSha1{"user.sha1"};
|
|
|
|
std::string fgetxattr(int fd, folly::StringPiece name);
|
|
void fsetxattr(int fd, folly::StringPiece name, folly::StringPiece value);
|
|
|
|
/// like getxattr(2), but portable. This is primarily to facilitate our
|
|
/// integration tests.
|
|
std::string getxattr(folly::StringPiece path, folly::StringPiece name);
|
|
|
|
/// like listxattr(2), but more easily consumable from C++.
|
|
// This is primarily to facilitate our integration tests.
|
|
std::vector<std::string> listxattr(folly::StringPiece path);
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|