Loading...
Searching...
No Matches
XrdSsiFile Class Reference

`#include <XrdSsiFile.hh>`

Inheritance diagram for XrdSsiFile:
Collaboration diagram for XrdSsiFile:

## Public Member Functions

| XrdSsiFile (const char *user, int MonID)
virtual | ~XrdSsiFile ()
int | close ()
int | fctl (const int cmd, const char *args, XrdOucErrInfo &out_error)
int | fctl (const int cmd, int alen, const char *args, const XrdSecEntity *client)
const char * | FName ()
int | getCXinfo (char cxtype[4], int &cxrsz)
int | getMmap (void **Addr, off_t &Size)
int | open (const char *fileName, XrdSfsFileOpenMode openMode, mode_t createMode, const XrdSecEntity *client=0, const char *opaque=0)
int | read (XrdSfsAio *aioparm)
XrdSfsXferSize | read (XrdSfsFileOffset fileOffset, char *buffer, XrdSfsXferSize buffer_size)
int | read (XrdSfsFileOffset fileOffset, XrdSfsXferSize preread_sz)
XrdSfsXferSize | readv (XrdOucIOVec *readV, int readCount)
int | SendData (XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size)
void | setXio (XrdSfsXio *xP)
int | stat (struct stat *buf)
int | sync ()
int | sync (XrdSfsAio *aiop)
int | truncate (XrdSfsFileOffset fileOffset)
int | write (XrdSfsAio *aioparm)
XrdSfsXferSize | write (XrdSfsFileOffset fileOffset, const char *buffer, XrdSfsXferSize buffer_size)
Public Member Functions inherited from XrdSfsFile
| 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 | 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 | writev (XrdOucIOVec *writeV, int wdvCnt)

## Additional Inherited Members

Public Types inherited from XrdSfsFile
enum | cpAct { cpCreate =0 , cpDelete , cpRestore , cpQuery , cpTrunc , cpWrite }
Public Attributes inherited from XrdSfsFile
XrdOucErrInfo & | error
Static Public Attributes inherited from XrdSfsFile
static const uint64_t | Verify = 0x8000000000000000ULL
| Options for pgRead() and pgWrite() as noted below.

## Detailed Description

Definition at line 39 of file XrdSsiFile.hh.

## Constructor & Destructor Documentation

## XrdSsiFile()

XrdSsiFile::XrdSsiFile | ( | const char * | user,
|  | int | MonID )

inline

Definition at line 102 of file XrdSsiFile.hh.

: XrdSfsFile(myEInfo), fsFile(0), fSessP(0),
myEInfo(user, MonID) {}
XrdSfsFile::XrdSfsFile
XrdSfsFile(const char *user=0, int MonID=0)
Definition XrdSfsInterface.hh:779

References XrdSfsFile::XrdSfsFile().

Here is the call graph for this function:

## ~XrdSsiFile()

XrdSsiFile::~XrdSsiFile | ( |  | ) |

virtual

Definition at line 65 of file XrdSsiFile.cc.

{
// If we have a file object then delete it -- it needs to close. Else do it.
//
if (fsFile) delete fsFile;
if (fSessP) fSessP->Recycle();
}

## Member Function Documentation

## close()

int XrdSsiFile::close | ( |  | ) |

virtual

Close the file.

Returns
  One of SFS_OK or SFS_ERROR.

Implements XrdSfsFile.

Definition at line 78 of file XrdSsiFile.cc.

{
// Route this request as needed
//
if (fsFile) return fsFile->close();
// Forward this to the file session object
//
return fSessP->close();
}

## fctl() [1/2]

int XrdSsiFile::fctl | ( | const int | cmd,
|  | const char * | args,
|  | XrdOucErrInfo & | eInfo )

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.

Implements XrdSfsFile.

Definition at line 101 of file XrdSsiFile.cc.

{
// Route this request as needed
//
if (fsFile) return fsFile->fctl(cmd, args, out_error);
// Indicate we would like to use SendData()
//
if (cmd == SFS_FCTL_GETFD)
{out_error.setErrCode(SFS_SFIO_FDVAL);
return SFS_OK;
}
// We don't support any other kind of command
//
return XrdSsiUtils::Emsg("fctl",ENOTSUP,"fctl",fSessP->FName(),out_error);
}
SFS_SFIO_FDVAL
#define SFS_SFIO_FDVAL
Definition XrdSfsInterface.hh:90
SFS_FCTL_GETFD
#define SFS_FCTL_GETFD
Definition XrdSfsInterface.hh:86
SFS_OK
#define SFS_OK
Definition XrdSfsInterface.hh:108
XrdSsiUtils::Emsg
static int Emsg(const char *pfx, int ecode, const char *op, const char *path, XrdOucErrInfo &eDest)
Definition XrdSsiUtils.cc:159

References XrdSsiUtils::Emsg(), XrdOucErrInfo::setErrCode(), SFS_FCTL_GETFD, SFS_OK, and SFS_SFIO_FDVAL.

Here is the call graph for this function:

## fctl() [2/2]

int XrdSsiFile::fctl | ( | const int | cmd,
|  | int | alen,
|  | const char * | args,
|  | const XrdSecEntity * | client )

virtual

Execute a special operation on the file (version 2)

Parameters

  cmd | - The operation to be performed: SFS_FCTL_SPEC1 Perform implementation defined action
  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 from XrdSfsFile.

Definition at line 124 of file XrdSsiFile.cc.

{
// Route this request as needed (callback possible)
//
if (fsFile) return fsFile->fctl(cmd, alen, args, client);
// Forward this to the session object
//
return fSessP->fctl(cmd, alen, args, client);
}

## FName()

const char * XrdSsiFile::FName | ( |  | ) |

virtual

Get the file path.

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

Implements XrdSfsFile.

Definition at line 143 of file XrdSsiFile.cc.

{
// Route to filesystem if need be
//
if (fsFile) return fsFile->FName();
// Return our name
//
return fSessP->FName();
}

## getCXinfo()

int XrdSsiFile::getCXinfo | ( | char | cxtype[4],
|  | int & | cxrsz )

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.

Implements XrdSfsFile.

Definition at line 159 of file XrdSsiFile.cc.

{
// Route this request as needed (no callback possible)
//
if (fsFile) return fsFile->getCXinfo(cxtype, cxrsz);
// Indicate we don't support compression
//
cxrsz = 0;
return SFS_OK;
}

References SFS_OK.

## getMmap()

int XrdSsiFile::getMmap | ( | void ** | Addr,
|  | off_t & | Size )

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.

Implements XrdSfsFile.

Definition at line 185 of file XrdSsiFile.cc.

{
// Route this request as needed (no callback possible)
//
if (fsFile) return fsFile->getMmap(Addr, Size);
// Indicate we don't support memory mapping
//
if (Addr) *Addr = 0;
Size = 0;
return SFS_OK;
}

References SFS_OK.

## open()

int XrdSsiFile::open | ( | const char * | fileName,
|  | XrdSfsFileOpenMode | openMode,
|  | mode_t | createMode,
|  | const XrdSecEntity * | client = 0,
|  | const char * | opaque = 0 )

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

Implements XrdSfsFile.

Definition at line 209 of file XrdSsiFile.cc.

{
static const char *epname = "open";
int eNum;
// Verify that this object is not already associated with an open file
//
if (fsFile || fSessP)
return XrdSsiUtils::Emsg(epname, EADDRINUSE, "open session", path, error);
// Open a regular file if this is wanted
//
if (fsChk && FSPath.Find(path))
{if (!(fsFile = theFS->newFile(error)))
return XrdSsiUtils::Emsg(epname, ENOMEM, "open file", path, error);
return fsFile->open(path, open_mode, Mode, client, info);
}
// Convert opaque and security into an environment
//
XrdOucEnv Open_Env(info, 0, client);
// Allocate file session and issue open
//
fSessP = XrdSsiFileSess::Alloc(error, error.getErrUser());
eNum = fSessP->open(path, Open_Env, open_mode);
if (eNum) {fSessP->Recycle(); fSessP = 0;}
return eNum;
}
Mode
int Mode
Definition XrdSecgsiProxy.cc:94
XrdOucPListAnchor::Find
unsigned long long Find(const char *pathname)
Definition XrdOucPList.hh:112
XrdSfsFileSystem::newFile
virtual XrdSfsFile * newFile(char *user=0, int MonID=0)=0
XrdSfsFile::error
XrdOucErrInfo & error
Definition XrdSfsInterface.hh:378
XrdSsiFileSess::Alloc
static XrdSsiFileSess * Alloc(XrdOucErrInfo &einfo, const char *user)
Definition XrdSsiFileSess.cc:126
XrdSsi::theFS
XrdSfsFileSystem * theFS
Definition XrdSsiFile.cc:54
XrdSsi::fsChk
bool fsChk
Definition XrdSsiFile.cc:56
XrdSsi::FSPath
XrdOucPListAnchor FSPath
Definition XrdSsiFile.cc:55

References XrdSsiFileSess::Alloc(), XrdSsiUtils::Emsg(), XrdSfsFile::error, XrdSsi::fsChk, XrdSsi::FSPath, Mode, and XrdSsi::theFS.

Here is the call graph for this function:

## read() [1/3]

int XrdSsiFile::read | ( | XrdSfsAio * | aioparm | ) |

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.

Implements XrdSfsFile.

Definition at line 312 of file XrdSsiFile.cc.

{
// Route to file system if need be (no callback possible)
//
if (fsFile) return fsFile->read(aiop);
// Execute this request in a synchronous fashion
//
aiop->Result = fSessP->read((XrdSfsFileOffset)aiop->sfsAio.aio_offset,
(char *)aiop->sfsAio.aio_buf,
(XrdSfsXferSize)aiop->sfsAio.aio_nbytes);
aiop->doneRead();
return 0;
}
XrdSfsFileOffset
long long XrdSfsFileOffset
Definition XrdSfsInterface.hh:128
XrdSfsXferSize
int XrdSfsXferSize
Definition XrdSfsInterface.hh:131

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::doneRead(), XrdSfsAio::Result, and XrdSfsAio::sfsAio.

Here is the call graph for this function:

## read() [2/3]

XrdSfsXferSize XrdSsiFile::read | ( | XrdSfsFileOffset | offset,
|  | char * | buffer,
|  | XrdSfsXferSize | size )

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.

Implements XrdSfsFile.

Definition at line 283 of file XrdSsiFile.cc.

{
// Route to file system if need be (no callback possible)
//
if (fsFile) return fsFile->read(offset, buff, blen);
// Forward this to the file session
//
return fSessP->read(offset, buff, blen);
}

## read() [3/3]

int XrdSsiFile::read | ( | XrdSfsFileOffset | offset,
|  | XrdSfsXferSize | 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 The number of bytes that will be pre-read.
  SFS_ERROR File could not be preread, error holds the reason.

Implements XrdSfsFile.

Definition at line 258 of file XrdSsiFile.cc.

{
// Route to file system if need be (no callback possible)
//
if (fsFile) return fsFile->read(offset, blen);
// We ignore these
//
return SFS_OK;
}

References SFS_OK.

## readv()

XrdSfsXferSize XrdSsiFile::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

  readV | pointer to the array of read requests.
  rdvCnt | the 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 from XrdSfsFile.

Definition at line 332 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (no callback possible)
//
if (fsFile) return fsFile->readv(readV, readCount);
return XrdSsiUtils::Emsg("readv",ENOTSUP,"readv",fSessP->FName(),error);
}

References XrdSsiUtils::Emsg(), and XrdSfsFile::error.

Here is the call graph for this function:

## SendData()

int XrdSsiFile::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 from XrdSfsFile.

Definition at line 357 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (no callback possible)
//
if (fsFile) return fsFile->SendData(sfDio, offset, size);
// Forward this to the file session object
//
return fSessP->SendData(sfDio, offset, size);
}

## setXio()

void XrdSsiFile::setXio | ( | XrdSfsXio * | xioP | ) |

virtual

Enable exchange buffer I/O for write calls.

Parameters

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

Reimplemented from XrdSfsFile.

Definition at line 375 of file XrdSsiFile.cc.

{
if (fSessP) fSessP->setXio(xP);
if (fsFile) fsFile->setXio(xP);
}

## stat()

int XrdSsiFile::stat | ( | struct stat * | buf | ) |

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.

Implements XrdSfsFile.

Definition at line 385 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (no callback possible)
//
if (fsFile) return fsFile->stat(buf);
// Otherwise there is no stat information
//
memset(buf, 0 , sizeof(struct stat));
return SFS_OK;
}
XrdSsiFile::stat
int stat(struct stat *buf)
Definition XrdSsiFile.cc:385

References SFS_OK, and stat().

Referenced by stat().

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

## sync() [1/2]

int XrdSsiFile::sync | ( |  | ) |

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

Implements XrdSfsFile.

Definition at line 409 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (callback possible)
//
if (fsFile) return fsFile->sync();
// We don't support this
//
return XrdSsiUtils::Emsg("sync",ENOTSUP,"sync",fSessP->FName(),error);
}

References XrdSsiUtils::Emsg(), and XrdSfsFile::error.

Here is the call graph for this function:

## sync() [2/2]

int XrdSsiFile::sync | ( | XrdSfsAio * | aiop | ) |

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.

Implements XrdSfsFile.

Definition at line 432 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (callback possible)
//
if (fsFile) return fsFile->sync(aiop);
// We don't support this
//
return XrdSsiUtils::Emsg("syncaio",ENOTSUP,"sync",fSessP->FName(),error);
}

References XrdSsiUtils::Emsg(), and XrdSfsFile::error.

Here is the call graph for this function:

## truncate()

int XrdSsiFile::truncate | ( | XrdSfsFileOffset | fsize | ) |

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

Implements XrdSfsFile.

Definition at line 448 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (callback possible)
//
if (fsFile) return fsFile->truncate(flen);
// Route this to the file session object
//
return fSessP->truncate(flen);
}

## write() [1/2]

int XrdSsiFile::write | ( | XrdSfsAio * | aioparm | ) |

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.

Implements XrdSfsFile.

Definition at line 503 of file XrdSsiFile.cc.

{
// Route to file system if need be (no callback possible)
//
if (fsFile) return fsFile->write(aiop);
// Execute this request in a synchronous fashion
//
aiop->Result = fSessP->write((XrdSfsFileOffset)aiop->sfsAio.aio_offset,
(char *)aiop->sfsAio.aio_buf,
(XrdSfsXferSize)aiop->sfsAio.aio_nbytes);
aiop->doneWrite();
return 0;
}

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::doneWrite(), XrdSfsAio::Result, and XrdSfsAio::sfsAio.

Here is the call graph for this function:

## write() [2/2]

XrdSfsXferSize XrdSsiFile::write | ( | XrdSfsFileOffset | offset,
|  | const char * | buffer,
|  | XrdSfsXferSize | size )

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.

Implements XrdSfsFile.

Definition at line 471 of file XrdSsiFile.cc.

{
// Route this request to file system if need be (no callback possible)
//
if (fsFile) return fsFile->write(offset, buff, blen);
// Route this to the file session object
//
return fSessP->write(offset, buff, blen);
}

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

- XrdSsiFile.hh
- XrdSsiFile.cc