2#include "XrdVersion.hh"
8using namespace std::literals;
22 if (this->oss ==
nullptr)
25 const auto opt = oss->get_entry_write(
Path);
29 auto entry = opt.value();
31 const std::string_view name{Aname};
33 if (name ==
"U.open.return_code"sv)
34 entry->open.return_code = {};
35 else if (name ==
"U.read.return_code"sv)
36 entry->read.return_code = {};
37 else if (name ==
"U.read.return_position"sv)
38 entry->read.return_position = {};
39 else if (name ==
"U.write.return_code"sv)
40 entry->write.return_code = {};
41 else if (name ==
"U.write.return_position"sv)
42 entry->write.return_position = {};
43 else if (name ==
"U.pattern"sv)
57 if (this->oss ==
nullptr)
60 const auto opt = oss->get_entry_read(
Path);
64 const auto entry = opt.value();
66 const std::string_view name{Aname};
69 if (name ==
"U.open.return_code"sv)
70 value = std::to_string(entry.open.return_code);
71 else if (name ==
"U.read.return_code"sv)
72 value = std::to_string(entry.read.return_code);
73 else if (name ==
"U.read.return_position"sv)
74 value = std::to_string(entry.read.return_position);
75 else if (name ==
"U.write.return_code"sv)
76 value = std::to_string(entry.write.return_code);
77 else if (name ==
"U.write.return_position"sv)
78 value = std::to_string(entry.write.return_position);
79 else if (name ==
"U.pattern"sv)
80 value = entry.pattern;
84 const int num_bytes = std::min(
static_cast<std::size_t
>(Avsz), value.size());
85 std::copy_n(value.begin(), num_bytes,
static_cast<char *
>(Aval));
97 if (this->oss ==
nullptr)
100 const auto opt = oss->get_entry_write(
Path);
101 if (!opt.has_value())
104 auto entry = opt.value();
106 const std::string_view name{Aname};
107 const std::string value(
static_cast<const char *
>(Aval), Avsz);
111 if (name ==
"U.open.return_code"sv)
112 entry->open.return_code = std::stoi(value);
113 else if (name ==
"U.read.return_code"sv)
114 entry->read.return_code = std::stoi(value);
115 else if (name ==
"U.read.return_position"sv)
116 entry->read.return_position = std::stoll(value);
117 else if (name ==
"U.write.return_code"sv)
118 entry->write.return_code = std::stoi(value);
119 else if (name ==
"U.write.return_position"sv)
120 entry->write.return_position = std::stoll(value);
121 else if (name ==
"U.pattern"sv)
122 entry->pattern = value;
126 catch(std::out_of_range &)
136 if (this->oss ==
nullptr)
XrdSysXAttr * XrdSysGetXAttrObject(XrdSysError *errP, const char *config_fn, const char *parms)
XrdSysXAttr * XrdSysGetXAttrObject(XrdSysError *errP, const char *config_fn, const char *parms)
XrdVERSIONINFO(XrdSysGetXAttrObject, XrdOssMirageXAttr)
void setOss(XrdOssMirage &oss)
virtual int Get(const char *Aname, void *Aval, int Avsz, const char *Path, int fd=-1) override
virtual int Del(const char *Aname, const char *Path, int fd=-1) override
virtual void Free(AList *aPL) override
virtual int List(AList **aPL, const char *Path, int fd=-1, int getSz=0) override
virtual int Set(const char *Aname, const void *Aval, int Avsz, const char *Path, int fd=-1, int isNew=0) override