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

#include <XrdPss.hh>

Inheritance diagram for XrdPssDir:
Collaboration diagram for XrdPssDir:

Public Member Functions

 XrdPssDir (const char *tid)
 ~XrdPssDir ()
int Close (long long *retsz=0)
int Opendir (const char *, XrdOucEnv &)
int Readdir (char *buff, int blen)
int StatRet (struct stat *buf)
Public Member Functions inherited from XrdOssDF
 XrdOssDF (const char *tid="", uint16_t dftype=0, int fdnum=-1)
virtual ~XrdOssDF ()
uint16_t DFType ()
virtual int Fchmod (mode_t mode)
virtual int Fctl (int cmd, int alen, const char *args, char **resp=0)
virtual void Flush ()
 Flush filesystem cached pages for this file (used for checksums).
virtual int Fstat (struct stat *buf)
virtual int Fsync ()
virtual int Fsync (XrdSfsAio *aiop)
virtual int Ftruncate (unsigned long long flen)
virtual int getFD ()
virtual off_t getMmap (void **addr)
virtual const char * getTID ()
virtual int isCompressed (char *cxidp=0)
virtual int Open (const char *path, int Oflag, mode_t Mode, XrdOucEnv &env)
virtual ssize_t pgRead (void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
virtual int pgRead (XrdSfsAio *aioparm, uint64_t opts)
virtual ssize_t pgWrite (void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
virtual int pgWrite (XrdSfsAio *aioparm, uint64_t opts)
virtual ssize_t Read (off_t offset, size_t size)
virtual ssize_t Read (void *buffer, off_t offset, size_t size)
virtual int Read (XrdSfsAio *aiop)
virtual ssize_t ReadRaw (void *buffer, off_t offset, size_t size)
virtual ssize_t ReadV (XrdOucIOVec *readV, int rdvcnt)
virtual ssize_t Write (const void *buffer, off_t offset, size_t size)
virtual int Write (XrdSfsAio *aiop)
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.
static const uint16_t DF_isFile = 0x0002
 Object is for a file.
static const uint16_t DF_isProxy = 0x0010
 Object is a proxy object.
static const uint64_t doCalc = 0x4000000000000000ULL
 pgw: Calculate checksums
static const int Fctl_ckpObj = 0
static const int Fctl_utimes = 1
static const uint64_t Verify = 0x8000000000000000ULL
 all: Verify checksums
Protected Attributes inherited from XrdOssDF
uint16_t dfType
int fd
off_t pgwEOF
short rsvd
const char * tident

Detailed Description

Definition at line 49 of file XrdPss.hh.

Constructor & Destructor Documentation

◆ XrdPssDir()

XrdPssDir::XrdPssDir ( const char * tid)
inline

Definition at line 64 of file XrdPss.hh.

66 myDir(0) {}
XrdOssDF(const char *tid="", uint16_t dftype=0, int fdnum=-1)
Definition XrdOss.hh:444
static const uint16_t DF_isDir
Object is for a directory.
Definition XrdOss.hh:392
static const uint16_t DF_isProxy
Object is a proxy object.
Definition XrdOss.hh:394

References XrdOssDF::XrdOssDF(), XrdOssDF::DF_isDir, and XrdOssDF::DF_isProxy.

Here is the call graph for this function:

◆ ~XrdPssDir()

XrdPssDir::~XrdPssDir ( )
inline

Definition at line 68 of file XrdPss.hh.

68{if (myDir) Close();}
int Close(long long *retsz=0)
Definition XrdPss.cc:748

References Close().

Here is the call graph for this function:

Member Function Documentation

◆ Close()

int XrdPssDir::Close ( long long * retsz = 0)
virtual

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 748 of file XrdPss.cc.

749{
750 DIR *theDir;
751
752// Close the directory proper if it exists. POSIX specified that directory
753// stream is no longer available after closedir() regardless if return value.
754//
755 if ((theDir = myDir))
756 {myDir = 0;
757 if (XrdPosixXrootd::Closedir(theDir)) return -errno;
758 return XrdOssOK;
759 }
760
761// Directory is not open
762//
763 return -XRDOSS_E8002;
764}
#define XRDOSS_E8002
#define XrdOssOK
Definition XrdOss.hh:50
static int Closedir(DIR *dirp)
Closedir() conforms to POSIX.1-2001 closedir()

References XrdPosixXrootd::Closedir(), XRDOSS_E8002, and XrdOssOK.

Referenced by ~XrdPssDir().

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

◆ Opendir()

int XrdPssDir::Opendir ( const char * path,
XrdOucEnv & env )
virtual

Open a directory.

Parameters
path- Pointer to the path of the directory to be opened.
env- Reference to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 650 of file XrdPss.cc.

651{
652 EPNAME("Opendir");
653 int rc;
654 char pbuff[PBsz];
655
656// Return an error if this object is already open
657//
658 if (myDir) return -XRDOSS_E8001;
659
660// Open directories are not supported for object id's
661//
662 if (*dir_path != '/') return -ENOTSUP;
663
664// Setup url info
665//
666 XrdPssUrlInfo uInfo(&Env, dir_path);
667 uInfo.setID();
668
669// Convert path to URL
670//
671 if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
672 return rc;
673
674// Do some tracing
675//
676 if(DEBUGON) {
677 auto urlObf = obfuscateAuth(pbuff);
678 DEBUG(uInfo.Tident(),"url="<<urlObf);
679 }
680
681// Open the directory
682//
683 myDir = XrdPosixXrootd::Opendir(pbuff);
684 if (!myDir) return -errno;
685 return XrdOssOK;
686}
#define DEBUG(x)
#define EPNAME(x)
#define XRDOSS_E8001
std::string obfuscateAuth(const std::string &input)
#define DEBUGON
static DIR * Opendir(const char *path)
Opendir() conforms to POSIX.1-2001 opendir()
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1414
static bool xLfn2Pfn
Definition XrdPss.hh:211
static const int PBsz
Definition XrdPss.cc:119

References DEBUG, DEBUGON, EPNAME, obfuscateAuth(), XrdPosixXrootd::Opendir(), XrdPssSys::P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::setID(), XrdPssUrlInfo::Tident(), XrdPssSys::xLfn2Pfn, XRDOSS_E8001, and XrdOssOK.

Here is the call graph for this function:

◆ Readdir()

int XrdPssDir::Readdir ( char * buff,
int blen )
virtual

Get the next directory entry.

Parameters
buff- Pointer to buffer where a null terminated string of the entry name is to be returned. If no more entries exist, a null string is returned.
blen- Length of the buffer.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssDF.

Definition at line 707 of file XrdPss.cc.

708{
709// Check if we are directly reading the directory
710//
711 if (myDir)
712 {dirent *entP, myEnt;
713 int rc = XrdPosixXrootd::Readdir_r(myDir, &myEnt, &entP);
714 if (rc) return -rc;
715 if (!entP) *buff = 0;
716 else strlcpy(buff, myEnt.d_name, blen);
717 return XrdOssOK;
718 }
719
720// The directory is not open
721//
722 return -XRDOSS_E8002;
723}
size_t strlcpy(char *dst, const char *src, size_t sz)
static int Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)

References XrdPosixXrootd::Readdir_r(), strlcpy(), XRDOSS_E8002, and XrdOssOK.

Here is the call graph for this function:

◆ StatRet()

int XrdPssDir::StatRet ( struct stat * buff)
virtual

Set the stat() buffer where stat information is to be placed corresponding to the directory entry returned by Readdir().

Parameters
buff- Pointer to stat structure to be used.
Returns
0 upon success or -ENOTSUP if not supported.
Note
This is a one-time call as stat structure is reused for each Readdir.
When StatRet() is in effect, directory entries that have been deleted from the target directory are quietly skipped.

Reimplemented from XrdOssDF.

Definition at line 728 of file XrdPss.cc.

729{
730 if (!myDir) return -XRDOSS_E8002;
731
732 auto rc = XrdPosixXrootd::StatRet(myDir, buff);
733 if (rc) return -rc;
734 return XrdOssOK;
735}
static int StatRet(DIR *dirp, struct stat *buf)

References stat, XrdPosixXrootd::StatRet(), XRDOSS_E8002, and XrdOssOK.

Here is the call graph for this function:

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