XRootD
Loading...
Searching...
No Matches
XrdSfsFile Class Referenceabstract

#include <XrdSfsInterface.hh>

Inheritance diagram for XrdSfsFile:
Collaboration diagram for XrdSfsFile:

Public Types

enum  cpAct {
  cpCreate =0 ,
  cpDelete ,
  cpRestore ,
  cpQuery ,
  cpTrunc ,
  cpWrite
}

Public Member Functions

 XrdSfsFile (const char *user=0, int MonID=0)
 XrdSfsFile (XrdOucErrInfo &eInfo)
 XrdSfsFile (XrdSfsFile &wrapF)
virtual ~XrdSfsFile ()
 Destructor.
virtual int checkpoint (cpAct act, struct iov *range=0, int n=0)
virtual int Clone (const std::vector< XrdOucCloneSeg > &cVec)
virtual int Clone (XrdSfsFile &srcFile)
virtual int close ()=0
virtual int fctl (const int cmd, const char *args, XrdOucErrInfo &eInfo)=0
virtual int fctl (const int cmd, int alen, const char *args, const XrdSecEntity *client=0)
virtual const char * FName ()=0
virtual int getCXinfo (char cxtype[4], int &cxrsz)=0
virtual int getMmap (void **Addr, off_t &Size)=0
virtual int open (const char *fileName, XrdSfsFileOpenMode openMode, mode_t createMode, const XrdSecEntity *client=0, const char *opaque=0)=0
virtual int pgRead (XrdSfsAio *aioparm, uint64_t opts=0)
virtual XrdSfsXferSize pgRead (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0)
virtual int pgWrite (XrdSfsAio *aioparm, uint64_t opts=0)
virtual XrdSfsXferSize pgWrite (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize wrlen, uint32_t *csvec, uint64_t opts=0)
virtual XrdSfsXferSize read (XrdOucRangeList &rlist)
virtual int read (XrdSfsAio *aioparm)=0
virtual XrdSfsXferSize read (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize size)=0
virtual XrdSfsXferSize read (XrdSfsFileOffset offset, XrdSfsXferSize size)=0
virtual XrdSfsXferSize readv (XrdOucIOVec *readV, int rdvCnt)
virtual int SendData (XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size)
virtual void setXio (XrdSfsXio *xioP)
virtual int stat (struct stat *buf)=0
virtual int sync ()=0
virtual int sync (XrdSfsAio *aiop)=0
virtual int truncate (XrdSfsFileOffset fsize)=0
virtual int write (XrdSfsAio *aioparm)=0
virtual XrdSfsXferSize write (XrdSfsFileOffset offset, const char *buffer, XrdSfsXferSize size)=0
virtual XrdSfsXferSize writev (XrdOucIOVec *writeV, int wdvCnt)

Public Attributes

XrdOucErrInfoerror

Static Public Attributes

static const uint64_t Verify = 0x8000000000000000ULL
 Options for pgRead() and pgWrite() as noted below.

Detailed Description

Definition at line 375 of file XrdSfsInterface.hh.

Member Enumeration Documentation

◆ cpAct

Create, delete, query, rollback a file checkpoint or perform an action.

Parameters
act- The operation to be performed (see cpAct enum below).
range- Use and requirement vary by function: cpCreate - Create a new checkpoint, one must not exist. Parameters ignored, not applicable. cpDelete - Delete an existing checkpoint, one must exist. Parameters ignored, not applicable. cpQuery - Where result is to be returned: range[0].offset - Amount currently in use. range[0].length - Maximum total length cpRestore - Restore data from checkpoint and delete it. Parameters ignored, not applicable. cpTrunc - Offset target for truncation. range[0].offset - Offset for truncations. cpWrite - Offset/lengths of the file to be checkpointed. The checkpoint must exist via previous cpCreate.
n- Number of elements in range. Applies only to cpWrite.
Returns
One of SFS_OK or SFS_ERROR only.
Enumerator
cpCreate 

Create a checkpoint, one must not be active.

cpDelete 

Delete an existing checkpoint.

cpRestore 

Restore an active checkpoint and delete it.

cpQuery 

Return checkpoint limits.

cpTrunc 

Truncate a file within checkpoint.

cpWrite 

Add data to an existing checkpoint.

Definition at line 444 of file XrdSfsInterface.hh.

444 {cpCreate=0,
445 cpDelete,
446 cpRestore,
447 cpQuery,
448 cpTrunc,
449 cpWrite
450 };
@ cpTrunc
Truncate a file within checkpoint.
@ cpDelete
Delete an existing checkpoint.
@ cpRestore
Restore an active checkpoint and delete it.
@ cpWrite
Add data to an existing checkpoint.
@ cpQuery
Return checkpoint limits.
@ cpCreate
Create a checkpoint, one must not be active.

Constructor & Destructor Documentation

◆ XrdSfsFile() [1/3]

XrdSfsFile::XrdSfsFile ( const char * user = 0,
int MonID = 0 )
inline

Constructor (user and MonID are the ones passed to newFile()!). This constructor should only be used by base plugins. Plugins that wrap an SfsFile should use the second version of the constructor shown below.

Parameters
user- Text identifying the client responsible for this call. The pointer may be null if identification is missing.
MonID- The monitoring identifier assigned to this and all future requests using the returned object.

Definition at line 822 of file XrdSfsInterface.hh.

823 : error(*(new XrdOucErrInfo(user, MonID)))
824 {lclEI = &error; pgwrEOF = 0;}
XrdOucErrInfo & error

References error.

Referenced by XrdBwmFile::XrdBwmFile(), XrdDigFile::XrdDigFile(), XrdOfsFile::XrdOfsFile(), XrdSfsFile(), XrdSfsNativeFile::XrdSfsNativeFile(), XrdSsiFile::XrdSsiFile(), XrdOfsFile::Clone(), and Clone().

Here is the caller graph for this function:

◆ XrdSfsFile() [2/3]

XrdSfsFile::XrdSfsFile ( XrdSfsFile & wrapF)
inline

Constructor for plugins that wrap another SFS plugin. This constructor inherits the error object from a wrapped XrdSfsFile object so that only one identical error object exists for all file objects in the chain.

Parameters
wrapF- Reference to the file object being wrapped.

Definition at line 834 of file XrdSfsInterface.hh.

835 : error(wrapF.error), lclEI(0), pgwrEOF(0) {}

References XrdSfsFile(), and error.

Here is the call graph for this function:

◆ XrdSfsFile() [3/3]

XrdSfsFile::XrdSfsFile ( XrdOucErrInfo & eInfo)
inline

Constructor for base plugins that predefined an error object. This is a convenience constructor for base plugins only.

Parameters
eInfo- Reference to the error object to use.

Definition at line 844 of file XrdSfsInterface.hh.

845 : error(eInfo), lclEI(0), pgwrEOF(0) {}

References error.

◆ ~XrdSfsFile()

virtual XrdSfsFile::~XrdSfsFile ( )
inlinevirtual

Destructor.

Definition at line 851 of file XrdSfsInterface.hh.

851{if (lclEI) delete lclEI;}

Member Function Documentation

◆ checkpoint()

int XrdSfsFile::checkpoint ( cpAct act,
struct iov * range = 0,
int n = 0 )
virtual

Reimplemented in XrdOfsFile, and XrdThrottle::File.

Definition at line 61 of file XrdSfsInterface.cc.

62{
63// Provide reasonable answers
64//
65 switch(act)
66 {case cpCreate: error.setErrInfo(EDQUOT,"Checkpoint quota exceeded.");
67 break;
68 case cpDelete:
69 case cpRestore: error.setErrInfo(ENOENT,"Checkpoint does not exist.");
70 break;
71 default: error.setErrInfo(EINVAL,"Invalid checkpoint request.");
72 break;
73 }
74 return SFS_ERROR;
75}
#define SFS_ERROR

References cpCreate, cpDelete, cpRestore, error, and SFS_ERROR.

◆ Clone() [1/2]

int XrdSfsFile::Clone ( const std::vector< XrdOucCloneSeg > & cVec)
virtual

Clone contents of a file from one or more other files.

Parameters
cVec- A vector of struct XrdOucCloneSeg describing the action.
Returns
One of SFS_OK or SFS_ERROR.

Reimplemented in XrdOfsFile.

Definition at line 88 of file XrdSfsInterface.cc.

89{
90 (void)cVec;
91 error.setErrInfo(ENOTSUP, "Not supported.");
92 return SFS_ERROR;
93}

References error, and SFS_ERROR.

◆ Clone() [2/2]

int XrdSfsFile::Clone ( XrdSfsFile & srcFile)
virtual

Clone contents of a file from another file.

Parameters
srcFile- Reference to the file to used to clone contents of this file,
Returns
One of SFS_OK or SFS_ERROR.

Reimplemented in XrdOfsFile.

Definition at line 81 of file XrdSfsInterface.cc.

82{
83 (void)srcFile;
84 error.setErrInfo(ENOTSUP, "Not supported.");
85 return SFS_ERROR;
86}

References XrdSfsFile(), error, and SFS_ERROR.

Here is the call graph for this function:

◆ close()

virtual int XrdSfsFile::close ( )
pure virtual

Close the file.

Returns
One of SFS_OK or SFS_ERROR.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ fctl() [1/2]

virtual int XrdSfsFile::fctl ( const int cmd,
const char * args,
XrdOucErrInfo & eInfo )
pure virtual

Execute a special operation on the file (version 1)

Parameters
cmd- The operation to be performed (see below). SFS_FCTL_GETFD Return file descriptor if possible SFS_FCTL_STATV Reserved for future use.
args- specific arguments to cmd SFS_FCTL_GETFD Set to zero.
eInfo- The object where error info or results are to be returned. This is legacy and the error onject may be used as well.
Returns
If an error occurs or the operation is not support, SFS_ERROR should be returned with error.code set to errno. Otherwise, SFS_FCTL_GETFD error.code holds the real file descriptor number If the value is negative, sendfile() is not used. If the value is SFS_SFIO_FDVAL then the SendData() method is used for future read requests.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

Referenced by XrdXrootdFile::XrdXrootdFile(), and XrdThrottle::File::FileSystem.

Here is the caller graph for this function:

◆ fctl() [2/2]

int XrdSfsFile::fctl ( const int cmd,
int alen,
const char * args,
const XrdSecEntity * client = 0 )
virtual

Execute a special operation on the file (version 2)

Parameters
cmd- The operation to be performed: SFS_FCTL_SPEC1 Perform implementation defined action V1 SFS_FCTL_SPEC2 Perform implementation defined action V2
alen- Length of data pointed to by args.
args- Data sent with request, zero if alen is zero.
client- Client's identify (see common description).
Returns
SFS_OK a null response is sent.
SFS_DATA error.code length of the data to be sent. error.message contains the data to be sent. o/w one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.

Reimplemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

Definition at line 99 of file XrdSfsInterface.cc.

103{
104 (void)cmd; (void)alen; (void)args; (void)client;
105 return SFS_OK;
106}
#define SFS_OK

References SFS_OK.

◆ FName()

virtual const char * XrdSfsFile::FName ( )
pure virtual

Get the file path.

Returns
Null terminated string of the path used in open().

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ getCXinfo()

virtual int XrdSfsFile::getCXinfo ( char cxtype[4],
int & cxrsz )
pure virtual

Get compression information for the file.

Parameters
cxtype- Place where the compression algorithm name is to be placed
cxrsz- Place where the compression page size is to be returned
Returns
One of the valid SFS return codes described above. If the file is not compressed or an error is returned, cxrsz must be set to 0.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ getMmap()

virtual int XrdSfsFile::getMmap ( void ** Addr,
off_t & Size )
pure virtual

Get file's memory mapping if one exists (memory mapped files only).

Parameters
Addr- Place where the starting memory address is returned.
Size- Place where the file's size is returned.
Returns
SFS_OK when the file is memory mapped or any other code otherwise.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

Referenced by XrdXrootdFile::XrdXrootdFile().

Here is the caller graph for this function:

◆ open()

virtual int XrdSfsFile::open ( const char * fileName,
XrdSfsFileOpenMode openMode,
mode_t createMode,
const XrdSecEntity * client = 0,
const char * opaque = 0 )
pure virtual

Open a file.

Parameters
fileName- Pointer to the path of the file to be opened.
openMode- Flags indicating how the open is to be handled. SFS_O_CREAT create the file SFS_O_CREATAT create the file in a perticular FS SFS_O_MKPTH Make directory path if missing SFS_O_NOWAIT do not impose operational delays SFS_O_NOTPC do not allow TPC operation SFS_O_POSC persist only on successful close SFS_O_RAWIO allow client-side decompression SFS_O_RDONLY open read/only SFS_O_RDWR open read/write SFS_O_REPLICA Open for replication SFS_O_RESET Reset any cached information SFS_O_TRUNC truncate existing file to zero length SFS_O_WRONLY open write/only
createMode- The file's mode if it will be created.
client- Client's identify (see common description).
opaque- path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED
Note
When SFS_O_CREATAT is specified, the CGI should contain an element oss.coloc=<path> where <path> is URL encoded and determines the filesystem in which the new file should be created.

Implemented in XrdBwmFile, XrdOfsFile, XrdSsiFile, and XrdThrottle::File.

◆ pgRead() [1/2]

XrdSfsXferSize XrdSfsFile::pgRead ( XrdSfsAio * aioparm,
uint64_t opts = 0 )
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
SFS_OK Request accepted and will be scheduled.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented in XrdOfsFile, and XrdThrottle::File.

Definition at line 135 of file XrdSfsInterface.cc.

136{
137 aioparm->Result = this->pgRead((XrdSfsFileOffset)aioparm->sfsAio.aio_offset,
138 (char *)aioparm->sfsAio.aio_buf,
140 aioparm->cksVec, opts);
141 aioparm->doneRead();
142 return SFS_OK;
143}
struct myOpts opts
off_t aio_offset
Definition XrdSfsAio.hh:49
size_t aio_nbytes
Definition XrdSfsAio.hh:48
void * aio_buf
Definition XrdSfsAio.hh:47
long long XrdSfsFileOffset
int XrdSfsXferSize
uint32_t * cksVec
Definition XrdSfsAio.hh:63
ssize_t Result
Definition XrdSfsAio.hh:65
virtual void doneRead()=0
struct aiocb sfsAio
Definition XrdSfsAio.hh:62
virtual XrdSfsXferSize pgRead(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0)

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::cksVec, XrdSfsAio::doneRead(), opts, pgRead(), XrdSfsAio::Result, SFS_OK, and XrdSfsAio::sfsAio.

Here is the call graph for this function:

◆ pgRead() [2/2]

XrdSfsXferSize XrdSfsFile::pgRead ( XrdSfsFileOffset offset,
char * buffer,
XrdSfsXferSize rdlen,
uint32_t * csvec,
uint64_t opts = 0 )
virtual

Read file pages into a buffer and return corresponding checksums.

Parameters
offset- The offset where the read is to start. It may be unaligned with certain caveats relative to csvec.
buffer- pointer to buffer where the bytes are to be placed.
rdlen- The number of bytes to read. The amount must be an integral number of XrdSfsPage::Size bytes.
csvec- A vector of entries to be filled with the cooresponding CRC32C checksum for each page. However, if the offset is unaligned, then csvec[0] contains the crc for the page fragment that brings it to alignment for csvec[1]. It must be sized to hold all aligned XrdSys::Pagesize crc's plus additional ones for leading and ending page fragments, if any.
opts- Processing options (see above).
Returns
>= 0 The number of bytes that placed in buffer.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented in XrdOfsFile, and XrdThrottle::File.

Definition at line 112 of file XrdSfsInterface.cc.

117{
118 XrdSfsXferSize bytes;
119
120// Read the data into the buffer
121//
122 if ((bytes = read(offset, buffer, rdlen)) <= 0) return bytes;
123
124// Generate the crc's.
125//
126 XrdOucPgrwUtils::csCalc(buffer, offset, bytes, csvec);
127
128// All done
129//
130 return bytes;
131}
#define read(a, b, c)
Definition XrdPosix.hh:82
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)

References XrdOucPgrwUtils::csCalc(), opts, and read.

Referenced by pgRead().

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

◆ pgWrite() [1/2]

XrdSfsXferSize XrdSfsFile::pgWrite ( XrdSfsAio * aioparm,
uint64_t opts = 0 )
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
SFS_OK Request accepted and will be scheduled.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented in XrdOfsFile, and XrdThrottle::File.

Definition at line 178 of file XrdSfsInterface.cc.

179{
180 aioparm->Result = this->pgWrite((XrdSfsFileOffset)aioparm->sfsAio.aio_offset,
181 (char *)aioparm->sfsAio.aio_buf,
183 aioparm->cksVec, opts);
184 aioparm->doneWrite();
185 return SFS_OK;
186}
virtual void doneWrite()=0
virtual XrdSfsXferSize pgWrite(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize wrlen, uint32_t *csvec, uint64_t opts=0)

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::cksVec, XrdSfsAio::doneWrite(), opts, pgWrite(), XrdSfsAio::Result, SFS_OK, and XrdSfsAio::sfsAio.

Here is the call graph for this function:

◆ pgWrite() [2/2]

XrdSfsXferSize XrdSfsFile::pgWrite ( XrdSfsFileOffset offset,
char * buffer,
XrdSfsXferSize wrlen,
uint32_t * csvec,
uint64_t opts = 0 )
virtual

Write file pages into a file with corresponding checksums.

Parameters
offset- The offset where the write is to start. It may be unaligned with certain caveats relative to csvec.
buffer- pointer to buffer containing the bytes to write.
wrlen- The number of bytes to write. If amount is not an integral number of XrdSys::PageSize bytes, then this must 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 fragment. If offset is unaligned then csvec[0] is the crc of the leading fragment to align the subsequent full page who's crc is in csvec[1]. It must be sized to hold all aligned XrdSys::Pagesize crc's plus additional ones for leading and ending page fragments, if any.
opts- Processing options (see above).
Returns
>= 0 The number of bytes written.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented in XrdOfsFile, and XrdThrottle::File.

Definition at line 149 of file XrdSfsInterface.cc.

154{
155
156// If we have a checksum vector and verify is on, do verification.
157//
158 if (opts & Verify)
159 {XrdOucPgrwUtils::dataInfo dInfo(buffer, csvec, offset, wrlen);
160 off_t badoff;
161 int badlen;
162
163 if (!XrdOucPgrwUtils::csVer(dInfo, badoff, badlen))
164 {char eMsg[512];
165 snprintf(eMsg, sizeof(eMsg), "Checksum error at offset %lld.", (long long) badoff);
166 error.setErrInfo(EDOM, eMsg);
167 return SFS_ERROR;
168 }
169 }
170
171// Now just return the result of a plain write
172//
173 return write(offset, buffer, wrlen);
174}
#define write(a, b, c)
Definition XrdPosix.hh:115
#define eMsg(x)
static bool csVer(dataInfo &dInfo, off_t &bado, int &badc)
static const uint64_t Verify
Options for pgRead() and pgWrite() as noted below.

References XrdOucPgrwUtils::csVer(), eMsg, error, opts, SFS_ERROR, Verify, and write.

Referenced by pgWrite().

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

◆ read() [1/4]

XrdSfsXferSize XrdSfsFile::read ( XrdOucRangeList & rlist)
virtual

Preread a list of file blocks into the file system cache.

Parameters
rlist- A list of byte ranges to pre-read.
Returns
>= 0 When 0, the request was ignored; otherwise, it has been accepted.
SFS_ERROR File could not be preread, error holds the reason.

Definition at line 192 of file XrdSfsInterface.cc.

193{
194 for (auto it = rlist.begin(); it != rlist.end(); it++)
195 if (read(it->offset, it->size) == SFS_ERROR) return SFS_ERROR;
196 return 1;
197}

References read, and SFS_ERROR.

◆ read() [2/4]

virtual int XrdSfsFile::read ( XrdSfsAio * aioparm)
pure virtual

Read file bytes using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
Returns
SFS_OK Request accepted and will be scheduled.
SFS_ERROR File could not be read, error holds the reason.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ read() [3/4]

virtual XrdSfsXferSize XrdSfsFile::read ( XrdSfsFileOffset offset,
char * buffer,
XrdSfsXferSize size )
pure virtual

Read file bytes into a buffer.

Parameters
offset- The offset where the read is to start.
buffer- pointer to buffer where the bytes are to be placed.
size- The number of bytes to read.
Returns
>= 0 The number of bytes that placed in buffer.
SFS_ERROR File could not be read, error holds the reason.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ read() [4/4]

virtual XrdSfsXferSize XrdSfsFile::read ( XrdSfsFileOffset offset,
XrdSfsXferSize size )
pure virtual

Preread a file block 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 When 0, the request was ignored; otherwise, it has been accepted.
SFS_ERROR File could not be preread, error holds the reason.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ readv()

XrdSfsXferSize XrdSfsFile::readv ( XrdOucIOVec * readV,
int rdvCnt )
virtual

Given an array of read requests (size rdvCnt), read them from the file and place the contents consecutively in the provided buffer. A dumb default implementation is supplied but should be replaced to increase performance.

Parameters
readVpointer to the array of read requests.
rdvCntthe number of elements in readV.
Returns
>=0 The numbe of bytes placed into the buffer.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented in XrdDigFile, XrdOfsFile, XrdSfsNativeFile, and XrdSsiFile.

Definition at line 203 of file XrdSfsInterface.cc.

205{
206 XrdSfsXferSize rdsz, totbytes = 0;
207
208 for (int i = 0; i < rdvCnt; i++)
209 {rdsz = read(readV[i].offset,
210 readV[i].data, readV[i].size);
211 if (rdsz != readV[i].size)
212 {if (rdsz < 0) return rdsz;
213 error.setErrInfo(ESPIPE,"read past eof");
214 return SFS_ERROR;
215 }
216 totbytes += rdsz;
217 }
218 return totbytes;
219}

References error, read, and SFS_ERROR.

◆ SendData()

int XrdSfsFile::SendData ( XrdSfsDio * sfDio,
XrdSfsFileOffset offset,
XrdSfsXferSize size )
virtual

Send file bytes via a XrdSfsDio sendfile object to a client (optional).

Parameters
sfDio- Pointer to the sendfile object for data transfer.
offset- The offset where the read is to start.
size- The number of bytes to read and send.
Returns
SFS_ERROR File not read, error object has reason.
SFS_OK Either data has been successfully sent via sfDio or no data has been sent and a normal read() should be issued.

Reimplemented in XrdSsiFile, and XrdThrottle::File.

Definition at line 225 of file XrdSfsInterface.cc.

228{
229 (void)sfDio; (void)offset; (void)size;
230 return SFS_OK;
231}

References SFS_OK.

◆ setXio()

virtual void XrdSfsFile::setXio ( XrdSfsXio * xioP)
inlinevirtual

Enable exchange buffer I/O for write calls.

Parameters
xioP- Pointer to the XrdSfsXio object to be used for buffer exchanges.

Reimplemented in XrdSsiFile.

Definition at line 809 of file XrdSfsInterface.hh.

809{ (void)xioP; }

◆ stat()

virtual int XrdSfsFile::stat ( struct stat * buf)
pure virtual

Return state information on the file.

Parameters
buf- Pointer to the structure where info it to be returned.
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL. When SFS_OK is returned, buf must hold stat information.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

References stat().

Referenced by XrdXrootdFile::XrdXrootdFile(), and stat().

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

◆ sync() [1/2]

virtual int XrdSfsFile::sync ( )
pure virtual

Make sure all outstanding data is actually written to the file (sync).

Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ sync() [2/2]

virtual int XrdSfsFile::sync ( XrdSfsAio * aiop)
pure virtual

Make sure all outstanding data is actually written to the file (async).

Returns
SFS_OK Request accepted and will be scheduled.
SFS_ERROR Request could not be accepted, return error has reason.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ truncate()

virtual int XrdSfsFile::truncate ( XrdSfsFileOffset fsize)
pure virtual

Truncate the file.

Parameters
fsize- The size that the file is to have.
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ write() [1/2]

virtual int XrdSfsFile::write ( XrdSfsAio * aioparm)
pure virtual

Write file bytes using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
Returns
0 Request accepted and will be scheduled.
!0 Request not accepted, returned value is errno.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ write() [2/2]

virtual XrdSfsXferSize XrdSfsFile::write ( XrdSfsFileOffset offset,
const char * buffer,
XrdSfsXferSize size )
pure virtual

Write file bytes from a buffer.

Parameters
offset- The offset where the write is to start.
buffer- pointer to buffer where the bytes reside.
size- The number of bytes to write.
Returns
>= 0 The number of bytes that were written.
SFS_ERROR File could not be written, error holds the reason.

Implemented in XrdBwmFile, XrdDigFile, XrdOfsFile, XrdSfsNativeFile, XrdSsiFile, and XrdThrottle::File.

◆ writev()

XrdSfsXferSize XrdSfsFile::writev ( XrdOucIOVec * writeV,
int wdvCnt )
virtual

Given an array of write requests (size wdvcnt), write them to the file from the provided associated buffer. A dumb default implementation is supplied but should be replaced to increase performance.

Parameters
writeVpointer to the array of write requests.
wdvCntthe number of elements in writeV.
Returns
>=0 The total number of bytes written to the file.
SFS_ERROR File could not be written, error holds the reason.

Definition at line 237 of file XrdSfsInterface.cc.

239{
240 XrdSfsXferSize wrsz, totbytes = 0;
241
242 for (int i = 0; i < wdvCnt; i++)
243 {wrsz = write(writeV[i].offset,
244 writeV[i].data, writeV[i].size);
245 if (wrsz != writeV[i].size)
246 {if (wrsz < 0) return wrsz;
247 error.setErrInfo(ESPIPE,"write past eof");
248 return SFS_ERROR;
249 }
250 totbytes += wrsz;
251 }
252 return totbytes;
253}

References error, SFS_ERROR, and write.

Member Data Documentation

◆ error

◆ Verify

const uint64_t XrdSfsFile::Verify = 0x8000000000000000ULL
static

Options for pgRead() and pgWrite() as noted below.

all: Verify checksums

Definition at line 550 of file XrdSfsInterface.hh.

Referenced by XrdOfsFile::pgRead(), XrdOfsFile::pgRead(), XrdOfsFile::pgWrite(), XrdOfsFile::pgWrite(), and pgWrite().


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