36 #include <sys/param.h>
38 #include <sys/types.h>
120 static char PrivLet[] = {
'd',
'i',
124 static const int PrivNum =
sizeof(PrivLet);
136 char pbuff[1024], rType[3];
137 const char *Resp[2] = {rType, pbuff};
138 const char *locArg, *opq, *
Path =
Split(args,&opq,pbuff,
sizeof(pbuff));
142 XrdOucEnv loc_Env(opq ? opq+1 : 0,0,client);
144 ZTRACE(
fsctl,
"locate args=" <<(args ? args :
"''"));
152 && (retc =
Finder->
Locate(einfo, locArg, find_flag, &loc_Env)))
155 if (cmd &
SFS_O_TRUNC) {rType[0] =
'S'; rType[1] = ossRW;}
158 rType[0] = ((
fstat.st_mode & S_IFBLK) == S_IFBLK ?
's' :
'S');
159 rType[1] = (
fstat.st_mode & S_IWUSR ?
'w' :
'r');
167 if ((Resp1Len =
myIF->
GetDest(pbuff,
sizeof(pbuff), ifType, retHN)))
168 {einfo.
setErrInfo(Resp1Len+3, (
const char **)Resp, 2);
171 return Emsg(epname, einfo, ENETUNREACH,
"locate",
Path);
178 const char *opq, *
Path =
Split(args, &opq, pbuff,
sizeof(pbuff));
179 XrdOucEnv fs_Env(opq ? opq+1 : 0,0,client);
180 ZTRACE(
fsctl,
"statfs args=" <<(args ? args :
"''"));
187 return XrdOfsFS->
Emsg(epname, einfo, retc,
"statfs", args);
196 const char *opq, *
Path =
Split(args, &opq, pbuff,
sizeof(pbuff));
197 XrdOucEnv statls_Env(opq ? opq+1 : 0,0,client);
198 ZTRACE(
fsctl,
"statls args=" <<(args ? args :
"''"));
201 {statls_Env.
Put(
"cms.qvfs",
"1");
203 {
if (retc ==
SFS_DATA) retc = Reformat(einfo);
218 const char *opq, *
Path =
Split(args, &opq, pbuff,
sizeof(pbuff));
219 XrdOucEnv xa_Env(opq ? opq+1 : 0,0,client);
220 ZTRACE(
fsctl,
"statxa args=" <<(args ? args :
"''"));
230 cP = bP + blen; strcpy(cP,
"&ofs.ap="); cP += 8;
232 else {
for (i = 0; i < PrivNum; i++)
233 if (PrivTab[i] & privs) *cP++ = PrivLet[i];
234 if (cP == (bP + blen + 1)) *cP++ =
'?';
246 ZTRACE(
fsctl,
"statcc args=" <<(args ? args :
"''"));
248 else if (Balancer) retc = Balancer->
Locate(einfo,
".",lcc_flag,&lcc_Env);
256 return XrdOfsFS->
Emsg(epname, einfo, ENOTSUP,
"fsctl", args);
276 {
XrdOucEnv pc_Env(args.ArgP[1] ? args.ArgP[1] : 0, 0, client);
279 return FSctl_PC->
FSctl(cmd, args, eInfo, client);
282 else if (FSctl_PI)
return FSctl_PI->
FSctl(cmd, args, eInfo, client);
286 return XrdOfsFS->
Emsg(
"FSctl", eInfo, ENOTSUP,
"FSctl",
"");
298 if (FSctl_PI)
return FSctl_PI->
FSctl(cmd,alen,args,file,file.
error,client);
@ AOP_Any
Special for getting privs.
@ AOP_Stat
exists(), stat()
@ AOP_Read
open() r/o, prepare()
#define AUTHORIZE(usr, env, optype, action, pathp, edata)
int fstat(int fildes, struct stat *buf)
int Arg2Len
Length or -count of args in extension.
< SFS_FSCTL_PLUGIN/PLUGIO/PLUGXC parms
virtual XrdAccPrivs Access(const XrdSecEntity *Entity, const char *path, const Access_Operation oper, XrdOucEnv *Env=0)=0
virtual int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *Info=0)=0
virtual int Locate(XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *Info=0)=0
static ifType GetIFType(bool conIPv4, bool hasIP64, bool pvtIP)
int GetDest(char *dest, int dlen, ifType ifT=PublicV6, bool prefn=false)
ifType
The enum that is used to index into ifData to get appropriate interface.
virtual int FSctl(const int cmd, int alen, const char *args, XrdSfsFile &file, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=0
const char * Split(const char *Args, const char **Opq, char *Path, int Plen)
int fsctl(const int cmd, const char *args, XrdOucErrInfo &out_error, const XrdSecEntity *client=0)
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, XrdOfsHandle *hP)
static int fsError(XrdOucErrInfo &myError, int rc)
int FSctl(const int cmd, XrdSfsFSctl &args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
int stat(const char *Name, struct stat *buf, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
virtual int StatLS(XrdOucEnv &env, const char *path, char *buff, int &blen)
virtual int StatXA(const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
virtual int StatFS(const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
virtual int Stat(const char *path, struct stat *buff, int opts=0, XrdOucEnv *envP=0)=0
void Put(const char *varname, const char *value)
int setErrInfo(int code, const char *emsg)
char * getMsgBuff(int &mblen)
const char * getErrUser()
static const int uIPv64
ucap: Supports only IPv4 info
static const int uIPv4
ucap: Supports read redirects