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

#include <XrdDigFS.hh>

+ Inheritance diagram for XrdDigFS:
+ Collaboration diagram for XrdDigFS:

Public Member Functions

 XrdDigFS ()
 
virtual ~XrdDigFS ()
 
int chmod (const char *Name, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
int exists (const char *fileName, XrdSfsFileExistence &exists_flag, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
int fsctl (const int cmd, const char *args, XrdOucErrInfo &out_error, const XrdSecClientName *client=0)
 
int getStats (char *buff, int blen)
 
const char * getVersion ()
 
int mkdir (const char *dirName, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
XrdSfsDirectorynewDir (char *user=0, int monid=0)
 
XrdSfsFilenewFile (char *user=0, int monid=0)
 
int prepare (XrdSfsPrep &pargs, XrdOucErrInfo &out_error, const XrdSecClientName *client=0)
 
int rem (const char *path, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
int remdir (const char *dirName, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
int rename (const char *oldFileName, const char *newFileName, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaqueO=0, const char *opaqueN=0)
 
int stat (const char *Name, mode_t &mode, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
int stat (const char *Name, struct stat *buf, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
 
int truncate (const char *Name, XrdSfsFileOffset fileOffset, XrdOucErrInfo &out_error, const XrdSecEntity *client=0, const char *opaque=0)
 
- Public Member Functions inherited from XrdSfsFileSystem
 XrdSfsFileSystem ()
 Constructor and Destructor.
 
virtual ~XrdSfsFileSystem ()
 
virtual int chksum (csFunc Func, const char *csName, const char *path, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)
 
virtual int chmod (const char *path, XrdSfsMode mode, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 
virtual void Connect (const XrdSecEntity *client=0)
 
virtual void Disc (const XrdSecEntity *client=0)
 
virtual void EnvInfo (XrdOucEnv *envP)
 
virtual int exists (const char *path, XrdSfsFileExistence &eFlag, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 
virtual int FAttr (XrdSfsFACtl *faReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
 
uint64_t Features ()
 
virtual int fsctl (const int cmd, const char *args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=0
 
virtual int FSctl (const int cmd, XrdSfsFSctl &args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
 
virtual int getChkPSize ()
 
virtual int gpFile (gpfFunc &gpAct, XrdSfsGPFile &gpReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
 
virtual int mkdir (const char *path, XrdSfsMode mode, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 
virtual XrdSfsDirectorynewDir (XrdOucErrInfo &eInfo)
 
virtual XrdSfsFilenewFile (XrdOucErrInfo &eInfo)
 
virtual int prepare (XrdSfsPrep &pargs, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=0
 
virtual int rem (const char *path, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 
virtual int remdir (const char *path, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 
virtual int rename (const char *oPath, const char *nPath, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaqueO=0, const char *opaqueN=0)=0
 
virtual int stat (const char *Name, struct stat *buf, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 
virtual int stat (const char *path, mode_t &mode, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)=0
 

Static Public Member Functions

static int Emsg (const char *, XrdOucErrInfo &, int, const char *x, const char *y="")
 
static int Validate (const char *)
 

Additional Inherited Members

- Public Types inherited from XrdSfsFileSystem
enum  csFunc {
  csCalc = 0 ,
  csGet ,
  csSize
}
 
enum  gpfFunc {
  gpfCancel =0 ,
  gpfGet ,
  gpfPut
}
 
- Protected Attributes inherited from XrdSfsFileSystem
uint64_t FeatureSet
 Adjust features at initialization.
 

Detailed Description

Definition at line 163 of file XrdDigFS.hh.

Constructor & Destructor Documentation

◆ XrdDigFS()

XrdDigFS::XrdDigFS ( )
inline

Definition at line 261 of file XrdDigFS.hh.

261{}

◆ ~XrdDigFS()

virtual XrdDigFS::~XrdDigFS ( )
inlinevirtual

Definition at line 262 of file XrdDigFS.hh.

262{}

Member Function Documentation

◆ chmod()

int XrdDigFS::chmod ( const char * Name,
XrdSfsMode Mode,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )
inline

Definition at line 177 of file XrdDigFS.hh.

182 {return Reject("chmod", Name, out_error);}

◆ Emsg()

int XrdDigFS::Emsg ( const char * pfx,
XrdOucErrInfo & einfo,
int ecode,
const char * x,
const char * y = "" )
static

Definition at line 605 of file XrdDigFS.cc.

610{
611 const char *etext;
612 char buffer[MAXPATHLEN+80];
613
614// Get the reason for the error
615//
616 if (ecode < 0) ecode = -ecode;
617 etext = XrdSysE2T(ecode);
618
619// Format the error message
620//
621 snprintf(buffer,sizeof(buffer),"Unable to %s %s; %s", op, target, etext);
622
623// Print it out if debugging is enabled
624//
625#ifndef NODEBUG
626 eDest->Emsg(pfx, buffer);
627#endif
628
629// Place the error message in the error object and return
630//
631 einfo.setErrInfo(ecode, buffer);
632
633 return SFS_ERROR;
634}
static XrdSysError eDest(0,"crypto_")
#define SFS_ERROR
const char * XrdSysE2T(int errcode)
Definition XrdSysE2T.cc:99
int setErrInfo(int code, const char *emsg)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)

References eDest, XrdSysError::Emsg(), XrdOucErrInfo::setErrInfo(), SFS_ERROR, and XrdSysE2T().

Referenced by XrdDigDirectory::close(), XrdDigFile::close(), exists(), XrdDigDirectory::nextEntry(), XrdDigDirectory::open(), XrdDigFile::open(), XrdDigFile::read(), XrdDigFile::readv(), stat(), and XrdDigFile::stat().

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

◆ exists()

int XrdDigFS::exists ( const char * fileName,
XrdSfsFileExistence & exists_flag,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )

Definition at line 640 of file XrdDigFS.cc.

662{
663 static const char *epname = "exists";
664 struct stat fstat;
665
666// Now try to find the file or directory
667//
668 if (!XrdDigUFS::Statfn(path, &fstat))
669 { if (S_ISDIR(fstat.st_mode)) file_exists=XrdSfsFileExistIsDirectory;
670 else if (S_ISREG(fstat.st_mode)) file_exists=XrdSfsFileExistIsFile;
671 else file_exists=XrdSfsFileExistNo;
672 return SFS_OK;
673 }
674 if (errno == ENOENT)
675 {file_exists=XrdSfsFileExistNo;
676 return SFS_OK;
677 }
678
679// An error occurred, return the error info
680//
681 return XrdDigFS::Emsg(epname, error, errno, "locate", path);
682}
#define fstat(a, b)
Definition XrdPosix.hh:57
#define stat(a, b)
Definition XrdPosix.hh:96
@ XrdSfsFileExistIsFile
@ XrdSfsFileExistNo
@ XrdSfsFileExistIsDirectory
#define SFS_OK
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, const char *y="")
Definition XrdDigFS.cc:605
static int Statfn(const char *fn, struct stat *buf)
Definition XrdDigFS.cc:96

References Emsg(), XrdSfsDirectory::error, fstat, SFS_OK, stat, XrdDigUFS::Statfn(), XrdSfsFileExistIsDirectory, XrdSfsFileExistIsFile, and XrdSfsFileExistNo.

+ Here is the call graph for this function:

◆ fsctl()

int XrdDigFS::fsctl ( const int cmd,
const char * args,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0 )

Definition at line 688 of file XrdDigFS.cc.

704{
705
706// Process the LOCATE request. We only support "*/path" type of requests and
707// if valid, we return ourselves as the location. Security is not applied here.
708//
709 if ((cmd & SFS_FSCTL_CMD) == SFS_FSCTL_LOCATE)
710 {if ((*args == '*' && !(SFS_LCLROOT(args+1)))
711 || (*args == '/' && !(SFS_LCLROOT(args ))))
712 {eInfo.setErrInfo(EINVAL, "Invalid locate path");
713 return SFS_ERROR;
714 }
715
716 Config.GetLocResp(eInfo, (cmd & SFS_O_HNAME));
717 return SFS_DATA;
718 }
719
720// We don't support anything else
721//
722 eInfo.setErrInfo(ENOTSUP, "Operation not supported.");
723 return SFS_ERROR;
724}
#define SFS_O_HNAME
#define SFS_DATA
#define SFS_LCLROOT(x)
#define SFS_FSCTL_CMD
#define SFS_FSCTL_LOCATE
void GetLocResp(XrdOucErrInfo &eInfo, bool nameok)
XrdDigConfig Config

References XrdDig::Config, XrdDigConfig::GetLocResp(), XrdOucErrInfo::setErrInfo(), SFS_DATA, SFS_ERROR, SFS_FSCTL_CMD, SFS_FSCTL_LOCATE, SFS_LCLROOT, and SFS_O_HNAME.

+ Here is the call graph for this function:

◆ getStats()

int XrdDigFS::getStats ( char * buff,
int blen )
inlinevirtual

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 195 of file XrdDigFS.hh.

195{return 0;}

◆ getVersion()

const char * XrdDigFS::getVersion ( )
virtual

Get version string.

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

Implements XrdSfsFileSystem.

Definition at line 730 of file XrdDigFS.cc.

730{return XrdVERSION;}

◆ mkdir()

int XrdDigFS::mkdir ( const char * dirName,
XrdSfsMode Mode,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )
inline

Definition at line 199 of file XrdDigFS.hh.

204 {return Reject("mkdir", dirName, out_error);}

◆ newDir()

XrdSfsDirectory * XrdDigFS::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 169 of file XrdDigFS.hh.

◆ newFile()

XrdSfsFile * XrdDigFS::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 172 of file XrdDigFS.hh.

173 {return (XrdSfsFile *)new XrdDigFile(user,monid);}

◆ prepare()

int XrdDigFS::prepare ( XrdSfsPrep & pargs,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0 )
inline

Definition at line 206 of file XrdDigFS.hh.

208 {return 0;}

◆ rem()

int XrdDigFS::rem ( const char * path,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )
inline

Definition at line 210 of file XrdDigFS.hh.

214 {return Reject("rm", path, out_error);}

◆ remdir()

int XrdDigFS::remdir ( const char * dirName,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )
inline

Definition at line 216 of file XrdDigFS.hh.

220 {return Reject("rmdir", dirName, out_error);}

◆ rename()

int XrdDigFS::rename ( const char * oldFileName,
const char * newFileName,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaqueO = 0,
const char * opaqueN = 0 )
inline

Definition at line 222 of file XrdDigFS.hh.

228 {return Reject("rename", oldFileName, out_error);}

◆ stat() [1/2]

int XrdDigFS::stat ( const char * Name,
mode_t & mode,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )
inline

Definition at line 236 of file XrdDigFS.hh.

241 {struct stat bfr;
242 int rc = stat(Name, &bfr, out_error, client);
243 if (!rc) mode = bfr.st_mode;
244 return rc;
245 }

References stat.

◆ stat() [2/2]

int XrdDigFS::stat ( const char * Name,
struct stat * buf,
XrdOucErrInfo & out_error,
const XrdSecClientName * client = 0,
const char * opaque = 0 )

Definition at line 745 of file XrdDigFS.cc.

761{
762 static const char *epname = "stat";
763 static const int wMask = ~(S_IWUSR | S_IWGRP | S_IWOTH);
764 char *fname;
765 int retc;
766
767// Check if we are trying to stat the root
768//
769 if (!strcmp(path, SFS_LCLPRFX) || !strcmp(path, SFS_LCLPRFY))
770 {const char *auth;
771 if (Config.GenAccess(client, &auth, 1) < 0)
772 return XrdDigFS::Emsg(epname,error,EACCES,"stat directory",path);
774 return SFS_OK;
775 }
776
777// Authorize and get the correct fname to stat
778//
779 if ((retc = Validate(path))
780 || !(fname = Config.GenPath(retc, client, "stat", path+SFS_LCLPLEN)))
781 return XrdDigFS::Emsg(epname,error,retc,"stat",path);
782
783// Fixup filename when stat is issued into /proc (linux only)
784//
785#ifdef __linux__
786 char *myLink;
787 if ((myLink = strstr(fname, " -> "))) *myLink = 0;
788#endif
789
790// Execute the function
791//
792 if (XrdDigUFS::Statfn(fname, buf))
793 {retc = errno;
794 free(fname);
795 return XrdDigFS::Emsg(epname, error, retc, "stat", path);
796 }
797
798// Turn off write bits in the mode
799//
800 buf->st_mode &= wMask;
801
802// All went well
803//
804 free(fname);
805 return SFS_OK;
806}
#define SFS_LCLPRFY
#define SFS_LCLPRFX
#define SFS_LCLPLEN
int GenAccess(const XrdSecEntity *client, const char *aList[], int aMax)
char * GenPath(int &rc, const XrdSecEntity *client, const char *opname, const char *lfn, pType lfnType=isAny)
static void StatRoot(struct stat *sP)
static int Validate(const char *)
Definition XrdDigFS.cc:812

References XrdDig::Config, Emsg(), XrdSfsDirectory::error, XrdDigConfig::GenAccess(), XrdDigConfig::GenPath(), SFS_LCLPLEN, SFS_LCLPRFX, SFS_LCLPRFY, SFS_OK, XrdDigUFS::Statfn(), and XrdDigConfig::StatRoot().

+ Here is the call graph for this function:

◆ truncate()

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

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 247 of file XrdDigFS.hh.

252 {return Reject("truncate", Name, out_error);}

◆ Validate()

int XrdDigFS::Validate ( const char * path)
static

Definition at line 812 of file XrdDigFS.cc.

813{
814// Make sure this is our path and is legal
815//
816 return (SFS_LCLPATH(path) && *(path+SFS_LCLPLEN) ? 0 : EPERM);
817}
#define SFS_LCLPATH(x)

References SFS_LCLPATH, and SFS_LCLPLEN.

Referenced by XrdDigDirectory::open(), and XrdDigFile::open().

+ Here is the caller graph for this function:

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