Loading...
Searching...
No Matches
XrdPosixXrootd Class Reference

POSIX interface to XRootD with some extensions, as noted. More...

`#include <XrdPosixXrootd.hh>`

Collaboration diagram for XrdPosixXrootd:

## Public Member Functions

| XrdPosixXrootd (int maxfd=255, int maxdir=0, int maxthr=0)
| ~XrdPosixXrootd ()
int | fdOrigin ()

## Static Public Member Functions

static int | Access (const char *path, int amode)
| Access() conforms to POSIX.1-2001 access().
static int | Close (int fildes)
| Close() conforms to POSIX.1-2001 close().
static int | Closedir (DIR *dirp)
| Closedir() conforms to POSIX.1-2001 closedir().
static int | endPoint (int FD, char *Buff, int Blen)
static int | Fstat (int fildes, struct stat *buf)
| Fstat() conforms to POSIX.1-2001 fstat().
static int | Fsync (int fildes)
| Fsync() conforms to POSIX.1-2001 fsync().
static void | Fsync (int fildes, XrdPosixCallBackIO *cbp)
static int | Ftruncate (int fildes, off_t offset)
| Ftruncate() conforms to POSIX.1-2001 ftruncate().
static long long | Getxattr (const char *path, const char *name, void *value, unsigned long long size)
static bool | isXrootdDir (DIR *dirp)
static off_t | Lseek (int fildes, off_t offset, int whence)
| Lseek() conforms to POSIX.1-2001 lseek().
static int | Mkdir (const char *path, mode_t mode)
| Mkdir() conforms to POSIX.1-2001 mkdir().
static bool | myFD (int fd)
static int | Open (const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)
static DIR * | Opendir (const char *path)
| Opendir() conforms to POSIX.1-2001 opendir().
static ssize_t | Pread (int fildes, void *buf, size_t nbyte, off_t offset)
| Pread() conforms to POSIX.1-2001 pread().
static void | Pread (int fildes, void *buf, size_t nbyte, off_t offset, XrdPosixCallBackIO *cbp)
static ssize_t | Pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
| Pwrite() conforms to POSIX.1-2001 pwrite().
static void | Pwrite (int fildes, const void *buf, size_t nbyte, off_t offset, XrdPosixCallBackIO *cbp)
static int | QueryChksum (const char *path, time_t &mtime, char *buff, int blen)
static int | QueryError (std::string &emsg, DIR *dirP, bool reset=true)
static int | QueryError (std::string &emsg, int fd=-1, bool reset=true)
static long long | QueryOpaque (const char *path, char *buff, int blen)
static ssize_t | Read (int fildes, void *buf, size_t nbyte)
| Read() conforms to POSIX.1-2001 read().
static struct dirent * | Readdir (DIR *dirp)
static struct dirent64 * | Readdir64 (DIR *dirp)
static int | Readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
static int | Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
static ssize_t | Readv (int fildes, const struct iovec *iov, int iovcnt)
| Readv() conforms to POSIX.1-2001 readv().
static int | Rename (const char *oldpath, const char *newpath)
| Rename() conforms to POSIX.1-2001 rename().
static void | Rewinddir (DIR *dirp)
| Rewinddir() conforms to POSIX.1-2001 rewinddir().
static int | Rmdir (const char *path)
| Rmdir() conforms to POSIX.1-2001 rmdir().
static void | Seekdir (DIR *dirp, long loc)
| Seekdir() conforms to POSIX.1-2001 seekdir().
static int | Stat (const char *path, struct stat *buf)
| Stat() conforms to POSIX.1-2001 stat().
static int | Statfs (const char *path, struct statfs *buf)
static int | StatRet (DIR *dirp, struct stat *buf)
static int | Statvfs (const char *path, struct statvfs *buf)
| Statvfs() conforms to POSIX.1-2001 statvfs().
static long | Telldir (DIR *dirp)
| Telldir() conforms to POSIX.1-2001 telldir().
static int | Truncate (const char *path, off_t offset)
| Telldir() conforms to POSIX.1-2001 telldir().
static int | Unlink (const char *path)
| Unlink() conforms to POSIX.1-2001 unlink().
static ssize_t | VRead (int fildes, const XrdOucIOVec *readV, int n)
static void | VRead (int fildes, const XrdOucIOVec *readV, int n, XrdPosixCallBackIO *cbp)
static ssize_t | Write (int fildes, const void *buf, size_t nbyte)
| Write() conforms to POSIX.1-2001 write().
static ssize_t | Writev (int fildes, const struct iovec *iov, int iovcnt)
| Writev() conforms to POSIX.1-2001 writev().

## Static Public Attributes

static const int | isStream = 0x40000000

## Friends

class | XrdPosixConfig
class | XrdPosixExtra

## Detailed Description

POSIX interface to XRootD with some extensions, as noted.

Definition at line 63 of file XrdPosixXrootd.hh.

## Constructor & Destructor Documentation

## XrdPosixXrootd()

XrdPosixXrootd::XrdPosixXrootd | ( | int | maxfd = 255,
|  | int | maxdir = 0,
|  | int | maxthr = 0 )

Definition at line 180 of file XrdPosixXrootd.cc.

{
static XrdSysMutex myMutex;
char *cfn;
// Test if XRDCL_EC is set. That env var. is set at XrdCl::PlugInManager::LoadFactory
// in XrdClPlugInManager.cc, which is called (by XrdOssGetSS while loading
// libXrdPss.so) before this function.
// Note: some standalone programs will call this constructor directly.
XrdPosixGlobals::usingEC = getenv("XRDCL_EC")? true : false;
// Only static fields are initialized here. We need to do this only once!
//
myMutex.Lock();
if (initDone) {myMutex.UnLock(); return;}
initDone = 1;
myMutex.UnLock();
// Initialize environment as a client or a server (it differs somewhat).
// Note that we create a permanent Env since some plugins rely on it. We
// leave the logger handling to OucPsx as we do not want to enable messages
// because this is likely a client application that doesn't understand noise.
//
if (!XrdPosixGlobals::theLogger && (cfn=getenv("XRDPOSIX_CONFIG")) && *cfn)
{bool hush;
if (*cfn == '+') {hush = false; cfn++;}
else hush = (getenv("XRDPOSIX_DEBUG") == 0);
if (*cfn)
{XrdOucEnv *psxEnv = new XrdOucEnv;
psxEnv->Put("psx.Client", "1");
XrdOucPsx psxConfig(&XrdVERSIONINFOVAR(XrdPosix), cfn, 0, psxEnv);
if (!psxConfig.ClientConfig("posix.", hush)
|| !XrdPosixConfig::SetConfig(psxConfig))
{std::cerr <<"Posix: Unable to instantiate specified "
"configuration; program exiting!" <<std::endl;
exit(16);
}
}
}
// Initialize file tracking
//
baseFD = XrdPosixObject::Init(fdnum);
}
XrdOucEnv::Put
void Put(const char *varname, const char *value)
Definition XrdOucEnv.hh:85
XrdPosixConfig::SetConfig
static bool SetConfig(XrdOucPsx &parms)
Definition XrdPosixConfig.cc:408
XrdPosixObject::Init
static int Init(int numfd)
Definition XrdPosixObject.cc:206
XrdSysMutex::Lock
void Lock()
Definition XrdSysPthread.hh:222
XrdSysMutex::UnLock
void UnLock()
Definition XrdSysPthread.hh:224
XrdPosixGlobals::theLogger
XrdSysLogger * theLogger
Definition XrdPosixXrootd.cc:89
XrdPosixGlobals::usingEC
bool usingEC
Definition XrdPosixXrootd.cc:101

References XrdOucPsx::ClientConfig(), XrdPosixObject::Init(), XrdSysMutex::Lock(), XrdOucEnv::Put(), XrdPosixConfig::SetConfig(), XrdPosixGlobals::theLogger, XrdSysMutex::UnLock(), and XrdPosixGlobals::usingEC.

Here is the call graph for this function:

## ~XrdPosixXrootd()

XrdPosixXrootd::~XrdPosixXrootd | ( |  | ) |

Definition at line 229 of file XrdPosixXrootd.cc.

{
// Shutdown processing
//
XrdPosixObject::Shutdown();
initDone = 0;
}
XrdPosixObject::Shutdown
static void Shutdown()
Definition XrdPosixObject.cc:317

References XrdPosixObject::Shutdown().

Here is the call graph for this function:

## Member Function Documentation

## Access()

int XrdPosixXrootd::Access | ( | const char * | path,
|  | int | amode )

static

Access() conforms to POSIX.1-2001 access().

Definition at line 242 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
mode_t stMode;
bool aOK = true;
// Issue the stat and verify that all went well
//
if (!admin.Stat(&stMode)) return -1;
// Translate the mode bits
//
if (amode & R_OK && !(stMode & S_IRUSR)) aOK = 0;
if (amode & W_OK && !(stMode & S_IWUSR)) aOK = 0;
if (amode & X_OK && !(stMode & S_IXUSR)) aOK = 0;
// All done
//
if (aOK) return 0;
return XrdPosixGlobals::ecMsg.SetErrno(EACCES);
}
XrdOucECMsg::SetErrno
int SetErrno(int ecc, int ret=-1, const char *alt=0)
Definition XrdOucECMsg.cc:152
XrdPosixGlobals::ecMsg
XrdOucECMsg ecMsg

References XrdPosixGlobals::ecMsg, and XrdPosixAdmin::Stat().

Here is the call graph for this function:

## Close()

int XrdPosixXrootd::Close | ( | int | fildes | ) |

static

Close() conforms to POSIX.1-2001 close().

Definition at line 268 of file XrdPosixXrootd.cc.

{
EPNAME("Close");
XrdCl::XRootDStatus Status;
XrdPosixFile *fP;
bool ret;
// Map the file number to the file object. In the prcess we relese the file
// number so no one can reference this file again.
//
if (!(fP = XrdPosixObject::ReleaseFile(fildes)))
return XrdPosixGlobals::ecMsg.SetErrno(EBADF);
// Detach the file from a possible cache. We need to up the reference count
// to synchrnoize with any possible callback as we may need to place this
// object in he delayed destroy queue if it is stil being used. Note that
// the caller will get a zero return code should we delay the close.
//
fP->Ref();
if (fP->XCio->Detach((XrdOucCacheIOCD&)*fP) && fP->Refs() < 2)
{if ((ret = fP->Close(Status))) {delete fP; fP = 0;}
else if (DEBUGON)
{std::string eTxt = Status.ToString();
DEBUG(eTxt <<" closing " << obfuscateAuth(fP->Origin()));
}
} else {
ret = true;
}
// If we still have a handle then we need to do a delayed delete on this
// object because either the close failed or there is still active I/O
//
if (fP) XrdPosixFile::DelayedDestroy(fP);
// Return final result. Note: close errors are recorded in global thread status
//
return (ret ? 0 : XrdPosixMap::Result(Status,XrdPosixGlobals::ecMsg,true));
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
obfuscateAuth
std::string obfuscateAuth(const std::string &input)
Definition XrdOucUtils.cc:1534
DEBUGON
#define DEBUGON
Definition XrdPosixTrace.hh:41
XrdOucCacheIO::Detach
virtual bool Detach(XrdOucCacheIOCD &iocd)=0
XrdPosixFile::XCio
XrdOucCacheIO * XCio
Definition XrdPosixFile.hh:65
XrdPosixFile::DelayedDestroy
static void * DelayedDestroy(void *)
Definition XrdPosixFile.cc:179
XrdPosixMap::Result
static int Result(const XrdCl::XRootDStatus &Status, XrdOucECMsg &ecMsg, bool retneg1=false)
Definition XrdPosixMap.cc:188
XrdPosixObject::Ref
void Ref()
Definition XrdPosixObject.hh:65
XrdPosixObject::ReleaseFile
static XrdPosixFile * ReleaseFile(int fildes)
Definition XrdPosixObject.cc:299
XrdCl::Status::ToString
std::string ToString() const
Create a string representation.
Definition XrdClStatus.cc:97

References XrdPosixFile::Close(), DEBUG, DEBUGON, XrdPosixFile::DelayedDestroy(), XrdOucCacheIO::Detach(), XrdPosixGlobals::ecMsg, EPNAME, obfuscateAuth(), XrdPosixFile::Origin(), XrdPosixObject::Ref(), XrdPosixObject::Refs(), XrdPosixObject::ReleaseFile(), XrdPosixMap::Result(), XrdCl::Status::ToString(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::Close(), main(), and XrdFfsPosix_close().

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

## Closedir()

int XrdPosixXrootd::Closedir | ( | DIR * | dirp | ) |

static

Closedir() conforms to POSIX.1-2001 closedir().

Definition at line 311 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
int fildes = XrdPosixDir::dirNo(dirp);
// Get the directory object
//
if (!(dP = XrdPosixObject::ReleaseDir(fildes)))
return XrdPosixGlobals::ecMsg.SetErrno(EBADF);
// Deallocate the directory
//
delete dP;
return 0;
}
XrdPosixDir::dirNo
static int dirNo(DIR *dirP)
Definition XrdPosixDir.hh:63
XrdPosixObject::ReleaseDir
static XrdPosixDir * ReleaseDir(int fildes)
Definition XrdPosixObject.cc:281

References XrdPosixDir::dirNo(), XrdPosixGlobals::ecMsg, and XrdPosixObject::ReleaseDir().

Referenced by XrdPssDir::Close(), and XrdFfsPosix_closedir().

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

## endPoint()

int XrdPosixXrootd::endPoint | ( | int | FD,
|  | char * | Buff,
|  | int | Blen )

static

endPoint() is a POSIX extension and returns the location of an open file.

Parameters

  FD | File descriptor of an open file in question.
  Buff | Pointer to the buffer to receive '<host>:<port>' of the server.
  Blen | Size of the buffer, it must be big enough for the result.

Returns
  >= 0 The numeric port number of the data server.
  -1 Call failed, errno has the reason.

Definition at line 331 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
int uPort;
// Find the file object
//
if (!(fp = XrdPosixObject::File(FD))) return 0;
// Make sure url is valid
//
if (!(fp->clFile.IsOpen()))
{fp->UnLock(); return -ENOTCONN;}
// Make sure we can fit result in the buffer
//
std::string dataServer;
fp->clFile.GetProperty( "DataServer", dataServer );
XrdCl::URL dataServerUrl = dataServer;
if (dataServer.size() >= (uint32_t)Blen)
{fp->UnLock(); return -ENAMETOOLONG;}
// Copy the data server location
//
strcpy(Buff, dataServer.c_str());
// Get the port and return it
//
uPort = dataServerUrl.GetPort();
fp->UnLock();
return uPort;
}
XrdCl::File::IsOpen
bool IsOpen() const
Check if the file is open.
Definition XrdClFile.cc:846
XrdCl::File::GetProperty
bool GetProperty(const std::string &name, std::string &value) const
Definition XrdClFile.cc:878
XrdCl::URL::GetPort
int GetPort() const
Get the target port.
Definition XrdClURL.hh:188
XrdPosixFile::clFile
XrdCl::File clFile
Definition XrdPosixFile.hh:67
XrdPosixObject::UnLock
void UnLock()
Definition XrdPosixObject.hh:83
XrdPosixObject::File
static XrdPosixFile * File(int fildes, bool glk=false)
Definition XrdPosixObject.cc:155

References XrdPosixFile::clFile, XrdPosixObject::File(), XrdCl::URL::GetPort(), XrdCl::File::GetProperty(), XrdCl::File::IsOpen(), and XrdPosixObject::UnLock().

Here is the call graph for this function:

## fdOrigin()

int XrdPosixXrootd::fdOrigin | ( |  | ) |

inline

The following methods are considered private but defined as public to allow XrdPosix 'C' functions and XrdPss classes access private members.

Definition at line 371 of file XrdPosixXrootd.hh.

{return baseFD;}

Referenced by xrootdfs_init().

Here is the caller graph for this function:

## Fstat()

int XrdPosixXrootd::Fstat | ( | int | fildes,
|  | struct stat * | buf )

static

Fstat() conforms to POSIX.1-2001 fstat().

Definition at line 369 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
int rc;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// First initialize the stat buffer
//
XrdPosixConfig::initStat(buf);
// Check if we can get the stat information from the cache.
//
rc = fp->XCio->Fstat(*buf);
if (rc <= 0)
{fp->UnLock();
if (!rc) return 0;
errno = -rc; //???
return -1;
}
// At this point we can call the file's Fstat() and if the file is not open
// it will be opened.
//
rc = fp->Fstat(*buf);
fp->UnLock();
if (rc < 0) {errno = -rc; rc = -1;}
return rc;
}
XrdOucCacheIO::Fstat
virtual int Fstat(struct stat &sbuff)
Definition XrdOucCache.hh:148
XrdPosixConfig::initStat
static void initStat(struct stat *buf)
Definition XrdPosixConfig.cc:337
XrdPosixFile::Fstat
int Fstat(struct stat &buf) override
Definition XrdPosixFile.cc:366

References XrdPosixObject::File(), XrdOucCacheIO::Fstat(), XrdPosixFile::Fstat(), XrdPosixConfig::initStat(), stat, XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::Fstat(), and xrootdfs_read().

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

## Fsync() [1/2]

int XrdPosixXrootd::Fsync | ( | int | fildes | ) |

static

Fsync() conforms to POSIX.1-2001 fsync().

Definition at line 405 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
int rc;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Do the sync
//
if ((rc = fp->XCio->Sync()) < 0) return Fault(fp, -rc);
fp->UnLock();
return 0;
}
XrdOucCacheIO::Sync
virtual int Sync()=0

References XrdPosixObject::File(), XrdOucCacheIO::Sync(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::Fsync(), XrdPssFile::Fsync(), and XrdFfsPosix_fsync().

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

## Fsync() [2/2]

void XrdPosixXrootd::Fsync | ( | int | fildes,
|  | XrdPosixCallBackIO * | cbp )

static

Definition at line 423 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
// Find the file object and do the sync
//
if ((fp = XrdPosixObject::File(fildes)))
{cbp->theFile = fp;
fp->Ref(); fp->UnLock();
fp->XCio->Sync(*cbp);
} else cbp->Complete(-1);
}
XrdPosixCallBackIO::Complete
virtual void Complete(ssize_t Result)=0

References XrdPosixCallBackIO::Complete(), XrdPosixObject::File(), XrdPosixObject::Ref(), XrdOucCacheIO::Sync(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Here is the call graph for this function:

## Ftruncate()

int XrdPosixXrootd::Ftruncate | ( | int | fildes,
|  | off_t | offset )

static

Ftruncate() conforms to POSIX.1-2001 ftruncate().

Definition at line 440 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
int rc;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Do the trunc
//
if ((rc = fp->XCio->Trunc(offset)) < 0) return Fault(fp, -rc);
fp->UnLock();
return 0;
}
XrdOucCacheIO::Trunc
virtual int Trunc(long long offs)=0

References XrdPosixObject::File(), XrdOucCacheIO::Trunc(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::Ftruncate(), and XrdFfsPosix_ftruncate().

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

## Getxattr()

long long XrdPosixXrootd::Getxattr | ( | const char * | path,
|  | const char * | name,
|  | void * | value,
|  | unsigned long long | size )

static

Getxattr() is a POSIX extension and conforms to Linux 2.4 getxattr(). This method returns attributes associated with a file. The format does not correspond to information returned by Linux. Refer to the XRootD protocol reference for the detailed description of the information returned.

Parameters

  path | pointer to the path whose attributes are to be returned
  name | name of the attribute to be returned. Valid attributes are xrootd.cksum - file's checksum xrootd.space - space associated with the path xrootd.xattr - server specific extended attributes for path
  value | pointer to the buffer to receive the attribute values.
  size | size of the buffer (value). If size is zero, only the maximum length of the attribute value is returned.

Returns
  On success, a positive number is returned indicating the size of is extended attribute value. On failure, -1 is returned and errno

## is set to indicate the reason.

Definition at line 464 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
XrdCl::QueryCode::Code reqCode;
int vsize = static_cast<int>(size);
// Check if user just wants the maximum length needed
//
if (size == 0) return 1024;
// Check if we support the query
//
if (name)
{ if (!strcmp(name,"xroot.cksum")) reqCode=XrdCl::QueryCode::Checksum;
else if (!strcmp(name,"xroot.space")) reqCode=XrdCl::QueryCode::Space;
else if (!strcmp(name,"xroot.xattr")) reqCode=XrdCl::QueryCode::XAttr;
else {errno = ENOATTR; return -1;} //???
}else {errno = EINVAL; return -1;}
// Stat the file first to allow vectoring of the request to the right server
//
if (!admin.Stat()) return -1;
// Return the result
//
return admin.Query(reqCode, value, vsize);
}
ENOATTR
#define ENOATTR
Definition XProtocol.hh:1343
XrdCl::QueryCode::Code
Code
XRootD query request codes.
Definition XrdClFileSystem.hh:53
XrdCl::QueryCode::XAttr
@ XAttr
Query file extended attributes.
Definition XrdClFileSystem.hh:63
XrdCl::QueryCode::Checksum
@ Checksum
Query file checksum.
Definition XrdClFileSystem.hh:56
XrdCl::QueryCode::Space
@ Space
Query logical space stats.
Definition XrdClFileSystem.hh:60

References XrdCl::QueryCode::Checksum, XrdPosixGlobals::ecMsg, ENOATTR, XrdPosixAdmin::Query(), XrdCl::QueryCode::Space, XrdPosixAdmin::Stat(), and XrdCl::QueryCode::XAttr.

Referenced by getchksum(), and XrdFfsPosix_getxattr().

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

## isXrootdDir()

bool XrdPosixXrootd::isXrootdDir | ( | DIR * | dirp | ) |

static

Definition at line 1462 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
int fildes;
if (!dirp) return false;
fildes = XrdPosixDir::dirNo(dirp);
if (!myFD(fildes) || !(dP = XrdPosixObject::Dir(fildes))) return false;
dP->UnLock();
return true;
}
XrdPosixObject::Dir
static XrdPosixDir * Dir(int fildes, bool glk=false)
Definition XrdPosixObject.cc:104
XrdPosixXrootd::myFD
static bool myFD(int fd)
Definition XrdPosixXrootd.cc:1480

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), myFD(), and XrdPosixObject::UnLock().

Here is the call graph for this function:

## Lseek()

off_t XrdPosixXrootd::Lseek | ( | int | fildes,
|  | off_t | offset,
|  | int | whence )

static

Lseek() conforms to POSIX.1-2001 lseek().

Definition at line 497 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
long long curroffset;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Set the new offset. Note that SEEK_END requires that the file be opened.
// An open may occur by calling the FSize() method via the cache pointer.
//
if (whence == SEEK_SET) curroffset = fp->setOffset(offset);
else if (whence == SEEK_CUR) curroffset = fp->addOffset(offset);
else if (whence == SEEK_END)
{curroffset = fp->XCio->FSize();
if (curroffset < 0) return Fault(fp,static_cast<int>(-curroffset));
curroffset = fp->setOffset(curroffset+offset);
}
else return Fault(fp, EINVAL);
// All done
//
fp->UnLock();
return curroffset;
}
XrdOucCacheIO::FSize
virtual long long FSize()=0
XrdPosixFile::addOffset
long long addOffset(long long offs, int updtSz=0)
Definition XrdPosixFile.hh:69
XrdPosixFile::setOffset
long long setOffset(long long offs)
Definition XrdPosixFile.hh:146

References XrdPosixFile::addOffset(), XrdPosixObject::File(), XrdOucCacheIO::FSize(), XrdPosixFile::setOffset(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by XrdFfsPosix_lseek().

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

## Mkdir()

int XrdPosixXrootd::Mkdir | ( | const char * | path,
|  | mode_t | mode )

static

Mkdir() conforms to POSIX.1-2001 mkdir().

Definition at line 528 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
XrdCl::MkDirFlags::Flags flags;
// Preferentially make the whole path unless told otherwise
//
flags = (mode & S_ISUID ? XrdCl::MkDirFlags::None
: XrdCl::MkDirFlags::MakePath);
// Make sure the admin is OK
//
if (!admin.isOK()) return -1;
// Issue the mkdir
//
return XrdPosixMap::Result(admin.Xrd.MkDir(admin.Url.GetPathWithParams(),
flags,
XrdPosixMap::Mode2Access(mode)),
XrdPosixGlobals::ecMsg,true
);
}
XrdPosixMap::Mode2Access
static XrdCl::Access::Mode Mode2Access(mode_t mode)
Definition XrdPosixMap.cc:168
XrdCl::MkDirFlags::Flags
Flags
Definition XrdClFileSystem.hh:143
XrdCl::MkDirFlags::None
@ None
Nothing special.
Definition XrdClFileSystem.hh:144
XrdCl::MkDirFlags::MakePath
@ MakePath
create the entire directory tree if it doesn't exist
Definition XrdClFileSystem.hh:145

References XrdPosixGlobals::ecMsg, XrdCl::URL::GetPathWithParams(), XrdPosixAdmin::isOK(), XrdCl::MkDirFlags::MakePath, XrdCl::FileSystem::MkDir(), XrdPosixMap::Mode2Access(), XrdCl::MkDirFlags::None, XrdPosixMap::Result(), XrdPosixAdmin::Url, and XrdPosixAdmin::Xrd.

Referenced by XrdPssSys::Mkdir(), and XrdFfsPosix_mkdir().

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

## myFD()

bool XrdPosixXrootd::myFD | ( | int | fd | ) |

static

Definition at line 1480 of file XrdPosixXrootd.cc.

{
return XrdPosixObject::Valid(fd);
}
XrdPosixObject::Valid
static bool Valid(int fd)
Definition XrdPosixObject.hh:85

References XrdPosixObject::Valid().

Referenced by isXrootdDir().

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

## Open()

int XrdPosixXrootd::Open | ( | const char * | path,
|  | int | oflag,
|  | mode_t | mode = 0,
|  | XrdPosixCallBack * | cbP = 0 )

static

Definition at line 555 of file XrdPosixXrootd.cc.

{
return Open(path, oflags, mode, cbP, 0);
}
XrdPosixXrootd::Open
static int Open(const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)
Definition XrdPosixXrootd.cc:555

References Open().

Referenced by main(), Open(), XrdPssFile::Open(), XrdPosixConfig::OpenFC(), and XrdFfsPosix_open().

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

## Opendir()

DIR * XrdPosixXrootd::Opendir | ( | const char * | path | ) |

static

Opendir() conforms to POSIX.1-2001 opendir().

Definition at line 705 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
DIR *dirP;
int rc;
// Get a new directory object
//
if (!(dP = new XrdPosixDir(path)))
{XrdPosixGlobals::ecMsg.SetErrno(ENOMEM);
return (DIR*)0;
}
// Assign a file descriptor to this file
//
if (!(dP->AssignFD()))
{delete dP;
XrdPosixGlobals::ecMsg.SetErrno(EMFILE);
return (DIR*)0;
}
// Open the directory
//
if ((dirP = dP->Open())) return dirP;
// We failed
//
rc = errno;
delete dP;
errno = rc; // Restore saved errno
return (DIR *)0;
}
XrdPosixDir::Open
DIR * Open()
Definition XrdPosixDir.cc:110
XrdPosixObject::AssignFD
bool AssignFD(bool isStream=false)
Definition XrdPosixObject.cc:67

References XrdPosixObject::AssignFD(), XrdPosixGlobals::ecMsg, and XrdPosixDir::Open().

Referenced by XrdPssDir::Opendir(), and XrdFfsPosix_opendir().

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

## Pread() [1/2]

ssize_t XrdPosixXrootd::Pread | ( | int | fildes,
|  | void * | buf,
|  | size_t | nbyte,
|  | off_t | offset )

static

Pread() conforms to POSIX.1-2001 pread().

Definition at line 742 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
long long offs, bytes;
int iosz;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes)))
return XrdPosixGlobals::ecMsg.SetErrno(EBADF);
// Make sure the size is not too large
//
if (nbyte > (size_t)0x7fffffff)
return Fault(fp, EOVERFLOW, "read size too large");
else iosz = static_cast<int>(nbyte);
// Issue the read
//
offs = static_cast<long long>(offset);
bytes = fp->XCio->Read((char *)buf, offs, (int)iosz);
if (bytes < 0) return Fault(fp,-bytes,"*");
// All went well
//
fp->UnLock();
return (ssize_t)bytes;
}
XrdOucCacheIO::Read
virtual int Read(char *buff, long long offs, int rlen)=0

References XrdPosixGlobals::ecMsg, XrdPosixObject::File(), XrdOucCacheIO::Read(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::Read(), XrdPssFile::Read(), and XrdFfsPosix_pread().

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

## Pread() [2/2]

void XrdPosixXrootd::Pread | ( | int | fildes,
|  | void * | buf,
|  | size_t | nbyte,
|  | off_t | offset,
|  | XrdPosixCallBackIO * | cbp )

static

Definition at line 773 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
long long offs;
int iosz;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) {cbp->Complete(-1); return;}
// Make sure the size is not too large
//
if (nbyte > (size_t)0x7fffffff)
{fp->UnLock();
fp->ecMsg.SetErrno(EOVERFLOW,0,"read size too large");
cbp->Complete(-1);
return;
}
// Prepare for the read
//
cbp->theFile = fp;
fp->Ref(); fp->UnLock();
iosz = static_cast<int>(nbyte);
offs = static_cast<long long>(offset);
// Issue the read
//
fp->XCio->Read(*cbp, (char *)buf, offs, (int)iosz);
}
XrdPosixObject::ecMsg
XrdOucECMsg ecMsg
Definition XrdPosixObject.hh:96

References XrdPosixCallBackIO::Complete(), XrdPosixObject::ecMsg, XrdPosixObject::File(), XrdOucCacheIO::Read(), XrdPosixObject::Ref(), XrdOucECMsg::SetErrno(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Here is the call graph for this function:

## Pwrite() [1/2]

ssize_t XrdPosixXrootd::Pwrite | ( | int | fildes,
|  | const void * | buf,
|  | size_t | nbyte,
|  | off_t | offset )

static

Pwrite() conforms to POSIX.1-2001 pwrite().

Definition at line 809 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
long long offs;
int iosz, bytes;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Make sure the size is not too large
//
if (nbyte > (size_t)0x7fffffff)
return Fault(fp,EOVERFLOW,"write size too large");
else iosz = static_cast<int>(nbyte);
// Issue the write
//
offs = static_cast<long long>(offset);
bytes = fp->XCio->Write((char *)buf, offs, (int)iosz);
if (bytes < 0) return Fault(fp,-bytes,"*");
// All went well
//
fp->UpdtSize(offs + iosz);
fp->UnLock();
return (ssize_t)iosz;
}
XrdOucCacheIO::Write
virtual int Write(char *buff, long long offs, int wlen)=0
XrdPosixFile::UpdtSize
void UpdtSize(size_t newsz)
Definition XrdPosixFile.hh:161

References XrdPosixObject::File(), XrdPosixObject::UnLock(), XrdPosixFile::UpdtSize(), XrdOucCacheIO::Write(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::Write(), XrdPssFile::Write(), and XrdFfsPosix_pwrite().

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

## Pwrite() [2/2]

void XrdPosixXrootd::Pwrite | ( | int | fildes,
|  | const void * | buf,
|  | size_t | nbyte,
|  | off_t | offset,
|  | XrdPosixCallBackIO * | cbp )

static

Definition at line 840 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
long long offs;
int iosz;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) {cbp->Complete(-1); return;}
// Make sure the size is not too large
//
if (nbyte > (size_t)0x7fffffff)
{fp->UnLock();
fp->ecMsg.SetErrno(EOVERFLOW,0,"read size too large");
cbp->Complete(-1);
return;
}
// Prepare for the writing
//
cbp->theFile = fp;
fp->Ref(); fp->UnLock();
iosz = static_cast<int>(nbyte);
offs = static_cast<long long>(offset);
// Issue the read
//
fp->XCio->Write(*cbp, (char *)buf, offs, (int)iosz);
}

References XrdPosixCallBackIO::Complete(), XrdPosixObject::ecMsg, XrdPosixObject::File(), XrdPosixObject::Ref(), XrdOucECMsg::SetErrno(), XrdPosixObject::UnLock(), XrdOucCacheIO::Write(), and XrdPosixFile::XCio.

Here is the call graph for this function:

## QueryChksum()

int XrdPosixXrootd::QueryChksum | ( | const char * | path,
|  | time_t & | mtime,
|  | char * | buff,
|  | int | blen )

static

QueryChksum() is a POSIX extension and returns a file's modification time and its associated checksum value.

Parameters

  path | path associated with the file whose checksum is wanted.
  mtime | where the file's modification time (st_mtime) is placed.
  buff | pointer to the buffer to hold the checksum value.
  blen | the length of the buffer.

Returns
  Upon success returns the length of the checksum response placed in buff. Otherwise, -1 is returned and errno appropriately set.

Definition at line 1489 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
// Stat the file first to allow vectoring of the request to the right server
//
if (!admin.Stat(0, &Mtime)) return -1;
// Now we can get the checksum as we have landed on the right server
//
return admin.Query(XrdCl::QueryCode::Checksum, value, vsize);
}

References XrdCl::QueryCode::Checksum, XrdPosixGlobals::ecMsg, XrdPosixAdmin::Query(), and XrdPosixAdmin::Stat().

Referenced by XrdPssCks::Get().

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

## QueryError() [1/2]

int XrdPosixXrootd::QueryError | ( | std::string & | emsg,
|  | DIR * | dirP,
|  | bool | reset = true )

static

Definition at line 1528 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
int fildes = XrdPosixDir::dirNo(dirP);
// Find the object
//
if (!(dP = XrdPosixObject::Dir(fildes)))
return XrdPosixGlobals::ecMsg.SetErrno(EBADF);
// Return result
//
return dP->getECMsg()->Get(emsg, reset);
}
emsg
int emsg(int rc, char *msg)
Definition XrdSectestServer.cc:309
XrdOucECMsg::Get
int Get(std::string &ecm, bool rst=true)
Definition XrdOucECMsg.cc:41
XrdPosixObject::getECMsg
XrdOucECMsg * getECMsg()
Definition XrdPosixObject.hh:56

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), XrdPosixGlobals::ecMsg, emsg(), XrdOucECMsg::Get(), and XrdPosixObject::getECMsg().

Here is the call graph for this function:

## QueryError() [2/2]

int XrdPosixXrootd::QueryError | ( | std::string & | emsg,
|  | int | fd = -1,
|  | bool | reset = true )

static

QueryError() is a POSIX extension and returns extended information about the last error returned from a call to a POSIX function.

Parameters

  emsg | Reference to a string to hold the retruned message text.
  fd | The file descriptor associated with the error. A negative value returns the last error encountered on the calling thread for the last function not releated to a file descritor. dirP Get the error associated with the last directory operation.
  reset | When true (the default) clears the error information.

Returns
  The error code and the associated message via parameter emsg. A zero return indicates that no error information is available. A -1 return indicates the call was bad itself because either the fd or dirP was invalid.

Definition at line 1507 of file XrdPosixXrootd.cc.

{
XrdOucECMsg* ecmP;
XrdPosixFile* fp = 0;
// If global wanted then use that one otherwise find the object specific one
//
if (fd < 0) ecmP = &XrdPosixGlobals::ecMsg;
else {if (!(fp = XrdPosixObject::File(fd))) return -1;
ecmP = fp->getECMsg();
}
// Return the message information
//
const int rc = ecmP->Get(emsg, reset);
if (fp) fp->UnLock();
return rc;
}

References XrdPosixGlobals::ecMsg, emsg(), XrdPosixObject::File(), XrdOucECMsg::Get(), XrdPosixObject::getECMsg(), and XrdPosixObject::UnLock().

Referenced by XrdPssSys::Info().

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

## QueryOpaque()

long long XrdPosixXrootd::QueryOpaque | ( | const char * | path,
|  | char * | buff,
|  | int | blen )

static

QueryOpaque() is a POSIX extension and returns a file's implementation specific information.

Parameters

  path | path associated with the file whose information is wanted.
  buff | pointer to the buffer to hold the information.
  blen | the length of the buffer.

Returns
  Upon success returns the length of the checksum response placed in buff. Otherwise, -1 is returned and errno appropriately set.

Definition at line 1547 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
// Stat the file first to allow vectoring of the request to the right server
//
if (!admin.Stat()) return -1;
// Now we can get the checksum as we have landed on the right server
//
return admin.Query(XrdCl::QueryCode::OpaqueFile, value, size);
}
XrdCl::QueryCode::OpaqueFile
@ OpaqueFile
Implementation dependent.
Definition XrdClFileSystem.hh:58

References XrdPosixGlobals::ecMsg, XrdCl::QueryCode::OpaqueFile, XrdPosixAdmin::Query(), and XrdPosixAdmin::Stat().

Here is the call graph for this function:

## Read()

ssize_t XrdPosixXrootd::Read | ( | int | fildes,
|  | void * | buf,
|  | size_t | nbyte )

static

Read() conforms to POSIX.1-2001 read().

Definition at line 876 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
long long bytes;
int iosz;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Make sure the size is not too large
//
if (nbyte > (size_t)0x7fffffff) return Fault(fp,EOVERFLOW);
else iosz = static_cast<int>(nbyte);
// Issue the read
//
bytes = fp->XCio->Read((char *)buf,fp->Offset(),(int)iosz);
if (bytes < 0) return Fault(fp,-bytes);
// All went well
//
fp->addOffset(bytes);
fp->UnLock();
return (ssize_t)bytes;
}
XrdPosixFile::Offset
long long Offset()
Definition XrdPosixFile.hh:112

References XrdPosixFile::addOffset(), XrdPosixObject::File(), XrdPosixFile::Offset(), XrdOucCacheIO::Read(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by main(), Readv(), and XrdFfsPosix_read().

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

## Readdir()

struct dirent * XrdPosixXrootd::Readdir | ( | DIR * | dirp | ) |

static

readdir() conforms to POSIX.1-2001 readdir() and is normally equivalent to readdir64(). The latter is provided for those platforms that require a specific 64-bit interface to directory information, which is now rare.

Definition at line 969 of file XrdPosixXrootd.cc.

{
dirent64 *dp64;
dirent *dp32; // Could be the same as dp64
if (!(dp64 = Readdir64(dirp))) return 0;
dp32 = (struct dirent *)dp64;
if ((char*)dp32->d_name != (char*)dp64->d_name)
{dp32->d_ino = dp64->d_ino;
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__GNU__) && !(defined(__FreeBSD_kernel__) && defined(__GLIBC__))
dp32->d_off = dp64->d_off;
#endif
#ifndef __solaris__
dp32->d_type = dp64->d_type;
#endif
dp32->d_reclen = dp64->d_reclen;
strcpy(dp32->d_name, dp64->d_name);
}
return dp32;
}
XrdPosixXrootd::Readdir64
static struct dirent64 * Readdir64(DIR *dirp)
Definition XrdPosixXrootd.cc:991

References Readdir64().

Referenced by XrdFfsPosix_readdir().

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

## Readdir64()

struct dirent64 * XrdPosixXrootd::Readdir64 | ( | DIR * | dirp | ) |

static

Definition at line 991 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
dirent64 *dentP;
int rc, fildes = XrdPosixDir::dirNo(dirp);
// Find the object
//
if (!(dP = XrdPosixObject::Dir(fildes)))
{XrdPosixGlobals::ecMsg.SetErrno(EBADF);
return (dirent64*)0;
}
// Get the next directory entry
//
if (!(dentP = dP->nextEntry())) rc = dP->Status();
else rc = 0;
// Return the appropriate result
//
dP->UnLock();
if (rc) errno = rc;
return dentP;
}
XrdPosixDir::nextEntry
dirent64 * nextEntry(dirent64 *dp=0)
Definition XrdPosixDir.cc:48
XrdPosixDir::Status
int Status()
Definition XrdPosixDir.hh:84

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), XrdPosixGlobals::ecMsg, XrdPosixDir::nextEntry(), XrdPosixDir::Status(), and XrdPosixObject::UnLock().

Referenced by Readdir().

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

## Readdir64_r()

int XrdPosixXrootd::Readdir64_r | ( | DIR * | dirp,
|  | struct dirent64 * | entry,
|  | struct dirent64 ** | result )

static

Definition at line 1042 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
int rc, fildes = XrdPosixDir::dirNo(dirp);
// Find the object
//
if (!(dP = XrdPosixObject::Dir(fildes))) return EBADF;
// Get the next entry
//
if (!(*result = dP->nextEntry(entry))) {rc = dP->Status(); *result = 0;}
else {rc = 0; *result = entry;}
// Return the appropriate result
//
dP->UnLock();
return rc;
}

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), XrdPosixDir::nextEntry(), XrdPosixDir::Status(), and XrdPosixObject::UnLock().

Referenced by Readdir_r().

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

## Readdir_r()

int XrdPosixXrootd::Readdir_r | ( | DIR * | dirp,
|  | struct dirent * | entry,
|  | struct dirent ** | result )

static

readdir_r() conforms to POSIX.1-2001 readdir_r() and is normally equivalent to readdir64_r(). The latter is provided for those platforms that require a specific 64-bit interface to directory information, which is now rare.

Definition at line 1020 of file XrdPosixXrootd.cc.

{
dirent64 *dp64 = 0, d64ent;
int rc;
if ((rc = Readdir64_r(dirp, &d64ent, &dp64)) || !dp64)
{*result = 0; return rc;}
entry->d_ino = dp64->d_ino;
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__GNU__) && !(defined(__FreeBSD_kernel__) && defined(__GLIBC__))
entry->d_off = dp64->d_off;
#endif
#ifndef __solaris__
entry->d_type = dp64->d_type;
#endif
entry->d_reclen = dp64->d_reclen;
strcpy(entry->d_name, dp64->d_name);
*result = entry;
return rc;
}
XrdPosixXrootd::Readdir64_r
static int Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
Definition XrdPosixXrootd.cc:1042

References Readdir64_r().

Referenced by XrdPssDir::Readdir().

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

## Readv()

ssize_t XrdPosixXrootd::Readv | ( | int | fildes,
|  | const struct iovec * | iov,
|  | int | iovcnt )

static

Readv() conforms to POSIX.1-2001 readv().

Definition at line 907 of file XrdPosixXrootd.cc.

{
ssize_t bytes, totbytes = 0;
int i;
// Return the results of the read for each iov segment
//
for (i = 0; i < iovcnt; i++)
{bytes = Read(fildes,(void *)iov[i].iov_base,(size_t)iov[i].iov_len);
if (bytes > 0) totbytes += bytes;
else if (bytes < 0) return -1;
else break;
}
// All done
//
return totbytes;
}
XrdPosixXrootd::Read
static ssize_t Read(int fildes, void *buf, size_t nbyte)
Read() conforms to POSIX.1-2001 read().
Definition XrdPosixXrootd.cc:876

References Read().

Here is the call graph for this function:

## Rename()

int XrdPosixXrootd::Rename | ( | const char * | oldpath,
|  | const char * | newpath )

static

Rename() conforms to POSIX.1-2001 rename().

Definition at line 1067 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(oldpath,XrdPosixGlobals::ecMsg);
XrdCl::URL newUrl((std::string)newpath);
// Make sure the admin is OK and the new url is valid
//
if (!admin.isOK() || !newUrl.IsValid())
return XrdPosixGlobals::ecMsg.SetErrno(EINVAL);
// Issue rename to he cache (it really should just deep-six both files)
//
if (XrdPosixGlobals::theCache)
{LfnPath oldF("rename", oldpath);
LfnPath newF("rename", newpath);
if (!oldF.path || !newF.path) return -1;
XrdPosixGlobals::theCache->Rename(oldF.path, newF.path);
}
// Issue the rename
//
if (XrdPosixGlobals::usingEC)
return EcRename(oldpath, newpath, admin);
return XrdPosixMap::Result(admin.Xrd.Mv(admin.Url.GetPathWithParams(),
newUrl.GetPathWithParams()),
XrdPosixGlobals::ecMsg, true);
}
XrdOucCache::Rename
virtual int Rename(const char *oldp, const char *newp)
Definition XrdOucCache.hh:610
XrdPosixGlobals::theCache
XrdOucCache * theCache
Definition XrdPosixConfig.cc:77

References XrdPosixGlobals::ecMsg, XrdCl::URL::GetPathWithParams(), XrdPosixAdmin::isOK(), XrdCl::URL::IsValid(), XrdCl::FileSystem::Mv(), XrdPosixMap::Result(), XrdPosixGlobals::theCache, XrdPosixAdmin::Url, XrdPosixGlobals::usingEC, and XrdPosixAdmin::Xrd.

Referenced by XrdPssSys::Rename(), and XrdFfsPosix_rename().

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

## Rewinddir()

void XrdPosixXrootd::Rewinddir | ( | DIR * | dirp | ) |

static

Rewinddir() conforms to POSIX.1-2001 rewinddir().

Definition at line 1100 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
int fildes = XrdPosixDir::dirNo(dirp);
// Find the object and rewind it
//
if ((dP = XrdPosixObject::Dir(fildes)))
{dP->rewind();
dP->UnLock();
}
}
XrdPosixDir::rewind
void rewind()
Definition XrdPosixDir.hh:80

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), XrdPosixDir::rewind(), and XrdPosixObject::UnLock().

Here is the call graph for this function:

## Rmdir()

int XrdPosixXrootd::Rmdir | ( | const char * | path | ) |

static

Rmdir() conforms to POSIX.1-2001 rmdir().

Definition at line 1117 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
// Make sure the admin is OK
//
if (!admin.isOK()) return -1;
// Remove directory from the cache first
//
if (XrdPosixGlobals::theCache)
{LfnPath rmd("rmdir", path);
if (!rmd.path) return -1;
XrdPosixGlobals::theCache->Rmdir(rmd.path);
}
// Issue the rmdir
//
return XrdPosixMap::Result(admin.Xrd.RmDir(admin.Url.GetPathWithParams()),
XrdPosixGlobals::ecMsg, true);
}
XrdOucCache::Rmdir
virtual int Rmdir(const char *dirp)
Definition XrdOucCache.hh:622

References XrdPosixGlobals::ecMsg, XrdCl::URL::GetPathWithParams(), XrdPosixAdmin::isOK(), XrdPosixMap::Result(), XrdCl::FileSystem::RmDir(), XrdPosixGlobals::theCache, XrdPosixAdmin::Url, and XrdPosixAdmin::Xrd.

Referenced by XrdPssSys::Remdir(), and XrdFfsPosix_rmdir().

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

## Seekdir()

void XrdPosixXrootd::Seekdir | ( | DIR * | dirp,
|  | long | loc )

static

Seekdir() conforms to POSIX.1-2001 seekdir().

Definition at line 1143 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
int fildes = XrdPosixDir::dirNo(dirp);
// Find the object
//
if (!(dP = XrdPosixObject::Dir(fildes))) return;
// Sets the current directory position
//
if (dP->Unread() && !(dP->Open()))
{if (loc >= dP->getEntries()) loc = dP->getEntries();
else if (loc < 0) loc = 0;
dP->setOffset(loc);
}
dP->UnLock();
}
XrdPosixDir::Unread
bool Unread()
Definition XrdPosixDir.hh:86
XrdPosixDir::setOffset
void setOffset(long offset)
Definition XrdPosixDir.hh:69
XrdPosixDir::getEntries
long getEntries()
Definition XrdPosixDir.hh:65

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), XrdPosixDir::getEntries(), XrdPosixDir::Open(), XrdPosixDir::setOffset(), XrdPosixObject::UnLock(), and XrdPosixDir::Unread().

Here is the call graph for this function:

## Stat()

int XrdPosixXrootd::Stat | ( | const char * | path,
|  | struct stat * | buf )

static

Stat() conforms to POSIX.1-2001 stat().

Definition at line 1166 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
bool cacheChk = false;
// Make sure the admin is OK
//
if (!admin.isOK()) return -1;
// Initialize the stat buffer
//
XrdPosixConfig::initStat(buf);
// Check if we can get the stat informatation from the cache
//
if (! XrdPosixGlobals::usingEC && XrdPosixGlobals::theCache)
{LfnPath statX("stat", path, false);
if (!statX.path) return -1;
int rc = XrdPosixGlobals::theCache->Stat(statX.path, *buf);
if (!rc) return 0;
if (rc < 0) {errno = -rc; return -1;} // does the cache set this???
cacheChk = true;
}
// Issue the stat and verify that all went well
//
if (XrdPosixGlobals::usingEC)
return EcStat(path, buf, admin);
if (!admin.Stat(*buf)) return -1;
// If we are here and the cache was checked then the file was not in the cache.
// We informally tell the caller this is the case by setting atime to zero.
// Normally, atime will never be zero in any other case.
//
if (cacheChk) buf->st_atime = 0;
return 0;
}
XrdOucCache::Stat
virtual int Stat(const char *url, struct stat &sbuff)
Definition XrdOucCache.hh:638

References XrdPosixGlobals::ecMsg, XrdPosixConfig::initStat(), XrdPosixAdmin::isOK(), XrdPosixAdmin::Stat(), stat, XrdPosixGlobals::theCache, and XrdPosixGlobals::usingEC.

Referenced by XrdPssFile::Fstat(), main(), XrdPssSys::Stat(), and XrdFfsPosix_stat().

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

## Statfs()

int XrdPosixXrootd::Statfs | ( | const char * | path,
|  | struct statfs * | buf )

static

Statfs() generally conforms to the platform-specific definition of statfs(). There is no specific POSIX specification for this call.

Definition at line 1209 of file XrdPosixXrootd.cc.

{
struct statvfs myVfs;
int rc;
// Issue a statvfs() call and transcribe the results
//
if ((rc = Statvfs(path, &myVfs))) return rc;
// The vfs structure and fs structures should be size compatible (not really)
//
memset(buf, 0, sizeof(struct statfs));
buf->f_bsize = myVfs.f_bsize;
buf->f_blocks = myVfs.f_blocks;
buf->f_bfree = myVfs.f_bfree;
buf->f_files = myVfs.f_files;
buf->f_ffree = myVfs.f_ffree;
#if defined(__APPLE__) || defined(__FreeBSD__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
buf->f_iosize = myVfs.f_frsize;
#else
buf->f_frsize = myVfs.f_frsize;
#endif
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
buf->f_bavail = myVfs.f_bavail;
#endif
#if defined(__linux__) || defined(__GNU__)
buf->f_namelen = myVfs.f_namemax;
#elif defined(__FreeBSD__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
buf->f_namemax = myVfs.f_namemax;
#endif
return 0;
}
statvfs
#define statvfs(a, b)
Definition XrdPosix.hh:105
statfs
#define statfs(a, b)
Definition XrdPosix.hh:103
XrdPosixXrootd::Statvfs
static int Statvfs(const char *path, struct statvfs *buf)
Statvfs() conforms to POSIX.1-2001 statvfs().
Definition XrdPosixXrootd.cc:1265

References statfs, Statvfs(), and statvfs.

Here is the call graph for this function:

## StatRet()

int XrdPosixXrootd::StatRet | ( | DIR * | dirp,
|  | struct stat * | buf )

static

Definition at line 1246 of file XrdPosixXrootd.cc.

{
// Find the object
//
auto fildes = XrdPosixDir::dirNo(dirp);
auto dP = XrdPosixObject::Dir(fildes);
if (!dP) return EBADF;
// Get the stat info
auto rc = dP->StatRet(buf);
dP->UnLock();
return rc;
}

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), and stat.

Referenced by XrdPssDir::StatRet().

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

## Statvfs()

int XrdPosixXrootd::Statvfs | ( | const char * | path,
|  | struct statvfs * | buf )

static

Statvfs() conforms to POSIX.1-2001 statvfs().

Definition at line 1265 of file XrdPosixXrootd.cc.

{
static const int szVFS = sizeof(buf->f_bfree);
static const long long max32 = 0x7fffffffLL;
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
XrdCl::StatInfoVFS *vfsStat;
long long rwFree, ssFree, rwBlks;
int rwNum, ssNum, rwUtil, ssUtil;
// Make sure we connected
//
if (!admin.isOK()) return -1;
// Issue the statfvs call
//
if (XrdPosixMap::Result(admin.Xrd.StatVFS(admin.Url.GetPathWithParams(),
vfsStat),
XrdPosixGlobals::ecMsg) < 0) return -1;
// Extract out the information
//
rwNum = static_cast<int>(vfsStat->GetNodesRW());
rwFree = (long long)vfsStat->GetFreeRW();
rwUtil = static_cast<int>(vfsStat->GetUtilizationRW());
ssNum = static_cast<int>(vfsStat->GetNodesStaging());
ssFree = (long long)vfsStat->GetFreeStaging();
ssUtil = static_cast<int>(vfsStat->GetUtilizationStaging());
delete vfsStat;
// Calculate number of blocks
//
if (rwUtil == 0) rwBlks = rwFree;
else if (rwUtil >= 100) rwBlks = 0;
else rwBlks = rwFree * (100 / (100 - rwUtil));
if (ssUtil == 0) rwBlks += ssFree;
else if (ssUtil < 100) rwBlks += ssFree * (100 / (100 - ssUtil));
// Scale units to what will fit here (we can have a 32-bit or 64-bit struct)
//
if (szVFS < 8)
{if (rwBlks > max32) rwBlks = max32;
if (rwFree > max32) rwFree = max32;
if (ssFree > max32) ssFree = max32;
}
// Return what little we can
//
memset(buf, 0, sizeof(struct statvfs));
buf->f_bsize = 1024*1024;
buf->f_frsize = 1024*1024;
buf->f_blocks = static_cast<fsblkcnt_t>(rwBlks);
buf->f_bfree = static_cast<fsblkcnt_t>(rwFree + ssFree);
buf->f_bavail = static_cast<fsblkcnt_t>(rwFree);
buf->f_ffree = rwNum + ssNum;
buf->f_favail = rwNum;
buf->f_namemax = 255; // The best we are going to do here
buf->f_flag = (rwNum == 0 ? ST_RDONLY|ST_NOSUID : ST_NOSUID);
return 0;
}
XrdCl::StatInfoVFS::GetFreeRW
uint64_t GetFreeRW() const
Get size of the largest contiguous area of free r/w space (in MB).
Definition XrdClXRootDResponses.hh:592
XrdCl::StatInfoVFS::GetNodesStaging
uint64_t GetNodesStaging() const
Get number of nodes that can provide staging space.
Definition XrdClXRootDResponses.hh:608
XrdCl::StatInfoVFS::GetUtilizationStaging
uint8_t GetUtilizationStaging() const
Get percentage of the partition utilization represented by FreeStaging.
Definition XrdClXRootDResponses.hh:624
XrdCl::StatInfoVFS::GetFreeStaging
uint64_t GetFreeStaging() const
Get size of the largest contiguous area of free staging space (in MB).
Definition XrdClXRootDResponses.hh:616
XrdCl::StatInfoVFS::GetUtilizationRW
uint8_t GetUtilizationRW() const
Get percentage of the partition utilization represented by FreeRW.
Definition XrdClXRootDResponses.hh:600
XrdCl::StatInfoVFS::GetNodesRW
uint64_t GetNodesRW() const
Get number of nodes that can provide read/write space.
Definition XrdClXRootDResponses.hh:584

References XrdPosixGlobals::ecMsg, XrdCl::StatInfoVFS::GetFreeRW(), XrdCl::StatInfoVFS::GetFreeStaging(), XrdCl::StatInfoVFS::GetNodesRW(), XrdCl::StatInfoVFS::GetNodesStaging(), XrdCl::URL::GetPathWithParams(), XrdCl::StatInfoVFS::GetUtilizationRW(), XrdCl::StatInfoVFS::GetUtilizationStaging(), XrdPosixAdmin::isOK(), XrdPosixMap::Result(), XrdCl::FileSystem::StatVFS(), statvfs, XrdPosixAdmin::Url, and XrdPosixAdmin::Xrd.

Referenced by Statfs().

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

## Telldir()

long XrdPosixXrootd::Telldir | ( | DIR * | dirp | ) |

static

Telldir() conforms to POSIX.1-2001 telldir().

Definition at line 1331 of file XrdPosixXrootd.cc.

{
XrdPosixDir *dP;
long pos;
int fildes = XrdPosixDir::dirNo(dirp);
// Find the object
//
if (!(dP = XrdPosixObject::Dir(fildes)))
return XrdPosixGlobals::ecMsg.SetErrno(EBADF,0);
// Tell the current directory location
//
pos = dP->getOffset();
dP->UnLock();
return pos;
}
XrdPosixDir::getOffset
long getOffset()
Definition XrdPosixDir.hh:67

References XrdPosixObject::Dir(), XrdPosixDir::dirNo(), XrdPosixGlobals::ecMsg, XrdPosixDir::getOffset(), and XrdPosixObject::UnLock().

Here is the call graph for this function:

## Truncate()

int XrdPosixXrootd::Truncate | ( | const char * | path,
|  | off_t | offset )

static

Telldir() conforms to POSIX.1-2001 telldir().

Definition at line 1353 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
uint64_t tSize = static_cast<uint64_t>(Size);
// Make sure the admin is OK
//
if (!admin.isOK()) return -1;
// Truncate in the cache first
//
if (XrdPosixGlobals::theCache)
{LfnPath trunc("truncate", path);
if (!trunc.path) return -1;
XrdPosixGlobals::theCache->Truncate(trunc.path, tSize);
}
// Issue the truncate to the origin
//
std::string urlp = admin.Url.GetPathWithParams();
return XrdPosixMap::Result(admin.Xrd.Truncate(urlp,tSize),
XrdPosixGlobals::ecMsg,true);
}
XrdOucCache::Truncate
virtual int Truncate(const char *path, off_t size)
Definition XrdOucCache.hh:651

References XrdPosixGlobals::ecMsg, XrdCl::URL::GetPathWithParams(), XrdPosixAdmin::isOK(), XrdPosixMap::Result(), XrdPosixGlobals::theCache, XrdCl::FileSystem::Truncate(), XrdPosixAdmin::Url, and XrdPosixAdmin::Xrd.

Referenced by XrdPssSys::Truncate(), and XrdFfsPosix_truncate().

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

## Unlink()

int XrdPosixXrootd::Unlink | ( | const char * | path | ) |

static

Unlink() conforms to POSIX.1-2001 unlink().

Definition at line 1381 of file XrdPosixXrootd.cc.

{
XrdPosixAdmin admin(path,XrdPosixGlobals::ecMsg);
// Make sure the admin is OK
//
if (!admin.isOK()) return -1;
// Unlink the cache first
//
if (XrdPosixGlobals::theCache)
{LfnPath remf("unlink", path);
if (!remf.path) return -1;
XrdPosixGlobals::theCache->Unlink(remf.path);
}
// Issue the UnLink
//
if (XrdPosixGlobals::usingEC)
return EcUnlink(path, admin);
return XrdPosixMap::Result(admin.Xrd.Rm(admin.Url.GetPathWithParams()),
XrdPosixGlobals::ecMsg, true);
}
XrdOucCache::Unlink
virtual int Unlink(const char *path)
Definition XrdOucCache.hh:663

References XrdPosixGlobals::ecMsg, XrdCl::URL::GetPathWithParams(), XrdPosixAdmin::isOK(), XrdPosixMap::Result(), XrdCl::FileSystem::Rm(), XrdPosixGlobals::theCache, XrdPosixAdmin::Url, XrdPosixGlobals::usingEC, and XrdPosixAdmin::Xrd.

Referenced by XrdPssSys::Unlink(), and XrdFfsPosix_unlink().

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

## VRead() [1/2]

ssize_t XrdPosixXrootd::VRead | ( | int | fildes,
|  | const XrdOucIOVec * | readV,
|  | int | n )

static

Definition at line 930 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
ssize_t bytes;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Issue the read
//
if ((bytes = fp->XCio->ReadV(readV, n)) < 0) return Fault(fp,-bytes);
// Return bytes read
//
fp->UnLock();
return bytes;
}
XrdOucCacheIO::ReadV
virtual int ReadV(const XrdOucIOVec *readV, int rnum)
Definition XrdOucCache.cc:86

References XrdPosixObject::File(), XrdOucCacheIO::ReadV(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Here is the call graph for this function:

## VRead() [2/2]

void XrdPosixXrootd::VRead | ( | int | fildes,
|  | const XrdOucIOVec * | readV,
|  | int | n,
|  | XrdPosixCallBackIO * | cbp )

static

VRead() is a POSIX extension and allows one to read multiple chunks of a file in one operation.

Parameters

  fildes | file descriptor of a file opened for reading.
  readV | the read vector of offset/length/buffer triplets. Data at each offset of the specifiued length is placed in buffer.
  n | the number of elements in the readV vector.
  cbp | pointer to the callback object for async execution.

Definition at line 951 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
// Find the file object and issue read
//
if ((fp = XrdPosixObject::File(fildes)))
{cbp->theFile = fp;
fp->Ref(); fp->UnLock();
fp->XCio->ReadV(*cbp, readV, n);
} else cbp->Complete(-1);
}

References XrdPosixCallBackIO::Complete(), XrdPosixObject::File(), XrdOucCacheIO::ReadV(), XrdPosixObject::Ref(), XrdPosixObject::UnLock(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::ReadV().

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

## Write()

ssize_t XrdPosixXrootd::Write | ( | int | fildes,
|  | const void * | buf,
|  | size_t | nbyte )

static

Write() conforms to POSIX.1-2001 write().

Definition at line 1410 of file XrdPosixXrootd.cc.

{
XrdPosixFile *fp;
int iosz, bytes;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes))) return -1;
// Make sure the size is not too large
//
if (nbyte > (size_t)0x7fffffff) return Fault(fp,EOVERFLOW);
else iosz = static_cast<int>(nbyte);
// Issue the write
//
bytes = fp->XCio->Write((char *)buf,fp->Offset(),(int)iosz);
if (bytes < 0) return Fault(fp,-bytes);
// All went well
//
fp->addOffset(iosz, 1);
fp->UnLock();
return (ssize_t)iosz;
}

References XrdPosixFile::addOffset(), XrdPosixObject::File(), XrdPosixFile::Offset(), XrdPosixObject::UnLock(), XrdOucCacheIO::Write(), and XrdPosixFile::XCio.

Referenced by Writev(), and XrdFfsPosix_write().

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

## Writev()

ssize_t XrdPosixXrootd::Writev | ( | int | fildes,
|  | const struct iovec * | iov,
|  | int | iovcnt )

static

Writev() conforms to POSIX.1-2001 writev().

Definition at line 1440 of file XrdPosixXrootd.cc.

{
ssize_t totbytes = 0;
int i;
// Return the results of the write for each iov segment
//
for (i = 0; i < iovcnt; i++)
{if (!Write(fildes,(void *)iov[i].iov_base,(size_t)iov[i].iov_len))
return -1;
totbytes += iov[i].iov_len;
}
// All done
//
return totbytes;
}
XrdPosixXrootd::Write
static ssize_t Write(int fildes, const void *buf, size_t nbyte)
Write() conforms to POSIX.1-2001 write().
Definition XrdPosixXrootd.cc:1410

References Write().

Here is the call graph for this function:

## Friends And Related Symbol Documentation

## XrdPosixConfig

friend class XrdPosixConfig

friend

Definition at line 66 of file XrdPosixXrootd.hh.

References XrdPosixConfig.

Referenced by XrdPosixConfig.

## XrdPosixExtra

friend class XrdPosixExtra

friend

Definition at line 67 of file XrdPosixXrootd.hh.

References stat, and XrdPosixExtra.

Referenced by XrdPosixExtra.

## Member Data Documentation

## isStream

const int XrdPosixXrootd::isStream = 0x40000000

static

Open() conforms to POSIX.1-2001 open() when extensions are not used.

Extensions:

Parameters

  cbP | Pointer to a callback object. When specified, the open is performed in the background and the Comp[lete() is called when the Open() completes. See XrdPosixCallBack.hh for complete details.

Returns
  -1 is always returned when cbP is specified. If the Open() was actually scheduled then errno will contain EINPROGRESS. Otherwise, the Open() immediately failed and errno contains the reason.

Definition at line 166 of file XrdPosixXrootd.hh.

Referenced by XrdPosix_Fopen().

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

- XrdPosixXrootd.hh
- XrdPosixXrootd.cc