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

#include <XrdSfsNative.hh>

+ Inheritance diagram for XrdSfsNative:
+ Collaboration diagram for XrdSfsNative:

Public Member Functions

 XrdSfsNative (XrdSysError *lp)
 
virtual ~XrdSfsNative ()
 
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 getStats (char *buff, int blen)=0
 
virtual const char * getVersion ()=0
 
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 (char *user=0, int MonID=0)=0
 
virtual XrdSfsDirectorynewDir (XrdOucErrInfo &eInfo)
 
virtual XrdSfsFilenewFile (char *user=0, int MonID=0)=0
 
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
 
virtual int truncate (const char *path, XrdSfsFileOffset fsize, 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 Mkpath (const char *path, mode_t mode, const char *info=0)
 

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 152 of file XrdSfsNative.hh.

Constructor & Destructor Documentation

◆ XrdSfsNative()

XrdSfsNative::XrdSfsNative ( XrdSysError lp)

Definition at line 103 of file XrdSfsNative.cc.

104{
105 eDest = ep;
106}

◆ ~XrdSfsNative()

virtual XrdSfsNative::~XrdSfsNative ( )
inlinevirtual

Definition at line 246 of file XrdSfsNative.hh.

246{}

Member Function Documentation

◆ chmod()

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

Definition at line 658 of file XrdSfsNative.cc.

673{
674 static const char *epname = "chmod";
675 mode_t acc_mode = Mode & S_IAMB;
676
677// Perform the actual deletion
678//
679 if (XrdSfsUFS::Chmod(path, acc_mode) )
680 return XrdSfsNative::Emsg(epname,error,errno,"change mode on",path);
681
682// All done
683//
684 return SFS_OK;
685}
#define S_IAMB
Definition XrdConfig.cc:159
int Mode
#define SFS_OK
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, const char *y="")
static int Chmod(const char *fn, mode_t mode)

References XrdSfsUFS::Chmod(), Emsg(), Mode, S_IAMB, and SFS_OK.

+ Here is the call graph for this function:

◆ Emsg()

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

Definition at line 1022 of file XrdSfsNative.cc.

1027{
1028 const char *etext;
1029 char buffer[MAXPATHLEN+80];
1030
1031// Get the reason for the error
1032//
1033 if (ecode < 0) ecode = -ecode;
1034 etext = XrdSysE2T(ecode);
1035
1036// Format the error message
1037//
1038 snprintf(buffer,sizeof(buffer),"Unable to %s %s; %s", op, target, etext);
1039
1040// Print it out if debugging is enabled
1041//
1042#ifndef NODEBUG
1043 eDest->Emsg(pfx, buffer);
1044#endif
1045
1046// Place the error message in the error object and return
1047//
1048 einfo.setErrInfo(ecode, buffer);
1049
1050 return SFS_ERROR;
1051}
#define SFS_ERROR
const char * XrdSysE2T(int errcode)
Definition XrdSysE2T.cc:104
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 chmod(), XrdSfsNativeDirectory::close(), XrdSfsNativeFile::close(), exists(), mkdir(), XrdSfsNativeDirectory::nextEntry(), XrdSfsNativeDirectory::open(), XrdSfsNativeFile::open(), XrdSfsNativeFile::read(), XrdSfsNativeFile::readv(), rem(), remdir(), rename(), stat(), XrdSfsNativeFile::stat(), XrdSfsNativeFile::sync(), truncate(), XrdSfsNativeFile::truncate(), and XrdSfsNativeFile::write().

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

◆ exists()

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

Definition at line 691 of file XrdSfsNative.cc.

713{
714 static const char *epname = "exists";
715 struct stat fstat;
716
717// Now try to find the file or directory
718//
719 if (!XrdSfsUFS::Statfn(path, &fstat) )
720 { if (S_ISDIR(fstat.st_mode)) file_exists=XrdSfsFileExistIsDirectory;
721 else if (S_ISREG(fstat.st_mode)) file_exists=XrdSfsFileExistIsFile;
722 else file_exists=XrdSfsFileExistNo;
723 return SFS_OK;
724 }
725 if (errno == ENOENT)
726 {file_exists=XrdSfsFileExistNo;
727 return SFS_OK;
728 }
729
730// An error occurred, return the error info
731//
732 return XrdSfsNative::Emsg(epname, error, errno, "locate", path);
733}
#define fstat(a, b)
Definition XrdPosix.hh:57
#define stat(a, b)
Definition XrdPosix.hh:96
@ XrdSfsFileExistIsFile
@ XrdSfsFileExistNo
@ XrdSfsFileExistIsDirectory
static int Statfn(const char *fn, struct stat *buf)

References Emsg(), fstat, SFS_OK, stat, XrdSfsUFS::Statfn(), XrdSfsFileExistIsDirectory, XrdSfsFileExistIsFile, and XrdSfsFileExistNo.

+ Here is the call graph for this function:

◆ fsctl()

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

Definition at line 739 of file XrdSfsNative.cc.

743{
744 out_error.setErrInfo(ENOTSUP, "Operation not supported.");
745 return SFS_ERROR;
746}

References XrdOucErrInfo::setErrInfo(), and SFS_ERROR.

+ Here is the call graph for this function:

◆ getStats()

int XrdSfsNative::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 183 of file XrdSfsNative.hh.

183{return 0;}

◆ getVersion()

const char * XrdSfsNative::getVersion ( )
virtual

Get version string.

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

Implements XrdSfsFileSystem.

Definition at line 752 of file XrdSfsNative.cc.

752{return XrdVERSION;}

◆ mkdir()

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

Definition at line 758 of file XrdSfsNative.cc.

775{
776 static const char *epname = "mkdir";
777 mode_t acc_mode = Mode & S_IAMB;
778
779// Create the path if it does not already exist
780//
781 if (Mode & SFS_O_MKPTH) Mkpath(path, acc_mode, info);
782
783// Perform the actual deletion
784//
785 if (XrdSfsUFS::Mkdir(path, acc_mode) )
786 return XrdSfsNative::Emsg(epname,error,errno,"create directory",path);
787
788// All done
789//
790 return SFS_OK;
791}
#define SFS_O_MKPTH
static int Mkpath(const char *path, mode_t mode, const char *info=0)
static int Mkdir(const char *fn, mode_t mode)

References Emsg(), XrdSfsUFS::Mkdir(), Mkpath(), Mode, S_IAMB, SFS_O_MKPTH, and SFS_OK.

+ Here is the call graph for this function:

◆ Mkpath()

int XrdSfsNative::Mkpath ( const char *  path,
mode_t  mode,
const char *  info = 0 
)
static

Definition at line 806 of file XrdSfsNative.cc.

807{
808 char actual_path[MAXPATHLEN], *local_path, *next_path;
809 unsigned int plen;
810 struct stat buf;
811
812// Extract out the path we should make
813//
814 if (!(plen = strlen(path))) return -ENOENT;
815 if (plen >= sizeof(actual_path)) return -ENAMETOOLONG;
816 strcpy(actual_path, path);
817 if (actual_path[plen-1] == '/') actual_path[plen-1] = '\0';
818
819// Typically, the path exist. So, do a quick check before launching into it
820//
821 if (!(local_path = rindex(actual_path, (int)'/'))
822 || local_path == actual_path) return 0;
823 *local_path = '\0';
824 if (!XrdSfsUFS::Statfn(actual_path, &buf)) return 0;
825 *local_path = '/';
826
827// Start creating directories starting with the root. Notice that we will not
828// do anything with the last component. The caller is responsible for that.
829//
830 local_path = actual_path+1;
831 while((next_path = index(local_path, int('/'))))
832 {*next_path = '\0';
833 if (XrdSfsUFS::Mkdir(actual_path,mode) && errno != EEXIST)
834 return -errno;
835 *next_path = '/';
836 local_path = next_path+1;
837 }
838
839// All done
840//
841 return 0;
842}

References XrdSfsUFS::Mkdir(), stat, and XrdSfsUFS::Statfn().

Referenced by mkdir(), and XrdSfsNativeFile::open().

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

◆ newDir()

XrdSfsDirectory * XrdSfsNative::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 158 of file XrdSfsNative.hh.

◆ newFile()

XrdSfsFile * XrdSfsNative::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 161 of file XrdSfsNative.hh.

◆ prepare()

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

Definition at line 193 of file XrdSfsNative.hh.

195 {return 0;}

◆ rem()

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

Definition at line 848 of file XrdSfsNative.cc.

862{
863 static const char *epname = "rem";
864
865// Perform the actual deletion
866//
867 if (XrdSfsUFS::Rem(path) )
868 return XrdSfsNative::Emsg(epname, error, errno, "remove", path);
869
870// All done
871//
872 return SFS_OK;
873}
static int Rem(const char *fn)

References Emsg(), XrdSfsUFS::Rem(), and SFS_OK.

+ Here is the call graph for this function:

◆ remdir()

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

Definition at line 879 of file XrdSfsNative.cc.

893{
894 static const char *epname = "remdir";
895
896// Perform the actual deletion
897//
898 if (XrdSfsUFS::Remdir(path) )
899 return XrdSfsNative::Emsg(epname, error, errno, "remove", path);
900
901// All done
902//
903 return SFS_OK;
904}
static int Remdir(const char *fn)

References Emsg(), XrdSfsUFS::Remdir(), and SFS_OK.

+ Here is the call graph for this function:

◆ rename()

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

Definition at line 910 of file XrdSfsNative.cc.

928{
929 static const char *epname = "rename";
930
931// Perform actual rename operation
932//
933 if (XrdSfsUFS::Rename(old_name, new_name) )
934 return XrdSfsNative::Emsg(epname, error, errno, "rename", old_name);
935
936// All done
937//
938 return SFS_OK;
939}
static int Rename(const char *ofn, const char *nfn)

References Emsg(), XrdSfsUFS::Rename(), and SFS_OK.

+ Here is the call graph for this function:

◆ stat() [1/2]

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

Definition at line 220 of file XrdSfsNative.hh.

225 {struct stat bfr;
226 int rc = stat(Name, &bfr, out_error, client);
227 if (!rc) mode = bfr.st_mode;
228 return rc;
229 }

References stat.

◆ stat() [2/2]

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

Definition at line 945 of file XrdSfsNative.cc.

961{
962 static const char *epname = "stat";
963
964// Execute the function
965//
966 if (XrdSfsUFS::Statfn(path, buf) )
967 return XrdSfsNative::Emsg(epname, error, errno, "state", path);
968
969// All went well
970//
971 return SFS_OK;
972}

References Emsg(), SFS_OK, and XrdSfsUFS::Statfn().

+ Here is the call graph for this function:

◆ truncate()

int XrdSfsNative::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 978 of file XrdSfsNative.cc.

1000{
1001 static const char *epname = "trunc";
1002
1003// Make sure the offset is not too larg
1004//
1005 if (sizeof(off_t) < sizeof(flen) && flen > 0x000000007fffffff)
1006 return XrdSfsNative::Emsg(epname, error, EFBIG, "truncate", path);
1007
1008// Perform the function
1009//
1010 if (XrdSfsUFS::Truncate(path, flen) )
1011 return XrdSfsNative::Emsg(epname, error, errno, "truncate", path);
1012
1013// All done
1014//
1015 return SFS_OK;
1016}
static int Truncate(const char *fn, off_t flen)

References Emsg(), SFS_OK, and XrdSfsUFS::Truncate().

+ Here is the call graph for this function:

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