XRootD
XrdPosixPrepIO Class Reference

#include <XrdPosixPrepIO.hh>

+ Inheritance diagram for XrdPosixPrepIO:
+ Collaboration diagram for XrdPosixPrepIO:

Public Member Functions

 XrdPosixPrepIO (XrdPosixFile *fP, XrdCl::OpenFlags::Flags clflags, XrdCl::Access::Mode clmode)
 
virtual ~XrdPosixPrepIO ()
 
bool Detach (XrdOucCacheIOCD &cdP)
 
void Disable ()
 
long long FSize ()
 
int Fstat (struct stat &buf)
 
int Open ()
 
const char * Path ()
 
int Read (char *Buffer, long long Offset, int Length)
 
void Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
 
int ReadV (const XrdOucIOVec *readV, int n)
 
void ReadV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
 
int Sync ()
 
void Sync (XrdOucCacheIOCB &iocb)
 
int Trunc (long long Offset)
 
int Write (char *Buffer, long long Offset, int Length)
 
void Write (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
 
- Public Member Functions inherited from XrdOucCacheIO
 XrdOucCacheIO ()
 Construct and Destructor. More...
 
virtual const char * Location (bool refresh=false)
 
virtual int pgRead (char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual void pgRead (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual int pgWrite (char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual void pgWrite (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual void Preread (aprParms &Parms)
 
virtual void Preread (long long offs, int rlen, int opts=0)
 
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)
 

Additional Inherited Members

- Static Public Attributes inherited from XrdOucCacheIO
static const uint64_t forceCS = 0x0000000000000001ULL
 
static const int SingleUse = 0x0001
 Mark pages for single use. More...
 
- Protected Member Functions inherited from XrdOucCacheIO
virtual ~XrdOucCacheIO ()
 

Detailed Description

Definition at line 38 of file XrdPosixPrepIO.hh.

Constructor & Destructor Documentation

◆ XrdPosixPrepIO()

XrdPosixPrepIO::XrdPosixPrepIO ( XrdPosixFile fP,
XrdCl::OpenFlags::Flags  clflags,
XrdCl::Access::Mode  clmode 
)
inline

Definition at line 89 of file XrdPosixPrepIO.hh.

91  : fileP(fP), openRC(0), iCalls(0),
92  clFlags(clflags), clMode(clmode) {}

◆ ~XrdPosixPrepIO()

virtual XrdPosixPrepIO::~XrdPosixPrepIO ( )
inlinevirtual

Definition at line 93 of file XrdPosixPrepIO.hh.

93 {}

Member Function Documentation

◆ Detach()

bool XrdPosixPrepIO::Detach ( XrdOucCacheIOCD iocd)
inlinevirtual

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.

Definition at line 42 of file XrdPosixPrepIO.hh.

42 {(void)cdP; return true;}

◆ Disable()

void XrdPosixPrepIO::Disable ( )

Definition at line 51 of file XrdPosixPrepIO.cc.

52 {
53  EPNAME("PrepIODisable");
54  XrdPosixObjGuard objGuard(fileP);
55 
56  if(DEBUGON) {
57  DEBUG("Disabling deferred open " << obfuscateAuth(fileP->Origin()));
58  }
59 
60  openRC = -ESHUTDOWN;
61 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
std::string obfuscateAuth(const std::string &input)
#define DEBUGON
const char * Origin()

References DEBUG, DEBUGON, EPNAME, obfuscateAuth(), and XrdPosixFile::Origin().

Referenced by XrdPosixFile::Close().

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

◆ FSize()

long long XrdPosixPrepIO::FSize ( )
inlinevirtual

Obtain size of the file.

Returns
Size of the file in bytes.

Implements XrdOucCacheIO.

Definition at line 46 of file XrdPosixPrepIO.hh.

46 {return (Init() ? fileP->FSize() : openRC);}
long long FSize() override
Definition: XrdPosixFile.hh:94

References XrdPosixFile::FSize().

+ Here is the call graph for this function:

◆ Fstat()

int XrdPosixPrepIO::Fstat ( struct stat sbuff)
inlinevirtual

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.

Definition at line 48 of file XrdPosixPrepIO.hh.

49  {return (Init() ? fileP->Fstat(buf) : openRC);}
int Fstat(struct stat &buf) override

References XrdPosixFile::Fstat().

+ Here is the call graph for this function:

◆ Open()

int XrdPosixPrepIO::Open ( )
inline

Definition at line 51 of file XrdPosixPrepIO.hh.

51 {Init(); return openRC;}

◆ Path()

const char* XrdPosixPrepIO::Path ( )
inlinevirtual

Get the path associated with this object.

Returns
Pointer to the path.

Implements XrdOucCacheIO.

Definition at line 53 of file XrdPosixPrepIO.hh.

53 {return fileP->Path();}
const char * Path() override

References XrdPosixFile::Path().

+ Here is the call graph for this function:

◆ Read() [1/2]

int XrdPosixPrepIO::Read ( char *  buff,
long long  offs,
int  rlen 
)
inlinevirtual

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.

Definition at line 55 of file XrdPosixPrepIO.hh.

56  {return (Init() ? fileP->Read(Buffer, Offset, Length) : openRC);}
int Read(char *Buff, long long Offs, int Len) override

References XrdPosixFile::Read().

+ Here is the call graph for this function:

◆ Read() [2/2]

void XrdPosixPrepIO::Read ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  rlen 
)
inlinevirtual

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.

Definition at line 58 of file XrdPosixPrepIO.hh.

59  {if (Init(&iocb)) fileP->Read(iocb, buff, offs, rlen);
60  else iocb.Done(openRC);
61  }
virtual void Done(int result)=0

References XrdOucCacheIOCB::Done(), and XrdPosixFile::Read().

+ Here is the call graph for this function:

◆ ReadV() [1/2]

int XrdPosixPrepIO::ReadV ( const XrdOucIOVec readV,
int  rnum 
)
inlinevirtual

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.

Definition at line 63 of file XrdPosixPrepIO.hh.

64  {return (Init() ? fileP->ReadV(readV, n) : openRC);}
int ReadV(const XrdOucIOVec *readV, int n) override

References XrdPosixFile::ReadV().

+ Here is the call graph for this function:

◆ ReadV() [2/2]

void XrdPosixPrepIO::ReadV ( XrdOucCacheIOCB iocb,
const XrdOucIOVec readV,
int  rnum 
)
inlinevirtual

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.

Definition at line 66 of file XrdPosixPrepIO.hh.

67  {if (Init(&iocb)) fileP->ReadV(iocb, readV, rnum);
68  else iocb.Done(openRC);
69  }

References XrdOucCacheIOCB::Done(), and XrdPosixFile::ReadV().

+ Here is the call graph for this function:

◆ Sync() [1/2]

int XrdPosixPrepIO::Sync ( )
inlinevirtual

Perform an synchronous sync() operation.

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

Implements XrdOucCacheIO.

Definition at line 71 of file XrdPosixPrepIO.hh.

71 {return (Init() ? fileP->Sync() : openRC);}
int Sync() override

References XrdPosixFile::Sync().

+ Here is the call graph for this function:

◆ Sync() [2/2]

void XrdPosixPrepIO::Sync ( XrdOucCacheIOCB iocb)
inlinevirtual

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.

Definition at line 73 of file XrdPosixPrepIO.hh.

74  {if (Init(&iocb)) fileP->Sync(iocb);
75  else iocb.Done(openRC);
76  }

References XrdOucCacheIOCB::Done(), and XrdPosixFile::Sync().

+ Here is the call graph for this function:

◆ Trunc()

int XrdPosixPrepIO::Trunc ( long long  offs)
inlinevirtual

Perform an synchronous trunc() operation.

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

Implements XrdOucCacheIO.

Definition at line 78 of file XrdPosixPrepIO.hh.

79  {return (Init() ? fileP->Trunc(Offset) : openRC);}
int Trunc(long long Offset) override

References XrdPosixFile::Trunc().

+ Here is the call graph for this function:

◆ Write() [1/2]

int XrdPosixPrepIO::Write ( char *  buff,
long long  offs,
int  wlen 
)
inlinevirtual

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.

Definition at line 81 of file XrdPosixPrepIO.hh.

82  {return (Init() ? fileP->Write(Buffer,Offset,Length) : openRC);}
int Write(char *Buff, long long Offs, int Len) override

References XrdPosixFile::Write().

+ Here is the call graph for this function:

◆ Write() [2/2]

void XrdPosixPrepIO::Write ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  wlen 
)
inlinevirtual

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.

Definition at line 84 of file XrdPosixPrepIO.hh.

85  {if (Init(&iocb)) fileP->Write(iocb, buff, offs, wlen);
86  else iocb.Done(openRC);
87  }

References XrdOucCacheIOCB::Done(), and XrdPosixFile::Write().

+ Here is the call graph for this function:

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