Loading...
Searching...
No Matches
XrdPosixExtra Class Reference

Extended POSIX interface to XRootD. More...

`#include <XrdPosixExtra.hh>`

Collaboration diagram for XrdPosixExtra:

## Public Member Functions

| XrdPosixExtra ()
| ~XrdPosixExtra ()

## Static Public Member Functions

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)
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)

## Static Public Attributes

static const uint64_t | forceCS = 0x0000000000000001ULL

## Detailed Description

Extended POSIX interface to XRootD.

Definition at line 46 of file XrdPosixExtra.hh.

## Constructor & Destructor Documentation

## XrdPosixExtra()

XrdPosixExtra::XrdPosixExtra | ( |  | ) |

inline

Definition at line 97 of file XrdPosixExtra.hh.

{}

## ~XrdPosixExtra()

XrdPosixExtra::~XrdPosixExtra | ( |  | ) |

inline

Definition at line 98 of file XrdPosixExtra.hh.

{}

## Member Function Documentation

## pgRead()

ssize_t XrdPosixExtra::pgRead | ( | int | fildes,
|  | void * | buffer,
|  | off_t | offset,
|  | size_t | rdlen,
|  | std::vector< uint32_t > & | csvec,
|  | uint64_t | opts = 0,
|  | XrdPosixCallBackIO * | cbp = 0 )

static

Definition at line 46 of file XrdPosixExtra.cc.

{
XrdPosixFile *fp;
long long offs, bytes;
uint64_t fOpts;
int iosz;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes)))
{if (!cbp) return -1;
cbp->Complete(-1);
return 0;
}
// Make sure the size is not too large
//
if (rdlen > (size_t)0x7fffffff)
{fp->UnLock();
errno = EOVERFLOW;
if (!cbp) return -1;
cbp->Complete(-1);
return 0;
}
// Get the parameters
//
iosz = static_cast<int>(rdlen);
offs = static_cast<long long>(offset);
csvec.clear();
fOpts= (opts & forceCS ? XrdOucCacheIO::forceCS : 0);
// Issue the read in the sync case
//
if (!cbp)
{bytes = fp->XCio->pgRead((char *)buffer, offs, (int)iosz, csvec, fOpts);
if (bytes < 0)
{fp->ecMsg.SetErrno(-bytes);
fp->UnLock();
return -1;
}
fp->UnLock();
return (ssize_t)bytes;
}
// Handle the read in the async case
//
cbp->theFile = fp;
fp->Ref(); fp->UnLock();
// Issue the read
//
fp->XCio->pgRead(*cbp, (char *)buffer, offs, (int)iosz, csvec, fOpts);
return 0;
}
opts
struct myOpts opts
XrdOucCacheIO::forceCS
static const uint64_t forceCS
Definition XrdOucCache.hh:188
XrdOucCacheIO::pgRead
virtual int pgRead(char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
Definition XrdOucCache.cc:39
XrdOucECMsg::SetErrno
int SetErrno(int ecc, int ret=-1, const char *alt=0)
Definition XrdOucECMsg.cc:152
XrdPosixCallBackIO::Complete
virtual void Complete(ssize_t Result)=0
XrdPosixExtra::forceCS
static const uint64_t forceCS
Definition XrdPosixExtra.hh:67
XrdPosixFile::XCio
XrdOucCacheIO * XCio
Definition XrdPosixFile.hh:65
XrdPosixObject::Ref
void Ref()
Definition XrdPosixObject.hh:65
XrdPosixObject::UnLock
void UnLock()
Definition XrdPosixObject.hh:83
XrdPosixObject::ecMsg
XrdOucECMsg ecMsg
Definition XrdPosixObject.hh:96
XrdPosixObject::File
static XrdPosixFile * File(int fildes, bool glk=false)
Definition XrdPosixObject.cc:155

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

Referenced by XrdPssFile::pgRead(), and XrdPssFile::pgRead().

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

## pgWrite()

ssize_t XrdPosixExtra::pgWrite | ( | int | fildes,
|  | void * | buffer,
|  | off_t | offset,
|  | size_t | wrlen,
|  | std::vector< uint32_t > & | csvec,
|  | uint64_t | opts = 0,
|  | XrdPosixCallBackIO * | cbp = 0 )

static

Write file pages into a file with corresponding checksums.

Parameters

  fildes | - File descriptor
  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. be the last write to the file at or above the offset.
  csvec | - A vector which contains the corresponding CRC32 checksum for each page or page segment. If size is 0, then checksums are calculated. If not zero, the size must equal the required number of checksums for offset/wrlen.
  opts | - Options as noted.
  cbp | - When supplied, return is made via callback.

Returns
  >= 0 Sync: The number of bytes written upon success. Async: Always returns 0.
  < 0 errno hold reason for failure.

Definition at line 111 of file XrdPosixExtra.cc.

{
XrdPosixFile *fp;
long long offs;
int iosz, bytes;
// Find the file object
//
if (!(fp = XrdPosixObject::File(fildes)))
{if (!cbp) return -1;
cbp->Complete(-1);
return 0;
}
// Make sure the size is not too large
//
if (wrlen > (size_t)0x7fffffff)
{fp->UnLock();
errno = EOVERFLOW;
if (!cbp) return -1;
cbp->Complete(-1);
return 0;
}
// Check if we need to generate checksums or verify that we have the right num.
//
if (csvec.size() == 0)
XrdOucPgrwUtils::csCalc((const char *)buffer, offset, wrlen, csvec);
else if (XrdOucPgrwUtils::csNum(offset, wrlen) != (int)csvec.size())
{fp->UnLock();
errno = EINVAL;
if (!cbp) return -1;
cbp->Complete(-1);
return 0;
}
// Get the parameters
//
iosz = static_cast<int>(wrlen);
offs = static_cast<long long>(offset);
// Sync: Issue the write
//
if (!cbp)
{bytes = fp->XCio->pgWrite((char *)buffer, offs, (int)iosz, csvec);
if (bytes < 0)
{fp->ecMsg.SetErrno(-bytes);
fp->UnLock();
return -1;
}
fp->UpdtSize(offs + iosz);
fp->UnLock();
return (ssize_t)bytes;
}
// Async: Prepare for writing
//
cbp->theFile = fp;
fp->Ref(); fp->UnLock();
// Issue the write
//
fp->XCio->pgWrite(*cbp, (char *)buffer, offs, (int)iosz, csvec);
return 0;
}
XrdOucCacheIO::pgWrite
virtual int pgWrite(char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
Definition XrdOucCache.cc:68
XrdOucPgrwUtils::csCalc
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)
Definition XrdOucPgrwUtils.cc:54
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
XrdPosixFile::UpdtSize
void UpdtSize(size_t newsz)
Definition XrdPosixFile.hh:161

References XrdPosixCallBackIO::Complete(), XrdOucPgrwUtils::csCalc(), XrdOucPgrwUtils::csNum(), XrdPosixObject::ecMsg, XrdPosixObject::File(), opts, XrdOucCacheIO::pgWrite(), XrdPosixObject::Ref(), XrdOucECMsg::SetErrno(), XrdPosixObject::UnLock(), XrdPosixFile::UpdtSize(), and XrdPosixFile::XCio.

Referenced by XrdPssFile::pgWrite(), and XrdPssFile::pgWrite().

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

## Member Data Documentation

## forceCS

const uint64_t XrdPosixExtra::forceCS = 0x0000000000000001ULL

static

Read file pages into a buffer and return corresponding checksums.

Parameters

  fildes | - File descriptor
  buffer | - pointer to buffer where the bytes are to be placed.
  offset | - The offset where the read is to start.
  rdlen | - The number of bytes to read.
  csvec | - A vector to be filled with the corresponding CRC32C checksums for each page or page segment, if available.
  opts | - Options as noted.
  cbp | - Async version: return is made via callback.

Returns
  >= 0 Sync: Number of bytes that placed in buffer upon success; Async: Always returns 0.
  < 0 errno hold reason for failure.

Definition at line 67 of file XrdPosixExtra.hh.

Referenced by pgRead(), XrdPssFile::pgRead(), and XrdPssFile::pgRead().

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

- XrdPosixExtra.hh
- XrdPosixExtra.cc