10 #define ENOATTR ENODATA
14 containerName(
'\0', optPrefix +
"_container",
"container name to use"),
15 poolName(
'\0', optPrefix +
"_pool",
"pool name to use"),
16 sysName(
'\0', optPrefix +
"_sys",
"sys name to use")
22 auto stripped = path.substr(0,path.find_last_of(
'/'));
28 auto result =
pathMap.emplace(path, obj);
36 &
poh,
nullptr,
nullptr),
39 &
coh,
nullptr,
nullptr),
47 "can't release dir object for ", item.first);
61 auto result = dfs_stat(
dfs,
getDirObj(path), path.c_str(), &statBuf);
62 if (result && (errno == ENOENT || errno == ENOTDIR)) {
72 auto result = dfs_stat(
dfs,
getDirObj(path), path.c_str(), &statBuf);
73 if (result && errno == ENOENT) {
77 if (followLink && S_ISLNK(statBuf.st_mode)) {
79 daos_size_t size =
sizeof(buf);
82 "can't open link", path);
84 "can't get symlink of link ", path);
88 return std::unique_ptr<const genericStat>(
new genericStat(statBuf, std::chrono::nanoseconds(1)));
93 const std::string& name) {
98 &obj,
nullptr,
nullptr),
99 "can't lookup ", path);
101 daos_size_t size =
sizeof(buffer);
102 auto retval = dfs_getxattr(
dfs, obj, name.c_str(), buffer, &size);
105 if (errno == ENOENT || errno ==
ENOATTR) {
127 return std::unique_ptr<const genericStat>(
new genericStat(statBuf, std::chrono::nanoseconds(1)));
132 "can't set xattr '", name,
"' to '", value,
"' on ",
path);
138 daos_size_t size =
sizeof(buffer);
139 auto retval = dfs_getxattr(
handler.
dfs,
obj, name.c_str(), buffer, &size);
153 auto result = dfs_removexattr(
handler.
dfs,
obj, name.c_str());
154 if (result && errno ==
ENOATTR) {
158 "can't remove xattr ", name,
" from ",
path);
162 xattrs.emplace_front(name, value);
165 for (
const auto& item : xattrs) {
166 handle->
setXattr(item.first, item.second);
174 daos_size_t size(
sizeof(buf));
176 "can't get xattrs for ", aHandler.
path);
178 for (
auto readPtr = &buf[0]; readPtr < &buf[size];) {
179 add(readPtr, aHandler.
getXattr(readPtr));
185 auto attrData = std::unique_ptr<attrDataType>(
new attrDataType());
186 attrData->fill(*
this);
187 if (attrData->xattrs.empty()) {
193 return std::move(attrData);