35 #include <sys/types.h>
36 #include <sys/xattr.h>
44 #define AttrName(Aname, Abuff, Ablen) snprintf(Abuff, Ablen, "user.%s", Aname);
50 int XrdSysFAttr::Del(
const char *Aname,
const char *
Path,
int fd)
61 ec = (fd < 0 ? removexattr(
Path, Avar) : fremovexattr(fd, Avar));
65 if (
ec)
ec = Diagnose(
"remove", Aname,
Path, errno);
73 int XrdSysFAttr::Get(
const char *Aname,
void *Aval,
int Avsz,
74 const char *
Path,
int fd)
85 ec = (fd < 0 ? getxattr(
Path, Avar, Aval, Avsz)
86 : fgetxattr(fd, Avar, Aval, Avsz));
90 if (
ec < 0)
ec = Diagnose(
"get", Aname,
Path, errno);
98 int XrdSysFAttr::List(AList **aPL,
const char *
Path,
int fd,
int getSz)
101 char *Buff = 0, *bP, *bEnd;
102 int ec, Tlen, maxSz = 0, *msP = (getSz ? &maxSz : 0);
107 Tlen = (fd < 0 ? listxattr(
Path, Buff, 0) : flistxattr(fd, Buff, 0));
121 if (!(Buff = (
char *)malloc(Tlen)))
return -ENOMEM;
126 Tlen = (fd < 0 ? listxattr(
Path, Buff, Tlen) : flistxattr(fd, Buff, Tlen));
137 bP = Buff; bEnd = Buff+Tlen;
139 {
if (!strncmp(
"user.", bP, 5) && bP[5]
140 && (aNew = getEnt(
Path, fd, bP+5, *aPL, msP))) *aPL = aNew;
141 bP = bP + strlen(bP) + 1;
154 int XrdSysFAttr::Set(
const char *Aname,
const void *Aval,
int Avsz,
155 const char *
Path,
int fd,
int isNew)
158 int ec, xFlag = (isNew ? XATTR_CREATE : 0);
162 AttrName(Aname, Avar,
sizeof(Avar));
166 ec = (fd < 0 ? setxattr(
Path, Avar, Aval, Avsz, xFlag)
167 : fsetxattr(fd, Avar, Aval, Avsz, xFlag));
171 if (
ec < 0)
ec = Diagnose(
"set", Aname,
Path, errno);
#define AttrName(Aname, Abuff, Ablen)