XRootD
XrdOssArc Class Reference

#include <XrdOssArc.hh>

+ Inheritance diagram for XrdOssArc:
+ Collaboration diagram for XrdOssArc:

Public Member Functions

 XrdOssArc (XrdOss &ossref)
 
virtual ~XrdOssArc ()
 
virtual int Chmod (const char *path, mode_t mode, XrdOucEnv *envP=0) override
 
virtual int Create (const char *tid, const char *path, mode_t mode, XrdOucEnv &env, int opts=0) override
 
virtual uint64_t Features () override
 
virtual int FSctl (int cmd, int alen, const char *args, char **resp=0) override
 
virtual bool getErrMsg (std::string &eText) override
 
int InitArc (const char *, const char *parms, XrdOucEnv *envP)
 
virtual int Lfn2Pfn (const char *Path, char *buff, int blen) override
 
virtual const char * Lfn2Pfn (const char *Path, char *buff, int blen, int &rc) override
 
virtual int Mkdir (const char *path, mode_t mode, int mkpath=0, XrdOucEnv *envP=0) override
 
virtual XrdOssDFnewDir (const char *tident) override
 
virtual XrdOssDFnewFile (const char *tident) override
 
virtual int Remdir (const char *path, int Opts=0, XrdOucEnv *envP=0) override
 
virtual int Rename (const char *oPath, const char *nPath, XrdOucEnv *oEnvP=0, XrdOucEnv *nEnvP=0) override
 
virtual int Stat (const char *path, struct stat *buff, int opts=0, XrdOucEnv *envP=0) override
 
virtual int Truncate (const char *path, unsigned long long fsize, XrdOucEnv *envP=0) override
 
virtual int Unlink (const char *path, int Opts=0, XrdOucEnv *envP=0) override
 
- Public Member Functions inherited from XrdOssWrapper
 XrdOssWrapper (XrdOss &ossRef)
 
virtual ~XrdOssWrapper ()
 
virtual void Connect (XrdOucEnv &env)
 
virtual void Disc (XrdOucEnv &env)
 
virtual void EnvInfo (XrdOucEnv *envP)
 
virtual int Init (XrdSysLogger *lp, const char *cfn)
 
virtual int Init (XrdSysLogger *lp, const char *cfn, XrdOucEnv *envP)
 
virtual int Reloc (const char *tident, const char *path, const char *cgName, const char *anchor=0)
 
virtual int StatFS (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
 
virtual int StatLS (XrdOucEnv &env, const char *path, char *buff, int &blen)
 
virtual int StatPF (const char *path, struct stat *buff)
 
virtual int StatPF (const char *path, struct stat *buff, int opts)
 
virtual int Stats (char *buff, int blen)
 
virtual int StatVS (XrdOssVSInfo *vsP, const char *sname=0, int updt=0)
 
virtual int StatXA (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
 
virtual int StatXP (const char *path, unsigned long long &attr, XrdOucEnv *envP=0)
 
- Public Member Functions inherited from XrdOss
 XrdOss ()
 Constructor and Destructor. More...
 
virtual ~XrdOss ()
 

Additional Inherited Members

- Static Public Attributes inherited from XrdOss
static const int PF_csVer = 0x00000001
 verified file checksums present More...
 
static const int PF_csVun = 0x00000002
 unverified file checksums present More...
 
static const int PF_dInfo = 0x00000001
 
static const int PF_dNums = 0x00000002
 
static const int PF_dStat = 0x00000008
 
static const int PF_isLFN = 0x00000004
 
- Protected Attributes inherited from XrdOssWrapper
XrdOsswrapPI
 

Detailed Description

Definition at line 39 of file XrdOssArc.hh.

Constructor & Destructor Documentation

◆ XrdOssArc()

XrdOssArc::XrdOssArc ( XrdOss ossref)
inline

Definition at line 253 of file XrdOssArc.hh.

253 :XrdOssWrapper(ossref) {}
XrdOssWrapper(XrdOss &ossRef)

◆ ~XrdOssArc()

virtual XrdOssArc::~XrdOssArc ( )
inlinevirtual

Definition at line 255 of file XrdOssArc.hh.

255 {}

Member Function Documentation

◆ Chmod()

int XrdOssArc::Chmod ( const char *  path,
mode_t  mode,
XrdOucEnv envP = 0 
)
overridevirtual

Change file mode settings.

Parameters
path- Pointer to the path of the file in question.
mode- The new file mode setting.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 124 of file XrdOssArc.cc.

125 {
126 
127 // chmod is only valid for non-archive paths
128 //
129  if (XrdOssArcCompose::isMine(path))
130  {Elog.Emsg("Chmod", EROFS, "chmod using", path);
131  return -EROFS;
132  }
133 
134 // Pass this through
135 //
136  return wrapPI.Chmod(path, mode, envP);
137 }
static bool isMine(const char *path)
virtual int Chmod(const char *path, mode_t mode, XrdOucEnv *envP=0)=0
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:116
XrdSysError Elog(0, "OssArc_")
XrdOucEnv * envP
Definition: XrdPss.cc:110

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdProxy::envP, and XrdOssArcCompose::isMine().

+ Here is the call graph for this function:

◆ Create()

int XrdOssArc::Create ( const char *  tid,
const char *  path,
mode_t  mode,
XrdOucEnv env,
int  opts = 0 
)
overridevirtual

Create file.

Parameters
tid- Pointer to the trace identifier.
path- Pointer to the path of the file to create.
mode- The new file mode setting.
env- Reference to environmental information.
opts- Create options: XRDOSS_mkpath - create dir path if it does not exist. XRDOSS_new - the file must not already exist. oflags<<8 - open flags shifted 8 bits to the left/
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 143 of file XrdOssArc.cc.

145 {
146 
147 // Create is only valid for non-archive paths
148 //
149  if (XrdOssArcCompose::isMine(path))
150  {Elog.Emsg("create", EROFS, "create file using", path);
151  return -EROFS;
152  }
153 
154 // Pass this through
155 //
156  return wrapPI.Create(tid, path, mode, env, opts);
157 }
struct myOpts opts
virtual int Create(const char *tid, const char *path, mode_t mode, XrdOucEnv &env, int opts=0)=0

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdOssArcCompose::isMine(), and opts.

+ Here is the call graph for this function:

◆ Features()

uint64_t XrdOssArc::Features ( )
overridevirtual

Return storage system features.

Returns
Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOssWrapper.

Definition at line 163 of file XrdOssArc.cc.

164 {
165  return XRDOSS_HASXERT | wrapPI.Features();
166 }
#define XRDOSS_HASXERT
Definition: XrdOss.hh:543
virtual uint64_t Features()
Definition: XrdOss.cc:60

References XRDOSS_HASXERT.

◆ FSctl()

int XrdOssArc::FSctl ( int  cmd,
int  alen,
const char *  args,
char **  resp = 0 
)
overridevirtual

Execute a special storage system operation.

Parameters
cmd- The operation to be performed: XRDOSS_FSCTLFA - Perform proxy file attribute operation
alen- Length of data pointed to by args.
args- Data sent with request, zero if alen is zero.
resp- Where the response is to be set, if any.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 172 of file XrdOssArc.cc.

173 {
174 // Pass this through
175 //
176  return wrapPI.FSctl(cmd, alen, args, resp);
177 }
virtual int FSctl(int cmd, int alen, const char *args, char **resp=0)
Definition: XrdOss.cc:66

◆ getErrMsg()

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

Obtain detailed error message text for the immediately preceeding error returned by any method in this class.

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

Definition at line 183 of file XrdOssArc.cc.

184 {
185 // Return any extened error mesage associated with this thread
186 //
187  if (ecMsg.hasMsg())
188  {ecMsg.Get(eText);
189  return true;
190  }
191  return false;
192 }
bool hasMsg() const
Definition: XrdOucECMsg.hh:73
int Get(std::string &ecm, bool rst=true)
Definition: XrdOucECMsg.cc:41
thread_local XrdOucECMsg ecMsg

References XrdOssArcGlobals::ecMsg, XrdOucECMsg::Get(), and XrdOucECMsg::hasMsg().

+ Here is the call graph for this function:

◆ InitArc()

int XrdOssArc::InitArc ( const char *  configfn,
const char *  parms,
XrdOucEnv envP 
)

Definition at line 205 of file XrdOssArc.cc.

206 {
207  const char *ending = "completed.";
208  int retc = EINVAL;
209 
210 // Obtain pointer to the scheduler. If missing allocate one.
211 //
212  if (!envP || !(schedP = (XrdScheduler*)envP->GetPtr("XrdScheduler*")))
213  {schedP = new XrdScheduler;
214  schedP->Start();
215  }
216 
217 // Print herald
218 //
219  Elog.Say("++++++ Archive Storage System initialization started.");
220 
221 // Configure the subsystems
222 //
223  if ( (!Config.Configure(configfn, parms, envP)) ) ending = "failed!";
224  else retc = XrdOssOK;
225 
226 // Print closing herald
227 //
228  Elog.Say("------ Archive Storage System initialization ", ending);
229 
230 // All done.
231 //
232  return retc;
233 }
#define XrdOssOK
Definition: XrdOss.hh:54
bool Configure(const char *cfn, const char *parms, XrdOucEnv *envP)
void * GetPtr(const char *varname)
Definition: XrdOucEnv.cc:281
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition: XrdSysError.cc:162
XrdOssArcConfig Config
Definition: XrdOssArc.cc:68
XrdScheduler * schedP
Definition: XrdOssArc.cc:66

References XrdOssArcGlobals::Config, XrdOssArcConfig::Configure(), XrdOssArcGlobals::Elog, XrdProxy::envP, XrdOucEnv::GetPtr(), XrdSysError::Say(), XrdOssArcGlobals::schedP, XrdScheduler::Start(), and XrdOssOK.

Referenced by XrdVERSIONINFO().

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

◆ Lfn2Pfn() [1/2]

int XrdOssArc::Lfn2Pfn ( const char *  Path,
char *  buff,
int  blen 
)
overridevirtual

Translate logical name to physical name V1 (deprecated).

Parameters
Path- Path in whose information is wanted.
buff- Pointer to the buffer to hold the new path.
blen- Length of the buffer.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 239 of file XrdOssArc.cc.

240 {
241  int rc = 0;
242 
243 // Use v2 version to generate the Pfn
244 //
245  if (Lfn2Pfn(Path, buff, blen, rc) == Path && !rc)
246  {if ((int)strlen(Path) >= blen) rc = -ENAMETOOLONG;
247  else strcpy(buff, Path);
248  }
249  return rc;
250 }
XrdOucString Path
virtual int Lfn2Pfn(const char *Path, char *buff, int blen) override
Definition: XrdOssArc.cc:239

References Path.

◆ Lfn2Pfn() [2/2]

const char * XrdOssArc::Lfn2Pfn ( const char *  Path,
char *  buff,
int  blen,
int &  rc 
)
overridevirtual

Translate logical name to physical name V2.

Parameters
Path- Path in whose information is wanted.
buff- Pointer to the buffer to hold the new path.
blen- Length of the buffer.
rc- Place where failure return code is to be returned: -errno or -osserr (see XrdOssError.hh).
Returns
Pointer to the translated path upon success or nil on failure.

Reimplemented from XrdOssWrapper.

Definition at line 256 of file XrdOssArc.cc.

257 {
258 
259 // The caller typically needs the LFN2PFN mapping to handle file attributes,
260 // checksums, and prepare requests. All of these are disallowed for our
261 // internal paths so we simply fail the mapping here.
262 //
264  {rc = -EPERM;
265  return 0;
266  }
267 
268 // Use the underlying mapping.
269 //
270  return wrapPI.Lfn2Pfn(Path, buff, blen, rc);
271 }
virtual int Lfn2Pfn(const char *Path, char *buff, int blen)
Definition: XrdOss.hh:954

References XrdOssArcCompose::isMine(), and Path.

+ Here is the call graph for this function:

◆ Mkdir()

int XrdOssArc::Mkdir ( const char *  path,
mode_t  mode,
int  mkpath = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Create a directory.

Parameters
path- Pointer to the path of the directory to be created.
mode- The directory mode setting.
mkpath- When true the path is created if it does not exist.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 277 of file XrdOssArc.cc.

278 {
279 
280 // mkdir is only valid for non-archive paths
281 //
282  if (XrdOssArcCompose::isMine(path))
283  {Elog.Emsg("Mkdir", EROFS, "create directory using", path);
284  return -EROFS;
285  }
286 
287 // Pass this through
288 //
289  return wrapPI.Mkdir(path, mode, mkpath, envP);
290 }
virtual int Mkdir(const char *path, mode_t mode, int mkpath=0, XrdOucEnv *envP=0)=0

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdProxy::envP, and XrdOssArcCompose::isMine().

+ Here is the call graph for this function:

◆ newDir()

virtual XrdOssDF* XrdOssArc::newDir ( const char *  tident)
inlineoverridevirtual

Obtain a new director object to be used for future directory requests.

Parameters
tident- The trace identifier.
Returns
pointer- Pointer to a possibly wrapped XrdOssDF object.
nil - Insufficient memory to allocate an object.

Reimplemented from XrdOssWrapper.

Definition at line 52 of file XrdOssArc.hh.

53  {return new XrdOssArcDir(tident,wrapPI.newDir(tident));}
#define tident
virtual XrdOssDF * newDir(const char *tident)=0

References XrdOss::newDir(), tident, and XrdOssWrapper::wrapPI.

+ Here is the call graph for this function:

◆ newFile()

virtual XrdOssDF* XrdOssArc::newFile ( const char *  tident)
inlineoverridevirtual

Obtain a new file object to be used for a future file requests.

Parameters
tident- The trace identifier.
Returns
pointer- Pointer to a possibly wrapped XrdOssDF object.
nil - Insufficient memory to allocate an object.

Reimplemented from XrdOssWrapper.

Definition at line 64 of file XrdOssArc.hh.

65  {return new XrdOssArcFile(tident,wrapPI.newFile(tident));}
virtual XrdOssDF * newFile(const char *tident)=0

References XrdOss::newFile(), tident, and XrdOssWrapper::wrapPI.

+ Here is the call graph for this function:

◆ Remdir()

int XrdOssArc::Remdir ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Remove a directory.

Parameters
path- Pointer to the path of the directory to be removed.
Opts- The processing options: XRDOSS_Online - only remove online copy XRDOSS_isPFN - path is already translated.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 296 of file XrdOssArc.cc.

297 {
298 
299 // Remdir is only valid for non-archive paths
300 //
301  if (XrdOssArcCompose::isMine(path))
302  {Elog.Emsg("Remdir", EROFS, "remove", path);
303  return -EROFS;
304  }
305 
306 // Pass this through
307 //
308  return wrapPI.Remdir(path, Opts, envP);
309 }
virtual int Remdir(const char *path, int Opts=0, XrdOucEnv *envP=0)=0
int Opts
Definition: XrdMpxStats.cc:58

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdProxy::envP, XrdOssArcCompose::isMine(), and XrdMpx::Opts.

+ Here is the call graph for this function:

◆ Rename()

int XrdOssArc::Rename ( const char *  oPath,
const char *  nPath,
XrdOucEnv oEnvP = 0,
XrdOucEnv nEnvP = 0 
)
overridevirtual

Rename a file or directory.

Parameters
oPath- Pointer to the path to be renamed.
nPath- Pointer to the path oPath is to have.
oEnvP- Environmental information for oPath.
nEnvP- Environmental information for nPath.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 315 of file XrdOssArc.cc.

317 {
318 
319 // Rename is only valid for non-archive paths
320 //
321  if (XrdOssArcCompose::isMine(oldname) || (XrdOssArcCompose::isMine(newname)))
322  {Elog.Emsg("Rename", EROFS, "rename", newname);
323  return -EROFS;
324  }
325 
326 // Pass this through
327 //
328  return wrapPI.Rename(oldname, newname, old_env, new_env);
329 }
virtual int Rename(const char *oPath, const char *nPath, XrdOucEnv *oEnvP=0, XrdOucEnv *nEnvP=0)=0

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), and XrdOssArcCompose::isMine().

+ Here is the call graph for this function:

◆ Stat()

int XrdOssArc::Stat ( const char *  path,
struct stat buff,
int  opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Return state information on a file or directory.

Parameters
path- Pointer to the path in question.
buff- Pointer to the structure where info it to be returned.
opts- Options: XRDOSS_preop - this is a stat prior to open. XRDOSS_resonly - only look for resident files. XRDOSS_updtatm - update file access time.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 335 of file XrdOssArc.cc.

337 {
338  TraceInfo("Stat", 0);
339  char buff[MAXPATHLEN];
340  int rc;
341 
342 // Prepare to process the archive/backup request
343 //
344  XrdOssArcCompose dsInfo(path, envP, rc, false, true);
345 
346 // Make sure all went well
347 //
348  if (rc)
349  {if (rc != EDOM)
350  {Elog.Emsg("Stat", rc, "locate", path);
351  return -rc;
352  }
353  return wrapPI.Stat(path, Stat, opts, envP);
354  }
355 
356 // If this is a stat for an archive, we can do this here
357 //
358  if (dsInfo.didType == dsInfo.isARC)
359  {if ((rc = dsInfo.ArcPath(buff, sizeof(buff), true))) return -rc;
360  if (stat(buff, Stat))
361  {rc = errno;
362  DEBUG("Stat archive "<<buff<<" failed; "<<XrdSysE2T(rc));
363  return -rc;
364  }
365  return XrdOssOK;
366  }
367 
368 // The person want to stat a particular file in an archive. The most sensible
369 // way to do this is to ask the DM system for than information.
370 //
371  if ((rc = dsInfo.Stat(dsInfo.flScope.c_str(), dsInfo.flName.c_str(), Stat)))
372  {DEBUG("Stat file "<<dsInfo.flScope.c_str()<<':'<<dsInfo.flName.c_str()
373  <<" failed; "<<XrdSysE2T(rc));
374  return -rc;
375  }
376  return XrdOssOK;
377 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define TraceInfo(x, y)
#define stat(a, b)
Definition: XrdPosix.hh:105
const char * XrdSysE2T(int errcode)
Definition: XrdSysE2T.cc:104
virtual int Stat(const char *path, struct stat *buff, int opts=0, XrdOucEnv *envP=0) override
Definition: XrdOssArc.cc:335
virtual int Stat(const char *path, struct stat *buff, int opts=0, XrdOucEnv *envP=0)=0

References XrdOssArcCompose::ArcPath(), DEBUG, XrdOssArcCompose::didType, XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdProxy::envP, XrdOssArcCompose::flName, XrdOssArcCompose::flScope, XrdOssArcCompose::isARC, opts, Stat, stat, XrdOssArcCompose::Stat(), TraceInfo, XrdOssOK, and XrdSysE2T().

+ Here is the call graph for this function:

◆ Truncate()

int XrdOssArc::Truncate ( const char *  path,
unsigned long long  fsize,
XrdOucEnv envP = 0 
)
overridevirtual

Truncate a file.

Parameters
path- Pointer to the path of the file to be truncated.
fsize- The size that the file is to have.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 383 of file XrdOssArc.cc.

385 {
386 
387 // Truncate is only valid for non-archive paths
388 //
389  if (XrdOssArcCompose::isMine(path))
390  {Elog.Emsg("Truncate", EROFS, "truncate", path);
391  return -EROFS;
392  }
393 
394 // Pass this through
395 //
396  return wrapPI.Truncate(path, size, envP);
397 }
virtual int Truncate(const char *path, unsigned long long fsize, XrdOucEnv *envP=0)=0

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdProxy::envP, and XrdOssArcCompose::isMine().

+ Here is the call graph for this function:

◆ Unlink()

int XrdOssArc::Unlink ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

Remove a file.

Parameters
path- Pointer to the path of the file to be removed.
Opts- Options: XRDOSS_isMIG - this is a migratable path. XRDOSS_isPFN - do not apply name2name to path. XRDOSS_Online - remove only the online copy.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapper.

Definition at line 403 of file XrdOssArc.cc.

404 {
405 
406 // Unlink is only valid for non-archive paths
407 //
408  if (XrdOssArcCompose::isMine(path))
409  {Elog.Emsg("Rename", EROFS, "remove", path);
410  return -EROFS;
411  }
412 
413 // Pass this through
414 //
415  return wrapPI.Unlink(path, Opts, envP);
416 }
virtual int Unlink(const char *path, int Opts=0, XrdOucEnv *envP=0)=0

References XrdOssArcGlobals::Elog, XrdSysError::Emsg(), XrdProxy::envP, XrdOssArcCompose::isMine(), and XrdMpx::Opts.

+ Here is the call graph for this function:

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