XRootD
Loading...
Searching...
No Matches
XrdOfs Class Reference

#include <XrdOfs.hh>

Inheritance diagram for XrdOfs:
Collaboration diagram for XrdOfs:

Classes

struct  fwdOpt

Public Types

enum  {
  Authorize = 0x0001 ,
  XAttrPlug = 0x0002 ,
  isPeer = 0x0050 ,
  isProxy = 0x0020 ,
  isManager = 0x0040 ,
  isServer = 0x0080 ,
  isSuper = 0x00C0 ,
  isMeta = 0x0100 ,
  haveRole = 0x01F0 ,
  Forwarding = 0x1000 ,
  ThirdPC = 0x2000 ,
  SubCluster = 0x4000 ,
  RdrTPC = 0x8000
}
Public Types inherited from XrdSfsFileSystem
enum  csFunc {
  csCalc = 0 ,
  csGet ,
  csSize
}
enum  gpfFunc {
  gpfCancel =0 ,
  gpfGet ,
  gpfPut
}

Public Member Functions

 XrdOfs ()
virtual ~XrdOfs ()
int chksum (csFunc Func, const char *csName, const char *Path, XrdOucErrInfo &out_error, const XrdSecEntity *client=0, const char *opaque=0)
int chmod (const char *Name, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
void Config_Cluster (XrdOss *)
void Config_Display (XrdSysError &)
virtual int Configure (XrdSysError &)
virtual int Configure (XrdSysError &, XrdOucEnv *)
void Connect (const XrdSecEntity *client=0)
void Disc (const XrdSecEntity *client=0)
int exists (const char *fileName, XrdSfsFileExistence &exists_flag, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
int FAttr (XrdSfsFACtl *faReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
int FSctl (const int cmd, XrdSfsFSctl &args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
int fsctl (const int cmd, const char *args, XrdOucErrInfo &out_error, const XrdSecEntity *client=0)
int getStats (char *buff, int blen)
const char * getVersion ()
int mkdir (const char *dirName, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
XrdSfsDirectory * newDir (char *user=0, int MonID=0)
XrdSfsDirectory * newDir (XrdOucErrInfo &eInfo)
XrdSfsFile * newFile (char *user=0, int MonID=0)
XrdSfsFile * newFile (XrdOucErrInfo &eInfo)
int prepare (XrdSfsPrep &pargs, XrdOucErrInfo &out_error, const XrdSecEntity *client=0)
int rem (const char *path, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *info=0)
int remdir (const char *dirName, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *info=0)
int rename (const char *oldFileName, const char *newFileName, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *infoO=0, const char *infoN=0)
int SetupCksRT (XrdCksCalc *&, XrdOucEnv &, const char *&)
int stat (const char *Name, mode_t &mode, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
int stat (const char *Name, struct stat *buf, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
int truncate (const char *Name, XrdSfsFileOffset fileOffset, XrdOucErrInfo &out_error, const XrdSecEntity *client=0, const char *opaque=0)
bool WantCksRT ()
Public Member Functions inherited from XrdSfsFileSystem
 XrdSfsFileSystem ()
 Constructor and Destructor.
virtual ~XrdSfsFileSystem ()
virtual void EnvInfo (XrdOucEnv *envP)
uint64_t Features ()
virtual int getChkPSize ()
virtual int gpFile (gpfFunc &gpAct, XrdSfsGPFile &gpReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)

Public Attributes

char * ConfigFN
mode_t dMask [2]
mode_t fMask [2]
struct fwdOpt fwdCHMOD
struct fwdOpt fwdMKDIR
struct fwdOpt fwdMKPATH
struct fwdOpt fwdMV
struct fwdOpt fwdRM
struct fwdOpt fwdRMDIR
struct fwdOpt fwdTRUNC
XrdNetIF * myIF
int myPort
int Options
char * tpcRdrHost [2]
int tpcRdrPort [2]

Static Public Attributes

static int MaxDelay = 60
static int OSSDelay = 30

Protected Member Functions

virtual int ConfigXeq (char *var, XrdOucStream &, XrdSysError &)
const char * Split (const char *Args, const char **Opq, char *Path, int Plen)
int Stall (XrdOucErrInfo &, int, const char *)
void Unpersist (XrdOfsHandle *hP, int xcev=1)
bool ValidCST (const char *cst)
char * WaitTime (int, char *, int)

Static Protected Member Functions

static int Emsg (const char *, XrdOucErrInfo &, int, const char *x, const char *y="", const char *xtra=0, bool chktype=true)
static int Emsg (const char *, XrdOucErrInfo &, int, const char *x, XrdOfsHandle *hP, bool posChk=false, bool chktype=true)
static int EmsgType (int ecode)
static int fsError (XrdOucErrInfo &myError, int rc)

Protected Attributes

XrdOfsEvr evrObject
XrdCmsClient * Finder
Protected Attributes inherited from XrdSfsFileSystem
uint64_t FeatureSet
 Adjust features at initialization.

Friends

class XrdOfsDirectory
class XrdOfsFile

Detailed Description

Definition at line 243 of file XrdOfs.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Authorize 
XAttrPlug 
isPeer 
isProxy 
isManager 
isServer 
isSuper 
isMeta 
haveRole 
Forwarding 
ThirdPC 
SubCluster 
RdrTPC 

Definition at line 376 of file XrdOfs.hh.

376 {Authorize = 0x0001, // Authorization wanted
377 XAttrPlug = 0x0002, // Extended Attribute Plugin
378 isPeer = 0x0050, // Role peer
379 isProxy = 0x0020, // Role proxy
380 isManager = 0x0040, // Role manager
381 isServer = 0x0080, // Role server
382 isSuper = 0x00C0, // Role supervisor
383 isMeta = 0x0100, // Role meta + above
384 haveRole = 0x01F0, // A role is present
385 Forwarding= 0x1000, // Fowarding wanted
386 ThirdPC = 0x2000, // This party copy wanted
387 SubCluster= 0x4000, // all.subcluster directive encountered
388 RdrTPC = 0x8000
389 }; // These are set in Options below
@ isProxy
Definition XrdOfs.hh:379
@ haveRole
Definition XrdOfs.hh:384
@ RdrTPC
Definition XrdOfs.hh:388
@ ThirdPC
Definition XrdOfs.hh:386
@ isMeta
Definition XrdOfs.hh:383
@ SubCluster
Definition XrdOfs.hh:387
@ isManager
Definition XrdOfs.hh:380
@ isPeer
Definition XrdOfs.hh:378
@ XAttrPlug
Definition XrdOfs.hh:377
@ isSuper
Definition XrdOfs.hh:382
@ isServer
Definition XrdOfs.hh:381
@ Authorize
Definition XrdOfs.hh:376
@ Forwarding
Definition XrdOfs.hh:385

Constructor & Destructor Documentation

◆ XrdOfs()

XrdOfs::XrdOfs ( )

Definition at line 171 of file XrdOfs.cc.

171 : dMask{0000,0775}, fMask{0000,0775}, // Legacy
173{
174 const char *bp;
175
176// Establish defaults
177//
178 ofsConfig = 0;
179 FSctl_PC = 0;
180 FSctl_PI = 0;
181 Authorization = 0;
182 Finder = 0;
183 Balancer = 0;
184 evsObject = 0;
185 ossRPList = 0;
186 myRole = strdup("server");
187 OssIsProxy = 0;
188 ossRW =' ';
189 ossFeatures = 0;
190
191// Obtain port number we will be using. Note that the constructor must occur
192// after the port number is known (i.e., this cannot be a global static).
193//
194 myPort = (bp = getenv("XRDPORT")) ? strtol(bp, (char **)NULL, 10) : 0;
195
196// Defaults for POSC
197//
198 poscQ = 0;
199 poscLog = 0;
200 poscHold= 10*60;
201 poscAuto= 0;
202 poscSync= 1;
203
204// Set the configuration file name and dummy handle
205//
206 ConfigFN = 0;
207 XrdOfsHandle::Alloc(&dummyHandle);
208
209// Set checksum pointers
210//
211 CksRTCalc = 0;
212 CksRTName = 0;
213 Cks = 0;
214 CksPfn = true;
215 CksRdr = true;
216 CksRTCgi = 0;
217
218// Prepare handling
219//
220 prepHandler = 0;
221 prepAuth = true;
222
223// Eextended attribute limits
224//
225 usxMaxNsz = kXR_faMaxNlen;
226 usxMaxVsz = kXR_faMaxVlen;
227
228// Other options
229//
230 DirRdr = false;
231 reProxy = false;
232 OssHasPGrw= false;
233 tryXERT = false;
234}
@ kXR_faMaxVlen
Definition XProtocol.hh:312
@ kXR_faMaxNlen
Definition XProtocol.hh:311
static int Alloc(const char *thePath, int Opts, XrdOfsHandle **Handle)
mode_t dMask[2]
Definition XrdOfs.hh:396
int myPort
Definition XrdOfs.hh:392
XrdCmsClient * Finder
Definition XrdOfs.hh:441
mode_t fMask[2]
Definition XrdOfs.hh:397
char * ConfigFN
Definition XrdOfs.hh:432
int tpcRdrPort[2]
Definition XrdOfs.hh:402
char * tpcRdrHost[2]
Definition XrdOfs.hh:401

References XrdOfsHandle::Alloc(), ConfigFN, dMask, Finder, fMask, kXR_faMaxNlen, kXR_faMaxVlen, myPort, tpcRdrHost, and tpcRdrPort.

Here is the call graph for this function:

◆ ~XrdOfs()

virtual XrdOfs::~XrdOfs ( )
inlinevirtual

Definition at line 368 of file XrdOfs.hh.

368{} // Too complicate to delete :-)

Member Function Documentation

◆ chksum()

int XrdOfs::chksum ( csFunc Func,
const char * csName,
const char * Path,
XrdOucErrInfo & out_error,
const XrdSecEntity * client = 0,
const char * opaque = 0 )
virtual

Reimplemented from XrdSfsFileSystem.

Definition at line 1905 of file XrdOfs.cc.

1925{
1926 EPNAME("chksum");
1927 XrdOucEnv cksEnv(opaque,0,client);
1928 XrdCksData cksData;
1929 const char *tident = einfo.getErrUser();
1930 char buff[MAXPATHLEN+8];
1931 int rc;
1932
1933// Check if we support checksumming
1934//
1935 if (!Cks)
1936 {einfo.setErrInfo(ENOTSUP, "Checksums are not supported.");
1937 return SFS_ERROR;
1938 }
1939
1940// A csSize request is issued usually once to verify everything is working. We
1941// take this opportunity to also verify the checksum name.
1942//
1943 rc = cksData.Set(csName);
1944 if (!rc || Func == XrdSfsFileSystem::csSize)
1945 {if (rc && (rc = Cks->Size(csName)))
1946 {einfo.setErrCode(rc); return SFS_OK;}
1947 strcpy(buff, csName); strcat(buff, " checksum not supported.");
1948 einfo.setErrInfo(ENOTSUP, buff);
1949 return SFS_ERROR;
1950 }
1951
1952// Everything else requires a path
1953//
1954 if (!Path)
1955 {strcpy(buff, csName);
1956 strcat(buff, " checksum path not specified.");
1957 einfo.setErrInfo(EINVAL, buff);
1958 return SFS_ERROR;
1959 }
1960
1961// Apply security, as needed
1962//
1963 XTRACE(stat, Path, csName);
1964 AUTHORIZE(client,&cksEnv,AOP_Stat,"checksum",Path,einfo);
1965
1966// If we are a menager then we need to redirect the client to where the file is
1967//
1968 if (CksRdr && Finder && Finder->isRemote()
1969 && (rc = Finder->Locate(einfo, Path, SFS_O_RDONLY, &cksEnv)))
1970 return fsError(einfo, rc);
1971
1972// At this point we need to convert the lfn to a pfn
1973//
1974 if (CksPfn && !(Path = XrdOfsOss->Lfn2Pfn(Path, buff, MAXPATHLEN, rc)))
1975 return Emsg(epname, einfo, rc, "checksum", Path,
1976 "+ofs_chksum: lfn to pfn mapping failed");
1977
1978// Originally we only passed he env pointer for proxy servers. Due to popular
1979// demand, we always pass the env as it points to the SecEntity object unless
1980// we don't have it then we pass the caller's environment.
1981//
1983 {if (client) cksData.envP = &cksEnv;
1984 else cksData.envP = (einfo.getEnv() ? einfo.getEnv() : &cksEnv);
1985 }
1986
1987// Now determine what to do
1988//
1989 if (Func == XrdSfsFileSystem::csCalc) rc = Cks->Calc(Path, cksData);
1990 else if (Func == XrdSfsFileSystem::csGet) rc = Cks->Get( Path, cksData);
1991 else {einfo.setErrInfo(EINVAL, "Invalid checksum function.");
1992 return SFS_ERROR;
1993 }
1994
1995// See if all went well
1996//
1997#ifdef ENOATTR
1998 if (rc >= 0 || rc == -ENOATTR || rc == -ESTALE || rc == -ESRCH)
1999#else
2000 if (rc >= 0 || rc == -ENODATA || rc == -ESTALE || rc == -ESRCH)
2001#endif
2002 {if (rc >= 0) {cksData.Get(buff, MAXPATHLEN); rc = 0;}
2003 else {*buff = 0; rc = -rc;}
2004 einfo.setErrInfo(rc, buff);
2005 return SFS_OK;
2006 }
2007
2008// We failed
2009//
2010 return Emsg(epname, einfo, rc, "checksum", Path, "?");
2011}
#define ENOATTR
@ AOP_Stat
exists(), stat()
#define tident
#define EPNAME(x)
#define XTRACE(act, target, x)
#define ENODATA
#define AUTHORIZE(usr, env, optype, action, pathp, edata)
XrdOss * XrdOfsOss
Definition XrdOfs.cc:165
XrdOucString Path
#define SFS_ERROR
#define SFS_O_RDONLY
#define SFS_OK
int Set(const char *csName)
Definition XrdCksData.hh:81
int Get(char *Buff, int Blen)
Definition XrdCksData.hh:69
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, XrdOfsHandle *hP, bool posChk=false, bool chktype=true)
Definition XrdOfs.cc:2637
static int fsError(XrdOucErrInfo &myError, int rc)
Definition XrdOfs.cc:2837
int stat(const char *Name, struct stat *buf, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
Definition XrdOfs.cc:2485
virtual int Lfn2Pfn(const char *Path, char *buff, int blen)
Definition XrdOss.hh:954

References AOP_Stat, AUTHORIZE, XrdSfsFileSystem::csCalc, XrdSfsFileSystem::csGet, XrdSfsFileSystem::csSize, Emsg(), ENOATTR, ENODATA, EPNAME, Finder, fsError(), XrdCksData::Get(), XrdOucErrInfo::getEnv(), XrdOucErrInfo::getErrUser(), Path, XrdCksData::Set(), XrdOucErrInfo::setErrCode(), XrdOucErrInfo::setErrInfo(), SFS_ERROR, SFS_O_RDONLY, SFS_OK, stat(), tident, XrdOfsOss, and XTRACE.

Here is the call graph for this function:

◆ chmod()

int XrdOfs::chmod ( const char * path,
XrdSfsMode mode,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
virtual

Change file mode settings.

Parameters
path- Pointer to the path of the file in question.
mode- The new file mode setting.
eInfo- The object where error info or results are to be returned.
client- Client's identify (see common description).
opaque- Path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 2017 of file XrdOfs.cc.

2032{
2033 EPNAME("chmod");
2034 static const int locFlags = SFS_O_RDWR|SFS_O_META;
2035 struct stat Stat;
2036 mode_t acc_mode = Mode & S_IAMB;
2037 const char *tident = einfo.getErrUser();
2038 XrdOucEnv chmod_Env(info,0,client);
2039 int retc;
2040 XTRACE(chmod, path, "");
2041
2042// Apply security, as needed
2043//
2044 AUTHORIZE(client,&chmod_Env,AOP_Chmod,"chmod",path,einfo);
2045
2046// Find out where we should chmod this file
2047//
2048 if (Finder && Finder->isRemote())
2049 {if (fwdCHMOD.Cmd)
2050 {char buff[8];
2051 sprintf(buff, "%o", static_cast<int>(acc_mode));
2052 if (Forward(retc,einfo,fwdCHMOD,path,buff,&chmod_Env)) return retc;
2053 }
2054 else if ((retc = Finder->Locate(einfo, path, locFlags, &chmod_Env)))
2055 return fsError(einfo, retc);
2056 }
2057
2058// We need to adjust the mode based on whether this is a file or directory.
2059//
2060 if ((retc = XrdOfsOss->Stat(path, &Stat, 0, &chmod_Env)))
2061 return XrdOfsFS->Emsg(epname, einfo, retc, "stat", path, "?");
2062 if (S_ISDIR(Stat.st_mode)) acc_mode = (acc_mode | dMask[0]) & dMask[1];
2063 else acc_mode = (acc_mode | fMask[0]) & fMask[1];
2064
2065// Check if we should generate an event
2066//
2067 if (evsObject && evsObject->Enabled(XrdOfsEvs::Chmod))
2068 {XrdOfsEvsInfo evInfo(tident, path, info, &chmod_Env, acc_mode);
2069 evsObject->Notify(XrdOfsEvs::Chmod, evInfo);
2070 }
2071
2072// Now try to find the file or directory
2073//
2074 if (!(retc = XrdOfsOss->Chmod(path, acc_mode, &chmod_Env))) return SFS_OK;
2075
2076// An error occurred, return the error info
2077//
2078 return XrdOfsFS->Emsg(epname, einfo, retc, "chmod", path, "?");
2079}
@ AOP_Chmod
chmod()
struct stat Stat
Definition XrdCks.cc:49
#define S_IAMB
Definition XrdConfig.cc:163
XrdOfs * XrdOfsFS
Definition XrdOfsFS.cc:47
int Mode
#define SFS_O_META
#define SFS_O_RDWR
int chmod(const char *Name, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
Definition XrdOfs.cc:2017
struct fwdOpt fwdCHMOD
Definition XrdOfs.hh:421
virtual int Chmod(const char *path, mode_t mode, XrdOucEnv *envP=0)=0
virtual int Stat(const char *path, struct stat *buff, int opts=0, XrdOucEnv *envP=0)=0

References AOP_Chmod, AUTHORIZE, XrdOfsEvs::Chmod, chmod(), dMask, EPNAME, Finder, fMask, fsError(), fwdCHMOD, XrdOucErrInfo::getErrUser(), Mode, S_IAMB, SFS_O_META, SFS_O_RDWR, SFS_OK, Stat, stat(), tident, XrdOfsFS, XrdOfsOss, and XTRACE.

Referenced by chmod().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Config_Cluster()

void XrdOfs::Config_Cluster ( XrdOss * )

◆ Config_Display()

void XrdOfs::Config_Display ( XrdSysError & Eroute)

Definition at line 428 of file XrdOfsConfig.cc.

429{
430 const char *cloc, *pval;
431 char buff[8192], fwbuff[512], *bp;
432 int i;
433
434 if (!ConfigFN || !ConfigFN[0]) cloc = "default";
435 else cloc = ConfigFN;
436 if (!poscQ) pval = "off";
437 else pval = (poscAuto ? "auto" : "manual");
438
439 snprintf(buff, sizeof(buff), "Config effective %s ofs configuration:\n"
440 " all.role %s\n"
441 "%s"
442 " ofs.maxdelay %d\n"
443 " ofs.persist %s hold %d%s%s\n"
444 " ofs.trace %x",
445 cloc, myRole,
446 (Options & Authorize ? " ofs.authorize\n" : ""),
447 MaxDelay,
448 pval, poscHold, (poscLog ? " logdir " : ""),
449 (poscLog ? poscLog : ""), OfsTrace.What);
450
451 Eroute.Say(buff);
452
453 if (CksRTCgi || CksRTName)
454 {snprintf(buff, sizeof(buff), " ofs.cksrt auto %s%s",
455 (CksRTName ? CksRTName:"none"),(CksRTCgi ? " chkcgi":""));
456 Eroute.Say(buff);
457 }
458
459 ofsConfig->Display();
460
461 if (Options & Forwarding)
462 {*fwbuff = 0;
463 if (ConfigDispFwd(buff, fwdCHMOD))
464 {Eroute.Say(buff); strcat(fwbuff, " ch");}
465 if (ConfigDispFwd(buff, fwdMKDIR))
466 {Eroute.Say(buff); strcat(fwbuff, " mk");}
467 if (ConfigDispFwd(buff, fwdMV))
468 {Eroute.Say(buff); strcat(fwbuff, " mv");}
469 if (ConfigDispFwd(buff, fwdRM))
470 {Eroute.Say(buff); strcat(fwbuff, " rm");}
471 if (ConfigDispFwd(buff, fwdRMDIR))
472 {Eroute.Say(buff); strcat(fwbuff, " rd");}
473 if (ConfigDispFwd(buff, fwdTRUNC))
474 {Eroute.Say(buff); strcat(fwbuff, " tr");}
475 if (*fwbuff) XrdOucEnv::Export("XRDOFS_FWD", fwbuff);
476 }
477
478 if (evsObject)
479 {bp = buff;
480 setBuff(" ofs.notify ", 18); // 1234567890
481 if (evsObject->Enabled(XrdOfsEvs::Chmod)) setBuff("chmod ", 6);
482 if (evsObject->Enabled(XrdOfsEvs::Closer)) setBuff("closer ", 7);
483 if (evsObject->Enabled(XrdOfsEvs::Closew)) setBuff("closew ", 7);
484 if (evsObject->Enabled(XrdOfsEvs::Create)) setBuff("create ", 7);
485 if (evsObject->Enabled(XrdOfsEvs::Mkdir)) setBuff("mkdir ", 6);
486 if (evsObject->Enabled(XrdOfsEvs::Mv)) setBuff("mv ", 3);
487 if (evsObject->Enabled(XrdOfsEvs::Openr)) setBuff("openr ", 6);
488 if (evsObject->Enabled(XrdOfsEvs::Openw)) setBuff("openw ", 6);
489 if (evsObject->Enabled(XrdOfsEvs::Rm)) setBuff("rm ", 3);
490 if (evsObject->Enabled(XrdOfsEvs::Rmdir)) setBuff("rmdir ", 6);
491 if (evsObject->Enabled(XrdOfsEvs::Trunc)) setBuff("trunc ", 6);
492 if (evsObject->Enabled(XrdOfsEvs::Fwrite)) setBuff("fwrite ", 7);
493 setBuff("msgs ", 5);
494 i=sprintf(fwbuff,"%d %d ",evsObject->maxSmsg(),evsObject->maxLmsg());
495 setBuff(fwbuff, i);
496 cloc = evsObject->Prog();
497 if (*cloc != '>') setBuff("|",1);
498 setBuff(cloc, strlen(cloc));
499 setBuff("\0", 1);
500 Eroute.Say(buff);
501 }
502}
#define setBuff(x, y)
XrdSysTrace OfsTrace("ofs")
struct fwdOpt fwdTRUNC
Definition XrdOfs.hh:427
struct fwdOpt fwdRMDIR
Definition XrdOfs.hh:426
int Options
Definition XrdOfs.hh:391
struct fwdOpt fwdMKDIR
Definition XrdOfs.hh:422
static int MaxDelay
Definition XrdOfs.hh:429
struct fwdOpt fwdMV
Definition XrdOfs.hh:424
struct fwdOpt fwdRM
Definition XrdOfs.hh:425
static int Export(const char *Var, const char *Val)
Definition XrdOucEnv.cc:170
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)

References Authorize, XrdOfsEvs::Chmod, XrdOfsEvs::Closer, XrdOfsEvs::Closew, ConfigFN, XrdOfsEvs::Create, XrdOucEnv::Export(), Forwarding, fwdCHMOD, fwdMKDIR, fwdMV, fwdRM, fwdRMDIR, fwdTRUNC, XrdOfsEvs::Fwrite, MaxDelay, XrdOfsEvs::Mkdir, XrdOfsEvs::Mv, OfsTrace, XrdOfsEvs::Openr, XrdOfsEvs::Openw, Options, XrdOfsEvs::Rm, XrdOfsEvs::Rmdir, XrdSysError::Say(), setBuff, and XrdOfsEvs::Trunc.

Referenced by Configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Configure() [1/2]

int XrdOfs::Configure ( XrdSysError & Eroute)
virtual

Definition at line 146 of file XrdOfsConfig.cc.

146{return Configure(Eroute, 0);}
virtual int Configure(XrdSysError &)

References Configure().

Referenced by Configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Configure() [2/2]

int XrdOfs::Configure ( XrdSysError & Eroute,
XrdOucEnv * EnvInfo )
virtual

Definition at line 148 of file XrdOfsConfig.cc.

148 {
149/*
150 Function: Establish default values using a configuration file.
151
152 Input: None.
153
154 Output: 0 upon success or !0 otherwise.
155*/
156 char *var;
157 const char *tmp;
158 int cfgFD, retc, NoGo = 0;
159 XrdOucEnv myEnv;
160 XrdOucStream Config(&Eroute, getenv("XRDINSTANCE"), &myEnv, "=====> ");
161
162// Print warm-up message
163//
164 Eroute.Say("++++++ File system initialization started.");
165
166// Start off with no POSC log. Note that XrdSfsGetDefaultFileSystem nakes sure
167// that we are configured only once.
168//
169 poscLog = NULL;
170
171// Establish the network interface that the caller must provide
172//
173 if (!EnvInfo || !(myIF = (XrdNetIF *)EnvInfo->GetPtr("XrdNetIF*")))
174 {Eroute.Emsg("Finder", "Network i/f undefined; unable to self-locate.");
175 NoGo = 1;
176 }
177 ofsSchedP = (XrdScheduler *)EnvInfo->GetPtr("XrdScheduler*");
178
179// Preset all variables with common defaults
180//
181 Options = 0;
182 if (getenv("XRDDEBUG")) OfsTrace.What = TRACE_MOST | TRACE_debug;
183
184// Allocate a our plugin configurator
185//
186 ofsConfig = XrdOfsConfigPI::New(ConfigFN, &Config, &Eroute, 0, this);
187
188// If there is no config file, return with the defaults sets.
189//
190 if( !ConfigFN || !*ConfigFN)
191 Eroute.Emsg("Config", "Configuration file not specified.");
192 else {
193 // Try to open the configuration file.
194 //
195 if ( (cfgFD = open(ConfigFN, O_RDONLY, 0)) < 0)
196 return Eroute.Emsg("Config", errno, "open config file",
197 ConfigFN);
198 Config.Attach(cfgFD);
199 static const char *cvec[] = {"*** ofs plugin config:",0};
200 Config.Capture(cvec);
201
202 // Now start reading records until eof.
203 //
204 while((var = Config.GetMyFirstWord()))
205 {if (!strncmp(var, "ofs.", 4)
206 || !strcmp(var, "all.role")
207 || !strcmp(var, "all.subcluster"))
208 {if (ConfigXeq(var+4,Config,Eroute)) {Config.Echo();NoGo=1;}}
209 else if (!strcmp(var, "oss.defaults")
210 || !strcmp(var, "all.export"))
211 {xexp(Config, Eroute, *var == 'a');
212 Config.noEcho();
213 }
214 }
215
216 // Now check if any errors occurred during file i/o
217 //
218 if ((retc = Config.LastError()))
219 NoGo = Eroute.Emsg("Config", -retc, "read config file",
220 ConfigFN);
221 Config.Close();
222 }
223
224// If no exports were specified, the default is that we are writable
225//
226 if (ossRW == ' ') ossRW = 'w';
227
228// Adjust the umask to correspond to the maximum mode allowed
229//
230 mode_t uMask = 0777 & (~(dMask[1] | fMask[1]));
231 umask(uMask);
232
233// Export our role if we actually have one
234//
235 if (myRole) XrdOucEnv::Export("XRDROLE", myRole);
236
237// Set the redirect option for other layers
238//
239 if (Options & isManager)
240 XrdOucEnv::Export("XRDREDIRECT", (Options & isMeta ? "M" : "R"));
241 else XrdOucEnv::Export("XRDREDIRECT", "0");
242
243// If we are a proxy, then figure out where the prosy storge system resides
244//
245 if ((Options & isProxy) && !(Options & isManager))
246 {char buff[2048], *bp, *libofs = getenv("XRDOFSLIB");
247 if (!libofs) bp = buff;
248 else {strcpy(buff, libofs); bp = buff+strlen(buff)-1;
249 while(bp != buff && *(bp-1) != '/') bp--;
250 }
251 strcpy(bp, "libXrdPss.so");
252 ofsConfig->Default(XrdOfsConfigPI::theOssLib, buff, 0);
253 ofsConfig->Default(XrdOfsConfigPI::theCksLib, buff, 0);
254 }
255
256// Configure third party copy but only if we are not a manager. Phase 1 needs
257// to be done before we load the plugins as they may need this info.
258//
259 if ((Options & ThirdPC) && !(Options & isManager))
260 NoGo |= ConfigTPC(Eroute, EnvInfo);
261
262// We need to do pre-initialization for event recording as the oss needs some
263// environmental information from that initialization to initialize the frm,
264// should it need to be used. We will do full evr initialization after the oss
265// and the finder are initialized. A bit messy in the current plug-in world.
266//
267 if (!(Options & isManager) && !evrObject.Init(&Eroute)) NoGo = 1;
268
269// Determine whether we should load authorization
270//
271 int piOpts = XrdOfsConfigPI::allXXXLib;
272 if (!(Options & Authorize)) piOpts &= ~XrdOfsConfigPI::theAutLib;
273
274// We need to export plugins to other protocols which means we need to
275// record them in the outmost environment. So get it.
276//
277 XrdOucEnv *xrdEnv = 0;
278 if (EnvInfo) xrdEnv = (XrdOucEnv*)EnvInfo->GetPtr("xrdEnv*");
279
280// Now load all of the required plugins
281//
282 if (!ofsConfig->Load(piOpts, EnvInfo)) NoGo = 1;
283 else {ofsConfig->Plugin(XrdOfsOss);
284 ossFeatures = XrdOfsOss->Features();
285 if (ossFeatures & XRDOSS_HASNOSF) FeatureSet |= XrdSfs::hasNOSF;
286 if (ossFeatures & XRDOSS_HASCACH)
288 if (xrdEnv) xrdEnv->Put("XrdCache", "T"); // Existence check
289 }
290 if (ossFeatures & XRDOSS_HASNAIO) FeatureSet |= XrdSfs::hasNAIO;
291 if (ossFeatures & XRDOSS_HASFICL) FeatureSet |= XrdSfs::hasFICL;
292 if (ossFeatures & XRDOSS_HASXERT) tryXERT = true;
293 if (xrdEnv) xrdEnv->PutPtr("XrdOss*", XrdOfsOss);
294 ofsConfig->Plugin(Cks);
295 CksPfn = !ofsConfig->OssCks();
296 CksRdr = !ofsConfig->LclCks();
297 if (ofsConfig->Plugin(prepHandler))
298 {prepAuth = ofsConfig->PrepAuth();
300 }
301 if (Options & Authorize)
302 {ofsConfig->Plugin(Authorization);
303 XrdOfsTPC::Init(Authorization);
304 if (xrdEnv) xrdEnv->PutPtr("XrdAccAuthorize*",Authorization);
306 }
307 }
308
309// If a cache has been configured then that cache may want to interact with
310// the cache-specific FSctl() operation. We check if a plugin was provided.
311//
312 if (ossFeatures & XRDOSS_HASCACH)
313 FSctl_PC = (XrdOfsFSctl_PI*)EnvInfo->GetPtr("XrdFSCtl_PC*");
314
315// Configure third party copy phase 2, but only if we are not a manager.
316//
317 if ((Options & ThirdPC) && !(Options & isManager)) NoGo |= ConfigTPC(Eroute);
318
319// Extract out the export list should it have been supplied by the oss plugin
320//
321 ossRPList = (XrdOucPListAnchor *)EnvInfo->GetPtr("XrdOssRPList*");
322
323// Initialize redirection. We type te herald here to minimize confusion
324//
325 if (Options & haveRole)
326 {Eroute.Say("++++++ Configuring ", myRole, " role. . .");
327 if (ConfigRedir(Eroute, EnvInfo))
328 {Eroute.Emsg("Config", "Unable to create cluster management client.");
329 NoGo = 1;
330 }
331 }
332
333// Initialize the FSctl plugin if we have one. Note that we needed to defer
334// until now because we needed to configure the cms plugin first (see above).
335//
336 if (ofsConfig->Plugin(FSctl_PI) && !ofsConfig->ConfigCtl(Finder, EnvInfo))
337 {Eroute.Emsg("Config", "Unable to configure FSctl plugin.");
338 NoGo = 1;
339 }
340
341// Initialize the cache FSctl handler if we have one. The same deferal applies.
342//
343 if (FSctl_PC)
344 {struct XrdOfsFSctl_PI::Plugins thePI = {Authorization, Finder,
346 XrdOucEnv pcEnv;
347 pcEnv.PutPtr("XrdOfsHandle*", dummyHandle);
348 if (!FSctl_PC->Configure(ConfigFN, 0, &pcEnv, thePI))
349 {Eroute.Emsg("Config", "Unable to configure cache FSctl handler.");
350 NoGo = 1;
351 }
352 }
353
354// Initialize th Evr object if we are an actual server
355//
356 if (!(Options & isManager) && !evrObject.Init(Balancer)) NoGo = 1;
357
358// Turn off forwarding if we are not a pure remote redirector or a peer
359//
360 if (Options & Forwarding)
361 {const char *why = 0;
362 if (!(Options & Authorize)) why = "authorization not enabled";
363 else if (!(Options & isPeer) && (Options & (isServer | isProxy)))
364 why = "not a pure manager";
365 if (why)
366 {Eroute.Say("Config warning: forwarding turned off; ", why);
367 Options &= ~(Forwarding);
368 fwdCHMOD.Reset(); fwdMKDIR.Reset(); fwdMKPATH.Reset();
369 fwdMV.Reset(); fwdRM.Reset(); fwdRMDIR.Reset();
370 fwdTRUNC.Reset();
371 }
372 }
373
374// If we need to send notifications, initialize the interface
375//
376 if (!NoGo && evsObject) NoGo = evsObject->Start(&Eroute);
377
378// If the OSS plugin is really a proxy. If it is, it will export its origin.
379// We also suppress translating lfn to pfn (usually done via osslib +cksio).
380// Note: consulting the ENVAR below is historic and remains for compatibility
381// Otherwise we can configure checkpointing if we are a data server.
382//
383 if (ossFeatures & XRDOSS_HASPRXY || getenv("XRDXROOTD_PROXY"))
384 {OssIsProxy = 1;
385 CksPfn = false;
387 } else if (!(Options & isManager) && !XrdOfsConfigCP::Init()) NoGo = 1;
388
389// Indicate wheter oss implements pgrw or it has to be simulated
390//
391 OssHasPGrw = (ossFeatures & XRDOSS_HASPGRW) != 0;
392
393// If POSC processing is enabled (as by default) do it. Warning! This must be
394// the last item in the configuration list as we need a working filesystem.
395// Note that in proxy mode we always disable posc!
396//
397 if (OssIsProxy || getenv("XRDXROOTD_NOPOSC"))
398 {if (poscAuto != -1 && !NoGo)
399 Eroute.Say("Config POSC has been disabled by the osslib plugin.");
400 } else if (poscAuto != -1 && !NoGo) NoGo |= ConfigPosc(Eroute);
401
402// Configure realtime checksums if need be
403//
404 if (CksRTCgi || CksRTName) NoGo |= ConfigCksRT(Eroute, EnvInfo);
405
406// Setup statistical monitoring
407//
408 OfsStats.setRole(myRole);
409
410// Display final configuration
411//
412 if (!NoGo) Config_Display(Eroute);
413 delete ofsConfig; ofsConfig = 0;
414
415// All done
416//
417 tmp = (NoGo ? " initialization failed." : " initialization completed.");
418 Eroute.Say("------ File system ", myRole, tmp);
419 return NoGo;
420}
#define TRACE_debug
XrdScheduler * ofsSchedP
#define TRACE_MOST
XrdOfsStats OfsStats
Definition XrdOfs.cc:115
#define XRDOSS_HASFICL
Definition XrdOss.hh:544
#define XRDOSS_HASCACH
Definition XrdOss.hh:540
#define XRDOSS_HASPRXY
Definition XrdOss.hh:538
#define XRDOSS_HASXERT
Definition XrdOss.hh:543
#define XRDOSS_HASNOSF
Definition XrdOss.hh:539
#define XRDOSS_HASPGRW
Definition XrdOss.hh:536
#define XRDOSS_HASNAIO
Definition XrdOss.hh:541
#define open
Definition XrdPosix.hh:78
static bool Init()
static XrdOfsConfigPI * New(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP, XrdVersionInfo *verP=0, XrdSfsFileSystem *sfsP=0)
@ theOssLib
Oss plugin.
@ allXXXLib
All plugins (Load() only).
@ theCksLib
Checksum manager plugin.
void setRole(const char *theRole)
static void Init()
Definition XrdOfsTPC.cc:414
XrdOfsEvr evrObject
Definition XrdOfs.hh:440
struct fwdOpt fwdMKPATH
Definition XrdOfs.hh:423
void Config_Display(XrdSysError &)
XrdNetIF * myIF
Definition XrdOfs.hh:406
virtual int ConfigXeq(char *var, XrdOucStream &, XrdSysError &)
virtual uint64_t Features()
Definition XrdOss.cc:60
void PutPtr(const char *varname, void *value)
Definition XrdOucEnv.cc:298
void Put(const char *varname, const char *value)
Definition XrdOucEnv.hh:85
virtual void EnvInfo(XrdOucEnv *envP)
uint64_t FeatureSet
Adjust features at initialization.
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
XrdCmsConfig Config
static const uint64_t hasAUTZ
Feature: Authorization.
static const uint64_t hasPRP2
Feature: Prepare Handler Version 2 (different calling conventions).
static const uint64_t hasCACH
Feature: Implements a data cache.
static const uint64_t hasNOSF
Feature: Supports no sendfile.
static const uint64_t hasFICL
Feature: Supports file cloning and samefs.
static const uint64_t hasNAIO
Feature: Supports no async I/O.
static const uint64_t hasPRXY
Feature: Proxy Server.

References XrdOfsConfigPI::allXXXLib, Authorize, Config_Display(), ConfigFN, ConfigXeq(), dMask, XrdSysError::Emsg(), XrdSfsFileSystem::EnvInfo(), evrObject, XrdOucEnv::Export(), XrdSfsFileSystem::FeatureSet, Finder, fMask, Forwarding, fwdCHMOD, fwdMKDIR, fwdMKPATH, fwdMV, fwdRM, fwdRMDIR, fwdTRUNC, XrdSfs::hasAUTZ, XrdSfs::hasCACH, XrdSfs::hasFICL, XrdSfs::hasNAIO, XrdSfs::hasNOSF, XrdSfs::hasPRP2, XrdSfs::hasPRXY, haveRole, XrdOfsConfigCP::Init(), XrdOfsTPC::Init(), isManager, isMeta, isPeer, isProxy, isServer, myIF, XrdOfsConfigPI::New(), ofsSchedP, OfsStats, OfsTrace, open, Options, XrdOucEnv::Put(), XrdOucEnv::PutPtr(), XrdSysError::Say(), XrdOfsConfigPI::theCksLib, XrdOfsConfigPI::theOssLib, ThirdPC, TRACE_debug, TRACE_MOST, XrdOfsFS, XrdOfsOss, XRDOSS_HASCACH, XRDOSS_HASFICL, XRDOSS_HASNAIO, XRDOSS_HASNOSF, XRDOSS_HASPGRW, XRDOSS_HASPRXY, and XRDOSS_HASXERT.

Here is the call graph for this function:

◆ ConfigXeq()

int XrdOfs::ConfigXeq ( char * var,
XrdOucStream & Config,
XrdSysError & Eroute )
protectedvirtual

Definition at line 879 of file XrdOfsConfig.cc.

881{
882 char *val, vBuff[64];
883
884 // Now assign the appropriate global variable
885 //
886 TS_Bit("authorize", Options, Authorize);
887 TS_XPI("authlib", theAutLib);
888 TS_XPI("ckslib", theCksLib);
889 TS_Xeq("cksrt", xcksrt);
890 TS_Xeq("cksrdsz", xcrds);
891 TS_XPI("cmslib", theCmsLib);
892 TS_Xeq("crmode", xcrm);
893 TS_XPI("ctllib", theCtlLib);
894 TS_Xeq("dirlist", xdirl);
895 TS_Xeq("forward", xforward);
896 TS_Xeq("maxdelay", xmaxd);
897 TS_Xeq("notify", xnot);
898 TS_Xeq("notifymsg", xnmsg);
899 TS_XPI("osslib", theOssLib);
900 TS_Xeq("persist", xpers);
901 TS_XPI("preplib", thePrpLib);
902 TS_Xeq("role", xrole);
903 TS_Xeq("tpc", xtpc);
904 TS_Xeq("trace", xtrace);
905 TS_Xeq("xattr", xatr);
906 TS_XPI("xattrlib", theAtrLib);
907
908 // Process miscellaneous directives handled elsemwhere
909 //
910 if (!strcmp("chkpnt", var)) return (XrdOfsConfigCP::Parse(Config) ? 0 : 1);
911
912 // Screen out the subcluster directive (we need to track that)
913 //
914 TS_Bit("subcluster",Options,SubCluster);
915
916 // Get the actual value for simple directives
917 //
918 strlcpy(vBuff, var, sizeof(vBuff)); var = vBuff;
919 if (!(val = Config.GetWord()))
920 {Eroute.Emsg("Config", "value not specified for", var); return 1;}
921
922 // No match found, complain.
923 //
924 Eroute.Say("Config warning: ignoring unknown directive '",var,"'.");
925 Config.Echo();
926 return 0;
927}
#define TS_Bit(x, m, v)
#define TS_Xeq(x, m)
Definition XrdConfig.cc:160
#define TS_XPI(x, m)
size_t strlcpy(char *dst, const char *src, size_t sz)
static bool Parse(XrdOucStream &Config)

References Authorize, XrdSysError::Emsg(), Options, XrdOfsConfigCP::Parse(), XrdSysError::Say(), strlcpy(), SubCluster, TS_Bit, TS_Xeq, and TS_XPI.

Referenced by Configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Connect()

void XrdOfs::Connect ( const XrdSecEntity * client = 0)
virtual

Notify filesystem that a client has connected.

Parameters
client- Client's identify (see common description).

Reimplemented from XrdSfsFileSystem.

Definition at line 2085 of file XrdOfs.cc.

2086{
2087 XrdOucEnv myEnv(0, 0, client);
2088
2089// Pass this call along
2090//
2091 XrdOfsOss->Connect(myEnv);
2092}
virtual void Connect(XrdOucEnv &env)
Definition XrdOss.cc:42

References XrdOfsOss.

◆ Disc()

void XrdOfs::Disc ( const XrdSecEntity * client = 0)
virtual

Notify filesystem that a client has disconnected.

Parameters
client- Client's identify (see common description).

Reimplemented from XrdSfsFileSystem.

Definition at line 2098 of file XrdOfs.cc.

2099{
2100 XrdOucEnv myEnv(0, 0, client);
2101
2102// Pass this call along
2103//
2104 XrdOfsOss->Disc(myEnv);
2105}
virtual void Disc(XrdOucEnv &env)
Definition XrdOss.cc:48

References XrdOfsOss.

◆ Emsg() [1/2]

int XrdOfs::Emsg ( const char * pfx,
XrdOucErrInfo & einfo,
int ecode,
const char * x,
const char * y = "",
const char * xtra = 0,
bool chktype = true )
staticprotected

Definition at line 2677 of file XrdOfs.cc.

2684{
2685 char* buffer;
2686 int buflen, rc;
2687 bool msgDone = false;
2688
2689// Screen out non-errors
2690//
2691 if (chkType && (rc = EmsgType(ecode)) != SFS_ERROR) return rc;
2692
2693// Setup message handling
2694//
2695 if (einfo.extData()) einfo.Reset();
2696 buffer = einfo.getMsgBuff(buflen);
2697 std::string eText;
2698
2699 // Translate ecode to corresponding errno
2700 int rcode = OfsEroute.ec2errno(ecode);
2701
2702// Check for extended information
2703//
2704 if (xtra)
2705 switch(*xtra)
2706 {case '?': xtra = 0;
2707 if (XrdOfsFS->tryXERT && XrdOfsOss->getErrMsg(eText))
2708 {if (eText.find("Unable") != std::string::npos)
2709 {einfo.setErrInfo(rcode, eText.c_str());
2710 msgDone = true;
2711 } else xtra = eText.c_str();
2712 }
2713 break;
2714 case '+': xtra++;
2715 break;
2716 default: einfo.setErrInfo(rcode, xtra);
2717 msgDone = true;
2718 break;
2719 }
2720
2721// Format the error message if it has not been already set
2722//
2723 if (!msgDone)
2724 {XrdOucERoute::Format(buffer, buflen, ecode, op, target, xtra);
2725 einfo.setErrCode(rcode);
2726 }
2727
2728// Print it out
2729//
2730 OfsEroute.Emsg(pfx, einfo.getErrUser(), buffer);
2731
2732// Return an error
2733//
2734 return SFS_ERROR;
2735}
XrdSysError OfsEroute(0)
static int EmsgType(int ecode)
Definition XrdOfs.cc:2741
virtual bool getErrMsg(std::string &eText)
Definition XrdOss.hh:680
static int Format(char *buff, int blen, int ecode, const char *etxt1, const char *etxt2=0, const char *xtra=0)
const char * getErrUser()
char * getMsgBuff(int &mblen)
int setErrInfo(int code, const char *emsg)
void Reset()
Reset object to no message state. Call this method to release appendages.
int setErrCode(int code)
int ec2errno(int ecode)

References EmsgType(), XrdOucErrInfo::extData(), XrdOucERoute::Format(), XrdOucErrInfo::getErrUser(), XrdOucErrInfo::getMsgBuff(), OfsEroute, XrdOucErrInfo::Reset(), XrdOucErrInfo::setErrCode(), XrdOucErrInfo::setErrInfo(), SFS_ERROR, XrdOfsFS, and XrdOfsOss.

Here is the call graph for this function:

◆ Emsg() [2/2]

int XrdOfs::Emsg ( const char * pfx,
XrdOucErrInfo & einfo,
int ecode,
const char * x,
XrdOfsHandle * hP,
bool posChk = false,
bool chktype = true )
staticprotected

Definition at line 2637 of file XrdOfs.cc.

2644{
2645 const char* etP = 0;
2646 int rc;
2647
2648// Screen out non-errors
2649//
2650 if (chkType && (rc = EmsgType(ecode)) != SFS_ERROR) return rc;
2651
2652// Get any extended information
2653//
2654 std::string eText;
2655 if (XrdOfsFS->tryXERT && hP->Select().getErrMsg(eText)) etP = eText.c_str();
2656
2657// First issue the error message so if we have to unpersist it makes sense
2658//
2659 rc = Emsg(pfx, einfo, ecode, op, hP->Name(), etP);
2660
2661// If this is a POSC file then we need to unpersist it. Note that we are always
2662// called with the handle **unlocked**
2663//
2664 if (posChk && hP->isRW == XrdOfsHandle::opPC)
2665 {hP->Lock();
2666 XrdOfsFS->Unpersist(hP);
2667 hP->UnLock();
2668 }
2669
2670// Now return the error
2671//
2672 return rc;
2673}
static const int opPC
XrdOssDF & Select(void)
const char * Name()
void Unpersist(XrdOfsHandle *hP, int xcev=1)
Definition XrdOfs.cc:2947
virtual bool getErrMsg(std::string &eText)
Definition XrdOss.hh:478

References Emsg(), EmsgType(), XrdOssDF::getErrMsg(), XrdOfsHandle::isRW, XrdOfsHandle::Lock(), XrdOfsHandle::Name(), XrdOfsHandle::opPC, XrdOfsHandle::Select(), SFS_ERROR, XrdOfsHandle::UnLock(), and XrdOfsFS.

Referenced by chksum(), Emsg(), FAttr(), and fsctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EmsgType()

int XrdOfs::EmsgType ( int ecode)
staticprotected

Definition at line 2741 of file XrdOfs.cc.

2742{
2743
2744// If the error is EBUSY then we just need to stall the client. This is
2745// a hack in order to provide for proxy support
2746//
2747 if (ecode < 0) ecode = -ecode;
2748 if (ecode == EBUSY) return 5; // A hack for proxy support
2749
2750// Check for timeout conditions that require a client delay
2751//
2752 if (ecode == ETIMEDOUT) return OSSDelay;
2753
2754// This is a real error
2755//
2756 return SFS_ERROR;
2757}
static int OSSDelay
Definition XrdOfs.hh:430

References OSSDelay, and SFS_ERROR.

Referenced by Emsg(), and Emsg().

Here is the caller graph for this function:

◆ exists()

int XrdOfs::exists ( const char * path,
XrdSfsFileExistence & eFlag,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
virtual

Return directory/file existence information (short stat).

Parameters
path- Pointer to the path of the file/directory in question.
eFlag- Where the results are to be returned.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- Path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED When SFS_OK is returned, eFlag must be properly set, as follows: XrdSfsFileExistNo - path does not exist XrdSfsFileExistIsFile - path refers to an online file XrdSfsFileExistIsDirectory - path refers to an online directory XrdSfsFileExistIsOffline - path refers to an offline file XrdSfsFileExistIsOther - path is neither a file nor directory

Implements XrdSfsFileSystem.

Definition at line 2111 of file XrdOfs.cc.

2133{
2134 EPNAME("exists");
2135 struct stat fstat;
2136 int retc;
2137 const char *tident = einfo.getErrUser();
2138 XrdOucEnv stat_Env(info,0,client);
2139 XTRACE(exists, path, "");
2140
2141// Apply security, as needed
2142//
2143 AUTHORIZE(client,&stat_Env,AOP_Stat,"locate",path,einfo);
2144
2145// Find out where we should stat this file
2146//
2147 if (Finder && Finder->isRemote()
2148 && (retc = Finder->Locate(einfo, path, SFS_O_RDONLY, &stat_Env)))
2149 return fsError(einfo, retc);
2150
2151// Now try to find the file or directory
2152//
2153 retc = XrdOfsOss->Stat(path, &fstat, 0, &stat_Env);
2154 if (!retc)
2155 { if (S_ISDIR(fstat.st_mode)) file_exists=XrdSfsFileExistIsDirectory;
2156 else if (S_ISREG(fstat.st_mode)) file_exists=XrdSfsFileExistIsFile;
2157 else file_exists=XrdSfsFileExistNo;
2158 return SFS_OK;
2159 }
2160 if (retc == -ENOENT)
2161 {file_exists=XrdSfsFileExistNo;
2162 return SFS_OK;
2163 }
2164
2165// An error occurred, return the error info
2166//
2167 return XrdOfsFS->Emsg(epname, einfo, retc, "locate", path, "?");
2168}
#define fstat(a, b)
Definition XrdPosix.hh:62
@ XrdSfsFileExistIsFile
@ XrdSfsFileExistNo
@ XrdSfsFileExistIsDirectory
int exists(const char *fileName, XrdSfsFileExistence &exists_flag, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
Definition XrdOfs.cc:2111

References AOP_Stat, AUTHORIZE, EPNAME, exists(), Finder, fsError(), fstat, XrdOucErrInfo::getErrUser(), SFS_O_RDONLY, SFS_OK, stat(), tident, XrdOfsFS, XrdOfsOss, XrdSfsFileExistIsDirectory, XrdSfsFileExistIsFile, XrdSfsFileExistNo, and XTRACE.

Referenced by exists(), and rename().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FAttr()

int XrdOfs::FAttr ( XrdSfsFACtl * faReq,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client = 0 )
virtual

Perform a filesystem extended attribute function.

Parameters
faReq- pointer to the request object (see XrdSfsFAttr.hh). If the pointer is nill, simply return whether or not extended attributes are supported.
eInfo- The object where error info or results are to be returned.
client- Client's identify (see common description).
Returns
SFS_OK a null response is sent.
SFS_DATA error.code length of the data to be sent. error.message contains the data to be sent.
SFS_STARTED Operation started result will be returned via callback. o/w one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.

Reimplemented from XrdSfsFileSystem.

Definition at line 195 of file XrdOfsFAttr.cc.

198{
199 EPNAME("FAttr");
200 const char *tident = einfo.getErrUser();
201 char pfnbuff[MAXPATHLEN+8];
202 const char *accType;
203 long long xOpts;
204
205 struct faArgs {const char *name; int fArg; Access_Operation aop;};
206
207 static faArgs faTab[] = {{ "del fattr", SFS_O_RDWR, AOP_Update}, // del
208 { "get fattr", 0, AOP_Read}, // get
209 {"list fattr", 0, AOP_Read}, // list
210 { "set fattr", SFS_O_RDWR, AOP_Update} // set
211 };
212 static const int faNum = sizeof(faTab)/sizeof(struct faArgs);
213
214 int rc;
215
216// Check if we need only return support information
217//
218 if (!faReq)
219 {XrdOucEnv *envP = einfo.getEnv();
220 ZTRACE(fsctl, "FAttr req=info");
221 if (!envP || !usxMaxNsz)
222 {einfo.setErrInfo(ENOTSUP, "Not supported.");
223 return SFS_ERROR;
224 }
225 envP->PutInt("usxMaxNsz", usxMaxNsz);
226 envP->PutInt("usxMaxVsz", usxMaxVsz);
227 return SFS_OK;
228 }
229
230// Setup for to perform attribute functions
231//
232 XrdSfsFACtl &faCtl = *faReq;
233 XrdOucEnv FAttr_Env(faCtl.pcgi,0,client);
234
235// Make sure request code is valid (we also set some options)
236//
237 if (faCtl.rqst > faNum)
238 return Emsg(epname, einfo, EINVAL, "process fattrs", faCtl.path);
239 accType = faTab[faCtl.rqst].name;
240
241// Trace this call
242//
243 ZTRACE(fsctl, "FAttr " <<accType <<' ' <<faCtl.path);
244
245// Extract the export options if we can
246//
247 xOpts = (ossRPList ? ossRPList->Find(faCtl.path) : 0);
248
249// Perform authrorization and redirection if required
250//
251 if (faCtl.opts & XrdSfsFACtl::accChk)
252 {int luFlag = faTab[faCtl.rqst].fArg;
253 Access_Operation aOP = faTab[faCtl.rqst].aop;
254
255 AUTHORIZE(client, 0, aOP, accType ,faCtl.path, einfo);
256
257 if (Finder && Finder->isRemote()
258 && (rc = Finder->Locate(einfo, faCtl.path, luFlag, &FAttr_Env)))
259 return fsError(einfo, rc);
260
261 if (aOP == AOP_Update && xOpts & XRDEXP_NOTRW)
262 return Emsg(epname, einfo, EROFS, accType, faCtl.path);
263 }
264
265// If this is a proxy server then hand this request to the storage system
266// as it will need to be executed elsewhere.
267//
268 if (OssIsProxy)
269 {faCtl.envP = &FAttr_Env;
270 rc = XrdOfsOss->FSctl(XRDOSS_FSCTLFA, 0, (const char *)&faCtl);
271 if (rc) return XrdOfsFS->Emsg(epname, einfo, rc, accType, faCtl.path);
272 return SFS_OK;
273 }
274
275// Make sure we can use xattrs on the path
276//
277 if (xOpts & XRDEXP_NOXATTR)
278 return XrdOfsFS->Emsg(epname, einfo, EPERM, accType, faCtl.path);
279
280// Convert the lfn to a pfn for actual calls to the attribute processor
281//
282 faCtl.pfnP = XrdOfsOss->Lfn2Pfn(faCtl.path, pfnbuff, sizeof(pfnbuff), rc);
283 if (!faCtl.pfnP) return XrdOfsFS->Emsg(epname,einfo,rc,accType,faCtl.path);
284
285// Fan out for processing this on the local file system
286//
287 switch(faCtl.rqst)
288 {case XrdSfsFACtl::faDel:
289 return ctlFADel(faCtl, FAttr_Env, einfo);
290 break;
292 return ctlFAGet(faCtl, FAttr_Env, einfo);
293 break;
295 return ctlFALst(faCtl, FAttr_Env, einfo);
296 break;
298 return ctlFASet(faCtl, FAttr_Env, einfo);
299 break;
300 default: break;
301 }
302
303// The request code is not one we understand
304//
305 return XrdOfsFS->Emsg(epname, einfo, EINVAL, "process fattrs", faCtl.path);
306}
Access_Operation
The following are supported operations.
@ AOP_Update
open() r/w or append
@ AOP_Read
open() r/o, prepare()
#define ZTRACE(act, x)
#define XRDOSS_FSCTLFA
Definition XrdOss.hh:554
#define XRDEXP_NOTRW
#define XRDEXP_NOXATTR
int fsctl(const int cmd, const char *args, XrdOucErrInfo &out_error, const XrdSecEntity *client=0)
virtual int FSctl(int cmd, int alen, const char *args, char **resp=0)
Definition XrdOss.cc:66
void PutInt(const char *varname, long value)
Definition XrdOucEnv.cc:250
XrdOucEnv * envP
Definition XrdPss.cc:110
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.
XrdOucEnv * envP
Optional environmental information.
unsigned char opts
Request options (see below).

References XrdSfsFACtl::accChk, AOP_Read, AOP_Update, AUTHORIZE, Emsg(), XrdSfsFACtl::envP, EPNAME, XrdSfsFACtl::faDel, XrdSfsFACtl::faGet, XrdSfsFACtl::faLst, XrdSfsFACtl::faSet, Finder, fsctl(), fsError(), XrdOucErrInfo::getEnv(), XrdOucErrInfo::getErrUser(), XrdSfsFACtl::opts, XrdSfsFACtl::path, XrdSfsFACtl::pcgi, XrdSfsFACtl::pfnP, XrdOucEnv::PutInt(), XrdSfsFACtl::rqst, XrdOucErrInfo::setErrInfo(), SFS_ERROR, SFS_O_RDWR, SFS_OK, tident, XRDEXP_NOTRW, XRDEXP_NOXATTR, XrdOfsFS, XrdOfsOss, XRDOSS_FSCTLFA, and ZTRACE.

Here is the call graph for this function:

◆ FSctl()

int XrdOfs::FSctl ( const int cmd,
XrdSfsFSctl & args,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client = 0 )
virtual

Perform a filesystem control operation (version 2)

Parameters
cmd- The operation to be performed: SFS_FSCTL_PLUGFS Return Implementation Dependent Data FS SFS_FSCTL_PLUGIN Return Implementation Dependent Data v1 SFS_FSCTL_PLUGIO Return Implementation Dependent Data v2 SFS_FSCTL_PLUGXC Return Implementation Dependent Cache
args- Arguments specific to cmd. SFS_FSCTL_PLUGFS Unscreened argument string. SFS_FSCTL_PLUGIN path and opaque information. SFS_FSCTL_PLUGXC Unscreened argument string.
eInfo- The object where error info or results are to be returned.
client- Client's identify (see common description).
Returns
SFS_OK a null response is sent. SFS_DATA error.code length of the data to be sent. error.message contains the data to be sent. o/w one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.

Reimplemented from XrdSfsFileSystem.

Definition at line 263 of file XrdOfsFSctl.cc.

267{
268 EPNAME("FSctl");
269
270// This may be a cache-specfic operation, a forwardable operation, or one
271// destined to a FSctl plugin. We hande each case here.
272// is a simple case of wheter we have a plug-in for this or not.
273//
274 if (cmd == SFS_FSCTL_PLUGXC)
275 {if (FSctl_PC)
276 {if (args.Arg2Len == -2)
277 {XrdOucEnv pc_Env(args.ArgP[1], 0, client);
278 AUTHORIZE(client,&pc_Env,AOP_Read,"FSctl",args.ArgP[0],eInfo);
279 }
280 return FSctl_PC->FSctl(cmd, args, eInfo, client);
281 }
282 } else if (cmd == SFS_FSCTL_PLUGFS)
283 {char* resp = 0;
284 int rc, n = XRDOSS_FSCTLFS;
285 XrdOucEnv ps_Env(args.Arg2, 0, client);
286 AUTHORIZE(client,&ps_Env,AOP_Stat,"FSctl",args.Arg1,eInfo);
287 if (args.Arg2 && *args.Arg2 && args.Arg2Len > 0)
288 {std::string url(args.Arg1);
289 url += '?'; url += args.Arg2;
290 rc = XrdOfsOss->FSctl(n, url.size(), url.c_str(), &resp);
291 } else {
292 rc = XrdOfsOss->FSctl(n, args.Arg1Len, args.Arg1, &resp);
293 }
294 if (rc >= 0)
295 {rc = SFS_OK;
296 if (resp)
297 {if ((n = strlen(resp)))
298 {eInfo.setErrInfo(n, resp);
299 rc = SFS_DATA;
300 }
301 delete[] resp;
302 }
303 return rc;
304 }
305 return XrdOfsFS->Emsg("FSctl", eInfo, rc, "FSctl", "");
306 }
307 else if (FSctl_PI) return FSctl_PI->FSctl(cmd, args, eInfo, client);
308
309// Operation is not supported
310//
311 return XrdOfsFS->Emsg("FSctl", eInfo, ENOTSUP, "FSctl", "");
312}
#define XRDOSS_FSCTLFS
Definition XrdOss.hh:555
#define SFS_DATA
#define SFS_FSCTL_PLUGFS
#define SFS_FSCTL_PLUGXC
const char * Arg1
PLUGFS, PLUGIN, PLUGIO, PLUGXC.
int Arg2Len
Length or -count of args in extension.
int Arg1Len
Length.

References AOP_Read, AOP_Stat, XrdSfsFSctl::Arg1, XrdSfsFSctl::Arg1Len, XrdSfsFSctl::Arg2Len, AUTHORIZE, EPNAME, XrdOucErrInfo::setErrInfo(), SFS_DATA, SFS_FSCTL_PLUGFS, SFS_FSCTL_PLUGXC, SFS_OK, XrdOfsFS, XrdOfsOss, and XRDOSS_FSCTLFS.

Here is the call graph for this function:

◆ fsctl()

int XrdOfs::fsctl ( const int cmd,
const char * args,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client = 0 )
virtual

Perform a filesystem control operation (version 1)

Parameters
cmd- The operation to be performed: SFS_FSCTL_LOCATE Locate a file or file servers SFS_FSCTL_STATCC Return cluster config status SFS_FSCTL_STATFS Return physical filesystem information SFS_FSCTL_STATLS Return logical filesystem information SFS_FSCTL_STATXA Return extended attributes
args- Arguments specific to cmd. SFS_FSCTL_LOCATE args points to the path to be located "" path is the first exported path "*" return all current servers "*&zwj;/" return servers exporting path o/w return servers having the path SFS_FSCTL_STATFS Path in the filesystem in question. SFS_FSCTL_STATLS Path in the filesystem in question. SFS_FSCTL_STATXA Path of the file whose xattr is wanted.
eInfo- The object where error info or results are to be returned.
client- Client's identify (see common description).
Returns
SFS_OK a null response is sent.
SFS_DATA error.code length of the data to be sent. error.message contains the data to be sent.
SFS_STARTED Operation started result will be returned via callback. Valid only for for SFS_FSCTL_LOCATE, SFS_FSCTL_STATFS, and SFS_FSCTL_STATXA o/w one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.

Implements XrdSfsFileSystem.

Definition at line 93 of file XrdOfsFSctl.cc.

114{
115 EPNAME("fsctl");
116 static int PrivTab[] = {XrdAccPriv_Delete, XrdAccPriv_Insert,
120 static char PrivLet[] = {'d', 'i',
121 'k', 'l',
122 'n', 'r',
123 'w'};
124 static const int PrivNum = sizeof(PrivLet);
125
126 int retc, i, blen, privs, opcode = cmd & SFS_FSCTL_CMD;
127 const char *tident = einfo.getErrUser();
128 char *bP, *cP;
129
130// Process the LOCATE request
131//
132 if (opcode == SFS_FSCTL_LOCATE)
133 {static const int locMask = (SFS_O_FORCE|SFS_O_NOWAIT|SFS_O_RESET|
135 struct stat fstat;
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));
139 XrdNetIF::ifType ifType;
140 int Resp1Len;
141 int find_flag = SFS_O_LOCATE | (cmd & locMask);
142 XrdOucEnv loc_Env(opq ? opq+1 : 0,0,client);
143
144 ZTRACE(fsctl, "locate args=" <<(args ? args : "''"));
145
146 if (cmd & SFS_O_TRUNC) locArg = (char *)"*";
147 else { if (*Path == '*') {locArg = Path; Path++;}
148 else locArg = Path;
149 AUTHORIZE(client,&loc_Env,AOP_Stat,"locate",Path,einfo);
150 }
151 if (Finder && Finder->isRemote()
152 && (retc = Finder->Locate(einfo, locArg, find_flag, &loc_Env)))
153 return fsError(einfo, retc);
154
155 if (cmd & SFS_O_TRUNC) {rType[0] = 'S'; rType[1] = ossRW;}
156 else {if ((retc = XrdOfsOss->Stat(Path, &fstat, 0, &loc_Env)))
157 return XrdOfsFS->Emsg(epname, einfo, retc, "locate", Path);
158 rType[0] = ((fstat.st_mode & S_IFBLK) == S_IFBLK ? 's' : 'S');
159 rType[1] = (fstat.st_mode & S_IWUSR ? 'w' : 'r');
160 }
161 rType[2] = '\0';
162
163 ifType = XrdNetIF::GetIFType((einfo.getUCap() & XrdOucEI::uIPv4) != 0,
164 (einfo.getUCap() & XrdOucEI::uIPv64) != 0,
165 (einfo.getUCap() & XrdOucEI::uPrip) != 0);
166 bool retHN = (cmd & SFS_O_HNAME) != 0;
167 if ((Resp1Len = myIF->GetDest(pbuff, sizeof(pbuff), ifType, retHN)))
168 {einfo.setErrInfo(Resp1Len+3, (const char **)Resp, 2);
169 return SFS_DATA;
170 }
171 return Emsg(epname, einfo, ENETUNREACH, "locate", Path);
172 }
173
174// Process the STATFS request
175//
176 if (opcode == SFS_FSCTL_STATFS)
177 {char pbuff[1024];
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 : "''"));
181 AUTHORIZE(client,&fs_Env,AOP_Stat,"statfs",Path,einfo);
182 if (Finder && Finder->isRemote()
183 && (retc = Finder->Space(einfo, Path, &fs_Env)))
184 return fsError(einfo, retc);
185 bP = einfo.getMsgBuff(blen);
186 if ((retc = XrdOfsOss->StatFS(Path, bP, blen, &fs_Env)))
187 return XrdOfsFS->Emsg(epname, einfo, retc, "statfs", args);
188 einfo.setErrCode(blen+1);
189 return SFS_DATA;
190 }
191
192// Process the STATLS request
193//
194 if (opcode == SFS_FSCTL_STATLS)
195 {char pbuff[1024];
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 : "''"));
199 AUTHORIZE(client,&statls_Env,AOP_Stat,"statfs",Path,einfo);
200 if (Finder && Finder->isRemote())
201 {statls_Env.Put("cms.qvfs", "1");
202 if ((retc = Finder->Space(einfo, Path, &statls_Env)))
203 {if (retc == SFS_DATA) retc = Reformat(einfo);
204 return fsError(einfo, retc);
205 }
206 }
207 bP = einfo.getMsgBuff(blen);
208 if ((retc = XrdOfsOss->StatLS(statls_Env, Path, bP, blen)))
209 return XrdOfsFS->Emsg(epname, einfo, retc, "statls", Path);
210 einfo.setErrCode(blen+1);
211 return SFS_DATA;
212 }
213
214// Process the STATXA request
215//
216 if (opcode == SFS_FSCTL_STATXA)
217 {char pbuff[1024];
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 : "''"));
221 AUTHORIZE(client,&xa_Env,AOP_Stat,"statxa",Path,einfo);
222 if (Finder && Finder->isRemote()
223 && (retc = Finder->Locate(einfo,Path,SFS_O_RDONLY|SFS_O_STAT,&xa_Env)))
224 return fsError(einfo, retc);
225 bP = einfo.getMsgBuff(blen);
226 if ((retc = XrdOfsOss->StatXA(Path, bP, blen, &xa_Env)))
227 return XrdOfsFS->Emsg(epname, einfo, retc, "statxa", Path);
228 if (!client || !XrdOfsFS->Authorization) privs = XrdAccPriv_All;
229 else privs = XrdOfsFS->Authorization->Access(client, Path, AOP_Any);
230 cP = bP + blen; strcpy(cP, "&ofs.ap="); cP += 8;
231 if (privs == XrdAccPriv_All) *cP++ = 'a';
232 else {for (i = 0; i < PrivNum; i++)
233 if (PrivTab[i] & privs) *cP++ = PrivLet[i];
234 if (cP == (bP + blen + 1)) *cP++ = '?';
235 }
236 *cP++ = '\0';
237 einfo.setErrCode(cP-bP+1);
238 return SFS_DATA;
239 }
240
241// Process the STATCC request (this should always succeed)
242//
243 if (opcode == SFS_FSCTL_STATCC)
244 {static const int lcc_flag = SFS_O_LOCATE | SFS_O_LOCAL;
245 XrdOucEnv lcc_Env(0,0,client);
246 ZTRACE(fsctl, "statcc args=" <<(args ? args : "''"));
247 if (Finder) retc = Finder ->Locate(einfo,".",lcc_flag,&lcc_Env);
248 else if (Balancer) retc = Balancer->Locate(einfo,".",lcc_flag,&lcc_Env);
249 else retc = SFS_ERROR;
250 if (retc != SFS_DATA) einfo.setErrInfo(5, "none|");
251 return fsError(einfo, SFS_DATA);
252 }
253
254// Operation is not supported
255//
256 return XrdOfsFS->Emsg(epname, einfo, ENOTSUP, "fsctl", args);
257}
@ AOP_Any
Special for getting privs.
@ XrdAccPriv_Insert
@ XrdAccPriv_Lookup
@ XrdAccPriv_Rename
@ XrdAccPriv_All
@ XrdAccPriv_Read
@ XrdAccPriv_Lock
@ XrdAccPriv_Write
@ XrdAccPriv_Delete
#define SFS_O_HNAME
#define SFS_O_RESET
#define SFS_O_DIRLIST
#define SFS_FSCTL_STATFS
#define SFS_O_STAT
#define SFS_O_FORCE
#define SFS_FSCTL_CMD
#define SFS_FSCTL_STATLS
#define SFS_FSCTL_STATCC
#define SFS_O_LOCATE
#define SFS_FSCTL_STATXA
#define SFS_FSCTL_LOCATE
#define SFS_O_RAWIO
#define SFS_O_LOCAL
#define SFS_O_NOWAIT
#define SFS_O_TRUNC
virtual XrdAccPrivs Access(const XrdSecEntity *Entity, const char *path, const Access_Operation oper, XrdOucEnv *Env=0)=0
static ifType GetIFType(bool conIPv4, bool hasIP64, bool pvtIP)
Definition XrdNetIF.hh:204
ifType
The enum that is used to index into ifData to get appropriate interface.
Definition XrdNetIF.hh:64
const char * Split(const char *Args, const char **Opq, char *Path, int Plen)
Definition XrdOfs.cc:2894
virtual int StatLS(XrdOucEnv &env, const char *path, char *buff, int &blen)
Definition XrdOss.cc:97
virtual int StatXA(const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
Definition XrdOss.cc:127
virtual int StatFS(const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
Definition XrdOss.cc:87
static const int uIPv64
ucap: Supports only IPv4 info
static const int uIPv4
ucap: Supports read redirects
static const int uPrip

References AOP_Any, AOP_Stat, AUTHORIZE, Emsg(), EPNAME, Finder, fsctl(), fsError(), fstat, XrdOucErrInfo::getErrUser(), XrdNetIF::GetIFType(), XrdOucErrInfo::getMsgBuff(), XrdOucErrInfo::getUCap(), myIF, Path, XrdOucEnv::Put(), XrdOucErrInfo::setErrCode(), XrdOucErrInfo::setErrInfo(), SFS_DATA, SFS_ERROR, SFS_FSCTL_CMD, SFS_FSCTL_LOCATE, SFS_FSCTL_STATCC, SFS_FSCTL_STATFS, SFS_FSCTL_STATLS, SFS_FSCTL_STATXA, SFS_O_DIRLIST, SFS_O_FORCE, SFS_O_HNAME, SFS_O_LOCAL, SFS_O_LOCATE, SFS_O_NOWAIT, SFS_O_RAWIO, SFS_O_RDONLY, SFS_O_RESET, SFS_O_STAT, SFS_O_TRUNC, Split(), stat(), tident, XrdOucEI::uIPv4, XrdOucEI::uIPv64, XrdOucEI::uPrip, XrdAccPriv_All, XrdAccPriv_Delete, XrdAccPriv_Insert, XrdAccPriv_Lock, XrdAccPriv_Lookup, XrdAccPriv_Read, XrdAccPriv_Rename, XrdAccPriv_Write, XrdOfsFS, XrdOfsOss, and ZTRACE.

Referenced by FAttr(), and fsctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsError()

int XrdOfs::fsError ( XrdOucErrInfo & myError,
int rc )
staticprotected

Definition at line 2837 of file XrdOfs.cc.

2838{
2839
2840// Screen the error code (update statistics w/o a lock for speed!)
2841//
2842 if (rc == SFS_REDIRECT) {OfsStats.Data.numRedirect++; return SFS_REDIRECT;}
2843 if (rc == SFS_STARTED) {OfsStats.Data.numStarted++; return SFS_STARTED; }
2844 if (rc > 0) {OfsStats.Data.numDelays++; return rc; }
2845 if (rc == SFS_DATA) {OfsStats.Data.numReplies++; return SFS_DATA; }
2846 {OfsStats.Data.numErrors++; return SFS_ERROR; }
2847}
#define SFS_REDIRECT
#define SFS_STARTED
struct XrdOfsStats::StatsData Data

References OfsStats, SFS_DATA, SFS_ERROR, SFS_REDIRECT, and SFS_STARTED.

Referenced by chksum(), chmod(), exists(), FAttr(), fsctl(), mkdir(), prepare(), rename(), stat(), stat(), and truncate().

Here is the caller graph for this function:

◆ getStats()

int XrdOfs::getStats ( char * buff,
int blen )
virtual

Return statistical information.

Parameters
buff- Pointer to the buffer where results are to be returned. Statistics should be in standard XML format. If buff is nil then only maximum size information is wanted.
blen- The length available in buff.
Returns
Number of bytes placed in buff. When buff is nil, the maximum number of bytes that could have been placed in buff.

Implements XrdSfsFileSystem.

Definition at line 2174 of file XrdOfs.cc.

2175{
2176 int n;
2177
2178// See if the size just wanted
2179//
2180 if (!buff) return OfsStats.Report(0,0) + XrdOfsOss->Stats(0,0);
2181
2182// Report ofs info followed by the oss info
2183//
2184 n = OfsStats.Report(buff, blen);
2185 buff += n; blen -= n;
2186 n += XrdOfsOss->Stats(buff, blen);
2187
2188// All done
2189//
2190 return n;
2191}
int Report(char *Buff, int Blen)
virtual int Stats(char *buff, int blen)
Definition XrdOss.hh:788

References OfsStats, and XrdOfsOss.

◆ getVersion()

const char * XrdOfs::getVersion ( )
virtual

Get version string.

Returns
The version string. Normally this is the XrdVERSION value.

Implements XrdSfsFileSystem.

Definition at line 140 of file XrdOfsConfig.cc.

140{return XrdVERSION;}

◆ mkdir()

int XrdOfs::mkdir ( const char * path,
XrdSfsMode mode,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
virtual

Create a directory.

Parameters
path- Pointer to the path of the directory to be created.
mode- The directory mode setting.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- Path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 2197 of file XrdOfs.cc.

2215{
2216 EPNAME("mkdir");
2217 static const int LocOpts = SFS_O_RDWR | SFS_O_CREAT | SFS_O_META;
2218 mode_t acc_mode = (Mode | dMask[0]) & dMask[1];
2219 int retc, mkpath = Mode & SFS_O_MKPTH;
2220 const char *tident = einfo.getErrUser();
2221 XrdOucEnv mkdir_Env(info,0,client);
2222 XTRACE(mkdir, path, "");
2223
2224// Apply security, as needed
2225//
2226 AUTHORIZE(client,&mkdir_Env,AOP_Mkdir,"mkdir",path,einfo);
2227
2228// Find out where we should remove this file
2229//
2230 if (Finder && Finder->isRemote())
2231 {if (fwdMKDIR.Cmd)
2232 {char buff[8];
2233 sprintf(buff, "%o", static_cast<int>(acc_mode));
2234 if (Forward(retc, einfo, (mkpath ? fwdMKPATH:fwdMKDIR),
2235 path, buff, &mkdir_Env)) return retc;
2236 }
2237 else if ((retc = Finder->Locate(einfo,path,LocOpts,&mkdir_Env)))
2238 return fsError(einfo, retc);
2239 }
2240
2241// Perform the actual operation
2242//
2243 if ((retc = XrdOfsOss->Mkdir(path, acc_mode, mkpath, &mkdir_Env)))
2244 return XrdOfsFS->Emsg(epname, einfo, retc, "mkdir", path, "?");
2245
2246// Check if we should generate an event
2247//
2248 if (evsObject && evsObject->Enabled(XrdOfsEvs::Mkdir))
2249 {XrdOfsEvsInfo evInfo(tident, path, info, &mkdir_Env, acc_mode);
2250 evsObject->Notify(XrdOfsEvs::Mkdir, evInfo);
2251 }
2252
2253// If we have a redirector, tell it that we now have this path
2254//
2255 if (Balancer)
2256 {if (!mkpath) Balancer->Added(path);
2257 else {char *slash, *myPath = strdup(path);
2258 do {Balancer->Added(myPath);
2259 if ((slash = rindex(myPath, '/'))) *slash = 0;
2260 } while(slash && slash != myPath);
2261 free(myPath);
2262 }
2263 }
2264
2265 return SFS_OK;
2266}
@ AOP_Mkdir
mkdir()
#define SFS_O_MKPTH
#define SFS_O_CREAT
int mkdir(const char *dirName, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0)
Definition XrdOfs.cc:2197
virtual int Mkdir(const char *path, mode_t mode, int mkpath=0, XrdOucEnv *envP=0)=0

References AOP_Mkdir, AUTHORIZE, dMask, EPNAME, Finder, fsError(), fwdMKDIR, fwdMKPATH, XrdOucErrInfo::getErrUser(), XrdOfsEvs::Mkdir, mkdir(), Mode, SFS_O_CREAT, SFS_O_META, SFS_O_MKPTH, SFS_O_RDWR, SFS_OK, tident, XrdOfsFS, XrdOfsOss, and XTRACE.

Referenced by mkdir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newDir() [1/2]

XrdSfsDirectory * XrdOfs::newDir ( char * user = 0,
int MonID = 0 )
inlinevirtual

Obtain a new director object to be used for future directory requests.

Parameters
user- Text identifying the client responsible for this call. The pointer may be null if identification is missing.
MonID- The monitoring identifier assigned to this and all future requests using the returned object.
Returns
pointer- Pointer to an XrdSfsDirectory object.
nil - Insufficient memory to allocate an object.

Implements XrdSfsFileSystem.

Definition at line 252 of file XrdOfs.hh.

253 {return new XrdOfsDirFull(user, MonID);}

◆ newDir() [2/2]

XrdSfsDirectory * XrdOfs::newDir ( XrdOucErrInfo & eInfo)
inlinevirtual

Obtain a new wrapped directory object to be used for future requests.

Parameters
eInfo- Reference to the error object to be used by the new directory object. Note that an implementation is supplied for compatibility purposes but it returns a nil pointer which is considered to be a failure. You must supply an implementation for this to work correctly.
Returns
pointer- Pointer to an XrdSfsDirectory object.
nil - Insufficient memory to allocate an object.

Reimplemented from XrdSfsFileSystem.

Definition at line 255 of file XrdOfs.hh.

256 {return new XrdOfsDirectory(eInfo, eInfo.getErrUser());}
friend class XrdOfsDirectory
Definition XrdOfs.hh:245

References XrdOucErrInfo::getErrUser(), and XrdOfsDirectory.

Here is the call graph for this function:

◆ newFile() [1/2]

XrdSfsFile * XrdOfs::newFile ( char * user = 0,
int MonID = 0 )
inlinevirtual

Obtain a new file object to be used for a future file requests.

Parameters
user- Text identifying the client responsible for this call. The pointer may be null if identification is missing.
MonID- The monitoring identifier assigned to this and all future requests using the returned object.
Returns
pointer- Pointer to an XrdSfsFile object.
nil - Insufficient memory to allocate an object.

Implements XrdSfsFileSystem.

Definition at line 258 of file XrdOfs.hh.

259 {return new XrdOfsFileFull(user, MonID);}

◆ newFile() [2/2]

XrdSfsFile * XrdOfs::newFile ( XrdOucErrInfo & eInfo)
inlinevirtual

Obtain a new wrapped file object to be used for a future requests.

Parameters
eInfo- Reference to the error object to be used by the new file object. Note that an implementation is supplied for compatibility purposes but it returns a nil pointer which is considered to be a failure. You must supply an implementation for this to work correctly.
Returns
pointer- Pointer to an XrdSfsFile object.
nil - Insufficient memory to allocate an object.

Reimplemented from XrdSfsFileSystem.

Definition at line 261 of file XrdOfs.hh.

262 {return new XrdOfsFile(eInfo, eInfo.getErrUser());}
friend class XrdOfsFile
Definition XrdOfs.hh:246

References XrdOucErrInfo::getErrUser(), and XrdOfsFile.

Here is the call graph for this function:

◆ prepare()

int XrdOfs::prepare ( XrdSfsPrep & pargs,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client = 0 )
virtual

Prepare a file for future processing.

Parameters
pargs- The preapre arguments.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 2272 of file XrdOfs.cc.

2275{
2276 EPNAME("prepare");
2277 XrdOucEnv prep_Env(0,0,client);
2278 XrdOucTList *tp = pargs.paths;
2279 int retc;
2280
2281// Run through the paths to make sure client can read each one unless we aren't
2282// supposed to apply authorization.
2283//
2284 if (prepAuth)
2285 while(tp)
2286 {AUTHORIZE(client,0,AOP_Read,"prepare",tp->text,out_error);
2287 tp = tp->next;
2288 }
2289
2290// If there is a prepare plugin, invoke it and return the result.
2291//
2292 if (prepHandler)
2293 {if (pargs.opts & Prep_QUERY)
2294 return prepHandler->query(pargs, out_error, client);
2295 if (pargs.opts & Prep_CANCEL)
2296 return prepHandler->cancel(pargs, out_error, client);
2297
2298 return prepHandler->begin(pargs, out_error, client);
2299 }
2300
2301// If we have a finder object, use it to prepare the paths. Otherwise,
2302// ignore this prepare request (we may change this in the future).
2303//
2304 if (XrdOfsFS->Finder
2305 && (retc = XrdOfsFS->Finder->Prepare(out_error, pargs, &prep_Env)))
2306 return fsError(out_error, retc);
2307 return 0;
2308}
#define Prep_CANCEL
#define Prep_QUERY
XrdOucTList * paths
List of paths.
int opts
Prep_xxx.
virtual int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info=0)
XrdOucTList * next

References AOP_Read, AUTHORIZE, EPNAME, fsError(), XrdOucTList::next, XrdSfsPrep::opts, XrdSfsPrep::paths, Prep_CANCEL, Prep_QUERY, XrdOucTList::text, and XrdOfsFS.

Here is the call graph for this function:

◆ rem()

int XrdOfs::rem ( const char * path,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
inlinevirtual

Remove a file.

Parameters
path- Pointer to the path of the file to be removed.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- Path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 317 of file XrdOfs.hh.

321 {return remove('f', path, out_error, client, info);}

◆ remdir()

int XrdOfs::remdir ( const char * path,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
inlinevirtual

Remove a directory.

Parameters
path- Pointer to the path of the directory to be removed.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- Path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 323 of file XrdOfs.hh.

327 {return remove('d',dirName,out_error,client,info);}

◆ rename()

int XrdOfs::rename ( const char * oPath,
const char * nPath,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaqueO = 0,
const char * opaqueN = 0 )
virtual

Rename a file or directory.

Parameters
oPath- Pointer to the path to be renamed.
nPath- Pointer to the path oPath is to have.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaqueO- oPath's CGI information (see common description).
opaqueN- nPath's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 2380 of file XrdOfs.cc.

2398{
2399 EPNAME("rename");
2400 static const int LocOpts = SFS_O_RDWR|SFS_O_META;
2401 int retc;
2402 const char *tident = einfo.getErrUser();
2403 XrdOucEnv old_Env(infoO,0,client);
2404 XrdOucEnv new_Env(infoN,0,client);
2405 XTRACE(rename, new_name, "old fn=" <<old_name <<" new ");
2406
2407// Apply security, as needed
2408//
2409 AUTHORIZE(client, &old_Env, AOP_Rename, "renaming", old_name, einfo);
2410
2411// The above authorization may mutate the XrdSecEntity by putting a mapped name
2412// into the extended attributes. This mapped name will affect the subsequent
2413// authorization check below, giving the client access that may not be permitted.
2414// Hence, we delete this attribute to reset the object back to "pristine" state.
2415// If there was a way to make a copy of the XrdSecEntity, we could avoid this
2416// hack-y reach inside the extended attributes.
2417 if (client) client->eaAPI->Add("request.name", "", true);
2418
2419// If we do not have full-blown insert authorization, we'll need to test for
2420// destination existence
2421 bool cannot_overwrite = false;
2422 if (client && XrdOfsFS->Authorization &&
2423 !XrdOfsFS->Authorization->Access(client, new_name, AOP_Insert, &new_Env))
2424 {cannot_overwrite = true;
2425 AUTHORIZE(client, &new_Env, AOP_Excl_Insert,
2426 "rename to existing file (overwrite disallowed)", new_name, einfo);
2427 }
2428
2429// Find out where we should rename this file
2430//
2431 if (Finder && Finder->isRemote())
2432 {if (fwdMV.Cmd)
2433 {if (Forward(retc,einfo,fwdMV,old_name,new_name,&old_Env,&new_Env))
2434 return retc;
2435 }
2436 else if ((retc = Finder->Locate(einfo, old_name, LocOpts, &old_Env)))
2437 return fsError(einfo, retc);
2438 }
2439
2440// Check if we should generate an event
2441//
2442 if (evsObject && evsObject->Enabled(XrdOfsEvs::Mv))
2443 {XrdOfsEvsInfo evInfo(tident, old_name, infoO, &old_Env, 0, 0,
2444 new_name, infoN, &new_Env);
2445 evsObject->Notify(XrdOfsEvs::Mv, evInfo);
2446 }
2447
2448// If we cannot overwrite, we must test for existence first. This will test whether
2449// we will destroy data in the rename (without actually destroying data).
2450// Note there's an obvious race condition here; it was seen as the lesser-of-evils
2451// compared to creating an exclusive file and potentially leaking it in the event
2452// of a crash.
2453//
2454 if (cannot_overwrite)
2456 if (SFS_OK != exists(new_name, exists_flag, einfo, client, infoN))
2457 {// File existence check itself failed; we can't prove that data won't
2458 // be overwritten so we return an error.
2459 return fsError(einfo, -einfo.getErrInfo());
2460 }
2461 if (exists_flag != XrdSfsFileExistNo)
2462 {// EPERM mimics the error code set by Linux when you invoke rename()
2463 // but cannot overwrite the destination file.
2464 einfo.setErrInfo(EPERM, "Overwrite of existing data not permitted");
2465 return fsError(einfo, -EPERM);
2466 }
2467 }
2468
2469// Perform actual rename operation
2470//
2471 if ((retc = XrdOfsOss->Rename(old_name, new_name, &old_Env, &new_Env)))
2472 {return XrdOfsFS->Emsg(epname, einfo, retc, "rename", old_name, "?");
2473 }
2474 XrdOfsHandle::Hide(old_name);
2475 if (Balancer) {Balancer->Removed(old_name);
2476 Balancer->Added(new_name);
2477 }
2478 return SFS_OK;
2479}
@ AOP_Rename
mv() for source
@ AOP_Insert
mv() for target
@ AOP_Excl_Insert
mv() where destination doesn't exist.
XrdSfsFileExistence
static void Hide(const char *thePath)
int rename(const char *oldFileName, const char *newFileName, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *infoO=0, const char *infoN=0)
Definition XrdOfs.cc:2380
virtual int Rename(const char *oPath, const char *nPath, XrdOucEnv *oEnvP=0, XrdOucEnv *nEnvP=0)=0
bool Add(XrdSecAttr &attr)
XrdSecEntityAttr * eaAPI
non-const API to attributes

References XrdSecEntityAttr::Add(), AOP_Excl_Insert, AOP_Insert, AOP_Rename, AUTHORIZE, XrdSecEntity::eaAPI, EPNAME, exists(), Finder, fsError(), fwdMV, XrdOucErrInfo::getErrInfo(), XrdOucErrInfo::getErrUser(), XrdOfsHandle::Hide(), XrdOfsEvs::Mv, rename(), XrdOucErrInfo::setErrInfo(), SFS_O_META, SFS_O_RDWR, SFS_OK, tident, XrdOfsFS, XrdOfsOss, XrdSfsFileExistNo, and XTRACE.

Referenced by rename().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetupCksRT()

int XrdOfs::SetupCksRT ( XrdCksCalc *& cP,
XrdOucEnv & Env,
const char *& cT )

Definition at line 2763 of file XrdOfs.cc.

2764{
2765// Check if the cipher can come from the environment
2766//
2767 if (CksRTCgi && (cT = Env.Get("cks.type")))
2768 {if (!strcmp("default", cT))
2769 {int csLen;
2770 cT = CksRTCalc->Type(csLen);
2771 cP = CksRTCalc->New();
2772 return 0;
2773 }
2774 return (ValidCST(cT) && (cP=Cks->Object(cT)) ? 0 : -ENOTSUP);
2775 }
2776
2777// Set if auto real-time is enabled
2778//
2779 if (CksRTName)
2780 {cP = CksRTCalc->New();
2781 cT = CksRTName;
2782 return 0;
2783 }
2784
2785// All done
2786//
2787 cP = 0;
2788 cT = 0;
2789 return 0;
2790}
virtual XrdCksCalc * New()=0
bool ValidCST(const char *cst)
char * Get(const char *varname)
Definition XrdOucEnv.hh:69

References XrdOucEnv::Get(), XrdCksCalc::New(), and ValidCST().

Here is the call graph for this function:

◆ Split()

const char * XrdOfs::Split ( const char * Args,
const char ** Opq,
char * Path,
int Plen )
protected

Definition at line 2894 of file XrdOfs.cc.

2896{
2897 int xlen;
2898 *Opq = index(Args, '?');
2899 if (!(*Opq)) return Args;
2900 xlen = (*Opq)-Args;
2901 if (xlen >= Plen) xlen = Plen-1;
2902 strncpy(Path, Args, xlen);
2903 Path[xlen] = 0;
2904 return Path;
2905}

References Path.

Referenced by fsctl().

Here is the caller graph for this function:

◆ Stall()

int XrdOfs::Stall ( XrdOucErrInfo & einfo,
int stime,
const char * path )
protected

Definition at line 2911 of file XrdOfs.cc.

2914{
2915 const char *msgfmt = "File %s is being %s; "
2916 "estimated time to completion %s";
2917 EPNAME("Stall")
2918#ifndef NODEBUG
2919 const char *tident = "";
2920#endif
2921 char Mbuff[2048], Tbuff[32];
2922 const char *What = "staged";
2923
2924// Check why the stall is occurring
2925//
2926 if (stime < 0) {stime = 60; What = "created";}
2927
2928// Format the stall message
2929//
2930 snprintf(Mbuff, sizeof(Mbuff)-1, msgfmt,
2931 Fname(path), What, WaitTime(stime, Tbuff, sizeof(Tbuff)));
2932 ZTRACE(delay, "Stall " <<stime <<": " <<Mbuff <<" for " <<path);
2933
2934// Place the error message in the error object and return
2935//
2936 einfo.setErrInfo(0, Mbuff);
2937
2938// All done
2939//
2940 return (stime > MaxDelay ? MaxDelay : stime);
2941}
char * WaitTime(int, char *, int)
Definition XrdOfs.cc:2990

References EPNAME, MaxDelay, XrdOucErrInfo::setErrInfo(), tident, WaitTime(), and ZTRACE.

Here is the call graph for this function:

◆ stat() [1/2]

int XrdOfs::stat ( const char * path,
mode_t & mode,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
virtual

Return mode information on a file or directory.

Parameters
path- Pointer to the path in question.
mode- Where full mode information is to be returned.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED When SFS_OK is returned, mode must contain mode information. If the mode is -1 then it is taken as an offline file.

Implements XrdSfsFileSystem.

Definition at line 2527 of file XrdOfs.cc.

2545{
2546 EPNAME("stat");
2547 struct stat buf;
2548 int retc;
2549 const char *tident = einfo.getErrUser();
2550 XrdOucEnv stat_Env(info,0,client);
2551 XTRACE(stat, path, "");
2552
2553// Apply security, as needed
2554//
2555 AUTHORIZE(client,&stat_Env,AOP_Stat,"locate",path,einfo);
2556 mode = (mode_t)-1;
2557
2558// Find out where we should stat this file
2559//
2560 if (Finder && Finder->isRemote()
2561 && (retc = Finder->Locate(einfo,path,SFS_O_NOWAIT|SFS_O_RDONLY|SFS_O_STAT,
2562 &stat_Env)))
2563 return fsError(einfo, retc);
2564
2565// Now try to find the file or directory
2566//
2567 if (!(retc = XrdOfsOss->Stat(path, &buf, XRDOSS_resonly, &stat_Env)))
2568 mode=buf.st_mode;
2569 else if ((-ENOMSG) != retc)
2570 return XrdOfsFS->Emsg(epname, einfo, retc, "locate", path, "?");
2571 return SFS_OK;
2572}
#define XRDOSS_resonly
Definition XrdOss.hh:548

References AOP_Stat, AUTHORIZE, EPNAME, Finder, fsError(), XrdOucErrInfo::getErrUser(), SFS_O_NOWAIT, SFS_O_RDONLY, SFS_O_STAT, SFS_OK, stat(), tident, XrdOfsFS, XrdOfsOss, XRDOSS_resonly, and XTRACE.

Here is the call graph for this function:

◆ stat() [2/2]

int XrdOfs::stat ( const char * Name,
struct stat * buf,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client,
const char * opaque = 0 )
virtual

Return state information on a file or directory.

Parameters
Name- Pointer to the path in question.
buf- Pointer to the structure where info it to be returned.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED When SFS_OK is returned, buf must contain stat information.

Implements XrdSfsFileSystem.

Definition at line 2485 of file XrdOfs.cc.

2501{
2502 EPNAME("stat");
2503 int retc;
2504 const char *tident = einfo.getErrUser();
2505 XrdOucEnv stat_Env(info,0,client);
2506 XTRACE(stat, path, "");
2507
2508// Apply security, as needed
2509//
2510 AUTHORIZE(client,&stat_Env,AOP_Stat,"locate",path,einfo);
2511
2512// Find out where we should stat this file
2513//
2514 if (Finder && Finder->isRemote()
2515 && (retc = Finder->Locate(einfo, path, SFS_O_RDONLY|SFS_O_STAT, &stat_Env)))
2516 return fsError(einfo, retc);
2517
2518// Now try to find the file or directory
2519//
2520 if ((retc = XrdOfsOss->Stat(path, buf, 0, &stat_Env)))
2521 return XrdOfsFS->Emsg(epname, einfo, retc, "locate", path, "?");
2522 return SFS_OK;
2523}

References AOP_Stat, AUTHORIZE, EPNAME, Finder, fsError(), XrdOucErrInfo::getErrUser(), SFS_O_RDONLY, SFS_O_STAT, SFS_OK, stat(), tident, XrdOfsFS, XrdOfsOss, and XTRACE.

Referenced by chksum(), chmod(), exists(), fsctl(), stat(), and stat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ truncate()

int XrdOfs::truncate ( const char * path,
XrdSfsFileOffset fsize,
XrdOucErrInfo & eInfo,
const XrdSecEntity * client = 0,
const char * opaque = 0 )
virtual

Truncate a file.

Parameters
path- Pointer to the path of the file to be truncated.
fsize- The size that the file is to have.
eInfo- The object where error info is to be returned.
client- Client's identify (see common description).
opaque- path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFileSystem.

Definition at line 2578 of file XrdOfs.cc.

2594{
2595 EPNAME("truncate");
2596 const char *tident = einfo.getErrUser();
2597 XrdOucEnv trunc_Env(info,0,client);
2598 int retc;
2599 XTRACE(truncate, path, "");
2600
2601// Apply security, as needed
2602//
2603 AUTHORIZE(client,&trunc_Env,AOP_Update,"truncate",path,einfo);
2604
2605// Find out where we should chmod this file
2606//
2607 if (Finder && Finder->isRemote())
2608 {if (fwdTRUNC.Cmd)
2609 {char xSz[32];
2610 sprintf(xSz, "%lld", static_cast<long long>(Size));
2611 if (Forward(retc,einfo,fwdTRUNC,path,xSz,&trunc_Env)) return retc;
2612 }
2613 else if ((retc = Finder->Locate(einfo,path,SFS_O_RDWR,&trunc_Env)))
2614 return fsError(einfo, retc);
2615 }
2616
2617// Check if we should generate an event
2618//
2619 if (evsObject && evsObject->Enabled(XrdOfsEvs::Trunc))
2620 {XrdOfsEvsInfo evInfo(tident, path, info, &trunc_Env, 0, Size);
2621 evsObject->Notify(XrdOfsEvs::Trunc, evInfo);
2622 }
2623
2624// Now try to find the file or directory
2625//
2626 if (!(retc = XrdOfsOss->Truncate(path, Size, &trunc_Env))) return SFS_OK;
2627
2628// An error occurred, return the error info
2629//
2630 return XrdOfsFS->Emsg(epname, einfo, retc, "trunc", path, "?");
2631}
int truncate(const char *Name, XrdSfsFileOffset fileOffset, XrdOucErrInfo &out_error, const XrdSecEntity *client=0, const char *opaque=0)
Definition XrdOfs.cc:2578
virtual int Truncate(const char *path, unsigned long long fsize, XrdOucEnv *envP=0)=0

References AOP_Update, AUTHORIZE, EPNAME, Finder, fsError(), fwdTRUNC, XrdOucErrInfo::getErrUser(), SFS_O_RDWR, SFS_OK, tident, XrdOfsEvs::Trunc, truncate(), XrdOfsFS, XrdOfsOss, and XTRACE.

Referenced by truncate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Unpersist()

void XrdOfs::Unpersist ( XrdOfsHandle * hP,
int xcev = 1 )
protected

Definition at line 2947 of file XrdOfs.cc.

2948{
2949 EPNAME("Unpersist");
2950 const char *tident = oh->PoscUsr();
2951 int poscNum, retc;
2952 short theMode;
2953
2954// Trace the call
2955//
2956 FTRACE(close, "use=0");
2957
2958// Generate a proper close event as one has not yet been generated
2959//
2960 if (xcev && XrdOfsFS->evsObject && *tident != '?'
2961 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Closew))
2962 {XrdOfsEvsInfo evInfo(tident, oh->Name());
2963 XrdOfsFS->evsObject->Notify(XrdOfsEvs::Closew, evInfo);
2964 }
2965
2966// Now generate a removal event
2967//
2968 if (XrdOfsFS->Balancer) XrdOfsFS->Balancer->Removed(oh->Name());
2969 if (XrdOfsFS->evsObject && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Rm))
2970 {XrdOfsEvsInfo evInfo(tident, oh->Name());
2971 XrdOfsFS->evsObject->Notify(XrdOfsEvs::Rm, evInfo);
2972 }
2973
2974// Count this
2975//
2977
2978// Now unpersist the file
2979//
2980 OfsEroute.Emsg(epname, "Unpersisting", tident, oh->Name());
2981 if ((poscNum = oh->PoscGet(theMode))) poscQ->Del(oh->Name(), poscNum, 1);
2982 else if ((retc = XrdOfsOss->Unlink(oh->Name())))
2983 OfsEroute.Emsg(epname, retc, "unpersist", oh->Name());
2984}
#define FTRACE(act, x)
#define close(a)
Definition XrdPosix.hh:48
virtual void Removed(const char *path)
void Notify(Event eNum, XrdOfsEvsInfo &Info)
Definition XrdOfsEvs.cc:234
int Enabled(Event theEvents)
Definition XrdOfsEvs.hh:139
void Add(int &Cntr)
virtual int Unlink(const char *path, int Opts=0, XrdOucEnv *envP=0)=0

References close, XrdOfsEvs::Closew, EPNAME, FTRACE, XrdOfsHandle::Name(), OfsEroute, OfsStats, XrdOfsHandle::PoscGet(), XrdOfsHandle::PoscUsr(), XrdOfsEvs::Rm, tident, XrdOfsFS, and XrdOfsOss.

Here is the call graph for this function:

◆ ValidCST()

bool XrdOfs::ValidCST ( const char * cst)
protected

Definition at line 933 of file XrdOfsConfig.cc.

934{
935 std::string csWant(cst);
936
937// Check if checksum type is in the list of valid ones. The list is short.
938//
939 if (csList.size())
940 {for (const auto& name : csList)
941 {if (name == csWant) return true;}
942 }
943 return false;
944}

Referenced by SetupCksRT().

Here is the caller graph for this function:

◆ WaitTime()

char * XrdOfs::WaitTime ( int stime,
char * buff,
int blen )
protected

Definition at line 2990 of file XrdOfs.cc.

2991{
2992 int hr, min, sec;
2993
2994// Compute hours, minutes, and seconds
2995//
2996 min = stime / 60;
2997 sec = stime % 60;
2998 hr = min / 60;
2999 min = min % 60;
3000
3001// Now format the message based on time duration
3002//
3003 if (!hr && !min)
3004 snprintf(buff,blen,"%d second%s",sec,(sec > 1 ? "s" : ""));
3005 else if (!hr)
3006 {if (sec > 10) min++;
3007 snprintf(buff,blen,"%d minute%s",min,(min > 1 ? "s" : ""));
3008 }
3009 else {if (hr == 1)
3010 if (min <= 30)
3011 snprintf(buff,blen,"%d minutes",min+60);
3012 else snprintf(buff,blen,"%d hour and %d minutes",hr,min);
3013 else {if (min > 30) hr++;
3014 snprintf(buff,blen,"%d hours",hr);
3015 }
3016 }
3017
3018// Complete the message
3019//
3020 buff[blen-1] = '\0';
3021 return buff;
3022}

Referenced by Stall().

Here is the caller graph for this function:

◆ WantCksRT()

bool XrdOfs::WantCksRT ( )
inline

Definition at line 365 of file XrdOfs.hh.

365{return (CksRTCgi || CksRTName != 0);}

◆ XrdOfsDirectory

friend class XrdOfsDirectory
friend

Definition at line 245 of file XrdOfs.hh.

References XrdOfsDirectory.

Referenced by newDir(), and XrdOfsDirectory.

◆ XrdOfsFile

friend class XrdOfsFile
friend

Definition at line 246 of file XrdOfs.hh.

References XrdOfsFile.

Referenced by newFile(), and XrdOfsFile.

Member Data Documentation

◆ ConfigFN

char* XrdOfs::ConfigFN

Definition at line 432 of file XrdOfs.hh.

Referenced by XrdOfs(), Config_Display(), and Configure().

◆ dMask

mode_t XrdOfs::dMask[2]

Definition at line 396 of file XrdOfs.hh.

Referenced by XrdOfs(), chmod(), Configure(), and mkdir().

◆ evrObject

XrdOfsEvr XrdOfs::evrObject
protected

Definition at line 440 of file XrdOfs.hh.

Referenced by Configure().

◆ Finder

XrdCmsClient* XrdOfs::Finder
protected

Definition at line 441 of file XrdOfs.hh.

Referenced by XrdOfs(), chksum(), chmod(), Configure(), exists(), FAttr(), fsctl(), mkdir(), rename(), stat(), stat(), and truncate().

◆ fMask

mode_t XrdOfs::fMask[2]

Definition at line 397 of file XrdOfs.hh.

Referenced by XrdOfs(), chmod(), and Configure().

◆ fwdCHMOD

struct fwdOpt XrdOfs::fwdCHMOD

Definition at line 421 of file XrdOfs.hh.

Referenced by chmod(), Config_Display(), and Configure().

◆ fwdMKDIR

struct fwdOpt XrdOfs::fwdMKDIR

Definition at line 422 of file XrdOfs.hh.

Referenced by Config_Display(), Configure(), and mkdir().

◆ fwdMKPATH

struct fwdOpt XrdOfs::fwdMKPATH

Definition at line 423 of file XrdOfs.hh.

Referenced by Configure(), and mkdir().

◆ fwdMV

struct fwdOpt XrdOfs::fwdMV

Definition at line 424 of file XrdOfs.hh.

Referenced by Config_Display(), Configure(), and rename().

◆ fwdRM

struct fwdOpt XrdOfs::fwdRM

Definition at line 425 of file XrdOfs.hh.

Referenced by Config_Display(), and Configure().

◆ fwdRMDIR

struct fwdOpt XrdOfs::fwdRMDIR

Definition at line 426 of file XrdOfs.hh.

Referenced by Config_Display(), and Configure().

◆ fwdTRUNC

struct fwdOpt XrdOfs::fwdTRUNC

Definition at line 427 of file XrdOfs.hh.

Referenced by Config_Display(), Configure(), and truncate().

◆ MaxDelay

int XrdOfs::MaxDelay = 60
static

Definition at line 429 of file XrdOfs.hh.

Referenced by Config_Display(), and Stall().

◆ myIF

XrdNetIF* XrdOfs::myIF

Definition at line 406 of file XrdOfs.hh.

Referenced by Configure(), and fsctl().

◆ myPort

int XrdOfs::myPort

Definition at line 392 of file XrdOfs.hh.

Referenced by XrdOfs().

◆ Options

int XrdOfs::Options

Definition at line 391 of file XrdOfs.hh.

Referenced by Config_Display(), Configure(), and ConfigXeq().

◆ OSSDelay

int XrdOfs::OSSDelay = 30
static

Definition at line 430 of file XrdOfs.hh.

Referenced by EmsgType().

◆ tpcRdrHost

char* XrdOfs::tpcRdrHost[2]

Definition at line 401 of file XrdOfs.hh.

Referenced by XrdOfs().

◆ tpcRdrPort

int XrdOfs::tpcRdrPort[2]

Definition at line 402 of file XrdOfs.hh.

Referenced by XrdOfs().


The documentation for this class was generated from the following files: