xrootd
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
XrdPosixFile Class Reference

#include <XrdPosixFile.hh>

Inheritance diagram for XrdPosixFile:
Inheritance graph
[legend]
Collaboration diagram for XrdPosixFile:
Collaboration graph
[legend]

Public Member Functions

long long addOffset (long long offs, int updtSz=0)
 
bool Close (XrdCl::XRootDStatus &Status)
 
bool Detach (XrdOucCacheIOCD &cdP) override
 
void DetachDone () override
 Indicate that the CacheIO object has been detached.
 
bool Finalize (XrdCl::XRootDStatus *Status)
 
long long FSize () override
 
int Fstat (struct stat &buf) override
 
const char * Location (bool refresh=false) override
 
void HandleResponse (XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override
 
void updLock ()
 
void updUnLock ()
 
long long Offset ()
 
const char * Origin ()
 
const char * Path () override
 
int pgRead (char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0) override
 
void pgRead (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0) override
 
int pgWrite (char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0) override
 
void pgWrite (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0) override
 
int Read (char *Buff, long long Offs, int Len) override
 
void Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen) override
 
int ReadV (const XrdOucIOVec *readV, int n) override
 
void ReadV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int n) override
 
long long setOffset (long long offs)
 
bool Stat (XrdCl::XRootDStatus &Status, bool force=false)
 
int Sync () override
 
void Sync (XrdOucCacheIOCB &iocb) override
 
int Trunc (long long Offset) override
 
void UpdtSize (size_t newsz)
 
bool Who (XrdPosixFile **fileP) override
 
int Write (char *Buff, long long Offs, int Len) override
 
void Write (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen) override
 
 XrdPosixFile (bool &aOK, const char *path, XrdPosixCallBack *cbP=0, int Opts=0)
 
 ~XrdPosixFile ()
 
virtual bool Who (XrdPosixDir **dirP)
 
virtual bool Who (XrdPosixFile **fileP)
 
- Public Member Functions inherited from XrdPosixObject
bool AssignFD (bool isStream=false)
 
int FDNum ()
 
void Lock (bool wr=true)
 
void Ref ()
 
int Refs ()
 
void unRef ()
 
void UnLock ()
 
 XrdPosixObject ()
 
virtual ~XrdPosixObject ()
 
- Public Member Functions inherited from XrdOucCacheIO
virtual void Preread (long long offs, int rlen, int opts=0)
 
virtual void Preread (aprParms &Parms)
 
virtual void Trunc (XrdOucCacheIOCB &iocb, long long offs)
 
virtual void Update (XrdOucCacheIO &iocp)
 
virtual int WriteV (const XrdOucIOVec *writV, int wnum)
 
virtual void WriteV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *writV, int wnum)
 
 XrdOucCacheIO ()
 Construct and Destructor.
 
- Public Member Functions inherited from XrdOucCacheIOCD
 XrdOucCacheIOCD ()
 
virtual ~XrdOucCacheIOCD ()
 
- Public Member Functions inherited from XrdCl::ResponseHandler
virtual ~ResponseHandler ()
 
virtual void HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)
 

Static Public Member Functions

static void * DelayedDestroy (void *)
 
static void DelayedDestroy (XrdPosixFile *fp)
 
- Static Public Member Functions inherited from XrdPosixObject
static bool CanStream ()
 
static XrdPosixDirDir (int fildes, bool glk=false)
 
static XrdPosixFileFile (int fildes, bool glk=false)
 
static int Init (int numfd)
 
static void Release (XrdPosixObject *oP, bool needlk=true)
 
static XrdPosixDirReleaseDir (int fildes)
 
static XrdPosixFileReleaseFile (int fildes)
 
static void Shutdown ()
 
static bool Valid (int fd)
 
- Static Public Member Functions inherited from XrdCl::ResponseHandler
static ResponseHandlerWrap (std::function< void(XRootDStatus &, AnyObject &)> func)
 
static ResponseHandlerWrap (std::function< void(XRootDStatus *, AnyObject *)> func)
 

Public Attributes

XrdOucCacheIOXCio
 
XrdPosixPrepIOPrepIO
 
XrdCl::File clFile
 
size_t mySize
 
time_t myAtime
 
time_t myCtime
 
time_t myMtime
 
dev_t myRdev
 
ino_t myInode
 
mode_t myMode
 

Static Public Attributes

static XrdSysSemaphore ddSem
 
static XrdSysMutex ddMutex
 
static XrdPosixFileddList
 
static XrdPosixFileddLost
 
static char * sfSFX
 
static short sfSLN
 
static bool ddPosted
 
static int ddNum
 
static const int realFD = 1
 
static const int isStrm = 2
 
static const int isUpdt = 4
 
- Static Public Attributes inherited from XrdOucCacheIO
static const uint64_t forceCS = 0x0000000000000001ULL
 
static const int SingleUse = 0x0001
 Mark pages for single use.
 

Private Attributes

union { 
 
   long long   currOffset 
 
   XrdPosixCallBack *   theCB 
 
   XrdPosixFile *   nextFile 
 
};  
 
char * fPath
 
char * fOpen
 
char * fLoc
 
union { 
 
   int   cOpt 
 
   int   numTries 
 
};  
 
char isStream
 

Additional Inherited Members

- Protected Member Functions inherited from XrdOucCacheIO
virtual ~XrdOucCacheIO ()
 
- Protected Attributes inherited from XrdPosixObject
XrdSysRecMutex updMutex
 
XrdSysRWLock objMutex
 
int fdNum
 
int refCnt
 

Constructor & Destructor Documentation

◆ XrdPosixFile()

XrdPosixFile::XrdPosixFile ( bool &  aOK,
const char *  path,
XrdPosixCallBack cbP = 0,
int  Opts = 0 
)

◆ ~XrdPosixFile()

XrdPosixFile::~XrdPosixFile ( )

Member Function Documentation

◆ addOffset()

long long XrdPosixFile::addOffset ( long long  offs,
int  updtSz = 0 
)
inline

◆ Close()

bool XrdPosixFile::Close ( XrdCl::XRootDStatus Status)

◆ DelayedDestroy() [1/2]

static void * XrdPosixFile::DelayedDestroy ( void *  )
static

◆ DelayedDestroy() [2/2]

static void XrdPosixFile::DelayedDestroy ( XrdPosixFile fp)
static

◆ Detach()

bool XrdPosixFile::Detach ( XrdOucCacheIOCD iocd)
inlineoverridevirtual

Detach this CacheIO object from the cache.

Note
This method must be called instead of using the delete operator since CacheIO objects may have multiple outstanding references and actual deletion may need to be deferred.
Parameters
iocdreference to the detach complete callback object.
Returns
true Deletion can occur immediately. There is no outstanding I/O.
false Deletion must be deferred until it is safe to so from the cache perspective. At which point, the cache will call the DetachDone() method in the passed callback object. No locks may be held with respect to the CacheIO object when this is done to avoid deadlocks.

Implements XrdOucCacheIO.

◆ DetachDone()

void XrdPosixFile::DetachDone ( )
inlineoverridevirtual

Indicate that the CacheIO object has been detached.

Implements XrdOucCacheIOCD.

References XrdPosixObject::unRef().

◆ Finalize()

bool XrdPosixFile::Finalize ( XrdCl::XRootDStatus Status)

◆ FSize()

long long XrdPosixFile::FSize ( )
inlineoverridevirtual

Obtain size of the file.

Returns
Size of the file in bytes.

Implements XrdOucCacheIO.

References AtomicBeg, AtomicEnd, AtomicGet, mySize, and XrdPosixObject::updMutex.

Referenced by XrdPosixPrepIO::FSize().

◆ Fstat()

int XrdPosixFile::Fstat ( struct stat sbuff)
overridevirtual

Perform an fstat() operation (defaults to passthrough).

Parameters
sbuffreference to the stat buffer to be filled in. Only fields st_size, st_blocks, st_mtime (st_atime and st_ctime may be set to st_mtime), st_ino, and st_mode need to be set. All other fields are preset and should not be changed.
Returns
<0 - fstat failed, value is -errno. =0 - fstat succeeded, sbuff holds stat information. >0 - fstat could not be done, forward operation to next level.

Reimplemented from XrdOucCacheIO.

Referenced by XrdPosixPrepIO::Fstat().

◆ HandleResponse()

void XrdPosixFile::HandleResponse ( XrdCl::XRootDStatus status,
XrdCl::AnyObject response 
)
overridevirtual

Called when a response to associated request arrives or an error occurs

Parameters
statusstatus of the request
responsean object associated with the response (request dependent)

Reimplemented from XrdCl::ResponseHandler.

◆ Location()

const char * XrdPosixFile::Location ( bool  refresh = false)
overridevirtual

Get the file's location (i.e. endpoint hostname and port)

Parameters
refresh- when true, recomputes the location in case it changed st the location is cached from the previous successful call.
Returns
A pointer to the file's location. It remains valid until the file is closed or Location() is called with refresh set to true. A null string means the file is not open or location is unknown.

Reimplemented from XrdOucCacheIO.

◆ Offset()

long long XrdPosixFile::Offset ( )
inline

◆ Origin()

const char * XrdPosixFile::Origin ( )
inline

References fOpen.

◆ Path()

const char * XrdPosixFile::Path ( )
inlineoverridevirtual

Get the path associated with this object.

Returns
Pointer to the path.

Implements XrdOucCacheIO.

References fPath.

Referenced by XrdPosixPrepIO::Path().

◆ pgRead() [1/2]

int XrdPosixFile::pgRead ( char *  buff,
long long  offs,
int  rdlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
overridevirtual

Reimplemented from XrdOucCacheIO.

◆ pgRead() [2/2]

void XrdPosixFile::pgRead ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  rdlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
overridevirtual

Read file pages and checksums using asynchronous I/O (default sync).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to buffer where the bytes are to be placed.
offsThe offset where the read is to start.
rdlenThe number of bytes to read.
csvecA vector which will be filled with the corresponding CRC32C checksum for each page or page segment.
optsProcessing options: forceCS - always return checksums even when not available.
csfixWhen not nil, returns the number of corrected checksum errs.

Reimplemented from XrdOucCacheIO.

◆ pgWrite() [1/2]

int XrdPosixFile::pgWrite ( char *  buff,
long long  offs,
int  wrlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
overridevirtual

Write file pages from a buffer and corresponding verified checksums.

Parameters
buffpointer to buffer holding the bytes to be written.
offsThe offset where the write is to start.
wrlenThe number of bytes to write. offs+wrlen (i.e. it establishes an end of file).
csvecA vector of that holds the corresponding verified CRC32C checksum for each page or page segment.
optsProcessing options.
csfixWhen not nil, returns the number of corrected checksum errs.
Returns
>= 0 The number of bytes written.
-errno File could not be written, returned value is the reason.

Reimplemented from XrdOucCacheIO.

◆ pgWrite() [2/2]

void XrdPosixFile::pgWrite ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  wrlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
overridevirtual

Write file pages and checksums using asynchronous I/O (default sync).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to buffer holding the bytes to be written.
offsThe offset where the write is to start.
wrlenThe number of bytes to write.
csvecA vector of that holds the corresponding verified CRC32C checksum for each page or page segment.
optsProcessing options.
csfixWhen not nil, returns the number of corrected checksum errs.

Reimplemented from XrdOucCacheIO.

◆ Read() [1/2]

int XrdPosixFile::Read ( char *  buff,
long long  offs,
int  rlen 
)
overridevirtual

Perform an synchronous read.

Parameters
buffpointer to the buffer to receive the results. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
rlenthe number of bytes to read.
Returns
< 0 - Read failed, value is -errno. >=0 - Read succeeded, value is number of bytes read.

Implements XrdOucCacheIO.

Referenced by XrdPosixPrepIO::Read(), and XrdPosixPrepIO::Read().

◆ Read() [2/2]

void XrdPosixFile::Read ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  rlen 
)
overridevirtual

Perform an asynchronous read (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to the buffer to receive the results. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
rlenthe number of bytes to read.

Reimplemented from XrdOucCacheIO.

◆ ReadV() [1/2]

int XrdPosixFile::ReadV ( const XrdOucIOVec readV,
int  rnum 
)
overridevirtual

Perform an synchronous vector read.

Parameters
readVpointer to a vector of read requests.
rnumthe number of elements in the vector.
Returns
< 0 - ReadV failed, value is -errno. >=0 - ReadV succeeded, value is number of bytes read.

Reimplemented from XrdOucCacheIO.

Referenced by XrdPosixPrepIO::ReadV(), and XrdPosixPrepIO::ReadV().

◆ ReadV() [2/2]

void XrdPosixFile::ReadV ( XrdOucCacheIOCB iocb,
const XrdOucIOVec readV,
int  rnum 
)
overridevirtual

Perform an asynchronous vector read (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
readVpointer to a vector of read requests.
rnumthe number of elements in the vector.

Reimplemented from XrdOucCacheIO.

◆ setOffset()

long long XrdPosixFile::setOffset ( long long  offs)
inline

◆ Stat()

bool XrdPosixFile::Stat ( XrdCl::XRootDStatus Status,
bool  force = false 
)

◆ Sync() [1/2]

int XrdPosixFile::Sync ( )
overridevirtual

Perform an synchronous sync() operation.

Returns
<0 - Sync failed, value is -errno. =0 - Sync succeeded.

Implements XrdOucCacheIO.

Referenced by XrdPosixPrepIO::Sync(), and XrdPosixPrepIO::Sync().

◆ Sync() [2/2]

void XrdPosixFile::Sync ( XrdOucCacheIOCB iocb)
overridevirtual

Perform an asynchronous sync() operation (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.

Reimplemented from XrdOucCacheIO.

◆ Trunc()

int XrdPosixFile::Trunc ( long long  offs)
overridevirtual

Perform an synchronous trunc() operation.

Parameters
offsthe size the file is have.
Returns
<0 - Trunc failed, value is -errno. =0 - Trunc succeeded.

Implements XrdOucCacheIO.

Referenced by XrdPosixPrepIO::Trunc().

◆ updLock()

void XrdPosixFile::updLock ( )
inline

◆ UpdtSize()

void XrdPosixFile::UpdtSize ( size_t  newsz)
inline

◆ updUnLock()

void XrdPosixFile::updUnLock ( )
inline

◆ Who() [1/3]

virtual bool XrdPosixObject::Who ( XrdPosixDir **  dirP)
inlinevirtual

Reimplemented from XrdPosixObject.

◆ Who() [2/3]

virtual bool XrdPosixObject::Who ( XrdPosixFile **  fileP)
inlinevirtual

Reimplemented from XrdPosixObject.

◆ Who() [3/3]

bool XrdPosixFile::Who ( XrdPosixFile **  fileP)
inlineoverridevirtual

Reimplemented from XrdPosixObject.

◆ Write() [1/2]

int XrdPosixFile::Write ( char *  buff,
long long  offs,
int  wlen 
)
overridevirtual

Perform an synchronous write.

Parameters
buffpointer to the buffer holding the contents. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
wlenthe number of bytes to write
Returns
< 0 - Write failed, value is -errno. >=0 - Write succeeded, value is number of bytes written.

Implements XrdOucCacheIO.

Referenced by XrdPosixPrepIO::Write(), and XrdPosixPrepIO::Write().

◆ Write() [2/2]

void XrdPosixFile::Write ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  wlen 
)
overridevirtual

Perform an asynchronous write (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to the buffer holding the contents. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
wlenthe number of bytes to write

Reimplemented from XrdOucCacheIO.

Member Data Documentation

◆ [union]

union { ... } XrdPosixFile

◆ [union]

union { ... } XrdPosixFile

◆ clFile

XrdCl::File XrdPosixFile::clFile

◆ cOpt

int XrdPosixFile::cOpt

◆ currOffset

long long XrdPosixFile::currOffset

Referenced by addOffset(), Offset(), and setOffset().

◆ ddList

XrdPosixFile* XrdPosixFile::ddList
static

◆ ddLost

XrdPosixFile* XrdPosixFile::ddLost
static

◆ ddMutex

XrdSysMutex XrdPosixFile::ddMutex
static

◆ ddNum

int XrdPosixFile::ddNum
static

◆ ddPosted

bool XrdPosixFile::ddPosted
static

◆ ddSem

XrdSysSemaphore XrdPosixFile::ddSem
static

◆ fLoc

char* XrdPosixFile::fLoc
private

◆ fOpen

char* XrdPosixFile::fOpen
private

Referenced by Origin().

◆ fPath

char* XrdPosixFile::fPath
private

Referenced by Path().

◆ isStream

char XrdPosixFile::isStream
private

◆ isStrm

const int XrdPosixFile::isStrm = 2
static

◆ isUpdt

const int XrdPosixFile::isUpdt = 4
static

◆ myAtime

time_t XrdPosixFile::myAtime

◆ myCtime

time_t XrdPosixFile::myCtime

◆ myInode

ino_t XrdPosixFile::myInode

◆ myMode

mode_t XrdPosixFile::myMode

◆ myMtime

time_t XrdPosixFile::myMtime

◆ myRdev

dev_t XrdPosixFile::myRdev

◆ mySize

size_t XrdPosixFile::mySize

Referenced by addOffset(), FSize(), and UpdtSize().

◆ nextFile

XrdPosixFile* XrdPosixFile::nextFile

◆ numTries

int XrdPosixFile::numTries

◆ PrepIO

XrdPosixPrepIO* XrdPosixFile::PrepIO

◆ realFD

const int XrdPosixFile::realFD = 1
static

◆ sfSFX

char* XrdPosixFile::sfSFX
static

◆ sfSLN

short XrdPosixFile::sfSLN
static

◆ theCB

XrdPosixCallBack* XrdPosixFile::theCB

◆ XCio

XrdOucCacheIO* XrdPosixFile::XCio

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