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)
XrdSfsDirectory * | newDir (char *user=0, int monid=0)
XrdSfsFile * | newFile (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, XrdSfsFSctl &args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
virtual int | fsctl (const int cmd, const char *args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=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 XrdSfsDirectory * | newDir (XrdOucErrInfo &eInfo)
virtual XrdSfsFile * | newFile (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 | 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.

{
eDest = ep;
}

## ~XrdSfsNative()

virtual XrdSfsNative::~XrdSfsNative | ( |  | ) |

inline virtual

Definition at line 246 of file XrdSfsNative.hh.

{}

## 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.

{
static const char *epname = "chmod";
mode_t acc_mode = Mode & S_IAMB;
// Perform the actual deletion
//
if (XrdSfsUFS::Chmod(path, acc_mode) )
return XrdSfsNative::Emsg(epname,error,errno,"change mode on",path);
// All done
//
return SFS_OK;
}
S_IAMB
#define S_IAMB
Definition XrdConfig.cc:163
Mode
int Mode
Definition XrdSecgsiProxy.cc:94
SFS_OK
#define SFS_OK
Definition XrdSfsInterface.hh:108
XrdSfsNative::Emsg
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, const char *y="")
Definition XrdSfsNative.cc:1022
XrdSfsUFS::Chmod
static int Chmod(const char *fn, mode_t mode)
Definition XrdSfsNative.cc:77

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

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.

{
const char *etext;
char buffer[MAXPATHLEN+80];
// Get the reason for the error
//
if (ecode < 0) ecode = -ecode;
etext = XrdSysE2T(ecode);
// Format the error message
//
snprintf(buffer,sizeof(buffer),"Unable to %s %s; %s", op, target, etext);
// Print it out if debugging is enabled
//
#ifndef NODEBUG
eDest->Emsg(pfx, buffer);
#endif
// Place the error message in the error object and return
//
einfo.setErrInfo(ecode, buffer);
return SFS_ERROR;
}
SFS_ERROR
#define SFS_ERROR
Definition XrdSfsInterface.hh:109
XrdSysE2T
const char * XrdSysE2T(int errcode)
Definition XrdSysE2T.cc:104
XrdOucErrInfo::setErrInfo
int setErrInfo(int code, const char *emsg)
Definition XrdOucErrInfo.hh:147

References 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.

{
static const char *epname = "exists";
struct stat fstat;
// Now try to find the file or directory
//
if (!XrdSfsUFS::Statfn(path, &fstat) )
{ if (S_ISDIR(fstat.st_mode)) file_exists=XrdSfsFileExistIsDirectory;
else if (S_ISREG(fstat.st_mode)) file_exists=XrdSfsFileExistIsFile;
else file_exists=XrdSfsFileExistNo;
return SFS_OK;
}
if (errno == ENOENT)
{file_exists=XrdSfsFileExistNo;
return SFS_OK;
}
// An error occurred, return the error info
//
return XrdSfsNative::Emsg(epname, error, errno, "locate", path);
}
fstat
#define fstat(a, b)
Definition XrdPosix.hh:62
XrdSfsFileExistIsFile
@ XrdSfsFileExistIsFile
Definition XrdSfsInterface.hh:136
XrdSfsFileExistNo
@ XrdSfsFileExistNo
Definition XrdSfsInterface.hh:135
XrdSfsFileExistIsDirectory
@ XrdSfsFileExistIsDirectory
Definition XrdSfsInterface.hh:137
XrdSfsNative::stat
int stat(const char *Name, struct stat *buf, XrdOucErrInfo &out_error, const XrdSecClientName *client=0, const char *opaque=0)
Definition XrdSfsNative.cc:945
XrdSfsUFS::Statfn
static int Statfn(const char *fn, struct stat *buf)
Definition XrdSfsNative.cc:94

References Emsg(), fstat, SFS_OK, stat(), XrdSfsUFS::Statfn(), XrdSecClientName, 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.

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

References XrdOucErrInfo::setErrInfo(), SFS_ERROR, and XrdSecClientName.

Here is the call graph for this function:

## getStats()

int XrdSfsNative::getStats | ( | char * | buff,
|  | int | blen )

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

{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.

{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.

{
static const char *epname = "mkdir";
mode_t acc_mode = Mode & S_IAMB;
// Create the path if it does not already exist
//
if (Mode & SFS_O_MKPTH) Mkpath(path, acc_mode, info);
// Perform the actual deletion
//
if (XrdSfsUFS::Mkdir(path, acc_mode) )
return XrdSfsNative::Emsg(epname,error,errno,"create directory",path);
// All done
//
return SFS_OK;
}
SFS_O_MKPTH
#define SFS_O_MKPTH
Definition XrdSfsInterface.hh:71
XrdSfsNative::Mkpath
static int Mkpath(const char *path, mode_t mode, const char *info=0)
Definition XrdSfsNative.cc:806
XrdSfsUFS::Mkdir
static int Mkdir(const char *fn, mode_t mode)
Definition XrdSfsNative.cc:81

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

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.

{
char actual_path[MAXPATHLEN], *local_path, *next_path;
unsigned int plen;
struct stat buf;
// Extract out the path we should make
//
if (!(plen = strlen(path))) return -ENOENT;
if (plen >= sizeof(actual_path)) return -ENAMETOOLONG;
strcpy(actual_path, path);
if (actual_path[plen-1] == '/') actual_path[plen-1] = '\0';
// Typically, the path exist. So, do a quick check before launching into it
//
if (!(local_path = rindex(actual_path, (int)'/'))
|| local_path == actual_path) return 0;
*local_path = '\0';
if (!XrdSfsUFS::Statfn(actual_path, &buf)) return 0;
*local_path = '/';
// Start creating directories starting with the root. Notice that we will not
// do anything with the last component. The caller is responsible for that.
//
local_path = actual_path+1;
while((next_path = index(local_path, int('/'))))
{*next_path = '\0';
if (XrdSfsUFS::Mkdir(actual_path,mode) && errno != EEXIST)
return -errno;
*next_path = '/';
local_path = next_path+1;
}
// All done
//
return 0;
}

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 )

inline virtual

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.

{return (XrdSfsDirectory *)new XrdSfsNativeDirectory(user,monid);}

## newFile()

XrdSfsFile * XrdSfsNative::newFile | ( | char * | user = 0,
|  | int | MonID = 0 )

inline virtual

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.

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

## prepare()

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

inline

Definition at line 193 of file XrdSfsNative.hh.

{return 0;}

References XrdSecClientName.

## 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.

{
static const char *epname = "rem";
// Perform the actual deletion
//
if (XrdSfsUFS::Rem(path) )
return XrdSfsNative::Emsg(epname, error, errno, "remove", path);
// All done
//
return SFS_OK;
}
XrdSfsUFS::Rem
static int Rem(const char *fn)
Definition XrdSfsNative.cc:86

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

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.

{
static const char *epname = "remdir";
// Perform the actual deletion
//
if (XrdSfsUFS::Remdir(path) )
return XrdSfsNative::Emsg(epname, error, errno, "remove", path);
// All done
//
return SFS_OK;
}
XrdSfsUFS::Remdir
static int Remdir(const char *fn)
Definition XrdSfsNative.cc:88

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

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.

{
static const char *epname = "rename";
// Perform actual rename operation
//
if (XrdSfsUFS::Rename(old_name, new_name) )
return XrdSfsNative::Emsg(epname, error, errno, "rename", old_name);
// All done
//
return SFS_OK;
}
XrdSfsUFS::Rename
static int Rename(const char *ofn, const char *nfn)
Definition XrdSfsNative.cc:90

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

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.

{struct stat bfr;
int rc = stat(Name, &bfr, out_error, client);
if (!rc) mode = bfr.st_mode;
return rc;
}
stat
#define stat(a, b)
Definition XrdPosix.hh:101

References stat, stat(), and XrdSecClientName.

Here is the call graph for this function:

## 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.

{
static const char *epname = "stat";
// Execute the function
//
if (XrdSfsUFS::Statfn(path, buf) )
return XrdSfsNative::Emsg(epname, error, errno, "state", path);
// All went well
//
return SFS_OK;
}

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

Referenced by exists(), Mkpath(), stat(), and stat().

Here is the call graph for this function:
Here is the caller 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.

{
static const char *epname = "trunc";
// Make sure the offset is not too larg
//
if (sizeof(off_t) < sizeof(flen) && flen > 0x000000007fffffff)
return XrdSfsNative::Emsg(epname, error, EFBIG, "truncate", path);
// Perform the function
//
if (XrdSfsUFS::Truncate(path, flen) )
return XrdSfsNative::Emsg(epname, error, errno, "truncate", path);
// All done
//
return SFS_OK;
}
XrdSfsUFS::Truncate
static int Truncate(const char *fn, off_t flen)
Definition XrdSfsNative.cc:96

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

Here is the call graph for this function:

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

- XrdSfsNative.hh
- XrdSfsNative.cc