XRootD
XrdSsiDir Class Reference

#include <XrdSsiDir.hh>

+ Inheritance diagram for XrdSsiDir:
+ Collaboration diagram for XrdSsiDir:

Public Member Functions

 XrdSsiDir (const char *user, int MonID)
 
virtual ~XrdSsiDir ()
 
int autoStat (struct stat *buf)
 
int close ()
 
void copyError (XrdOucErrInfo &einfo)
 
const char * FName ()
 
const char * nextEntry ()
 
int open (const char *dirName, const XrdSecEntity *client, const char *opaque=0)
 
- Public Member Functions inherited from XrdSfsDirectory
 XrdSfsDirectory (const char *user=0, int MonID=0)
 
 XrdSfsDirectory (XrdOucErrInfo &eInfo)
 
 XrdSfsDirectory (XrdSfsDirectory &wrapD)
 
virtual ~XrdSfsDirectory ()
 Destructor. More...
 

Additional Inherited Members

- Public Attributes inherited from XrdSfsDirectory
XrdOucErrInfoerror
 

Detailed Description

Definition at line 36 of file XrdSsiDir.hh.

Constructor & Destructor Documentation

◆ XrdSsiDir()

XrdSsiDir::XrdSsiDir ( const char *  user,
int  MonID 
)
inline

Definition at line 54 of file XrdSsiDir.hh.

55  : XrdSfsDirectory(user, MonID), dirP(0),
56  tident(user ? user : ""), myEInfo(user, MonID) {}
XrdSfsDirectory(const char *user=0, int MonID=0)

◆ ~XrdSsiDir()

virtual XrdSsiDir::~XrdSsiDir ( )
inlinevirtual

Definition at line 58 of file XrdSsiDir.hh.

58 {if (dirP) delete dirP;}

Member Function Documentation

◆ autoStat()

int XrdSsiDir::autoStat ( struct stat buf)
virtual

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

Returns
If supported, SFS_OK should be returned. If not supported, then SFS_ERROR should be returned with error.code set to ENOTSUP.
Note
: When autoStat() is in effect, directory entries that have been deleted from the target directory are quietly skipped.

Reimplemented from XrdSfsDirectory.

Definition at line 141 of file XrdSsiDir.cc.

151 {
152  const char *epname = "autoStat";
153 
154 // Check if this directory is actually open
155 //
156  if (dirP) return dirP->autoStat(buf);
157  return XrdSsiUtils::Emsg(epname, EBADF, epname, "???", error);
158 }
virtual int autoStat(struct stat *buf)
XrdOucErrInfo & error
static int Emsg(const char *pfx, int ecode, const char *op, const char *path, XrdOucErrInfo &eDest)
Definition: XrdSsiUtils.cc:159

References XrdSsiUtils::Emsg().

+ Here is the call graph for this function:

◆ close()

int XrdSsiDir::close ( )
virtual

Close the directory.

Returns
One of SFS_OK or SFS_ERROR

Implements XrdSfsDirectory.

Definition at line 120 of file XrdSsiDir.cc.

128 {
129  const char *epname = "closedir";
130 
131 // Close as needed
132 //
133  if (dirP) return dirP->close();
134  return XrdSsiUtils::Emsg(epname, EBADF, epname, "???", error);
135 }
virtual int close()=0

References XrdSsiUtils::Emsg().

+ Here is the call graph for this function:

◆ copyError()

void XrdSsiDir::copyError ( XrdOucErrInfo einfo)
inline

Definition at line 48 of file XrdSsiDir.hh.

48 {einfo = error;}

References XrdSfsDirectory::error.

◆ FName()

const char * XrdSsiDir::FName ( )
virtual

Get the directory path.

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

Implements XrdSfsDirectory.

Definition at line 164 of file XrdSsiDir.cc.

165 {
166  const char *epname = "fname";
167 
168 // Check if this directory is actually open
169 //
170  if (dirP) return dirP->FName();
171  XrdSsiUtils::Emsg(epname, EBADF, epname, "???", error);
172  return "";
173 }
virtual const char * FName()=0

References XrdSsiUtils::Emsg().

+ Here is the call graph for this function:

◆ nextEntry()

const char * XrdSsiDir::nextEntry ( )
virtual

Get the next directory entry.

Returns
A null terminated string with the directory name. Normally, "." ".." are not returned. If a null pointer is returned then if this is due to an error, error.code should contain errno. Otherwise, error.code should contain zero to indicate that no more entries exist (i.e. end of list). See autoStat() for additional caveats.

Implements XrdSfsDirectory.

Definition at line 95 of file XrdSsiDir.cc.

106 {
107  const char *epname = "readdir";
108 
109 // Get next directory entry if we can
110 //
111  if (dirP) return dirP->nextEntry();
112  XrdSsiUtils::Emsg(epname, EBADF, epname, "???", error);
113  return 0;
114 }
virtual const char * nextEntry()=0

References XrdSsiUtils::Emsg().

+ Here is the call graph for this function:

◆ open()

int XrdSsiDir::open ( const char *  path,
const XrdSecEntity client,
const char *  opaque = 0 
)
virtual

Open a directory.

Parameters
path- Pointer to the path of the directory to be opened.
client- Client's identify (see common description).
opaque- path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, ir SFS_STALL

Implements XrdSfsDirectory.

Definition at line 54 of file XrdSsiDir.cc.

66 {
67  static const char *epname = "opendir";
68 
69 // Verify that this object is not already associated with an open file
70 //
71  if (dirP)
72  return XrdSsiUtils::Emsg(epname,EADDRINUSE,"open directory",dir_path,error);
73 
74 // Open a regular file if this is wanted
75 //
76  if (fsChk && FSPath.Find(dir_path))
77  {if (!(dirP = theFS->newDir((char *)tident, error.getErrMid())))
78  return XrdSsiUtils::Emsg(epname, ENOMEM, epname, dir_path, error);
79  dirP->error = error;
80  return dirP->open(dir_path, client, info);
81  }
82 
83 // All done
84 //
85  if (fsChk) error.setErrInfo(ENOTSUP, "Directory operations not "
86  "supported on given path.");
87  else error.setErrInfo(ENOTSUP, "Directory operations not supported.");
88  return SFS_ERROR;
89 }
#define SFS_ERROR
int setErrInfo(int code, const char *emsg)
unsigned long long Find(const char *pathname)
Definition: XrdOucPList.hh:112
virtual int open(const char *path, const XrdSecEntity *client=0, const char *opaque=0)=0
virtual XrdSfsDirectory * newDir(char *user=0, int MonID=0)=0
XrdSfsFileSystem * theFS
Definition: XrdSsiFile.cc:54
bool fsChk
Definition: XrdSsiFile.cc:56
XrdOucPListAnchor FSPath
Definition: XrdSsiFile.cc:55

References XrdSsiUtils::Emsg(), XrdOucPListAnchor::Find(), XrdSsi::fsChk, XrdSsi::FSPath, XrdSfsFileSystem::newDir(), SFS_ERROR, XrdSsi::theFS, and tident.

+ Here is the call graph for this function:

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