XRootD
XrdPssFile Class Reference

#include <XrdPss.hh>

+ Inheritance diagram for XrdPssFile:
+ Collaboration diagram for XrdPssFile:

Public Member Functions

 XrdPssFile (const char *tid)
 
virtual ~XrdPssFile ()
 
virtual int Close (long long *retsz=0) override
 
int Fchmod (mode_t mode) override
 
int Fctl (int cmd, int alen, const char *args, char **resp=0) override
 
int Fstat (struct stat *) override
 
int Fsync () override
 
int Fsync (XrdSfsAio *aiop) override
 
int Ftruncate (unsigned long long) override
 
bool getErrMsg (std::string &eText) override
 
virtual int Open (const char *, int, mode_t, XrdOucEnv &) override
 
ssize_t pgRead (void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts) override
 
int pgRead (XrdSfsAio *aioparm, uint64_t opts) override
 
ssize_t pgWrite (void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts) override
 
int pgWrite (XrdSfsAio *aioparm, uint64_t opts) override
 
ssize_t Read (off_t, size_t) override
 
ssize_t Read (void *, off_t, size_t) override
 
int Read (XrdSfsAio *aiop) override
 
ssize_t ReadRaw (void *, off_t, size_t) override
 
ssize_t ReadV (XrdOucIOVec *readV, int n) override
 
ssize_t Write (const void *, off_t, size_t) override
 
int Write (XrdSfsAio *aiop) override
 
- Public Member Functions inherited from XrdOssDF
 XrdOssDF (const char *tid="", uint16_t dftype=0, int fdnum=-1)
 
virtual ~XrdOssDF ()
 
virtual int Clone (const std::vector< XrdOucCloneSeg > &cVec)
 
virtual int Clone (XrdOssDF &srcFile)
 
uint16_t DFType ()
 
virtual void Flush ()
 Flush filesystem cached pages for this file (used for checksums). More...
 
virtual int getFD ()
 
virtual off_t getMmap (void **addr)
 
virtual const char * getTID ()
 
virtual int isCompressed (char *cxidp=0)
 
virtual int Opendir (const char *path, XrdOucEnv &env)
 
virtual ssize_t Read (XrdOucRangeList &rlist)
 
virtual int Readdir (char *buff, int blen)
 
virtual int StatRet (struct stat *buff)
 
virtual ssize_t WriteV (XrdOucIOVec *writeV, int wrvcnt)
 

Additional Inherited Members

- Static Public Attributes inherited from XrdOssDF
static const uint16_t DF_isDir = 0x0001
 Object is for a directory. More...
 
static const uint16_t DF_isFile = 0x0002
 Object is for a file. More...
 
static const uint16_t DF_isProxy = 0x0010
 Object is a proxy object. More...
 
static const uint64_t doCalc = 0x4000000000000000ULL
 pgw: Calculate checksums More...
 
static const int Fctl_ckpObj = 0
 
static const int Fctl_QFinfo = 3
 
static const int Fctl_setFD = 2
 
static const int Fctl_utimes = 1
 
static const uint64_t Verify = 0x8000000000000000ULL
 all: Verify checksums More...
 
- Protected Attributes inherited from XrdOssDF
uint16_t dfType
 
int fd
 
off_t pgwEOF
 
short rsvd
 
const char * tident
 

Detailed Description

Definition at line 86 of file XrdPss.hh.

Constructor & Destructor Documentation

◆ XrdPssFile()

XrdPssFile::XrdPssFile ( const char *  tid)
inline

Definition at line 118 of file XrdPss.hh.

120  rpInfo(0), tpcPath(0), entity(0), lastEtrc(0) {}
static const uint16_t DF_isFile
Object is for a file.
Definition: XrdOss.hh:433
XrdOssDF(const char *tid="", uint16_t dftype=0, int fdnum=-1)
Definition: XrdOss.hh:504
static const uint16_t DF_isProxy
Object is a proxy object.
Definition: XrdOss.hh:434

◆ ~XrdPssFile()

virtual XrdPssFile::~XrdPssFile ( )
inlinevirtual

Definition at line 122 of file XrdPss.hh.

122  {if (fd >= 0) Close();
123  if (rpInfo) delete(rpInfo);
124  if (tpcPath) free(tpcPath);
125  }
int fd
Definition: XrdOss.hh:515
virtual int Close(long long *retsz=0) override
Definition: XrdPss.cc:1022

References Close(), and XrdOssDF::fd.

+ Here is the call graph for this function:

Member Function Documentation

◆ Close()

int XrdPssFile::Close ( long long *  retsz = 0)
overridevirtual

Close a directory or file.

Parameters
retszIf not nil, where the size of the file is to be returned.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOssDF.

Definition at line 1022 of file XrdPss.cc.

1023 { int rc;
1024 
1025 // We don't support returning the size (we really should fix this)
1026 //
1027  if (retsz) *retsz = 0;
1028 
1029 // If the file is not open, then this may be OK if it is a 3rd party copy
1030 //
1031  if (fd < 0)
1032  {if (!tpcPath) return -XRDOSS_E8004;
1033  free(tpcPath);
1034  tpcPath = 0;
1035  return XrdOssOK;
1036  }
1037 
1038 // Close the file
1039 //
1040  rc = XrdPosixXrootd::Close(fd);
1041  fd = -1;
1042  if (rc == 0) return XrdOssOK;
1043  rc = -errno;
1044  lastEtrc = XrdPosixXrootd::QueryError(lastEtext);
1045  return rc;
1046 }
#define XRDOSS_E8004
Definition: XrdOssError.hh:38
#define XrdOssOK
Definition: XrdOss.hh:54
static int Close(int fildes)
Close() conforms to POSIX.1-2001 close()
static int QueryError(std::string &emsg, int fd=-1, bool reset=true)

References XrdPosixXrootd::Close(), XrdOssDF::fd, XrdPosixXrootd::QueryError(), XRDOSS_E8004, and XrdOssOK.

Referenced by ~XrdPssFile().

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

◆ Fchmod()

int XrdPssFile::Fchmod ( mode_t  mode)
inlineoverridevirtual

Change file mode settings.

Parameters
mode- The new file mode setting.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 96 of file XrdPss.hh.

96 {return XrdOssOK;}

References XrdOssOK.

◆ Fctl()

int XrdPssFile::Fctl ( int  cmd,
int  alen,
const char *  args,
char **  resp = 0 
)
overridevirtual

Reimplemented from XrdOssDF.

Definition at line 1325 of file XrdPss.cc.

1326 {
1327  XrdOucCacheOp::Code opc;
1328 
1329 // Made sure the file is open
1330 //
1331  if (fd < 0) return -XRDOSS_E8004;
1332 
1333 // Get correct argument to use
1334 //
1335  switch(cmd)
1336  {case XrdOssDF::Fctl_QFinfo: opc = XrdOucCacheOp::Code::QFinfo;
1337  break;
1338  default:
1339  *resp = 0;
1340  return -ENOTSUP;
1341  break;
1342  }
1343 
1344 // Convert argument to a string and prepare for the reponse
1345 //
1346  std::string theArgs(args, alen);
1347  std::string theResp;
1348 
1349 // Invoke the file control
1350 //
1351 
1352  if (XrdPosixExtra::Fctl(fd, opc, theArgs, theResp) < 0)
1353  {int rc = -errno;
1354  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1355  return rc;
1356  }
1357 
1358 // Convert the response
1359 //
1360  if (resp)
1361  {int n = theResp.size() + 1;
1362  *resp = new char[n];
1363  strcpy(*resp, theResp.c_str());
1364  }
1365  return XrdOssOK;
1366 }
static const int Fctl_QFinfo
Definition: XrdOss.hh:461
static int Fctl(int fildes, XrdOucCacheOp::Code opc, const std::string &args, std::string &resp)

References XrdPosixExtra::Fctl(), XrdOssDF::Fctl_QFinfo, XrdOssDF::fd, XrdPosixXrootd::QueryError(), XRDOSS_E8004, and XrdOssOK.

+ Here is the call graph for this function:

◆ Fstat()

int XrdPssFile::Fstat ( struct stat buf)
overridevirtual

Return state information for this file.

Parameters
buf- Pointer to the structure where info it to be returned.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1380 of file XrdPss.cc.

1381 {
1382  EPNAME("fstat");
1383 
1384 // If we have a file descriptor then return a stat for it
1385 //
1386  if (fd >= 0)
1387  {if (XrdPosixXrootd::Fstat(fd, buff) == 0) return XrdOssOK;
1388  int rc = -errno;
1389  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1390  return (ssize_t)rc;
1391  }
1392 
1393 // Otherwise, if this is not a tpc of any kind, return an error
1394 //
1395  if (!tpcPath) return -XRDOSS_E8004;
1396 
1397 // If this is a normal tpc then simply issue the stat against the origin
1398 //
1399  if (!rpInfo)
1400  {XrdOucEnv fstatEnv(0, 0, entity);
1401  return XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv);
1402  }
1403 
1404 // This is a reproxy tpc, if we have not yet dertermined the true dest, do so.
1405 //
1406  struct stat Stat;
1407 
1408  if (rpInfo->dstURL == 0
1409  || !fstatat(rpFD, rpInfo->tprPath, &Stat, AT_SYMLINK_NOFOLLOW))
1410  {char lnkbuff[2048]; int lnklen;
1411  lnklen = readlinkat(rpFD, rpInfo->tprPath, lnkbuff, sizeof(lnkbuff)-1);
1412  if (lnklen <= 0)
1413  {int rc = 0;
1414  if (lnklen < 0) {if (errno != ENOENT) rc = -errno;}
1415  else rc = -EFAULT;
1416  if (rc)
1417  {unlinkat(rpFD, rpInfo->tprPath, 0);
1418  return rc;
1419  }
1420  } else {
1421  unlinkat(rpFD, rpInfo->tprPath, 0);
1422  lnkbuff[lnklen] = 0;
1423  if (rpInfo->dstURL) free(rpInfo->dstURL);
1424  rpInfo->dstURL = strdup(lnkbuff);
1425  rpInfo->fSize = 1;
1426  DEBUG(tident,rpInfo->tprPath<<" maps "<<tpcPath<<" -> "<<lnkbuff);
1427  }
1428  }
1429 
1430 // At this point we may or may not have the final endpoint. An error here could
1431 // be due to write error recovery, so make allowance for that.
1432 //
1433  if (rpInfo->dstURL)
1434  {if (!XrdPosixXrootd::Stat(rpInfo->dstURL, buff))
1435  {if (!(rpInfo->fSize = buff->st_size)) rpInfo->fSize = 1;
1436  return XrdOssOK;
1437  }
1438  free(rpInfo->dstURL);
1439  rpInfo->dstURL = 0;
1440  }
1441 
1442 // We don't have the final endpoint. If we ever had it before, then punt.
1443 //
1444  if (rpInfo->fSize)
1445  {memset(buff, 0, sizeof(struct stat));
1446  buff->st_size = rpInfo->fSize;
1447  return XrdOssOK;
1448  }
1449 
1450 // If we are here then maybe the reproxy option was the wrong config setting.
1451 // Give stat a try on the origin we'll retry resolution on the next stat.
1452 //
1453  XrdOucEnv fstatEnv(0, 0, entity);
1454 
1455  if (XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv))
1456  memset(buff, 0, sizeof(struct stat));
1457  return XrdOssOK;
1458 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
struct stat Stat
Definition: XrdCks.cc:49
#define fstatat(a, b, c, d)
Definition: XrdPosix.hh:64
#define stat(a, b)
Definition: XrdPosix.hh:105
const char * tident
Definition: XrdOss.hh:513
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat()
static int Fstat(int fildes, struct stat *buf)
Fstat() conforms to POSIX.1-2001 fstat()
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
Definition: XrdPss.cc:559
int rpFD
Definition: XrdPss.cc:122
static XrdPssSys XrdProxySS
Definition: XrdPss.cc:102

References DEBUG, EPNAME, XrdOssDF::fd, XrdPosixXrootd::Fstat(), fstatat, XrdPosixXrootd::QueryError(), XrdProxy::rpFD, Stat, stat, XrdPssSys::Stat(), XrdPosixXrootd::Stat(), XrdOssDF::tident, XRDOSS_E8004, XrdOssOK, and XrdProxy::XrdProxySS.

+ Here is the call graph for this function:

◆ Fsync() [1/2]

int XrdPssFile::Fsync ( void  )
overridevirtual

Synchronize associated file with media (synchronous).

Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1471 of file XrdPss.cc.

1472 {
1473  if (fd < 0) return -XRDOSS_E8004;
1474 
1475  if (XrdPosixXrootd::Fsync(fd) == 0) return XrdOssOK;
1476  int rc = -errno;
1477  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1478  return (ssize_t)rc;
1479 }
static int Fsync(int fildes)
Fsync() conforms to POSIX.1-2001 fsync()

References XrdOssDF::fd, XrdPosixXrootd::Fsync(), XrdPosixXrootd::QueryError(), XRDOSS_E8004, and XrdOssOK.

+ Here is the call graph for this function:

◆ Fsync() [2/2]

int XrdPssFile::Fsync ( XrdSfsAio aiop)
overridevirtual

Synchronize associated file with media (asynchronous).

Parameters
aiop- Pointer to async I/O request object.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 53 of file XrdPssAio.cc.

54 {
55 
56 // Execute this request in an asynchronous fashion
57 //
59  return 0;
60 }
static XrdPssAioCB * Alloc(XrdSfsAio *aiop, bool isWr, bool pgrw=false)
Definition: XrdPssAioCB.cc:49

References XrdPssAioCB::Alloc(), XrdOssDF::fd, and XrdPosixXrootd::Fsync().

+ Here is the call graph for this function:

◆ Ftruncate()

int XrdPssFile::Ftruncate ( unsigned long long  flen)
overridevirtual

Set the size of the associated file.

Parameters
flen- The new size of the file.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1503 of file XrdPss.cc.

1504 {
1505  if (fd < 0) return -XRDOSS_E8004;
1506 
1507  if (XrdPosixXrootd::Ftruncate(fd, flen) == 0) return XrdOssOK;
1508  int rc = -errno;
1509  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1510  return (ssize_t)rc;
1511 }
static int Ftruncate(int fildes, off_t offset)
Ftruncate() conforms to POSIX.1-2001 ftruncate()

References XrdOssDF::fd, XrdPosixXrootd::Ftruncate(), XrdPosixXrootd::QueryError(), XRDOSS_E8004, and XrdOssOK.

+ Here is the call graph for this function:

◆ getErrMsg()

bool XrdPssFile::getErrMsg ( std::string &  eText)
overridevirtual

Obtain detailed error message text for the immediately preceeding directory or file error (see also XrdOss::getErrMsg()).

Parameters
eText- Where the message text is to be returned.
Returns
True if message text is available, false otherwise.
Note
This method should be called using the same thread that encountered the error; otherwise, missleading error text may be returned.
Upon return, the internal error message text is cleared.

Reimplemented from XrdOssDF.

Definition at line 1052 of file XrdPss.cc.

1053 {
1054 // Return what we have but make sure to reset whatever we have
1055 //
1056  if (lastEtrc <= 0 || lastEtext.empty()) return false;
1057  eText = lastEtext;
1058  lastEtext.clear();
1059  lastEtrc = 0;
1060  return true;
1061 }

◆ Open()

int XrdPssFile::Open ( const char *  path,
int  Oflag,
mode_t  Mode,
XrdOucEnv env 
)
overridevirtual

Open a file.

Parameters
path- Pointer to the path of the file to be opened.
Oflag- Standard open flags.
Mode- File open mode (ignored unless creating a file).
env- Reference to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 878 of file XrdPss.cc.

879 {
880  EPNAME("Open");
881  unsigned long long popts = XrdPssSys::XPList.Find(path);
882  const char *Cgi = "";
883  char pbuff[PBsz];
884  int rc;
885  bool tpcMode = (Oflag & O_NOFOLLOW) != 0;
886  bool rwMode = (Oflag & O_ACCMODE) != O_RDONLY;
887  bool ucgiOK = true;
888  bool ioCache = (Oflag & O_DIRECT);
889 
890 // Record the security environment
891 //
892  entity = Env.secEnv();
893 
894 // Turn off direct flag if set (we record it separately
895 //
896  if (ioCache) Oflag &= ~O_DIRECT;
897 
898 // Return an error if the object is already open
899 //
900  if (fd >= 0 || tpcPath) return -XRDOSS_E8003;
901 
902 // If we are opening this in r/w mode make sure we actually can
903 //
904  if (rwMode)
905  {if (XrdPssSys::fileOrgn) return -EROFS;
906  if (popts & XRDEXP_NOTRW)
907  {if (popts & XRDEXP_FORCERO && !tpcMode) Oflag = O_RDONLY;
908  else return -EROFS;
909  }
910  }
911 
912  // check CGI cache-control paramters
913  if (cacheFSctl)
914  {
915  int elen;
916  char *envcgi = (char *)Env.Env(elen);
917 
918  if (envcgi && strstr(envcgi, "only-if-cached"))
919  {
920  XrdOucErrInfo einfo;
921  XrdSfsFSctl myData;
922  myData.Arg1 = "cached";
923  myData.Arg1Len = 1;
924  myData.Arg2Len = 1;
925  const char *myArgs[1];
926  myArgs[0] = path;
927  myData.ArgP = myArgs;
928  int fsctlRes = cacheFSctl->FSctl(SFS_FSCTL_PLUGXC, myData, einfo);
929  if (fsctlRes == SFS_ERROR)
930  return -einfo.getErrInfo();
931  }
932  }
933 
934 // If this is a third party copy open, then strange rules apply. If this is an
935 // outgoing proxy we let everything pass through as this may be a TPC request
936 // elsewhere. Otherwise, if it's an open for reading, we open the file but
937 // strip off all CGI (technically, we should only remove the "tpc" tokens)
938 // because the source might not support direct TPC mode. If we are opening for
939 // writing, then we skip the open and mark this as a TPC handle which can only
940 // be used for fstat() and close(). Any other actions return an error.
941 //
942  if (tpcMode)
943  {Oflag &= ~O_NOFOLLOW;
944  if (!XrdProxy::outProxy || !IS_FWDPATH(path))
945  {if (rwMode)
946  {tpcPath = strdup(path);
947  if (XrdPssSys::reProxy)
948  {const char *rPath = Env.Get("tpc.reproxy");
949  if (!rPath || *rPath != '/') return -ENOATTR;
950  if (!(rPath = rindex(rPath, '/')) || *(rPath+1) == 0)
951  return -EFAULT;
952  rpInfo = new tprInfo(rPath+1);
953  }
954  return XrdOssOK;
955  }
956  ucgiOK = false;
957  }
958  }
959 
960 // Setup any required cgi information. Don't mess with it if it's an objectid
961 // or if the we are an outgoing proxy server.
962 //
963  if (!XrdProxy::outProxy && *path == '/' && !(XRDEXP_STAGE & popts))
964  Cgi = osslclCGI;
965 
966 // Construct the url info
967 //
968  XrdPssUrlInfo uInfo(&Env, path, Cgi, ucgiOK);
969  uInfo.setID();
970 
971 // Convert path to URL
972 //
973  if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
974  return rc;
975 
976 // Do some tracing
977 //
978  if(DEBUGON) {
979  auto urlObf = obfuscateAuth(pbuff);
980  DEBUG(uInfo.Tident(),"url="<<urlObf);
981  }
982 
983 // Try to open and if we failed, return an error
984 //
985  if (!XrdPssSys::dcaCheck || !ioCache)
986  {if ((fd = XrdPosixXrootd::Open(pbuff,Oflag,Mode)) < 0)
987  {rc = -errno;
988  lastEtrc = XrdPosixXrootd::QueryError(lastEtext);
989  return rc;
990  }
991  } else {
993  Info.ffReady = XrdPssSys::dcaWorld;
994  if (XrdPosixConfig::OpenFC(pbuff,Oflag,Mode,Info))
995  {Env.Put("FileURL", Info.cacheURL);
996  return -EDESTADDRREQ;
997  }
998  fd = Info.fileFD;
999  if (fd < 0)
1000  {rc = -errno;
1001  lastEtrc = XrdPosixXrootd::QueryError(lastEtext);
1002  return rc;
1003  }
1004  }
1005 
1006 // All done
1007 //
1008  return XrdOssOK;
1009 }
#define XRDOSS_E8003
Definition: XrdOssError.hh:37
#define XRDEXP_NOTRW
Definition: XrdOucExport.hh:45
#define XRDEXP_FORCERO
Definition: XrdOucExport.hh:43
#define XRDEXP_STAGE
Definition: XrdOucExport.hh:52
std::string obfuscateAuth(const std::string &input)
#define DEBUGON
#define IS_FWDPATH(x)
Definition: XrdPssUtils.hh:64
#define ENOATTR
Definition: XrdPss.cc:81
#define O_DIRECT
Definition: XrdPss.cc:77
int Mode
const char * Arg1
PLUGFS, PLUGIN, PLUGIO, PLUGXC.
int Arg2Len
Length or -count of args in extension.
#define SFS_ERROR
int Arg1Len
Length.
#define SFS_FSCTL_PLUGXC
< SFS_FSCTL_PLUGIN/PLUGIO/PLUGXC/PLUGFS parms
virtual int FSctl(const int cmd, int alen, const char *args, XrdSfsFile &file, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=0
unsigned long long Find(const char *pathname)
Definition: XrdOucPList.hh:112
static bool OpenFC(const char *path, int oflag, mode_t mode, XrdPosixInfo &Info)
static int Open(const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)
static char * fileOrgn
Definition: XrdPss.hh:213
static bool dcaCheck
Definition: XrdPss.hh:223
static bool reProxy
Definition: XrdPss.hh:226
static XrdOucPListAnchor XPList
Definition: XrdPss.hh:209
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition: XrdPss.cc:1621
static bool xLfn2Pfn
Definition: XrdPss.hh:222
static bool dcaWorld
Definition: XrdPss.hh:224
XrdOfsFSctl_PI * cacheFSctl
Definition: XrdPss.cc:112
static const int PBsz
Definition: XrdPss.cc:120
static const char * osslclCGI
Definition: XrdPss.cc:118
bool outProxy
Definition: XrdPss.cc:126

References XrdSfsFSctl::Arg1, XrdSfsFSctl::Arg1Len, XrdSfsFSctl::Arg2Len, XrdProxy::cacheFSctl, XrdPssSys::dcaCheck, XrdPssSys::dcaWorld, DEBUG, DEBUGON, ENOATTR, XrdOucEnv::Env(), EPNAME, XrdOssDF::fd, XrdPssSys::fileOrgn, XrdOucPListAnchor::Find(), XrdOfsFSctl_PI::FSctl(), XrdOucEnv::Get(), XrdOucErrInfo::getErrInfo(), TPC::Info, IS_FWDPATH, Mode, O_DIRECT, obfuscateAuth(), XrdPosixXrootd::Open(), XrdPosixConfig::OpenFC(), XrdProxy::osslclCGI, XrdProxy::outProxy, XrdPssSys::P2URL(), XrdProxy::PBsz, XrdOucEnv::Put(), XrdPosixXrootd::QueryError(), XrdPssSys::reProxy, XrdOucEnv::secEnv(), XrdPssUrlInfo::setID(), SFS_ERROR, SFS_FSCTL_PLUGXC, XrdPssUrlInfo::Tident(), XrdPssSys::xLfn2Pfn, XrdPssSys::XPList, XRDEXP_FORCERO, XRDEXP_NOTRW, XRDEXP_STAGE, XRDOSS_E8003, and XrdOssOK.

+ Here is the call graph for this function:

◆ pgRead() [1/2]

ssize_t XrdPssFile::pgRead ( void *  buffer,
off_t  offset,
size_t  rdlen,
uint32_t *  csvec,
uint64_t  opts 
)
overridevirtual

Reimplemented from XrdOssDF.

Definition at line 1081 of file XrdPss.cc.

1086 {
1087  std::vector<uint32_t> vecCS;
1088  uint64_t psxOpts;
1089  ssize_t bytes;
1090 
1091 // Make sure file is open
1092 //
1093  if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1094 
1095 // Set options as needed
1096 //
1097  psxOpts = (csvec ? XrdPosixExtra::forceCS : 0);
1098 
1099 // Issue the pgread
1100 //
1101  if ((bytes = XrdPosixExtra::pgRead(fd,buffer,offset,rdlen,vecCS,psxOpts)) < 0)
1102  {int rc = -errno;
1103  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1104  return (ssize_t)rc;
1105  }
1106 
1107 // Copy out the checksum vector
1108 //
1109  if (vecCS.size() && csvec)
1110  memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
1111 
1112 // All done
1113 //
1114  return bytes;
1115 }
static const uint64_t forceCS
static ssize_t pgRead(int fildes, void *buffer, off_t offset, size_t rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, XrdPosixCallBackIO *cbp=0)

References XrdOssDF::fd, XrdPosixExtra::forceCS, XrdPosixExtra::pgRead(), XrdPosixXrootd::QueryError(), and XRDOSS_E8004.

+ Here is the call graph for this function:

◆ pgRead() [2/2]

int XrdPssFile::pgRead ( XrdSfsAio aioparm,
uint64_t  opts 
)
overridevirtual

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
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 77 of file XrdPssAio.cc.

78 {
79  XrdPssAioCB *aioCB = XrdPssAioCB::Alloc(aiop, false, true);
80  uint64_t psxOpts = (aiop->cksVec ? XrdPosixExtra::forceCS : 0);
81 
82 // Execute this request in an asynchronous fashion
83 //
84  XrdPosixExtra::pgRead(fd, (void *)aiop->sfsAio.aio_buf,
85  (off_t)aiop->sfsAio.aio_offset,
86  (size_t)aiop->sfsAio.aio_nbytes,
87  aioCB->csVec, psxOpts, aioCB);
88  return 0;
89 }
std::vector< uint32_t > csVec
Definition: XrdPssAioCB.hh:53

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdSfsAio::cksVec, XrdPssAioCB::csVec, XrdOssDF::fd, XrdPosixExtra::forceCS, XrdPosixExtra::pgRead(), and XrdSfsAio::sfsAio.

+ Here is the call graph for this function:

◆ pgWrite() [1/2]

ssize_t XrdPssFile::pgWrite ( void *  buffer,
off_t  offset,
size_t  wrlen,
uint32_t *  csvec,
uint64_t  opts 
)
overridevirtual

Write file pages into a file with corresponding checksums.

Parameters
buffer- pointer to buffer containing the bytes to write.
offset- The offset where the write is to start.
wrlen- The number of bytes to write.
csvec- A vector which contains the corresponding CRC32 checksum for each page. See XrdOucPgrwUtils::csNum() for sizing.
opts- Processing options (see above).
Returns
>= 0 The number of bytes written upon success. or -errno or -osserr upon failure. (see XrdOssError.hh).
< 0 -errno or -osserr upon failure. (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1137 of file XrdPss.cc.

1142 {
1143  std::vector<uint32_t> vecCS;
1144  ssize_t bytes;
1145 
1146 // Make sure we have an open file
1147 //
1148  if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1149 
1150 // Check if caller wants to verify the checksums before writing
1151 //
1152  if (csvec && (opts & XrdOssDF::Verify))
1153  {XrdOucPgrwUtils::dataInfo dInfo((const char*)buffer,csvec,offset,wrlen);
1154  off_t bado;
1155  int badc;
1156  if (!XrdOucPgrwUtils::csVer(dInfo, bado, badc))
1157  {lastEtext = "pgWrite checksum verification failed.";
1158  lastEtrc = EDOM;
1159  return -EDOM;
1160  }
1161  }
1162 
1163 // Check if caller want checksum generated and possibly returned
1164 //
1165  if ((opts & XrdOssDF::doCalc) || csvec == 0)
1166  {XrdOucPgrwUtils::csCalc((const char *)buffer, offset, wrlen, vecCS);
1167  if (csvec) memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
1168  } else {
1169  int n = XrdOucPgrwUtils::csNum(offset, wrlen);
1170  vecCS.resize(n);
1171  vecCS.assign(n, 0);
1172  memcpy(vecCS.data(), csvec, n*sizeof(uint32_t));
1173  }
1174 
1175 // Issue the pgwrite
1176 //
1177  bytes = XrdPosixExtra::pgWrite(fd, buffer, offset, wrlen, vecCS);
1178 
1179 // Return result
1180 //
1181  if (bytes < 0)
1182  {int rc = -errno;
1183  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1184  return (ssize_t)rc;
1185  }
1186  return bytes;
1187 }
struct myOpts opts
static const uint64_t doCalc
pgw: Calculate checksums
Definition: XrdOss.hh:253
static const uint64_t Verify
all: Verify checksums
Definition: XrdOss.hh:251
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)
static bool csVer(dataInfo &dInfo, off_t &bado, int &badc)
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset & length.
static ssize_t pgWrite(int fildes, void *buffer, off_t offset, size_t wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, XrdPosixCallBackIO *cbp=0)

References XrdOucPgrwUtils::csCalc(), XrdOucPgrwUtils::csNum(), XrdOucPgrwUtils::csVer(), XrdOssDF::doCalc, XrdOssDF::fd, opts, XrdPosixExtra::pgWrite(), XrdPosixXrootd::QueryError(), XrdOssDF::Verify, and XRDOSS_E8004.

+ Here is the call graph for this function:

◆ pgWrite() [2/2]

int XrdPssFile::pgWrite ( XrdSfsAio aioparm,
uint64_t  opts 
)
overridevirtual

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
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 106 of file XrdPssAio.cc.

107 {
108 
109 // Check if caller wants to verify the checksums before writing
110 //
111  if (aiop->cksVec && (opts & XrdOssDF::Verify))
112  {XrdOucPgrwUtils::dataInfo dInfo((const char *)(aiop->sfsAio.aio_buf),
113  aiop->cksVec, aiop->sfsAio.aio_offset,
114  aiop->sfsAio.aio_nbytes);
115  off_t bado;
116  int badc;
117  if (!XrdOucPgrwUtils::csVer(dInfo, bado, badc)) return -EDOM;
118  }
119 
120 // Get a callback object as no errors can error here
121 //
122  XrdPssAioCB *aioCB = XrdPssAioCB::Alloc(aiop, true, true);
123 
124 // Check if caller want checksum generated and possibly returned
125 //
126  if ((opts & XrdOssDF::doCalc) || aiop->cksVec == 0)
127  {XrdOucPgrwUtils::csCalc((const char *)(aiop->sfsAio.aio_buf),
128  (off_t)(aiop->sfsAio.aio_offset),
129  (size_t)(aiop->sfsAio.aio_nbytes),
130  aioCB->csVec);
131  if (aiop->cksVec) memcpy(aiop->cksVec, aioCB->csVec.data(),
132  aioCB->csVec.size()*sizeof(uint32_t));
133  } else {
134  int n = XrdOucPgrwUtils::csNum(aiop->sfsAio.aio_offset,
135  aiop->sfsAio.aio_nbytes);
136  aioCB->csVec.resize(n);
137  aioCB->csVec.assign(n, 0);
138  memcpy(aioCB->csVec.data(), aiop->cksVec, n*sizeof(uint32_t));
139  }
140 
141 // Issue the pgWrite
142 //
143  XrdPosixExtra::pgWrite(fd, (void *)aiop->sfsAio.aio_buf,
144  (off_t)aiop->sfsAio.aio_offset,
145  (size_t)aiop->sfsAio.aio_nbytes,
146  aioCB->csVec, 0, aioCB);
147  return 0;
148 }

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdSfsAio::cksVec, XrdOucPgrwUtils::csCalc(), XrdOucPgrwUtils::csNum(), XrdPssAioCB::csVec, XrdOucPgrwUtils::csVer(), XrdOssDF::doCalc, XrdOssDF::fd, opts, XrdPosixExtra::pgWrite(), XrdSfsAio::sfsAio, and XrdOssDF::Verify.

+ Here is the call graph for this function:

◆ Read() [1/3]

ssize_t XrdPssFile::Read ( off_t  offset,
size_t  size 
)
overridevirtual

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 When 0, the request was ignored; otherwise, it has been accepted.
< 0 Failed with -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1202 of file XrdPss.cc.

1203 {
1204  if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1205 
1206  return 0; // We haven't implemented this yet!
1207 }

References XrdOssDF::fd, and XRDOSS_E8004.

Referenced by ReadRaw().

+ Here is the caller graph for this function:

◆ Read() [2/3]

ssize_t XrdPssFile::Read ( void *  buffer,
off_t  offset,
size_t  size 
)
overridevirtual

Read file bytes into a buffer.

Parameters
buffer- pointer to buffer where the bytes are to be placed.
offset- The offset where the read is to start.
size- The number of bytes to read.
Returns
>= 0 The number of bytes that placed in buffer.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1226 of file XrdPss.cc.

1227 {
1228  ssize_t retval;
1229 
1230  if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1231 
1232  if ((retval = XrdPosixXrootd::Pread(fd, buff, blen, offset)) < 0)
1233  {int rc = -errno;
1234  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1235  return (ssize_t)rc;
1236  }
1237  return retval;
1238 }
static ssize_t Pread(int fildes, void *buf, size_t nbyte, off_t offset)
Pread() conforms to POSIX.1-2001 pread()

References XrdOssDF::fd, XrdPosixXrootd::Pread(), XrdPosixXrootd::QueryError(), and XRDOSS_E8004.

+ Here is the call graph for this function:

◆ Read() [3/3]

int XrdPssFile::Read ( XrdSfsAio aiop)
overridevirtual

Read file bytes using asynchronous I/O.

Parameters
aiop- Pointer to async I/O object controlling the I/O.
Returns
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 165 of file XrdPssAio.cc.

166 {
167 
168 // Execute this request in an asynchronous fashion
169 //
170  XrdPosixXrootd::Pread(fd, (void *)aiop->sfsAio.aio_buf,
171  (size_t)aiop->sfsAio.aio_nbytes,
172  (off_t)aiop->sfsAio.aio_offset,
173  XrdPssAioCB::Alloc(aiop, false));
174  return 0;
175 }
off_t aio_offset
Definition: XrdSfsAio.hh:49
size_t aio_nbytes
Definition: XrdSfsAio.hh:48
void * aio_buf
Definition: XrdSfsAio.hh:47
struct aiocb sfsAio
Definition: XrdSfsAio.hh:62

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdOssDF::fd, XrdPosixXrootd::Pread(), and XrdSfsAio::sfsAio.

+ Here is the call graph for this function:

◆ ReadRaw()

ssize_t XrdPssFile::ReadRaw ( void *  buffer,
off_t  offset,
size_t  size 
)
overridevirtual

Read uncompressed file bytes into a buffer.

Parameters
buffer- pointer to buffer where the bytes are to be placed.
offset- The offset where the read is to start.
size- The number of bytes to read.
Returns
>= 0 The number of bytes that placed in buffer.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1287 of file XrdPss.cc.

1288 {
1289  return Read(buff, offset, blen);
1290 }
ssize_t Read(off_t, size_t) override
Definition: XrdPss.cc:1202

References Read().

+ Here is the call graph for this function:

◆ ReadV()

ssize_t XrdPssFile::ReadV ( XrdOucIOVec readV,
int  rdvcnt 
)
overridevirtual

Read file bytes as directed by the read vector.

Parameters
readVpointer to the array of read requests.
rdvcntthe number of elements in readV.
Returns
>=0 The numbe of bytes read.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1244 of file XrdPss.cc.

1258 {
1259  ssize_t retval;
1260 
1261  if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1262 
1263  if ((retval = XrdPosixXrootd::VRead(fd, readV, readCount)) < 0)
1264  {int rc = -errno;
1265  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1266  return (ssize_t)rc;
1267  }
1268  return (ssize_t)retval;;
1269 }
static void VRead(int fildes, const XrdOucIOVec *readV, int n, XrdPosixCallBackIO *cbp)

References XrdOssDF::fd, XrdPosixXrootd::QueryError(), XrdPosixXrootd::VRead(), and XRDOSS_E8004.

+ Here is the call graph for this function:

◆ Write() [1/2]

ssize_t XrdPssFile::Write ( const void *  buffer,
off_t  offset,
size_t  size 
)
overridevirtual

Write file bytes from a buffer.

Parameters
buffer- pointer to buffer where the bytes reside.
offset- The offset where the write is to start.
size- The number of bytes to write.
Returns
>= 0 The number of bytes that were written.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 1307 of file XrdPss.cc.

1308 {
1309  ssize_t retval;
1310 
1311  if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1312 
1313  if ((retval = XrdPosixXrootd::Pwrite(fd, buff, blen, offset)) < 0)
1314  {int rc = -errno;
1315  lastEtrc = XrdPosixXrootd::QueryError(lastEtext, fd);
1316  return (ssize_t)rc;
1317  }
1318  return (ssize_t)retval;
1319 }
static ssize_t Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
Pwrite() conforms to POSIX.1-2001 pwrite()

References XrdOssDF::fd, XrdPosixXrootd::Pwrite(), XrdPosixXrootd::QueryError(), and XRDOSS_E8004.

+ Here is the call graph for this function:

◆ Write() [2/2]

int XrdPssFile::Write ( XrdSfsAio aiop)
overridevirtual

Write file bytes using asynchronous I/O.

Parameters
aiop- Pointer to async I/O object controlling the I/O.
Returns
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 192 of file XrdPssAio.cc.

193 {
194 
195 // Execute this request in an asynchronous fashion
196 //
197  XrdPosixXrootd::Pwrite(fd, (const void *)aiop->sfsAio.aio_buf,
198  (size_t)aiop->sfsAio.aio_nbytes,
199  (off_t)aiop->sfsAio.aio_offset,
200  XrdPssAioCB::Alloc(aiop, true));
201  return 0;
202 }

References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdPssAioCB::Alloc(), XrdOssDF::fd, XrdPosixXrootd::Pwrite(), and XrdSfsAio::sfsAio.

+ Here is the call graph for this function:

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