65 faCTL(
char *bp,
char *bz,
int anum)
67 vnsz(0), iNum(anum), iEnd(0), verr(false) {}
68 ~faCTL() {
if (info)
delete [] info;}
72#define CRED (const XrdSecEntity *)Client
74#define FATTR_NAMESPACE 'U'
82XErrorCode Decode(faCTL &ctl,
int MaxNsz,
int MaxVsz)
84 char *bP = ctl.buff, *bend = ctl.bend;
91 for (
int i = 0; i < ctl.iNum; i++)
98 ctl.info[i].Name = bP;
105 if (!n || n > MaxNsz)
107 ctl.info[i].NLen = n;
113 ctl.vnsz = bP - ctl.buff;
119 for (
int i = 0; i < ctl.iNum; i++)
126 vsize = ntohl(vsize);
132 ctl.info[i].Value = bP;
133 ctl.info[i].VLen = vsize;
158 for (
int i = 0; i < inum; i++)
159 {
if (info[i].faRC == 0) info[i].
Name[0] = info[i].
Name[1] =
'\0';
162 memcpy(info[i].Name, &rc,
sizeof(rc));
182struct iovec *Alloc(
int &num)
183 {
static int iovmax = -1;
186 iovmax = sysconf(_SC_IOV_MAX);
195 if (num > iovmax) num = iovmax;
196 theIOV =
new struct iovec[num];
200 IOVec() : theIOV(0) {}
201 ~IOVec() {
if (theIOV)
delete [] theIOV;}
218 snprintf(eBuff,
sizeof(eBuff),
"%s processing fattr %s argument #%d",
221 return Resp.
Send(eCode, eBuff);
243int XrdXrootdProtocol::do_FAttr()
265 eTxt =
"Inspecting file attributes";
268 eTxt =
"Modifying file attributes";
275 "Required arguments for fattr request not present");
288 "fattr does not refer to an open file");
291 "fattr request modifies a file open for reading");
292 if (dlen) {dlen--; theArg++;}
294 return ProcFAttr(fp->
FileKey, 0, theArg, dlen, faCode,
false);
304 if (rpCheck(fn, &fnCgi))
return rpEmsg(eTxt, fn);
305 if (!(popt = Squash(fn)))
return vpEmsg(eTxt, fn);
312 return ProcFAttr(fn, fnCgi,
argp->
buff+n+1, dlen-n-1, faCode,
true);
319int XrdXrootdProtocol::ProcFAttr(
char *faPath,
char *faCgi,
char *faArgs,
320 int faALen,
int faCode,
bool doAChk)
334 sfsCtl.nPfx[1] =
'.';
343 faCTL ctl(faArgs, faArgs+faALen, fNumAttr);
346 if (rc)
return SendErr(
Response, ctl, rc);
350 sfsCtl.info = ctl.info;
355 if (faCode ==
kXR_fattrDel)
return XeqFADel(sfsCtl, faArgs, ctl.vnsz);
356 if (faCode ==
kXR_fattrGet)
return XeqFAGet(sfsCtl, faArgs, ctl.vnsz);
357 if (faCode ==
kXR_fattrSet)
return XeqFASet(sfsCtl, faArgs, ctl.vnsz);
366int XrdXrootdProtocol::XeqFADel(
XrdSfsFACtl &ctl,
char *faVars,
int faVLen)
388 iov[1].iov_base = faRC;
389 iov[1].iov_len =
sizeof(faRC);
390 iov[2].iov_base = faVars;
391 iov[2].iov_len = faVLen;
399int XrdXrootdProtocol::XeqFAGet(
XrdSfsFACtl &ctl,
char *faVars,
int faVLen)
406 int k, rc, dlen, vLen;
423 int iovNum = ctl.
iNum*2+3;
424 iov = iovHelper.Alloc(iovNum);
428 iov[1].iov_base = faRC;
429 iov[1].iov_len =
sizeof(faRC);
430 iov[2].iov_base = faVars;
431 iov[2].iov_len = faVLen;
432 dlen =
sizeof(faRC) + faVLen;
437 for (
int i = 0; i < ctl.
iNum; i++)
445 iov[k++].iov_len = vLen;
469 int k = 1, rc = 0, dlen = 0, vLen;
478 int iovNum = ctl.
iNum*3+1;
479 iov = iovHelper.Alloc(iovNum);
483 for (
int i = 0; i < ctl.
iNum; i++)
496 iov[k++].iov_len = vLen;
502 k = 1; dlen = 0; xresp =
true;
521 struct iovec
iov[16];
560 if (i == (
int)
sizeof(
iov))
562 if (rc || dP == 0)
return rc;
577int XrdXrootdProtocol::XeqFASet(
XrdSfsFACtl &ctl,
char *faVars,
int faVLen)
601 iov[1].iov_base = faRC;
602 iov[1].iov_len =
sizeof(faRC);
603 iov[2].iov_base = faVars;
604 iov[2].iov_len = faVLen;
struct ClientFattrRequest fattr
struct ClientRequestHdr header
char data[4]
Start of data.
int dlen
Data Length in subsequent buffer.
const kXR_char XROOTD_MON_OPENW
const kXR_char XROOTD_MON_OPENR
static const char * errName(kXR_int32 errCode)
static int mapError(int rc)
char * ID
Pointer to the client's link identity.
virtual int FAttr(XrdSfsFACtl *faReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
XrdXrootdFile * Get(int fnum)
static XrdXrootdXPath RPList
XrdXrootdFileTable * FTab
XrdXrootdMonitor::User Monitor
XrdXrootdResponse Response
static struct XrdXrootdProtocol::RD_Table Route[RD_Num]
static XrdSfsFileSystem * osFS
int Validate(const char *pd, const int pl=0)
ssize_t Send(int fd, KernelBuffer &buffer)
XrdSfsFABuff * fabP
-> Additional memory that was allocated
static const int retval
Above plus return actual attr value.
const char * path
The file path to act on (logical)
unsigned char rqst
Type of file attribute request (see below)
const char * pcgi
Opaque information (null if none)
static const int accChk
Perform access check.
static const int newAtr
For set the attribute must not exist.
XrdSfsFAInfo * info
Pointer to attribute information.
unsigned char opts
Request options (see below)
unsigned short iNum
Number of info entries.
char * Name
Variable name.
int VLen
Variable value length (aligned)
char * Value
Variable value.
short NLen
Length of name not including null byte.
int faRC
Action return code for this element.