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

#include <XrdOssArcDir.hh>

Inheritance diagram for XrdOssArcDir:
Collaboration diagram for XrdOssArcDir:

Public Member Functions

 XrdOssArcDir (const char *tident, XrdOssDF *df)
virtual ~XrdOssArcDir ()
int Close (long long *retsz=0) override
bool getErrMsg (std::string &eText) override
int Opendir (const char *path, XrdOucEnv &env) override
Public Member Functions inherited from XrdOssWrapDF
 XrdOssWrapDF (XrdOssDF &df2Wrap)
virtual ~XrdOssWrapDF ()
virtual int Clone (const std::vector< XrdOucCloneSeg > &cVec)
virtual int Clone (XrdOssDF &srcFile)
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 ssize_t Read (XrdOucRangeList &rlist)
virtual int Read (XrdSfsAio *aiop)
virtual int Readdir (char *buff, int blen)
virtual ssize_t ReadRaw (void *buffer, off_t offset, size_t size)
virtual ssize_t ReadV (XrdOucIOVec *readV, int rdvcnt)
virtual int StatRet (struct stat *Stat)
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)
Public Member Functions inherited from XrdOssDF
 XrdOssDF (const char *tid="", uint16_t dftype=0, int fdnum=-1)
virtual ~XrdOssDF ()
uint16_t DFType ()

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_QFinfo = 3
static const int Fctl_setFD = 2
static const int Fctl_utimes = 1
static const uint64_t Verify = 0x8000000000000000ULL
 all: Verify checksums
Protected Attributes inherited from XrdOssWrapDF
XrdOssDFwrapDF
Protected Attributes inherited from XrdOssDF
uint16_t dfType
int fd
off_t pgwEOF
short rsvd
const char * tident

Detailed Description

Definition at line 39 of file XrdOssArcDir.hh.

Constructor & Destructor Documentation

◆ XrdOssArcDir()

XrdOssArcDir::XrdOssArcDir ( const char * tident,
XrdOssDF * df )
inline

Definition at line 84 of file XrdOssArcDir.hh.

85 : XrdOssWrapDF(*df), ossDF(df) {}
XrdOssWrapDF(XrdOssDF &df2Wrap)

References XrdOssDF::XrdOssDF(), XrdOssWrapDF::XrdOssWrapDF(), and XrdOssDF::tident.

Here is the call graph for this function:

◆ ~XrdOssArcDir()

XrdOssArcDir::~XrdOssArcDir ( )
virtual

Definition at line 68 of file XrdOssArcDir.cc.

69{ delete ossDF;
70 if (zFile) delete zFile;
71}

Member Function Documentation

◆ Close()

int XrdOssArcDir::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).

Reimplemented from XrdOssWrapDF.

Definition at line 77 of file XrdOssArcDir.cc.

78{
79 int rc;
80
81// Issue close to possible zipfile appendage and delete it. The underlying
82// oss did not open the file, so we do not issue a close to that.
83//
84 if (zFile)
85 {rc = zFile->Close();
86 if (retsz) *retsz = 0;
87 delete zFile;
88 zFile = 0;
89 } else rc = ossDF->Close(retsz);
90
91// All done
92//
93 return rc;
94}

◆ getErrMsg()

bool XrdOssArcDir::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 XrdOssWrapDF.

Definition at line 100 of file XrdOssArcDir.cc.

101{
102// Return any extened error mesage associated with this thread
103//
104 if (ecMsg.hasMsg())
105 {std::string xMsg;
106 if (ossDF->getErrMsg(xMsg))
107 {ecMsg.Append();
108 ecMsg.Msg("oss", xMsg.c_str());
109 }
110 ecMsg.Get(eText);
111 return true;
112 }
113 return ossDF->getErrMsg(eText);
114}
bool hasMsg() const
std::string Msg()
XrdOucECMsg & Append(char dlm='\n')
int Get(std::string &ecm, bool rst=true)

References XrdOssArcGlobals::ecMsg.

◆ Opendir()

int XrdOssArcDir::Opendir ( const char * path,
XrdOucEnv & env )
overridevirtual

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 XrdOssWrapDF.

Definition at line 120 of file XrdOssArcDir.cc.

121{
122 TraceInfo("Opendir", ossDF->getTID());
123 int rc, arcFD;
124
125// Construct a minimal information object
126//
127 XrdOssArcCompose dsInfo(path, 0, rc, false);
128
129// If this is not out path, forward it along
130//
131 if (rc == EDOM) return ossDF->Opendir(path, env);
132
133// We don't support directory listings for backup paths
134//
135 if (dsInfo.didType == XrdOssArcCompose::isBKP) return EPERM;
136
137// Whether this is a request for an archve or a file in the archive, we
138// need to bring the archive file online. We do this first.
139//
140 char arcPath[MAXPATHLEN];
141 if ((rc = dsInfo.ArcPath(arcPath, sizeof(arcPath), true)))
142 {Elog.Emsg("opendir", rc, "instantiate path", arcPath);
143 return -rc;
144 }
145
146// Open the directory
147//
148 DEBUG("Dir="<<arcPath);
149 if ((arcFD = XrdSysFD_Open(arcPath, O_RDONLY)) < 0)
150 {rc = errno;
151 Elog.Emsg("opendir", rc, "open directory", arcPath);
152 return -rc;
153 }
154
155// We now promote the newly opened directory to the wrapped directory
156// object as it will handle all of the directory methods. We just do the open
157// to bypass all of the name2name mapping.
158//
159 rc = ossDF->Fctl(XrdOssDF::Fctl_setFD,sizeof(int),(const char*)&arcFD);
160 if (rc)
161 {Elog.Emsg("opendir", rc, "promote open of", arcPath);
162 close(arcFD);
163 return Neg(rc);
164 }
165
166// All done
167//
168 return XrdOssOK;
169}
#define DEBUG(x)
#define TraceInfo(x, y)
#define Neg(x)
Definition XrdOssArc.cc:78
#define XrdOssOK
Definition XrdOss.hh:54
#define close(a)
Definition XrdPosix.hh:48
static const int Fctl_setFD
Definition XrdOss.hh:460
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
XrdSysError Elog(0, "OssArc_")

References XrdOssArcCompose::ArcPath(), close, DEBUG, XrdOssArcCompose::didType, XrdOssArcGlobals::Elog, XrdOssDF::Fctl_setFD, XrdOssArcCompose::isBKP, Neg, TraceInfo, and XrdOssOK.

Here is the call graph for this function:

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