Loading...
Searching...
No Matches
XrdPssFile Class Reference

`#include <XrdPss.hh>`

Inheritance diagram for XrdPssFile:
Collaboration diagram for XrdPssFile:

## Public Member Functions

| XrdPssFile (const char *tid)
virtual | ~XrdPssFile ()
virtual int | Close (long long *retsz=0)
int | Fchmod (mode_t mode)
int | Fstat (struct stat *)
int | Fsync ()
int | Fsync (XrdSfsAio *aiop)
int | Ftruncate (unsigned long long)
virtual int | Open (const char *, int, mode_t, XrdOucEnv &)
ssize_t | pgRead (void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
int | pgRead (XrdSfsAio *aioparm, uint64_t opts)
ssize_t | pgWrite (void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
int | pgWrite (XrdSfsAio *aioparm, uint64_t opts)
ssize_t | Read (off_t, size_t)
ssize_t | Read (void *, off_t, size_t)
int | Read (XrdSfsAio *aiop)
ssize_t | ReadRaw (void *, off_t, size_t)
ssize_t | ReadV (XrdOucIOVec *readV, int n)
ssize_t | Write (const void *, off_t, size_t)
int | Write (XrdSfsAio *aiop)
Public Member Functions inherited from XrdOssDF
| XrdOssDF (const char *tid="", uint16_t dftype=0, int fdnum=-1)
virtual | ~XrdOssDF ()
uint16_t | DFType ()
virtual int | Fctl (int cmd, int alen, const char *args, char **resp=0)
virtual void | Flush ()
| Flush filesystem cached pages for this file (used for checksums).
virtual int | getFD ()
virtual off_t | getMmap (void **addr)
virtual const char * | getTID ()
virtual int | isCompressed (char *cxidp=0)
virtual int | Opendir (const char *path, XrdOucEnv &env)
virtual int | Readdir (char *buff, int blen)
virtual int | StatRet (struct stat *buff)
virtual ssize_t | WriteV (XrdOucIOVec *writeV, int wrvcnt)

## Additional Inherited Members

Static Public Attributes inherited from XrdOssDF
static const uint16_t | DF_isDir = 0x0001
| Object is for a directory.
static const uint16_t | DF_isFile = 0x0002
| Object is for a file.
static const uint16_t | DF_isProxy = 0x0010
| Object is a proxy object.
static const uint64_t | doCalc = 0x4000000000000000ULL
| pgw: Calculate checksums
static const int | Fctl_ckpObj = 0
static const int | Fctl_utimes = 1
static const uint64_t | Verify = 0x8000000000000000ULL
| all: Verify checksums
Protected Attributes inherited from XrdOssDF
uint16_t | dfType
int | fd
off_t | pgwEOF
short | rsvd
const char * | tident

## Detailed Description

Definition at line 81 of file XrdPss.hh.

## Constructor & Destructor Documentation

## XrdPssFile()

XrdPssFile::XrdPssFile | ( | const char * | tid | ) |

inline

Definition at line 111 of file XrdPss.hh.

: XrdOssDF(tid, XrdOssDF::DF_isFile|XrdOssDF::DF_isProxy),
rpInfo(0), tpcPath(0), entity(0) {}
XrdOssDF::DF_isFile
static const uint16_t DF_isFile
Object is for a file.
Definition XrdOss.hh:393
XrdOssDF::XrdOssDF
XrdOssDF(const char *tid="", uint16_t dftype=0, int fdnum=-1)
Definition XrdOss.hh:444
XrdOssDF::DF_isProxy
static const uint16_t DF_isProxy
Object is a proxy object.
Definition XrdOss.hh:394

References XrdOssDF::XrdOssDF(), XrdOssDF::DF_isFile, and XrdOssDF::DF_isProxy.

Here is the call graph for this function:

## ~XrdPssFile()

virtual XrdPssFile::~XrdPssFile | ( |  | ) |

inline virtual

Definition at line 115 of file XrdPss.hh.

{if (fd >= 0) Close();
if (rpInfo) delete(rpInfo);
if (tpcPath) free(tpcPath);
}
XrdOssDF::fd
int fd
Definition XrdOss.hh:455
XrdPssFile::Close
virtual int Close(long long *retsz=0)
Definition XrdPss.cc:919

References Close(), and XrdOssDF::fd.

Here is the call graph for this function:

## Member Function Documentation

## Close()

int XrdPssFile::Close | ( | long long * | retsz = 0 | ) |

virtual

Close a directory or file.

Parameters

  retsz | If not nil, where the size of the file is to be returned.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOssDF.

Definition at line 919 of file XrdPss.cc.

{ int rc;
// We don't support returning the size (we really should fix this)
//
if (retsz) *retsz = 0;
// If the file is not open, then this may be OK if it is a 3rd party copy
//
if (fd < 0)
{if (!tpcPath) return -XRDOSS_E8004;
free(tpcPath);
tpcPath = 0;
return XrdOssOK;
}
// Close the file
//
rc = XrdPosixXrootd::Close(fd);
fd = -1;
return (rc == 0 ? XrdOssOK : -errno);
}
XRDOSS_E8004
#define XRDOSS_E8004
Definition XrdOssError.hh:38
XrdOssOK
#define XrdOssOK
Definition XrdOss.hh:50
XrdPosixXrootd::Close
static int Close(int fildes)
Close() conforms to POSIX.1-2001 close().
Definition XrdPosixXrootd.cc:268

References XrdPosixXrootd::Close(), XrdOssDF::fd, XRDOSS_E8004, and XrdOssOK.

Referenced by ~XrdPssFile().

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

## Fchmod()

int XrdPssFile::Fchmod | ( | mode_t | mode | ) |

inline virtual

Change file mode settings.

Parameters

  mode | - The new file mode setting.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 91 of file XrdPss.hh.

{return XrdOssOK;}

References XrdOssOK.

## Fstat()

int XrdPssFile::Fstat | ( | struct stat * | buf | ) |

virtual

Return state information for this file.

Parameters

  buf | - Pointer to the structure where info it to be returned.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1187 of file XrdPss.cc.

{
EPNAME("fstat");
// If we have a file descriptor then return a stat for it
//
if (fd >= 0) return (XrdPosixXrootd::Fstat(fd, buff) ? -errno : XrdOssOK);
// Otherwise, if this is not a tpc of any kind, return an error
//
if (!tpcPath) return -XRDOSS_E8004;
// If this is a normal tpc then simply issue the stat against the origin
//
if (!rpInfo)
{XrdOucEnv fstatEnv(0, 0, entity);
return XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv);
}
// This is a reproxy tpc, if we have not yet dertermined the true dest, do so.
//
struct stat Stat;
if (rpInfo->dstURL == 0
|| !fstatat(rpFD, rpInfo->tprPath, &Stat, AT_SYMLINK_NOFOLLOW))
{char lnkbuff[2048]; int lnklen;
lnklen = readlinkat(rpFD, rpInfo->tprPath, lnkbuff, sizeof(lnkbuff)-1);
if (lnklen <= 0)
{int rc = 0;
if (lnklen < 0) {if (errno != ENOENT) rc = -errno;}
else rc = -EFAULT;
if (rc)
{unlinkat(rpFD, rpInfo->tprPath, 0);
return rc;
}
} else {
unlinkat(rpFD, rpInfo->tprPath, 0);
lnkbuff[lnklen] = 0;
if (rpInfo->dstURL) free(rpInfo->dstURL);
rpInfo->dstURL = strdup(lnkbuff);
rpInfo->fSize = 1;
DEBUG(tident,rpInfo->tprPath<<" maps "<<tpcPath<<" -> "<<lnkbuff);
}
}
// At this point we may or may not have the final endpoint. An error here could
// be due to write error recovery, so make allowance for that.
//
if (rpInfo->dstURL)
{if (!XrdPosixXrootd::Stat(rpInfo->dstURL, buff))
{if (!(rpInfo->fSize = buff->st_size)) rpInfo->fSize = 1;
return XrdOssOK;
}
free(rpInfo->dstURL);
rpInfo->dstURL = 0;
}
// We don't have the final endpoint. If we ever had it before, then punt.
//
if (rpInfo->fSize)
{memset(buff, 0, sizeof(struct stat));
buff->st_size = rpInfo->fSize;
return XrdOssOK;
}
// If we are here then maybe the reproxy option was the wrong config setting.
// Give stat a try on the origin we'll retry resolution on the next stat.
//
XrdOucEnv fstatEnv(0, 0, entity);
if (XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv))
memset(buff, 0, sizeof(struct stat));
return XrdOssOK;
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
Stat
struct stat Stat
Definition XrdCks.cc:49
stat
#define stat(a, b)
Definition XrdPosix.hh:101
XrdOssDF::tident
const char * tident
Definition XrdOss.hh:453
XrdPosixXrootd::Stat
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat().
Definition XrdPosixXrootd.cc:1166
XrdPosixXrootd::Fstat
static int Fstat(int fildes, struct stat *buf)
Fstat() conforms to POSIX.1-2001 fstat().
Definition XrdPosixXrootd.cc:369
XrdPssSys::Stat
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:490
XrdProxy::rpFD
int rpFD
Definition XrdPss.cc:121
XrdProxy::XrdProxySS
static XrdPssSys XrdProxySS
Definition XrdPss.cc:101

References DEBUG, EPNAME, XrdOssDF::fd, XrdPosixXrootd::Fstat(), XrdProxy::rpFD, Stat, XrdPosixXrootd::Stat(), stat, XrdOssDF::tident, XRDOSS_E8004, XrdOssOK, and XrdProxy::XrdProxySS.

Here is the call graph for this function:

## Fsync() [1/2]

int XrdPssFile::Fsync | ( | void |  | ) |

virtual

Synchronize associated file with media (synchronous).

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1273 of file XrdPss.cc.

{
if (fd < 0) return -XRDOSS_E8004;
return (XrdPosixXrootd::Fsync(fd) ? -errno : XrdOssOK);
}
XrdPosixXrootd::Fsync
static int Fsync(int fildes)
Fsync() conforms to POSIX.1-2001 fsync().
Definition XrdPosixXrootd.cc:405

References XrdOssDF::fd, XrdPosixXrootd::Fsync(), XRDOSS_E8004, and XrdOssOK.

Here is the call graph for this function:

## Fsync() [2/2]

int XrdPssFile::Fsync | ( | XrdSfsAio * | aiop | ) |

virtual

Synchronize associated file with media (asynchronous).

Parameters

  aiop | - Pointer to async I/O request object.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 53 of file XrdPssAio.cc.

{
// Execute this request in an asynchronous fashion
//
XrdPosixXrootd::Fsync(fd, XrdPssAioCB::Alloc(aiop, true));
return 0;
}
XrdPssAioCB::Alloc
static XrdPssAioCB * Alloc(XrdSfsAio *aiop, bool isWr, bool pgrw=false)
Definition XrdPssAioCB.cc:49

References XrdPssAioCB::Alloc(), XrdOssDF::fd, and XrdPosixXrootd::Fsync().

Here is the call graph for this function:

## Ftruncate()

int XrdPssFile::Ftruncate | ( | unsigned long long | flen | ) |

virtual

Set the size of the associated file.

Parameters

  flen | - The new size of the file.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1302 of file XrdPss.cc.

{
if (fd < 0) return -XRDOSS_E8004;
return (XrdPosixXrootd::Ftruncate(fd, flen) ? -errno : XrdOssOK);
}
XrdPosixXrootd::Ftruncate
static int Ftruncate(int fildes, off_t offset)
Ftruncate() conforms to POSIX.1-2001 ftruncate().
Definition XrdPosixXrootd.cc:440

References XrdOssDF::fd, XrdPosixXrootd::Ftruncate(), XRDOSS_E8004, and XrdOssOK.

Here is the call graph for this function:

## Open()

int XrdPssFile::Open | ( | const char * | path,
|  | int | Oflag,
|  | mode_t | Mode,
|  | XrdOucEnv & | env )

virtual

Open a file.

Parameters

  path | - Pointer to the path of the file to be opened.
  Oflag | - Standard open flags.
  Mode | - File open mode (ignored unless creating a file).
  env | - Reference to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 783 of file XrdPss.cc.

{
EPNAME("Open");
unsigned long long popts = XrdPssSys::XPList.Find(path);
const char *Cgi = "";
char pbuff[PBsz];
int rc;
bool tpcMode = (Oflag & O_NOFOLLOW) != 0;
bool rwMode = (Oflag & O_ACCMODE) != O_RDONLY;
bool ucgiOK = true;
bool ioCache = (Oflag & O_DIRECT);
// Record the security environment
//
entity = Env.secEnv();
// Turn off direct flag if set (we record it separately
//
if (ioCache) Oflag &= ~O_DIRECT;
// Return an error if the object is already open
//
if (fd >= 0 || tpcPath) return -XRDOSS_E8003;
// If we are opening this in r/w mode make sure we actually can
//
if (rwMode)
{if (XrdPssSys::fileOrgn) return -EROFS;
if (popts & XRDEXP_NOTRW)
{if (popts & XRDEXP_FORCERO && !tpcMode) Oflag = O_RDONLY;
else return -EROFS;
}
}
// check CGI cache-control paramters
if (cacheFSctl)
{
int elen;
char *envcgi = (char *)Env.Env(elen);
if (envcgi && strstr(envcgi, "only-if-cached"))
{
XrdOucErrInfo einfo;
XrdSfsFSctl myData;
myData.Arg1 = "cached";
myData.Arg1Len = 1;
myData.Arg2Len = 1;
const char *myArgs[1];
myArgs[0] = path;
myData.ArgP = myArgs;
int fsctlRes = cacheFSctl->FSctl(SFS_FSCTL_PLUGXC, myData, einfo);
if (fsctlRes == SFS_ERROR)
return -einfo.getErrInfo();
}
}
// If this is a third party copy open, then strange rules apply. If this is an
// outgoing proxy we let everything pass through as this may be a TPC request
// elsewhere. Otherwise, if it's an open for reading, we open the file but
// strip off all CGI (technically, we should only remove the "tpc" tokens)
// because the source might not support direct TPC mode. If we are opening for
// writing, then we skip the open and mark this as a TPC handle which can only
// be used for fstat() and close(). Any other actions return an error.
//
if (tpcMode)
{Oflag &= ~O_NOFOLLOW;
if (!XrdProxy::outProxy || !IS_FWDPATH(path))
{if (rwMode)
{tpcPath = strdup(path);
if (XrdPssSys::reProxy)
{const char *rPath = Env.Get("tpc.reproxy");
if (!rPath || *rPath != '/') return -ENOATTR;
if (!(rPath = rindex(rPath, '/')) || *(rPath+1) == 0)
return -EFAULT;
rpInfo = new tprInfo(rPath+1);
}
return XrdOssOK;
}
ucgiOK = false;
}
}
// Setup any required cgi information. Don't mess with it if it's an objectid
// or if the we are an outgoing proxy server.
//
if (!XrdProxy::outProxy && *path == '/' && !(XRDEXP_STAGE & popts))
Cgi = osslclCGI;
// Construct the url info
//
XrdPssUrlInfo uInfo(&Env, path, Cgi, ucgiOK);
uInfo.setID();
// Convert path to URL
//
if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
return rc;
// Do some tracing
//
if(DEBUGON) {
auto urlObf = obfuscateAuth(pbuff);
DEBUG(uInfo.Tident(),"url="<<urlObf);
}
// Try to open and if we failed, return an error
//
if (!XrdPssSys::dcaCheck || !ioCache)
{if ((fd = XrdPosixXrootd::Open(pbuff,Oflag,Mode)) < 0) return -errno;
} else {
XrdPosixInfo Info;
Info.ffReady = XrdPssSys::dcaWorld;
if (XrdPosixConfig::OpenFC(pbuff,Oflag,Mode,Info))
{Env.Put("FileURL", Info.cacheURL);
return -EDESTADDRREQ;
}
fd = Info.fileFD;
if (fd < 0) return -errno;
}
// All done
//
return XrdOssOK;
}
ENOATTR
#define ENOATTR
Definition XProtocol.hh:1343
O_DIRECT
#define O_DIRECT
Definition XrdCrc32c.cc:51
XRDOSS_E8003
#define XRDOSS_E8003
Definition XrdOssError.hh:37
XRDEXP_NOTRW
#define XRDEXP_NOTRW
Definition XrdOucExport.hh:45
XRDEXP_FORCERO
#define XRDEXP_FORCERO
Definition XrdOucExport.hh:43
XRDEXP_STAGE
#define XRDEXP_STAGE
Definition XrdOucExport.hh:52
obfuscateAuth
std::string obfuscateAuth(const std::string &input)
Definition XrdOucUtils.cc:1534
DEBUGON
#define DEBUGON
Definition XrdPosixTrace.hh:41
IS_FWDPATH
#define IS_FWDPATH(x)
Definition XrdPssUtils.hh:64
Mode
int Mode
Definition XrdSecgsiProxy.cc:94
XrdSfsFSctl::Arg1
const char * Arg1
PLUGINO, PLUGION, PLUGXC.
Definition XrdSfsInterface.hh:163
XrdSfsFSctl::Arg2Len
int Arg2Len
Length or -count of args in extension.
Definition XrdSfsInterface.hh:165
SFS_ERROR
#define SFS_ERROR
Definition XrdSfsInterface.hh:109
XrdSfsFSctl::Arg1Len
int Arg1Len
Length.
Definition XrdSfsInterface.hh:164
SFS_FSCTL_PLUGXC
#define SFS_FSCTL_PLUGXC
Definition XrdSfsInterface.hh:103
XrdOfsFSctl_PI::FSctl
virtual int FSctl(const int cmd, int alen, const char *args, XrdSfsFile &file, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=0
XrdOucErrInfo::getErrInfo
int getErrInfo()
Definition XrdOucErrInfo.hh:243
XrdOucPListAnchor::Find
unsigned long long Find(const char *pathname)
Definition XrdOucPList.hh:112
XrdPosixConfig::OpenFC
static bool OpenFC(const char *path, int oflag, mode_t mode, XrdPosixInfo &Info)
Definition XrdPosixConfig.cc:385
XrdPosixXrootd::Open
static int Open(const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)
Definition XrdPosixXrootd.cc:555
XrdPssSys::fileOrgn
static char * fileOrgn
Definition XrdPss.hh:202
XrdPssSys::dcaCheck
static bool dcaCheck
Definition XrdPss.hh:212
XrdPssSys::reProxy
static bool reProxy
Definition XrdPss.hh:215
XrdPssSys::XPList
static XrdOucPListAnchor XPList
Definition XrdPss.hh:198
XrdPssSys::P2URL
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1417
XrdPssSys::xLfn2Pfn
static bool xLfn2Pfn
Definition XrdPss.hh:211
XrdPssSys::dcaWorld
static bool dcaWorld
Definition XrdPss.hh:213
TPC::Info
@ Info
Definition XrdHttpTpcTPC.hh:29
XrdProxy::cacheFSctl
XrdOfsFSctl_PI * cacheFSctl
Definition XrdPss.cc:111
XrdProxy::PBsz
static const int PBsz
Definition XrdPss.cc:119
XrdProxy::osslclCGI
static const char * osslclCGI
Definition XrdPss.cc:117
XrdProxy::outProxy
bool outProxy
Definition XrdPss.cc:125

References XrdSfsFSctl::Arg1, XrdSfsFSctl::Arg1Len, XrdSfsFSctl::Arg2Len, XrdProxy::cacheFSctl, XrdPssSys::dcaCheck, XrdPssSys::dcaWorld, DEBUG, DEBUGON, ENOATTR, XrdOucEnv::Env(), EPNAME, XrdOssDF::fd, XrdPssSys::fileOrgn, XrdOucEnv::Get(), XrdOucErrInfo::getErrInfo(), IS_FWDPATH, Mode, O_DIRECT, obfuscateAuth(), XrdPosixXrootd::Open(), XrdPosixConfig::OpenFC(), XrdProxy::osslclCGI, XrdProxy::outProxy, XrdPssSys::P2URL(), XrdProxy::PBsz, XrdOucEnv::Put(), XrdPssSys::reProxy, XrdOucEnv::secEnv(), XrdPssUrlInfo::setID(), SFS_ERROR, SFS_FSCTL_PLUGXC, XrdPssUrlInfo::Tident(), XrdPssSys::xLfn2Pfn, XrdPssSys::XPList, XRDEXP_FORCERO, XRDEXP_NOTRW, XRDEXP_STAGE, XRDOSS_E8003, and XrdOssOK.

Here is the call graph for this function:

## pgRead() [1/2]

ssize_t XrdPssFile::pgRead | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | rdlen,
|  | uint32_t * | csvec,
|  | uint64_t | opts )

virtual

Reimplemented from XrdOssDF.

Definition at line 960 of file XrdPss.cc.

{
std::vector<uint32_t> vecCS;
uint64_t psxOpts;
ssize_t bytes;
// Make sure file is open
//
if (fd < 0) return (ssize_t)-XRDOSS_E8004;
// Set options as needed
//
psxOpts = (csvec ? XrdPosixExtra::forceCS : 0);
// Issue the pgread
//
if ((bytes = XrdPosixExtra::pgRead(fd,buffer,offset,rdlen,vecCS,psxOpts)) < 0)
return (ssize_t)-errno;
// Copy out the checksum vector
//
if (vecCS.size() && csvec)
memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
// All done
//
return bytes;
}
XrdPosixExtra::forceCS
static const uint64_t forceCS
Definition XrdPosixExtra.hh:67
XrdPosixExtra::pgRead
static ssize_t pgRead(int fildes, void *buffer, off_t offset, size_t rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, XrdPosixCallBackIO *cbp=0)
Definition XrdPosixExtra.cc:46

References XrdOssDF::fd, XrdPosixExtra::forceCS, opts, XrdPosixExtra::pgRead(), and XRDOSS_E8004.

Here is the call graph for this function:

## pgRead() [2/2]

int XrdPssFile::pgRead | ( | XrdSfsAio * | aioparm,
|  | uint64_t | opts )

virtual

Read file pages and checksums using asynchronous I/O.

Parameters

  aioparm | - Pointer to async I/O object controlling the I/O.
  opts | - Processing options (see above).

Returns
  0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 77 of file XrdPssAio.cc.

{
XrdPssAioCB *aioCB = XrdPssAioCB::Alloc(aiop, false, true);
uint64_t psxOpts = (aiop->cksVec ? XrdPosixExtra::forceCS : 0);
// Execute this request in an asynchronous fashion
//
XrdPosixExtra::pgRead(fd, (void *)aiop->sfsAio.aio_buf,
(off_t)aiop->sfsAio.aio_offset,
(size_t)aiop->sfsAio.aio_nbytes,
aioCB->csVec, psxOpts, aioCB);
return 0;
}
XrdPssAioCB::csVec
std::vector< uint32_t > csVec
Definition XrdPssAioCB.hh:53

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdSfsAio::cksVec, XrdPssAioCB::csVec, XrdOssDF::fd, XrdPosixExtra::forceCS, opts, XrdPosixExtra::pgRead(), and XrdSfsAio::sfsAio.

Here is the call graph for this function:

## pgWrite() [1/2]

ssize_t XrdPssFile::pgWrite | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | wrlen,
|  | uint32_t * | csvec,
|  | uint64_t | opts )

virtual

Write file pages into a file with corresponding checksums.

Parameters

  buffer | - pointer to buffer containing the bytes to write.
  offset | - The offset where the write is to start.
  wrlen | - The number of bytes to write.
  csvec | - A vector which contains the corresponding CRC32 checksum for each page. See XrdOucPgrwUtils::csNum() for sizing.
  opts | - Processing options (see above).

Returns
  >= 0 The number of bytes written upon success. or -errno or -osserr upon failure. (see XrdOssError.hh).
  < 0 -errno or -osserr upon failure. (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1013 of file XrdPss.cc.

{
std::vector<uint32_t> vecCS;
ssize_t bytes;
// Make sure we have an open file
//
if (fd < 0) return (ssize_t)-XRDOSS_E8004;
// Check if caller wants to verify the checksums before writing
//
if (csvec && (opts & XrdOssDF::Verify))
{XrdOucPgrwUtils::dataInfo dInfo((const char*)buffer,csvec,offset,wrlen);
off_t bado;
int badc;
if (!XrdOucPgrwUtils::csVer(dInfo, bado, badc)) return -EDOM;
}
// Check if caller want checksum generated and possibly returned
//
if ((opts & XrdOssDF::doCalc) || csvec == 0)
{XrdOucPgrwUtils::csCalc((const char *)buffer, offset, wrlen, vecCS);
if (csvec) memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
} else {
int n = XrdOucPgrwUtils::csNum(offset, wrlen);
vecCS.resize(n);
vecCS.assign(n, 0);
memcpy(vecCS.data(), csvec, n*sizeof(uint32_t));
}
// Issue the pgwrite
//
bytes = XrdPosixExtra::pgWrite(fd, buffer, offset, wrlen, vecCS);
// Return result
//
return (bytes < 0 ? (ssize_t)-errno : bytes);
}
opts
struct myOpts opts
XrdOssDF::doCalc
static const uint64_t doCalc
pgw: Calculate checksums
Definition XrdOss.hh:225
XrdOssDF::Verify
static const uint64_t Verify
all: Verify checksums
Definition XrdOss.hh:223
XrdOucPgrwUtils::csCalc
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)
Definition XrdOucPgrwUtils.cc:54
XrdOucPgrwUtils::csVer
static bool csVer(dataInfo &dInfo, off_t &bado, int &badc)
Definition XrdOucPgrwUtils.cc:166
XrdOucPgrwUtils::csNum
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset & length.
Definition XrdOucPgrwUtils.cc:109
XrdPosixExtra::pgWrite
static ssize_t pgWrite(int fildes, void *buffer, off_t offset, size_t wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, XrdPosixCallBackIO *cbp=0)
Definition XrdPosixExtra.cc:111

References XrdOucPgrwUtils::csCalc(), XrdOucPgrwUtils::csNum(), XrdOucPgrwUtils::csVer(), XrdOssDF::doCalc, XrdOssDF::fd, opts, XrdPosixExtra::pgWrite(), XrdOssDF::Verify, and XRDOSS_E8004.

Here is the call graph for this function:

## pgWrite() [2/2]

int XrdPssFile::pgWrite | ( | XrdSfsAio * | aioparm,
|  | uint64_t | opts )

virtual

Write file pages and checksums using asynchronous I/O.

Parameters

  aioparm | - Pointer to async I/O object controlling the I/O.
  opts | - Processing options (see above).

Returns
  0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 106 of file XrdPssAio.cc.

{
// Check if caller wants to verify the checksums before writing
//
if (aiop->cksVec && (opts & XrdOssDF::Verify))
{XrdOucPgrwUtils::dataInfo dInfo((const char *)(aiop->sfsAio.aio_buf),
aiop->cksVec, aiop->sfsAio.aio_offset,
aiop->sfsAio.aio_nbytes);
off_t bado;
int badc;
if (!XrdOucPgrwUtils::csVer(dInfo, bado, badc)) return -EDOM;
}
// Get a callback object as no errors can error here
//
XrdPssAioCB *aioCB = XrdPssAioCB::Alloc(aiop, true, true);
// Check if caller want checksum generated and possibly returned
//
if ((opts & XrdOssDF::doCalc) || aiop->cksVec == 0)
{XrdOucPgrwUtils::csCalc((const char *)(aiop->sfsAio.aio_buf),
(off_t)(aiop->sfsAio.aio_offset),
(size_t)(aiop->sfsAio.aio_nbytes),
aioCB->csVec);
if (aiop->cksVec) memcpy(aiop->cksVec, aioCB->csVec.data(),
aioCB->csVec.size()*sizeof(uint32_t));
} else {
int n = XrdOucPgrwUtils::csNum(aiop->sfsAio.aio_offset,
aiop->sfsAio.aio_nbytes);
aioCB->csVec.resize(n);
aioCB->csVec.assign(n, 0);
memcpy(aioCB->csVec.data(), aiop->cksVec, n*sizeof(uint32_t));
}
// Issue the pgWrite
//
XrdPosixExtra::pgWrite(fd, (void *)aiop->sfsAio.aio_buf,
(off_t)aiop->sfsAio.aio_offset,
(size_t)aiop->sfsAio.aio_nbytes,
aioCB->csVec, 0, aioCB);
return 0;
}

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdSfsAio::cksVec, XrdOucPgrwUtils::csCalc(), XrdOucPgrwUtils::csNum(), XrdPssAioCB::csVec, XrdOucPgrwUtils::csVer(), XrdOssDF::doCalc, XrdOssDF::fd, opts, XrdPosixExtra::pgWrite(), XrdSfsAio::sfsAio, and XrdOssDF::Verify.

Here is the call graph for this function:

## Read() [1/3]

ssize_t XrdPssFile::Read | ( | off_t | offset,
|  | size_t | size )

virtual

Preread file blocks into the file system cache.

Parameters

  offset | - The offset where the read is to start.
  size | - The number of bytes to pre-read.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1069 of file XrdPss.cc.

{
if (fd < 0) return (ssize_t)-XRDOSS_E8004;
return 0; // We haven't implemented this yet!
}

References XrdOssDF::fd, and XRDOSS_E8004.

Referenced by ReadRaw().

Here is the caller graph for this function:

## Read() [2/3]

ssize_t XrdPssFile::Read | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | size )

virtual

Read file bytes into a buffer.

Parameters

  buffer | - pointer to buffer where the bytes are to be placed.
  offset | - The offset where the read is to start.
  size | - The number of bytes to read.

Returns
  >= 0 The number of bytes that placed in buffer.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1093 of file XrdPss.cc.

{
ssize_t retval;
if (fd < 0) return (ssize_t)-XRDOSS_E8004;
return (retval = XrdPosixXrootd::Pread(fd, buff, blen, offset)) < 0
? (ssize_t)-errno : retval;
}
XrdPosixXrootd::Pread
static ssize_t Pread(int fildes, void *buf, size_t nbyte, off_t offset)
Pread() conforms to POSIX.1-2001 pread().
Definition XrdPosixXrootd.cc:742

References XrdOssDF::fd, XrdPosixXrootd::Pread(), and XRDOSS_E8004.

Here is the call graph for this function:

## Read() [3/3]

int XrdPssFile::Read | ( | XrdSfsAio * | aiop | ) |

virtual

Read file bytes using asynchronous I/O.

Parameters

  aiop | - Pointer to async I/O object controlling the I/O.

Returns
  0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 165 of file XrdPssAio.cc.

{
// Execute this request in an asynchronous fashion
//
XrdPosixXrootd::Pread(fd, (void *)aiop->sfsAio.aio_buf,
(size_t)aiop->sfsAio.aio_nbytes,
(off_t)aiop->sfsAio.aio_offset,
XrdPssAioCB::Alloc(aiop, false));
return 0;
}
aiocb::aio_offset
off_t aio_offset
Definition XrdSfsAio.hh:49
aiocb::aio_nbytes
size_t aio_nbytes
Definition XrdSfsAio.hh:48
aiocb::aio_buf
void * aio_buf
Definition XrdSfsAio.hh:47
XrdSfsAio::sfsAio
struct aiocb sfsAio
Definition XrdSfsAio.hh:62

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdOssDF::fd, XrdPosixXrootd::Pread(), and XrdSfsAio::sfsAio.

Here is the call graph for this function:

## ReadRaw()

ssize_t XrdPssFile::ReadRaw | ( | void * | buffer,
|  | off_t | offset,
|  | size_t | size )

virtual

Read uncompressed file bytes into a buffer.

Parameters

  buffer | - pointer to buffer where the bytes are to be placed.
  offset | - The offset where the read is to start.
  size | - The number of bytes to read.

Returns
  >= 0 The number of bytes that placed in buffer.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1145 of file XrdPss.cc.

{
return Read(buff, offset, blen);
}
XrdPssFile::Read
ssize_t Read(off_t, size_t)
Definition XrdPss.cc:1069

References Read().

Here is the call graph for this function:

## ReadV()

ssize_t XrdPssFile::ReadV | ( | XrdOucIOVec * | readV,
|  | int | rdvcnt )

virtual

Read file bytes as directed by the read vector.

Parameters

  readV | pointer to the array of read requests.
  rdvcnt | the number of elements in readV.

Returns
  >=0 The numbe of bytes read.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1107 of file XrdPss.cc.

{
ssize_t retval;
if (fd < 0) return (ssize_t)-XRDOSS_E8004;
return (retval = XrdPosixXrootd::VRead(fd, readV, readCount)) < 0 ? (ssize_t)-errno : retval;;
}
XrdPosixXrootd::VRead
static void VRead(int fildes, const XrdOucIOVec *readV, int n, XrdPosixCallBackIO *cbp)
Definition XrdPosixXrootd.cc:951

References XrdOssDF::fd, XrdPosixXrootd::VRead(), and XRDOSS_E8004.

Here is the call graph for this function:

## Write() [1/2]

ssize_t XrdPssFile::Write | ( | const void * | buffer,
|  | off_t | offset,
|  | size_t | size )

virtual

Write file bytes from a buffer.

Parameters

  buffer | - pointer to buffer where the bytes reside.
  offset | - The offset where the write is to start.
  size | - The number of bytes to write.

Returns
  >= 0 The number of bytes that were written.
  < 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1165 of file XrdPss.cc.

{
ssize_t retval;
if (fd < 0) return (ssize_t)-XRDOSS_E8004;
return (retval = XrdPosixXrootd::Pwrite(fd, buff, blen, offset)) < 0
? (ssize_t)-errno : retval;
}
XrdPosixXrootd::Pwrite
static ssize_t Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
Pwrite() conforms to POSIX.1-2001 pwrite().
Definition XrdPosixXrootd.cc:809

References XrdOssDF::fd, XrdPosixXrootd::Pwrite(), and XRDOSS_E8004.

Here is the call graph for this function:

## Write() [2/2]

int XrdPssFile::Write | ( | XrdSfsAio * | aiop | ) |

virtual

Write file bytes using asynchronous I/O.

Parameters

  aiop | - Pointer to async I/O object controlling the I/O.

Returns
  0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 192 of file XrdPssAio.cc.

{
// Execute this request in an asynchronous fashion
//
XrdPosixXrootd::Pwrite(fd, (const void *)aiop->sfsAio.aio_buf,
(size_t)aiop->sfsAio.aio_nbytes,
(off_t)aiop->sfsAio.aio_offset,
XrdPssAioCB::Alloc(aiop, true));
return 0;
}

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdOssDF::fd, XrdPosixXrootd::Pwrite(), and XrdSfsAio::sfsAio.

Here is the call graph for this function:

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

- XrdPss.hh
- XrdPss.cc
- XrdPssAio.cc