XRootD
Loading...
Searching...
No Matches
XrdOfsFile Class Reference

#include <XrdOfs.hh>

Inheritance diagram for XrdOfsFile:
Collaboration diagram for XrdOfsFile:

Public Member Functions

 XrdOfsFile (XrdOucErrInfo &eInfo, const char *user)
 ~XrdOfsFile ()
int checkpoint (XrdSfsFile::cpAct act, struct iov *range=0, int n=0)
int Clone (const std::vector< XrdOucCloneSeg > &cVec)
int Clone (XrdSfsFile &srcFile)
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=0)
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, const char *opaque=0)
int pgRead (XrdSfsAio *aioparm, uint64_t opts=0)
XrdSfsXferSize pgRead (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0)
int pgWrite (XrdSfsAio *aioparm, uint64_t opts=0)
XrdSfsXferSize pgWrite (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize wrlen, uint32_t *csvec, uint64_t opts=0)
int read (XrdSfsAio *aioparm)
XrdSfsXferSize read (XrdSfsFileOffset fileOffset, char *buffer, XrdSfsXferSize buffer_size)
int read (XrdSfsFileOffset fileOffset, XrdSfsXferSize amount)
XrdSfsXferSize readv (XrdOucIOVec *readV, int readCount)
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 XrdSfsXferSize read (XrdOucRangeList &rlist)
virtual int SendData (XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size)
virtual void setXio (XrdSfsXio *xioP)
virtual XrdSfsXferSize writev (XrdOucIOVec *writeV, int wdvCnt)

Protected Attributes

bool ckpBad
int dorawio
XrdOucChkPntmyCKP
XrdOfsTPCmyTPC
XrdOfsHandleoh
const char * tident
bool viaDel

Additional Inherited Members

Public Types inherited from XrdSfsFile
enum  cpAct {
  cpCreate =0 ,
  cpDelete ,
  cpRestore ,
  cpQuery ,
  cpTrunc ,
  cpWrite
}
Public Attributes inherited from XrdSfsFile
XrdOucErrInfoerror
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 115 of file XrdOfs.hh.

Constructor & Destructor Documentation

◆ XrdOfsFile()

XrdOfsFile::XrdOfsFile ( XrdOucErrInfo & eInfo,
const char * user )

Definition at line 462 of file XrdOfs.cc.

463 : XrdSfsFile(eInfo), tident(user ? user : ""),
464 oh(XrdOfs::dummyHandle), myTPC(0), myCKP(0),
465 dorawio(0), viaDel(false), ckpBad(false) {}
bool viaDel
Definition XrdOfs.hh:206
const char * tident
Definition XrdOfs.hh:201
XrdOfsHandle * oh
Definition XrdOfs.hh:202
int dorawio
Definition XrdOfs.hh:205
XrdOucChkPnt * myCKP
Definition XrdOfs.hh:204
bool ckpBad
Definition XrdOfs.hh:207
XrdOfsTPC * myTPC
Definition XrdOfs.hh:203
XrdSfsFile(const char *user=0, int MonID=0)

References XrdSfsFile::XrdSfsFile(), ckpBad, dorawio, myCKP, myTPC, oh, tident, and viaDel.

Referenced by XrdOfsFileFull::XrdOfsFileFull(), and Clone().

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

◆ ~XrdOfsFile()

XrdOfsFile::~XrdOfsFile ( )
inline

Definition at line 197 of file XrdOfs.hh.

197{viaDel = true; if (oh) close();}
int close()
Definition XrdOfs.cc:899

References close(), oh, and viaDel.

Here is the call graph for this function:

Member Function Documentation

◆ checkpoint()

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

Reimplemented from XrdSfsFile.

Definition at line 1006 of file XrdOfs.cc.

1007{
1008 EPNAME("chkpnt");
1009 const char *ckpName;
1010 int rc;
1011 bool readok;
1012
1013// Make sure we are active
1014//
1015 if (oh->Inactive()) return XrdOfsFS->Emsg(epname, error, EBADF,
1016 "handle checkpoint", (const char *)0);
1017
1018// If checkpointing is disabled, the don't accept this request.
1019//
1020 if (!XrdOfsConfigCP::Enabled) return XrdOfsFS->Emsg(epname, error, ENOTSUP,
1021 "handle disabled checkpoint", (const char *)0);
1022
1023// If this checkpoint is bad then only a delete, query or restore is allowed.
1024//
1025 if (ckpBad && (act == XrdSfsFile::cpTrunc || act == XrdSfsFile::cpWrite))
1026 return XrdOfsFS->Emsg(epname, error, EIDRM, "extend checkpoint "
1027 "(only delete or restore possible) for", oh->Name());
1028
1029// Handle the request
1030//
1031 switch(act)
1033 ckpName = "create checkpoint for";
1034 if ((rc = CreateCKP())) return rc;
1035 if ((rc = myCKP->Create())) {myCKP->Finished(); myCKP = 0;}
1036 break;
1038 ckpName = "delete checkpoint for";
1039 if (!myCKP) rc = ENOENT;
1040 else {rc = myCKP->Delete();
1041 myCKP->Finished();
1042 myCKP = 0;
1043 ckpBad = false;
1044 }
1045 break;
1047 ckpName = "query checkpoint for";
1048 if (!range || n <= 0)
1049 return XrdOfsFS->Emsg(epname, error, EINVAL,
1050 "query checkpoint limits for", oh->Name());
1051 rc = (myCKP ? myCKP->Query(*range) : ENOENT);
1052 break;
1054 ckpName = "restore checkpoint for";
1055 if (!myCKP) rc = ENOENT;
1056 else {if (!(rc = myCKP->Restore(&readok)))
1057 {myCKP->Finished();
1058 myCKP = 0;
1059 ckpBad = false;
1060 } else {
1061 if (!(oh->Select().DFType() & XrdOssDF::DF_isProxy))
1062 oh->Suppress((readok ? 0 : -EDOM));
1063 ckpBad = true;
1064 }
1065 }
1066 break;
1068 ckpName = "checkpoint truncate";
1069 if (!range) rc = EINVAL;
1070 else if (!myCKP) rc = ENOENT;
1071 else if ((rc = myCKP->Truncate(range))) ckpBad = true;
1072 break;
1074 ckpName = "checkpoint write";
1075 if (!range || n <= 0) rc = EINVAL;
1076 else if (!myCKP) rc = ENOENT;
1077 else if ((rc = myCKP->Write(range, n))) ckpBad = true;
1078 break;
1079
1080 default: return XrdOfsFS->Emsg(epname, error, EINVAL,
1081 "decode checkpoint request for", oh->Name());
1082 };
1083
1084// Complete as needed
1085//
1086 if (rc) return XrdOfsFS->Emsg(epname, error, rc, ckpName, oh->Name());
1087
1088// Trace success and return
1089//
1090 FTRACE(chkpnt, ckpName);
1091 return SFS_OK;
1092}
#define EPNAME(x)
#define FTRACE(act, x)
XrdOfs * XrdOfsFS
Definition XrdOfsFS.cc:47
#define SFS_OK
static bool Enabled
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, XrdOfsHandle *hP, bool posChk=false, bool chktype=true)
Definition XrdOfs.cc:2633
static const uint16_t DF_isProxy
Object is a proxy object.
Definition XrdOss.hh:434
XrdOucErrInfo & error
@ 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.

References ckpBad, XrdSfsFile::cpCreate, XrdSfsFile::cpDelete, XrdSfsFile::cpQuery, XrdSfsFile::cpRestore, XrdSfsFile::cpTrunc, XrdSfsFile::cpWrite, XrdOssDF::DF_isProxy, XrdOfsConfigCP::Enabled, EPNAME, XrdSfsFile::error, FTRACE, myCKP, oh, SFS_OK, and XrdOfsFS.

◆ Clone() [1/2]

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

Definition at line 881 of file XrdOfs.cc.

882{
883 EPNAME("Clone");
884 int rc = oh->Select().Clone(cVec);
885
886 if (rc < 0)
887 {char etxt[4096];
888 snprintf(etxt,sizeof(etxt),"%s from file ranges",oh->Name());
889 return XrdOfsFS->Emsg(epname, error, rc, "clone", etxt);
890 }
891
892 return SFS_OK;
893}

References EPNAME, XrdSfsFile::error, oh, SFS_OK, and XrdOfsFS.

◆ Clone() [2/2]

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

Definition at line 864 of file XrdOfs.cc.

865{
866 EPNAME("Clone");
867 XrdOfsFile& ofsFile = static_cast<XrdOfsFile&>(srcFile);
868 int rc = oh->Select().Clone(ofsFile.oh->Select());
869
870 if (rc < 0)
871 {char etxt[4096];
872 snprintf(etxt,sizeof(etxt),"%s from %s",oh->Name(),ofsFile.oh->Name());
873 return XrdOfsFS->Emsg(epname, error, rc, "clone", etxt);
874 }
875
876 return SFS_OK;
877}
XrdOfsFile(XrdOucErrInfo &eInfo, const char *user)
Definition XrdOfs.cc:462
XrdOssDF & Select(void)
const char * Name()

References XrdOfsFile(), XrdSfsFile::XrdSfsFile(), EPNAME, XrdSfsFile::error, XrdOfsHandle::Name(), oh, XrdOfsHandle::Select(), SFS_OK, and XrdOfsFS.

Here is the call graph for this function:

◆ close()

int XrdOfsFile::close ( )
virtual

Close the file.

Returns
One of SFS_OK or SFS_ERROR.

Implements XrdSfsFile.

Definition at line 899 of file XrdOfs.cc.

907{
908 EPNAME("close");
909
910 class CloseFH : public XrdOfsHanCB
911 {public: void Retired(XrdOfsHandle *hP) {XrdOfsFS->Unpersist(hP);}};
912 static XrdOfsHanCB *hCB = static_cast<XrdOfsHanCB *>(new CloseFH);
913
914 XrdOfsHandle *hP;
915 int poscNum, retc, cRetc = 0;
916 short theMode;
917
918// Trace the call
919//
920 FTRACE(close, "use=" <<oh->Usage()); // Unreliable trace, no origin lock
921
922// Verify the handle (we briefly maintain a global lock)
923//
924 XrdOfsFS->ocMutex.Lock();
925 if (oh == XrdOfs::dummyHandle)
926 {XrdOfsFS->ocMutex.UnLock(); return SFS_OK;}
927 if ((oh->Inactive()))
928 {XrdOfsFS->ocMutex.UnLock();
929 return XrdOfsFS->Emsg(epname, error, EBADF, "close file");
930 }
931 hP = oh; oh = XrdOfs::dummyHandle;
932 XrdOfsFS->ocMutex.UnLock();
933 hP->Lock();
934
935// Delete the tpc object, if any
936//
937 if (myTPC) {myTPC->Del(); myTPC = 0;}
938
939// Maintain statistics
940//
942 if (!(hP->isRW)) OfsStats.Data.numOpenR--;
943 else {OfsStats.Data.numOpenW--;
945 }
947
948// If this file was tagged as a POSC then we need to make sure it will persist
949// Note that we unpersist the file immediately when it's inactive or if no hold
950// time is allowed. Also, close events occur only for active handles. If the
951// entry was via delete then we ignore the close return code as there is no
952// one to handle it on the other side.
953//
954 if ((poscNum = hP->PoscGet(theMode, !viaDel)))
955 {if (viaDel)
956 {if (hP->Inactive() || !XrdOfsFS->poscHold)
957 {XrdOfsFS->Unpersist(hP, !hP->Inactive()); hP->Retire(cRetc);}
958 else hP->Retire(hCB, XrdOfsFS->poscHold);
959 return SFS_OK;
960 }
961 if ((retc = hP->Select().Fchmod(theMode)))
962 XrdOfsFS->Emsg(epname, error, retc, "fchmod", hP->Name());
963 else {XrdOfsFS->poscQ->Del(hP->Name(), poscNum);
964 if (XrdOfsFS->Balancer) XrdOfsFS->Balancer->Added(hP->Name());
965 }
966 }
967
968// Handle any oustanding checkpoint
969//
970 if (myCKP)
971 {retc = myCKP->Restore();
972 if (retc) XrdOfsFS->Emsg(epname,error,retc,"restore chkpnt",hP->Name());
973 myCKP->Finished();
974 myCKP = 0;
975 }
976
977// We need to handle the cunudrum that an event may have to be sent upon
978// the final close. However, that would cause the path name to be destroyed.
979// So, we have two modes of logic where we copy out the pathname if a final
980// close actually occurs. The path is not copied if it's not final and we
981// don't bother with any of it if we need not generate an event.
982//
983 if (XrdOfsFS->evsObject && tident
984 && XrdOfsFS->evsObject->Enabled(hP->isRW ? XrdOfsEvs::Closew
986 {long long FSize, *retsz;
987 char pathbuff[MAXPATHLEN+8];
988 XrdOfsEvs::Event theEvent;
989 if (hP->isRW) {theEvent = XrdOfsEvs::Closew; retsz = &FSize;}
990 else { theEvent = XrdOfsEvs::Closer; retsz = 0; FSize=0;}
991 if (!(hP->Retire(cRetc, retsz, pathbuff, sizeof(pathbuff))))
992 {XrdOfsEvsInfo evInfo(tident, pathbuff, "" , 0, 0, FSize);
993 XrdOfsFS->evsObject->Notify(theEvent, evInfo);
994 }
995 } else hP->Retire(cRetc);
996
997// All done
998//
999 return (cRetc ? XrdOfsFS->Emsg(epname, error, cRetc, "close file") : SFS_OK);
1000}
XrdOfsStats OfsStats
Definition XrdOfs.cc:115
virtual void Added(const char *path, int Pend=0)
void Notify(Event eNum, XrdOfsEvsInfo &Info)
Definition XrdOfsEvs.cc:234
int Enabled(Event theEvents)
Definition XrdOfsEvs.hh:139
virtual void Retired(XrdOfsHandle *)=0
int Retire(int &retc, long long *retsz=0, char *buff=0, int blen=0)
int PoscGet(short &Mode, int Done=0)
static const int opPC
int Del(const char *Lfn, int Offset, int Unlink=0)
struct XrdOfsStats::StatsData Data
XrdSysMutex sdMutex
void Unpersist(XrdOfsHandle *hP, int xcev=1)
Definition XrdOfs.cc:2933
virtual int Fchmod(mode_t mode)
Definition XrdOss.hh:148

References close(), XrdOfsEvs::Closer, XrdOfsEvs::Closew, EPNAME, XrdSfsFile::error, XrdOssDF::Fchmod(), FTRACE, XrdOfsHandle::Inactive(), XrdOfsHandle::isRW, XrdOfsHandle::Lock(), myCKP, myTPC, XrdOfsHandle::Name(), OfsStats, oh, XrdOfsHandle::opPC, XrdOfsHandle::PoscGet(), XrdOfsHandle::Retire(), XrdOfsHandle::Select(), SFS_OK, tident, viaDel, and XrdOfsFS.

Referenced by ~XrdOfsFile(), and close().

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

◆ fctl() [1/2]

int XrdOfsFile::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 1138 of file XrdOfs.cc.

1141{
1142// See if we can do this
1143//
1144 if (cmd == SFS_FCTL_GETFD)
1145 {out_error.setErrCode(oh->Select().getFD());
1146 return SFS_OK;
1147 }
1148
1149// We don't support this
1150//
1151 out_error.setErrInfo(ENOTSUP, "fctl operation not supported");
1152
1153// Return
1154//
1155 return SFS_ERROR;
1156}
#define SFS_ERROR
#define SFS_FCTL_GETFD

References oh, XrdOucErrInfo::setErrCode(), XrdOucErrInfo::setErrInfo(), SFS_ERROR, SFS_FCTL_GETFD, and SFS_OK.

Here is the call graph for this function:

◆ fctl() [2/2]

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

Definition at line 1160 of file XrdOfs.cc.

1162{ // 12345678901234
1163 EPNAME("fctl");
1164 static const char *fctlArg = "ofs.tpc cancel";
1165 static const int fctlAsz = 15;
1166
1167// For QFINFO we simply pass it to the Oss layer
1168//
1169 if (cmd == SFS_FCTL_QFINFO)
1170 {char* resp = 0;;
1171 int rc = oh->Select().Fctl(XrdOssDF::Fctl_QFinfo, alen, args, &resp);
1172 if (rc < 0)
1173 {if (resp) delete[] resp;
1174 return XrdOfsFS->Emsg(epname,error,rc,"fctl",oh,false,false);
1175 }
1176 if (resp)
1177 {if ((rc = strlen(resp)))
1178 {error.setErrInfo(rc, resp);
1179 delete[] resp;
1180 return SFS_DATA;
1181 }
1182 delete[] resp;
1183 }
1184 return SFS_OK;
1185 }
1186
1187// See if the is a tpc cancellation (the only thing we support here)
1188//
1189 if (cmd != SFS_FCTL_SPEC1 || !args || alen < fctlAsz || strcmp(fctlArg,args))
1190 return XrdOfsFS->FSctl(*this, cmd, alen, args, client);
1191
1192// Check if we have a tpc operation in progress
1193//
1194 if (!myTPC)
1195 {error.setErrInfo(ESRCH, "tpc operation not found");
1196 return SFS_ERROR;
1197 }
1198
1199// Cancel the tpc
1200//
1201 myTPC->Del();
1202 myTPC = 0;
1203 return SFS_OK;
1204}
#define SFS_DATA
#define SFS_FCTL_QFINFO
#define SFS_FCTL_SPEC1
int FSctl(const int cmd, XrdSfsFSctl &args, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
static const int Fctl_QFinfo
Definition XrdOss.hh:461

References EPNAME, XrdSfsFile::error, XrdOssDF::Fctl_QFinfo, myTPC, oh, SFS_DATA, SFS_ERROR, SFS_FCTL_QFINFO, SFS_FCTL_SPEC1, SFS_OK, and XrdOfsFS.

◆ FName()

const char * XrdOfsFile::FName ( )
inlinevirtual

Get the file path.

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

Implements XrdSfsFile.

Definition at line 145 of file XrdOfs.hh.

145{return (oh ? oh->Name() : "?");}

References oh.

◆ getCXinfo()

int XrdOfsFile::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 1850 of file XrdOfs.cc.

1861{
1862
1863// Copy out the info
1864//
1865 cxrsz = oh->Select().isCompressed(cxtype);
1866 return SFS_OK;
1867}

References oh, and SFS_OK.

◆ getMmap()

int XrdOfsFile::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 1693 of file XrdOfs.cc.

1701{
1702
1703// Perform the function
1704//
1705 Size = oh->Select().getMmap(Addr);
1706
1707 return SFS_OK;
1708}

References oh, and SFS_OK.

◆ open()

int XrdOfsFile::open ( const char * fileName,
XrdSfsFileOpenMode openMode,
mode_t createMode,
const XrdSecEntity * client,
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_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.

Implements XrdSfsFile.

Definition at line 471 of file XrdOfs.cc.

502{
503 EPNAME("open");
504 static const int crMask = (SFS_O_CREAT | SFS_O_TRUNC);
505 static const int opMask = (SFS_O_RDONLY | SFS_O_WRONLY | SFS_O_RDWR);
506
507 struct OpenHelper
508 {const char *Path;
509 XrdOfsHandle *hP;
510 XrdOssDF *fP;
511 XrdCksCalc *cP;
512 int poscNum;
513
514 int OK() {hP=0; fP=0; cP=0; poscNum=0; return SFS_OK;}
515
516 OpenHelper(const char *path)
517 : Path(path), hP(0), fP(0), cP(0), poscNum(0) {}
518
519 ~OpenHelper()
520 {int retc;
521 if (hP) hP->Retire(retc);
522 if (fP) delete fP;
523 if (cP) cP->Recycle();
524 if (poscNum > 0) XrdOfsFS->poscQ->Del(Path, poscNum, 1);
525 }
526 } oP(path);
527
528 mode_t theMode = (Mode | XrdOfsFS->fMask[0]) & XrdOfsFS->fMask[1];
529 const char *tpcKey;
530 int retc, isPosc = 0, crOpts = 0, isRW = 0, open_flag = 0;
531 int find_flag = open_mode & (SFS_O_NOWAIT | SFS_O_RESET | SFS_O_MULTIW);
532 XrdOucEnv Open_Env(info,0,client);
533
534// Trace entry
535//
536 ZTRACE(open, Xrd::hex1 <<open_mode <<"-" <<Xrd::oct1 <<Mode <<" ("
537 <<Xrd::oct1 <<theMode <<") fn=" <<path);
538
539// Verify that this object is not already associated with an open file
540//
541 XrdOfsFS->ocMutex.Lock();
542 if (oh != XrdOfs::dummyHandle)
543 {XrdOfsFS->ocMutex.UnLock();
544 return XrdOfsFS->Emsg(epname,error,EADDRINUSE,"open file",path);
545 }
546 XrdOfsFS->ocMutex.UnLock();
547
548// Handle the open mode options
549//
550 if (open_mode & crMask)
551 {crOpts = (Mode & SFS_O_MKPTH ? XRDOSS_mkpath : 0);
552 if (XrdOfsFS->poscQ && ((open_mode & SFS_O_POSC) ||
553 XrdOfsFS->poscAuto || Open_Env.Get("ofs.posc")))
554 {isPosc = 1; isRW = XrdOfsHandle::opPC;}
555 else isRW = XrdOfsHandle::opRW;
556 if (open_mode & SFS_O_CREAT)
557 {open_flag = O_RDWR | O_CREAT | O_EXCL;
558 find_flag |= SFS_O_RDWR | SFS_O_CREAT | (open_mode & SFS_O_REPLICA);
559 crOpts |= XRDOSS_new;
560 } else {
561 open_flag |= O_RDWR | O_CREAT | O_TRUNC;
562 find_flag |= SFS_O_RDWR | SFS_O_TRUNC;
563 }
564 if (XrdOfsFS->WantCksRT())
565 {const char* cipher = 0;
566 if ((retc = XrdOfsFS->SetupCksRT(oP.cP, Open_Env, cipher)))
567 {char eBuff[80];
568 snprintf(eBuff, sizeof(eBuff), "setup real-time %s checksum",
569 (cipher ? cipher : "unknown"));
570 return XrdOfsFS->Emsg(epname, error, retc, eBuff, path);
571 }
572 }
573 }
574 else
575 switch(open_mode & opMask)
576 {case SFS_O_RDONLY: open_flag = O_RDONLY; find_flag |= SFS_O_RDONLY;
577 break;
578 case SFS_O_WRONLY: open_flag = O_WRONLY; find_flag |= SFS_O_WRONLY;
579 isRW = XrdOfsHandle::opRW;
580 if (XrdOfsFS->poscQ && ((open_mode & SFS_O_POSC) ||
581 Open_Env.Get("ofs.posc"))) oP.poscNum = -1;
582 break;
583 case SFS_O_RDWR: open_flag = O_RDWR; find_flag |= SFS_O_RDWR;
584 isRW = XrdOfsHandle::opRW;
585 if (XrdOfsFS->poscQ && ((open_mode & SFS_O_POSC) ||
586 Open_Env.Get("ofs.posc"))) oP.poscNum = -1;
587 break;
588 default: open_flag = O_RDONLY; find_flag |= SFS_O_RDONLY;
589 break;
590 }
591
592// Preset TPC handling
593//
594 tpcKey = Open_Env.Get(XrdOucTPC::tpcKey);
595
596// Check if we will be redirecting the tpc request
597//
598 if (tpcKey && isRW && (XrdOfsFS->Options & XrdOfs::RdrTPC))
599 {const char *dOn = Open_Env.Get(XrdOucTPC::tpcDlgOn);
600 int k = ((dOn && *dOn == '1') || strcmp(tpcKey, "delegate") ? 1 : 0);
601 if (XrdOfsFS->tpcRdrHost[k])
602 {error.setErrInfo(XrdOfsFS->tpcRdrPort[k], XrdOfsFS->tpcRdrHost[k]);
603 return SFS_REDIRECT;
604 }
605 }
606
607// If we have a finder object, use it to direct the client. The final
608// destination will apply the security that is needed
609//
610 if (XrdOfsFS->Finder && (retc = XrdOfsFS->Finder->Locate(error, path,
611 find_flag, &Open_Env)))
612 return XrdOfsFS->fsError(error, retc);
613
614// Preset TPC handling and if not allowed, complain
615//
616 if (tpcKey && (open_mode & SFS_O_NOTPC))
617 return XrdOfsFS->Emsg(epname, error, EPROTOTYPE, "tpc", path,
618 "+TPC prohibited due to security configuration");
619
620// Create the file if so requested o/w try to attach the file
621//
622 if (open_flag & O_CREAT)
623 {// Apply security, as needed
624 //
625 // If we aren't requesting O_EXCL, one needs AOP_Create
626 bool overwrite_permitted = true;
627 if (!(open_flag & O_EXCL))
628 {if (client && XrdOfsFS->Authorization &&
629 !XrdOfsFS->Authorization->Access(client, path, AOP_Create, &Open_Env))
630 { // We don't have the ability to create a file without O_EXCL. If we have AOP_Excl_Create,
631 // then manipulate the open flags and see if we're successful with it.
632 AUTHORIZE(client,&Open_Env,AOP_Excl_Create,"create",path,error);
633 overwrite_permitted = false;
634 open_flag |= O_EXCL;
635 open_flag &= ~O_TRUNC;
636 }
637 }
638 // If we are in O_EXCL mode, then we accept either AOP_Excl_Create or AOP_Create
639 else if (client && XrdOfsFS->Authorization &&
640 !XrdOfsFS->Authorization->Access(client, path, AOP_Create, &Open_Env))
641 {AUTHORIZE(client,&Open_Env,AOP_Excl_Create,"create",path,error);
642 // In this case, we don't have AOP_Create but we do have AOP_Excl_Create; note that
643 // overwrites are not permitted (this is later used to correct an error code).
644 overwrite_permitted = false;
645 }
646
647 OOIDENTENV(client, Open_Env);
648
649 // For ephemeral file, we must enter the file into the queue
650 //
651 if (isPosc)
652 {bool isNew = (open_mode & SFS_O_TRUNC) == 0;
653 if ((oP.poscNum = XrdOfsFS->poscQ->Add(tident, path, isNew)) < 0)
654 return XrdOfsFS->Emsg(epname, error, oP.poscNum, "pcreate", path,
655 "+ofs_open: failed to enter file into posc queue");
656 }
657
658 // If placement information is present provide a hint to the oss plugin
659 //
660 if ((open_mode & ~SFS_O_CREAT) & SFS_O_CREATAT) crOpts |= XRDOSS_coloc;
661
662 // Create the file. If ENOTSUP is returned, promote the creation to
663 // the subsequent open. This is to accomodate proxy support.
664 //
665 if ((retc = XrdOfsOss->Create(tident, path, theMode, Open_Env,
666 ((open_flag << 8) | crOpts))))
667 {if (retc > 0) return XrdOfsFS->Stall(error, retc, path);
668 if (retc == -EINPROGRESS)
671 }
672 if (retc != -ENOTSUP)
673 {// If we tried to overwrite an existing file but do not have the AOP_Create
674 // privilege, then ensure we generate a 'permission denied' instead of 'exists'
675 if ((open_flag & O_EXCL) && retc == -EEXIST && !overwrite_permitted)
676 {retc = -EACCES;}
677 if (XrdOfsFS->Balancer) XrdOfsFS->Balancer->Removed(path);
678 return XrdOfsFS->Emsg(epname, error, retc, "create", path);
679 }
680 } else {
681 if (XrdOfsFS->Balancer) XrdOfsFS->Balancer->Added(path, isPosc);
682 open_flag = O_RDWR|O_TRUNC;
683 if (XrdOfsFS->evsObject
684 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Create))
685 {XrdOfsEvsInfo evInfo(tident,path,info,&Open_Env,Mode);
686 XrdOfsFS->evsObject->Notify(XrdOfsEvs::Create, evInfo);
687 }
688 }
689
690 } else {
691
692 // Apply security, as needed
693 //
694 if (tpcKey && !isRW)
695 {XrdOfsTPC::Facts Args(client, &error, &Open_Env, tpcKey, path);
696 if ((retc = XrdOfsTPC::Authorize(&myTPC, Args))) return retc;
697 } else {AUTHORIZE(client, &Open_Env, (isRW?AOP_Update:AOP_Read),
698 "open", path, error);
699 }
700 OOIDENTENV(client, Open_Env);
701 }
702
703// Get a handle for this file.
704//
705 if ((retc = XrdOfsHandle::Alloc(path, isRW, &oP.hP)))
706 {if (retc > 0) return XrdOfsFS->Stall(error, retc, path);
707 return XrdOfsFS->Emsg(epname, error, retc, "attach", path);
708 }
709
710// If this is a third party copy and we are the destination, then validate
711// specification at this point and setup to transfer. Note that if the
712// call fails and auto removal is enabled, the file we created will be deleted.
713//
714 if (tpcKey && isRW)
715 {char pfnbuff[MAXPATHLEN+8]; const char *pfnP;
716 if (!(pfnP = XrdOfsOss->Lfn2Pfn(path, pfnbuff, MAXPATHLEN, retc)))
717 return XrdOfsFS->Emsg(epname, error, retc, "open", path,
718 "+ofs_open: mapping tpc target lfn to pfn failed");
719 XrdOfsTPC::Facts Args(client, &error, &Open_Env, tpcKey, path, pfnP);
720 if ((retc = XrdOfsTPC::Validate(&myTPC, Args))) return retc;
721 }
722
723// Assign/transfer posc ownership. We may need to delay the client if the
724// file create ownership does not match and this is not a create request.
725//
726 if (oP.hP->isRW == XrdOfsHandle::opPC)
727 {if (!isRW) return XrdOfsFS->Stall(error, -1, path);
728 if ((retc = oP.hP->PoscSet(tident, oP.poscNum, theMode)))
729 {if (retc > 0) XrdOfsFS->poscQ->Del(path, retc);
730 else return XrdOfsFS->Emsg(epname, error, retc, "access", path,
731 "+ofs_open: posc mode initiation failed");
732 }
733 }
734
735// If this is a previously existing handle, we are almost done. If this is
736// the target of a third party copy request, fail it now. We don't support
737// multiple writers in tpc mode (this should really never happen).
738//
739 if (!(oP.hP->Inactive()))
740 {dorawio = (oh->isCompressed && open_mode & SFS_O_RAWIO ? 1 : 0);
741 if (tpcKey && isRW)
742 return XrdOfsFS->Emsg(epname, error, EALREADY, "tpc", path,
743 "+ofs_open: this tpc is already in progress");
744 XrdOfsFS->ocMutex.Lock(); oh = oP.hP; XrdOfsFS->ocMutex.UnLock();
745 FTRACE(open, "attach use=" <<oh->Usage());
746 if (oP.poscNum > 0) XrdOfsFS->poscQ->Commit(path, oP.poscNum);
747 oP.hP->UnLock();
750 if (oP.poscNum > 0) OfsStats.Data.numOpenP++;
752 return oP.OK();
753 }
754
755// Get a storage system object
756//
757 if (!(oP.fP = XrdOfsOss->newFile(tident)))
758 return XrdOfsFS->Emsg(epname, error, ENOMEM, "open", path);
759
760// We need to make special provisions for proxy servers in the presence of
761// the TPC option and possibly cache as it's handled differently in this case.
762//
763 if (XrdOfsFS->OssIsProxy)
764 {if (myTPC) open_flag |= O_NOFOLLOW;
765 if (error.getUCap() & XrdOucEI::uUrlOK &&
766 error.getUCap() & XrdOucEI::uLclF) open_flag |= O_DIRECT;
767 }
768
769// If we are doing real-time checksums, wrap the Oss file with a Cks file
770//
771 if (oP.cP)
772 {XrdOfsCksFile* cfP = new XrdOfsCksFile(tident,path,oP.fP,oP.cP,viaDel);
773 oP.fP = static_cast<XrdOssDF*>(cfP);
774 oP.cP = 0;
775 }
776
777// Open the file
778//
779 if ((retc = oP.fP->Open(path, open_flag, theMode, Open_Env)))
780 {if (retc > 0) return XrdOfsFS->Stall(error, retc, path);
781 if (retc == -EINPROGRESS)
784 }
785 if (retc == -ETXTBSY) return XrdOfsFS->Stall(error, -1, path);
786 if (retc == -EDESTADDRREQ)
787 {char *url = Open_Env.Get("FileURL");
788 if (url) {error.setErrInfo(-1, url); return SFS_REDIRECT;}
789 }
790 if (XrdOfsFS->Balancer && retc == -ENOENT)
791 XrdOfsFS->Balancer->Removed(path);
792 const char* etP = 0;
793 std::string eText;
794 if (XrdOfsFS->tryXERT && oP.fP->getErrMsg(eText)) etP = eText.c_str();
795 return XrdOfsFS->Emsg(epname, error, retc, "open", path, etP);
796 }
797
798// Verify that we can actually use this file
799//
800 if (oP.poscNum > 0)
801 {if ((retc = oP.fP->Fchmod(static_cast<mode_t>(theMode|XRDSFS_POSCPEND))))
802 return XrdOfsFS->Emsg(epname, error, retc, "fchmod", path,
803 "+ofs_open: POSC file designation failed");
804 XrdOfsFS->poscQ->Commit(path, oP.poscNum);
805 }
806
807// Set compression values and activate the handle
808//
809 if (oP.fP->isCompressed() > 0)
810 {oP.hP->isCompressed = 1;
811 dorawio = (open_mode & SFS_O_RAWIO ? 1 : 0);
812 }
813 oP.hP->Activate(oP.fP);
814 oP.hP->UnLock();
815
816// If this is being opened for sequential I/O advise the filesystem about it.
817//
818#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
819 if (!(XrdOfsFS->OssIsProxy) && open_mode & SFS_O_SEQIO)
820 {static RAtomic_int fadFails(0);
821 int theFD = oP.fP->getFD();
822 if (theFD >= 0 && fadFails < 4096)
823 if (posix_fadvise(theFD, 0, 0, POSIX_FADV_SEQUENTIAL) < 0)
824 {OfsEroute.Emsg(epname, errno, "fadvise for sequential I/O.");
825 fadFails++;
826 }
827 }
828#endif
829
830// Send an open event if we must
831//
832 if (XrdOfsFS->evsObject)
834 if (XrdOfsFS->evsObject->Enabled(theEvent))
835 {XrdOfsEvsInfo evInfo(tident, path, info, &Open_Env);
836 XrdOfsFS->evsObject->Notify(theEvent, evInfo);
837 }
838 }
839
840// Maintain statistics
841//
844 if (oP.poscNum > 0) OfsStats.Data.numOpenP++;
846
847// All done
848//
849 XrdOfsFS->ocMutex.Lock(); oh = oP.hP; XrdOfsFS->ocMutex.UnLock();
850 return oP.OK();
851}
@ AOP_Update
open() r/w or append
@ AOP_Create
open() with create
@ AOP_Read
open() r/o, prepare()
@ AOP_Excl_Create
open() with O_EXCL|O_CREAT
#define ZTRACE(act, x)
#define O_DIRECT
Definition XrdCrc32c.cc:51
#define OOIDENTENV(usr, env)
#define AUTHORIZE(usr, env, optype, action, pathp, edata)
XrdSysError OfsEroute(0)
XrdOss * XrdOfsOss
Definition XrdOfs.cc:165
#define XRDOSS_coloc
Definition XrdOss.hh:529
#define XRDOSS_new
Definition XrdOss.hh:527
#define XRDOSS_mkpath
Definition XrdOss.hh:526
int Mode
XrdOucString Path
#define XRDSFS_POSCPEND
#define SFS_O_RESET
#define SFS_O_CREATAT
#define SFS_O_SEQIO
#define SFS_O_NOTPC
#define SFS_O_POSC
#define SFS_REDIRECT
#define SFS_O_MKPTH
#define SFS_O_RDONLY
#define SFS_STARTED
#define SFS_O_MULTIW
#define SFS_O_WRONLY
#define SFS_O_CREAT
#define SFS_O_RAWIO
#define SFS_O_RDWR
#define SFS_O_NOWAIT
#define SFS_O_REPLICA
#define SFS_O_TRUNC
XrdSys::RAtomic< int > RAtomic_int
virtual XrdAccPrivs Access(const XrdSecEntity *Entity, const char *path, const Access_Operation oper, XrdOucEnv *Env=0)=0
virtual void Recycle()
Recycle the checksum object as it is no longer needed. A default is given.
virtual void Removed(const char *path)
virtual int Locate(XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *Info=0)=0
void Wait4Event(const char *path, XrdOucErrInfo *einfo)
Definition XrdOfsEvr.cc:226
int open(const char *fileName, XrdSfsFileOpenMode openMode, mode_t createMode, const XrdSecEntity *client, const char *opaque=0)
Definition XrdOfs.cc:471
static const int opRW
static int Alloc(const char *thePath, int Opts, XrdOfsHandle **Handle)
int Commit(const char *Lfn, int Offset)
int Add(const char *Tident, const char *Lfn, bool isNew)
static int Authorize(XrdOfsTPC **theTPC, Facts &Args, int isPLE=0)
Definition XrdOfsTPC.cc:221
static int Validate(XrdOfsTPC **theTPC, Facts &Args)
Definition XrdOfsTPC.cc:550
bool WantCksRT()
Definition XrdOfs.hh:363
XrdCmsClient * Finder
Definition XrdOfs.hh:439
mode_t fMask[2]
Definition XrdOfs.hh:395
XrdOfsEvr evrObject
Definition XrdOfs.hh:438
int tpcRdrPort[2]
Definition XrdOfs.hh:400
char * tpcRdrHost[2]
Definition XrdOfs.hh:399
int Options
Definition XrdOfs.hh:389
static int fsError(XrdOucErrInfo &myError, int rc)
Definition XrdOfs.cc:2823
int SetupCksRT(XrdCksCalc *&, XrdOucEnv &, const char *&)
Definition XrdOfs.cc:2759
int Stall(XrdOucErrInfo &, int, const char *)
Definition XrdOfs.cc:2897
@ RdrTPC
Definition XrdOfs.hh:386
virtual int Create(const char *tid, const char *path, mode_t mode, XrdOucEnv &env, int opts=0)=0
virtual XrdOssDF * newFile(const char *tident)=0
virtual int Lfn2Pfn(const char *Path, char *buff, int blen)
Definition XrdOss.hh:954
static const char * tpcDlgOn
Definition XrdOucTPC.hh:68
static const char * tpcKey
Definition XrdOucTPC.hh:58
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
static const int uUrlOK
ucap: Supports async responses
static const int uLclF
ucap: Client is on a private net

References XrdOfsHandle::Alloc(), AOP_Create, AOP_Excl_Create, AOP_Read, AOP_Update, AUTHORIZE, XrdOfsTPC::Authorize(), XrdOfsEvs::Create, dorawio, EPNAME, XrdSfsFile::error, FTRACE, Xrd::hex1, Mode, myTPC, O_DIRECT, Xrd::oct1, OfsEroute, OfsStats, oh, OOIDENTENV, open(), XrdOfsEvs::Openr, XrdOfsEvs::Openw, XrdOfsHandle::opPC, XrdOfsHandle::opRW, Path, XrdOfs::RdrTPC, XrdCksCalc::Recycle(), XrdOfsHandle::Retire(), SFS_O_CREAT, SFS_O_CREATAT, SFS_O_MKPTH, SFS_O_MULTIW, SFS_O_NOTPC, SFS_O_NOWAIT, SFS_O_POSC, SFS_O_RAWIO, SFS_O_RDONLY, SFS_O_RDWR, SFS_O_REPLICA, SFS_O_RESET, SFS_O_SEQIO, SFS_O_TRUNC, SFS_O_WRONLY, SFS_OK, SFS_REDIRECT, SFS_STARTED, tident, XrdOucTPC::tpcDlgOn, XrdOucTPC::tpcKey, XrdOucEI::uLclF, XrdOucEI::uUrlOK, XrdOfsTPC::Validate(), viaDel, XrdOfsFS, XrdOfsOss, XRDOSS_coloc, XRDOSS_mkpath, XRDOSS_new, XRDSFS_POSCPEND, and ZTRACE.

Referenced by open().

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

◆ pgRead() [1/2]

XrdSfsXferSize XrdOfsFile::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 from XrdSfsFile.

Definition at line 1260 of file XrdOfs.cc.

1261{
1262 EPNAME("aiopgread");
1263 uint64_t pgOpts;
1264 int rc;
1265
1266// If the oss plugin does not support pgRead or if we are doing rawio or the
1267// file is compressed then revert to using a standard async read. Note that
1268// the standard async read will generate checksums if a vector is present.
1269// Note: we set cksVec in the request to nil to indicate simulation!
1270//
1271 if (!XrdOfsFS->OssHasPGrw || dorawio || oh->isCompressed)
1272 {aioparm->cksVec = 0;
1273 return XrdOfsFile::read(aioparm);
1274 }
1275
1276// Perform required tracing
1277//
1278 FTRACE(aio, aioparm->sfsAio.aio_nbytes <<"@" <<aioparm->sfsAio.aio_offset);
1279
1280// Make sure the offset is not too large
1281//
1282#if _FILE_OFFSET_BITS!=64
1283 if (aiop->sfsAio.aio_offset > 0x000000007fffffff)
1284 return XrdOfsFS->Emsg(epname,error,-EFBIG,"pgRead",oh->Name(),0,false);
1285#endif
1286
1287// Pass through any flags of interest
1288//
1290 else pgOpts = 0;
1291
1292// Issue the read. Only true errors are returned here.
1293//
1294 if ((rc = oh->Select().pgRead(aioparm, pgOpts)) < 0)
1295 return XrdOfsFS->Emsg(epname, error, rc, "pgRead", oh, false, false);
1296
1297// All done
1298//
1299 return SFS_OK;
1300}
struct myOpts opts
off_t aio_offset
Definition XrdSfsAio.hh:49
size_t aio_nbytes
Definition XrdSfsAio.hh:48
int read(XrdSfsFileOffset fileOffset, XrdSfsXferSize amount)
Definition XrdOfs.cc:1425
static const uint64_t Verify
all: Verify checksums
Definition XrdOss.hh:251
uint32_t * cksVec
Definition XrdSfsAio.hh:63
struct aiocb sfsAio
Definition XrdSfsAio.hh:62
static const uint64_t Verify
Options for pgRead() and pgWrite() as noted below.

References aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::cksVec, dorawio, EPNAME, XrdSfsFile::error, FTRACE, oh, opts, read(), SFS_OK, XrdSfsAio::sfsAio, XrdOssDF::Verify, XrdSfsFile::Verify, and XrdOfsFS.

Here is the call graph for this function:

◆ pgRead() [2/2]

XrdSfsXferSize XrdOfsFile::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 from XrdSfsFile.

Definition at line 1210 of file XrdOfs.cc.

1215{
1216 EPNAME("pgRead");
1217 XrdSfsXferSize nbytes;
1218 uint64_t pgOpts;
1219
1220// If the oss plugin does not support pgRead and we doing rawio then simulate
1221// the pgread. As this is relatively common we skip the vtable. This means
1222// this class cannot be a inherited to override the read() method.
1223//
1224 if (!XrdOfsFS->OssHasPGrw || dorawio)
1225 {if ((nbytes = XrdOfsFile::read(offset, buffer, rdlen)) > 0)
1226 XrdOucPgrwUtils::csCalc(buffer, offset, nbytes, csvec);
1227 return nbytes;
1228 }
1229
1230// Perform required tracing
1231//
1232 FTRACE(read, rdlen <<"@" <<offset);
1233
1234// Make sure the offset is not too large
1235//
1236#if _FILE_OFFSET_BITS!=64
1237 if (offset > 0x000000007fffffff)
1238 return XrdOfsFS->Emsg(epname, error, EFBIG, "pgRead", oh->Name());
1239#endif
1240
1241// Pass through any flags of interest
1242//
1244 else pgOpts = 0;
1245
1246// Now read the actual number of bytes
1247//
1248 nbytes = (XrdSfsXferSize)(oh->Select().pgRead((void *)buffer,
1249 (off_t)offset, (size_t)rdlen, csvec, pgOpts));
1250 if (nbytes < 0)
1251 return XrdOfsFS->Emsg(epname,error,(int)nbytes,"pgRead",oh,false,false);
1252
1253// Return number of bytes read
1254//
1255 return nbytes;
1256}
int XrdSfsXferSize
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)

References XrdOucPgrwUtils::csCalc(), dorawio, EPNAME, XrdSfsFile::error, FTRACE, oh, opts, read(), XrdOssDF::Verify, XrdSfsFile::Verify, and XrdOfsFS.

Here is the call graph for this function:

◆ pgWrite() [1/2]

XrdSfsXferSize XrdOfsFile::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 from XrdSfsFile.

Definition at line 1360 of file XrdOfs.cc.

1361{
1362 EPNAME("aiopgWrite");
1363 uint64_t pgOpts;
1364 int rc;
1365
1366// If the oss plugin does not support pgWrite revert to using a standard write.
1367//
1368 if (!XrdOfsFS->OssHasPGrw)
1369 {if ((opts & XrdSfsFile::Verify)
1370 && !VerPgw((char *)aioparm->sfsAio.aio_buf,
1371 aioparm->sfsAio.aio_offset,
1372 aioparm->sfsAio.aio_nbytes,
1373 aioparm->cksVec, oh, error)) return SFS_ERROR;
1374 return XrdOfsFile::write(aioparm);
1375 }
1376
1377// If this is a POSC file, we must convert the async call to a sync call as we
1378// must trap any errors that unpersist the file. We can't do that via aio i/f.
1379//
1380 if (oh->isRW == XrdOfsHandle::opPC)
1381 {aioparm->Result = XrdOfsFile::pgWrite(aioparm->sfsAio.aio_offset,
1382 (char *)aioparm->sfsAio.aio_buf,
1383 aioparm->sfsAio.aio_nbytes,
1384 aioparm->cksVec, opts);
1385 aioparm->doneWrite();
1386 return SFS_OK;
1387 }
1388
1389// Perform any required tracing
1390//
1391 FTRACE(aio, aioparm->sfsAio.aio_nbytes <<"@" <<aioparm->sfsAio.aio_offset);
1392
1393// Make sure the offset is not too large
1394//
1395#if _FILE_OFFSET_BITS!=64
1396 if (aiop->sfsAio.aio_offset > 0x000000007fffffff)
1397 return XrdOfsFS->Emsg(epname, error, -EFBIG, "pgwrite", oh, true, false);
1398#endif
1399
1400// Silly Castor stuff
1401//
1402 if (XrdOfsFS->evsObject && !(oh->isChanged)
1403 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Fwrite)) GenFWEvent();
1404
1405// Pass through any flags of interest
1406//
1408 else pgOpts = 0;
1409
1410// Write the requested bytes
1411//
1412 oh->isPending = 1;
1413 if ((rc = oh->Select().pgWrite(aioparm, pgOpts)) < 0)
1414 return XrdOfsFS->Emsg(epname, error, rc, "pgwrite", oh, true, false);
1415
1416// All done
1417//
1418 return SFS_OK;
1419}
void * aio_buf
Definition XrdSfsAio.hh:47
XrdSfsXferSize pgWrite(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize wrlen, uint32_t *csvec, uint64_t opts=0)
Definition XrdOfs.cc:1306
XrdSfsXferSize write(XrdSfsFileOffset fileOffset, const char *buffer, XrdSfsXferSize buffer_size)
Definition XrdOfs.cc:1590
ssize_t Result
Definition XrdSfsAio.hh:65
virtual void doneWrite()=0

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::cksVec, XrdSfsAio::doneWrite(), EPNAME, XrdSfsFile::error, FTRACE, XrdOfsEvs::Fwrite, oh, XrdOfsHandle::opPC, opts, pgWrite(), XrdSfsAio::Result, SFS_ERROR, SFS_OK, XrdSfsAio::sfsAio, XrdOssDF::Verify, XrdSfsFile::Verify, write(), and XrdOfsFS.

Here is the call graph for this function:

◆ pgWrite() [2/2]

XrdSfsXferSize XrdOfsFile::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 from XrdSfsFile.

Definition at line 1306 of file XrdOfs.cc.

1311{
1312 EPNAME("pgWrite");
1313 XrdSfsXferSize nbytes;
1314 uint64_t pgOpts;
1315
1316// If the oss plugin does not support pgWrite revert to using a standard write.
1317//
1318 if (!XrdOfsFS->OssHasPGrw)
1319 {if ((opts & XrdSfsFile::Verify)
1320 && !VerPgw(buffer, offset, wrlen, csvec, oh, error)) return SFS_ERROR;
1321 return XrdOfsFile::write(offset, buffer, wrlen);
1322 }
1323
1324// Perform any required tracing
1325//
1326 FTRACE(write, wrlen <<"@" <<offset);
1327
1328// Make sure the offset is not too large
1329//
1330#if _FILE_OFFSET_BITS!=64
1331 if (offset > 0x000000007fffffff)
1332 return XrdOfsFS->Emsg(epname, error, -EFBIG, "pgwrite", oh, true, false);
1333#endif
1334
1335// Silly Castor stuff
1336//
1337 if (XrdOfsFS->evsObject && !(oh->isChanged)
1338 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Fwrite)) GenFWEvent();
1339
1340// Pass through any flags of interest
1341//
1343 else pgOpts = 0;
1344
1345// Write the requested bytes
1346//
1347 oh->isPending = 1;
1348 nbytes = (XrdSfsXferSize)(oh->Select().pgWrite((void *)buffer,
1349 (off_t)offset, (size_t)wrlen, csvec, pgOpts));
1350 if (nbytes < 0)
1351 return XrdOfsFS->Emsg(epname,error,(int)nbytes,"pgwrite",oh,true,false);
1352
1353// Return number of bytes written
1354//
1355 return nbytes;
1356}

References EPNAME, XrdSfsFile::error, FTRACE, XrdOfsEvs::Fwrite, oh, opts, SFS_ERROR, XrdOssDF::Verify, XrdSfsFile::Verify, write(), and XrdOfsFS.

Referenced by pgWrite().

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

◆ read() [1/3]

int XrdOfsFile::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 1550 of file XrdOfs.cc.

1551{
1552 EPNAME("aioread");
1553 int rc;
1554
1555// Async mode for compressed files is not supported.
1556//
1557 if (oh->isCompressed)
1558 {aiop->Result = this->read((XrdSfsFileOffset)aiop->sfsAio.aio_offset,
1559 (char *)aiop->sfsAio.aio_buf,
1560 (XrdSfsXferSize)aiop->sfsAio.aio_nbytes);
1561 aiop->doneRead();
1562 return 0;
1563 }
1564
1565// Perform required tracing
1566//
1567 FTRACE(aio, aiop->sfsAio.aio_nbytes <<"@" <<aiop->sfsAio.aio_offset);
1568
1569// Make sure the offset is not too large
1570//
1571#if _FILE_OFFSET_BITS!=64
1572 if (aiop->sfsAio.aio_offset > 0x000000007fffffff)
1573 return XrdOfsFS->Emsg(epname,error,-EFBIG,"read",oh->Name(),0,false);
1574#endif
1575
1576// Issue the read. Only true errors are returned here.
1577//
1578 if ((rc = oh->Select().Read(aiop)) < 0)
1579 return XrdOfsFS->Emsg(epname, error, rc, "read", oh, false, false);
1580
1581// All done
1582//
1583 return SFS_OK;
1584}
#define read(a, b, c)
Definition XrdPosix.hh:86
long long XrdSfsFileOffset

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::doneRead(), EPNAME, XrdSfsFile::error, FTRACE, oh, read, XrdSfsAio::Result, SFS_OK, XrdSfsAio::sfsAio, and XrdOfsFS.

Here is the call graph for this function:

◆ read() [2/3]

XrdSfsXferSize XrdOfsFile::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 1464 of file XrdOfs.cc.

1478{
1479 EPNAME("read");
1480 XrdSfsXferSize nbytes;
1481
1482// Perform required tracing
1483//
1484 FTRACE(read, blen <<"@" <<offset);
1485
1486// Make sure the offset is not too large
1487//
1488#if _FILE_OFFSET_BITS!=64
1489 if (offset > 0x000000007fffffff)
1490 return XrdOfsFS->Emsg(epname,error,-EFBIG,"read",oh->Name(),0,false);
1491#endif
1492
1493// Now read the actual number of bytes
1494//
1495 nbytes = (dorawio ?
1496 (XrdSfsXferSize)(oh->Select().ReadRaw((void *)buff,
1497 (off_t)offset, (size_t)blen))
1498 : (XrdSfsXferSize)(oh->Select().Read((void *)buff,
1499 (off_t)offset, (size_t)blen)));
1500 if (nbytes < 0)
1501 return XrdOfsFS->Emsg(epname, error, (int)nbytes, "read", oh, 0, false);
1502
1503// Return number of bytes read
1504//
1505 return nbytes;
1506}

References dorawio, EPNAME, XrdSfsFile::error, FTRACE, oh, read(), and XrdOfsFS.

Here is the call graph for this function:

◆ read() [3/3]

int XrdOfsFile::read ( XrdSfsFileOffset offset,
XrdSfsXferSize size )
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.

Implements XrdSfsFile.

Definition at line 1425 of file XrdOfs.cc.

1435{
1436 EPNAME("read");
1437 int retc;
1438
1439// Perform required tracing
1440//
1441 FTRACE(read, "preread " <<blen <<"@" <<offset);
1442
1443// Make sure the offset is not too large
1444//
1445#if _FILE_OFFSET_BITS!=64
1446 if (offset > 0x000000007fffffff)
1447 return XrdOfsFS->Emsg(epname,error,-EFBIG,"read",oh->Name(),0,false);
1448#endif
1449
1450// Now preread the actual number of bytes
1451//
1452 if ((retc = oh->Select().Read((off_t)offset, (size_t)blen)) < 0)
1453 return XrdOfsFS->Emsg(epname, error, (int)retc, "preread", oh, 0, false);
1454
1455// Return number of bytes read
1456//
1457 return retc;
1458}

References EPNAME, XrdSfsFile::error, FTRACE, oh, read(), and XrdOfsFS.

Referenced by pgRead(), pgRead(), read(), and read().

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

◆ readv()

XrdSfsXferSize XrdOfsFile::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 from XrdSfsFile.

Definition at line 1512 of file XrdOfs.cc.

1526{
1527 EPNAME("readv");
1528
1529 XrdSfsXferSize nbytes = oh->Select().ReadV(readV, readCount);
1530 if (nbytes < 0)
1531 return XrdOfsFS->Emsg(epname,error,(int)nbytes,"readv",oh,false,false);
1532
1533 return nbytes;
1534
1535}

References EPNAME, XrdSfsFile::error, oh, and XrdOfsFS.

◆ stat()

int XrdOfsFile::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 1714 of file XrdOfs.cc.

1722{
1723 EPNAME("fstat");
1724 int retc;
1725
1726// Perform any required tracing
1727//
1728 FTRACE(stat, "");
1729
1730// Perform the function
1731//
1732 if ((retc = oh->Select().Fstat(buf)) < 0)
1733 return XrdOfsFS->Emsg(epname,error,retc,"get state for",oh);
1734
1735 return SFS_OK;
1736}
int stat(struct stat *buf)
Definition XrdOfs.cc:1714

References EPNAME, XrdSfsFile::error, FTRACE, oh, SFS_OK, stat(), and XrdOfsFS.

Referenced by stat().

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

◆ sync() [1/2]

int XrdOfsFile::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 1742 of file XrdOfs.cc.

1750{
1751 EPNAME("sync");
1752 int retc;
1753
1754// Perform any required tracing
1755//
1756 FTRACE(sync, "");
1757
1758// If we have a tpc object hanging about, we need to dispatch that first
1759//
1760 if (myTPC && (retc = myTPC->Sync(&error))) return retc;
1761
1762// We can test the pendio flag w/o a lock because the person doing this
1763// sync must have done the previous write. Causality is the synchronizer.
1764//
1765 if (!(oh->isPending)) return SFS_OK;
1766
1767// We can also skip the sync if the file is closed. However, we need a file
1768// object lock in order to test the flag. We can also reset the PENDIO flag.
1769//
1770 oh->Lock();
1771 oh->isPending = 0;
1772 oh->UnLock();
1773
1774// Perform the function
1775//
1776 if ((retc = oh->Select().Fsync()))
1777 {oh->isPending = 1;
1778 return XrdOfsFS->Emsg(epname, error, retc, "synchronize", oh, true);
1779 }
1780
1781// Indicate all went well
1782//
1783 return SFS_OK;
1784}
int sync()
Definition XrdOfs.cc:1742

References EPNAME, XrdSfsFile::error, FTRACE, myTPC, oh, SFS_OK, sync(), and XrdOfsFS.

Referenced by sync(), and sync().

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

◆ sync() [2/2]

int XrdOfsFile::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 1792 of file XrdOfs.cc.

1793{
1794 aiop->Result = this->sync();
1795 aiop->doneWrite();
1796 return 0;
1797}

References XrdSfsAio::doneWrite(), XrdSfsAio::Result, and sync().

Here is the call graph for this function:

◆ truncate()

int XrdOfsFile::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 1803 of file XrdOfs.cc.

1817{
1818 EPNAME("trunc");
1819 int retc;
1820
1821// Lock the file handle and perform any tracing
1822//
1823 FTRACE(truncate, "len=" <<flen);
1824
1825// Make sure the offset is not too large
1826//
1827 if (sizeof(off_t) < sizeof(flen) && flen > 0x000000007fffffff)
1828 return XrdOfsFS->Emsg(epname, error, EFBIG, "truncate", oh, true);
1829
1830// Silly Castor stuff
1831//
1832 if (XrdOfsFS->evsObject && !(oh->isChanged)
1833 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Fwrite)) GenFWEvent();
1834
1835// Perform the function
1836//
1837 oh->isPending = 1;
1838 if ((retc = oh->Select().Ftruncate(flen)))
1839 return XrdOfsFS->Emsg(epname, error, retc, "truncate", oh, true);
1840
1841// Indicate Success
1842//
1843 return SFS_OK;
1844}
int truncate(XrdSfsFileOffset fileOffset)
Definition XrdOfs.cc:1803

References EPNAME, XrdSfsFile::error, FTRACE, XrdOfsEvs::Fwrite, oh, SFS_OK, truncate(), and XrdOfsFS.

Referenced by truncate().

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

◆ write() [1/2]

int XrdOfsFile::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 1646 of file XrdOfs.cc.

1647{
1648 EPNAME("aiowrite");
1649 int rc;
1650
1651// Perform any required tracing
1652//
1653 FTRACE(aio, aiop->sfsAio.aio_nbytes <<"@" <<aiop->sfsAio.aio_offset);
1654
1655// If this is a POSC file, we must convert the async call to a sync call as we
1656// must trap any errors that unpersist the file. We can't do that via aio i/f.
1657//
1658 if (oh->isRW == XrdOfsHandle::opPC)
1659 {aiop->Result = this->write(aiop->sfsAio.aio_offset,
1660 (const char *)aiop->sfsAio.aio_buf,
1661 aiop->sfsAio.aio_nbytes);
1662 aiop->doneWrite();
1663 return 0;
1664 }
1665
1666// Make sure the offset is not too large
1667//
1668#if _FILE_OFFSET_BITS!=64
1669 if (aiop->sfsAio.aio_offset > 0x000000007fffffff)
1670 return XrdOfsFS->Emsg(epname, error, -EFBIG, "write", oh, true, false);
1671#endif
1672
1673// Silly Castor stuff
1674//
1675 if (XrdOfsFS->evsObject && !(oh->isChanged)
1676 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Fwrite)) GenFWEvent();
1677
1678// Write the requested bytes
1679//
1680 oh->isPending = 1;
1681 if ((rc = oh->Select().Write(aiop)) < 0)
1682 return XrdOfsFS->Emsg(epname, error, rc, "write", oh, true, false);
1683
1684// All done
1685//
1686 return SFS_OK;
1687}
#define write(a, b, c)
Definition XrdPosix.hh:121

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::doneWrite(), EPNAME, XrdSfsFile::error, FTRACE, XrdOfsEvs::Fwrite, oh, XrdOfsHandle::opPC, XrdSfsAio::Result, SFS_OK, XrdSfsAio::sfsAio, write, and XrdOfsFS.

Here is the call graph for this function:

◆ write() [2/2]

XrdSfsXferSize XrdOfsFile::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 1590 of file XrdOfs.cc.

1607{
1608 EPNAME("write");
1609 XrdSfsXferSize nbytes;
1610
1611// Perform any required tracing
1612//
1613 FTRACE(write, blen <<"@" <<offset);
1614
1615// Make sure the offset is not too large
1616//
1617#if _FILE_OFFSET_BITS!=64
1618 if (offset > 0x000000007fffffff)
1619 return XrdOfsFS->Emsg(epname,error,-EFBIG,"write",oh,true,false);
1620#endif
1621
1622// Silly Castor stuff
1623//
1624 if (XrdOfsFS->evsObject && !(oh->isChanged)
1625 && XrdOfsFS->evsObject->Enabled(XrdOfsEvs::Fwrite)) GenFWEvent();
1626
1627// Write the requested bytes
1628//
1629 oh->isPending = 1;
1630 nbytes = (XrdSfsXferSize)(oh->Select().Write((const void *)buff,
1631 (off_t)offset, (size_t)blen));
1632 if (nbytes < 0)
1633 return XrdOfsFS->Emsg(epname,error,(int)nbytes,"write",oh,true,false);
1634
1635// Return number of bytes written
1636//
1637 return nbytes;
1638}

References EPNAME, XrdSfsFile::error, FTRACE, XrdOfsEvs::Fwrite, oh, write(), and XrdOfsFS.

Referenced by pgWrite(), pgWrite(), and write().

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

Member Data Documentation

◆ ckpBad

bool XrdOfsFile::ckpBad
protected

Definition at line 207 of file XrdOfs.hh.

Referenced by XrdOfsFile(), and checkpoint().

◆ dorawio

int XrdOfsFile::dorawio
protected

Definition at line 205 of file XrdOfs.hh.

Referenced by XrdOfsFile(), open(), pgRead(), pgRead(), and read().

◆ myCKP

XrdOucChkPnt* XrdOfsFile::myCKP
protected

Definition at line 204 of file XrdOfs.hh.

Referenced by XrdOfsFile(), checkpoint(), and close().

◆ myTPC

XrdOfsTPC* XrdOfsFile::myTPC
protected

Definition at line 203 of file XrdOfs.hh.

Referenced by XrdOfsFile(), close(), fctl(), open(), and sync().

◆ oh

◆ tident

const char* XrdOfsFile::tident
protected

Definition at line 201 of file XrdOfs.hh.

Referenced by XrdOfsFile(), close(), and open().

◆ viaDel

bool XrdOfsFile::viaDel
protected

Definition at line 206 of file XrdOfs.hh.

Referenced by XrdOfsFile(), ~XrdOfsFile(), close(), and open().


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