Loading...
Searching...
No Matches
XrdSfsNativeDirectory Class Reference

`#include <XrdSfsNative.hh>`

Inheritance diagram for XrdSfsNativeDirectory:
Collaboration diagram for XrdSfsNativeDirectory:

## Public Member Functions

| XrdSfsNativeDirectory (char *user=0, int monid=0)
| ~XrdSfsNativeDirectory ()
int | close ()
const char * | FName ()
const char * | nextEntry ()
int | open (const char *dirName, const XrdSecClientName *client=0, 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.
virtual int | autoStat (struct stat *buf)
virtual int | open (const char *path, const XrdSecEntity *client=0, const char *opaque=0)=0

## Additional Inherited Members

Public Attributes inherited from XrdSfsDirectory
XrdOucErrInfo & | error

## Detailed Description

Definition at line 45 of file XrdSfsNative.hh.

## Constructor & Destructor Documentation

## XrdSfsNativeDirectory()

XrdSfsNativeDirectory::XrdSfsNativeDirectory | ( | char * | user = 0,
|  | int | monid = 0 )

inline

Definition at line 59 of file XrdSfsNative.hh.

: XrdSfsDirectory(user, monid)
{ateof = 0; fname = 0;
dh = (DIR *)0;
d_pnt = &dirent_full.d_entry;
}
XrdSfsDirectory::XrdSfsDirectory
XrdSfsDirectory(const char *user=0, int MonID=0)
Definition XrdSfsInterface.hh:320

References XrdSfsDirectory::XrdSfsDirectory().

Here is the call graph for this function:

## ~XrdSfsNativeDirectory()

XrdSfsNativeDirectory::~XrdSfsNativeDirectory | ( |  | ) |

inline

Definition at line 66 of file XrdSfsNative.hh.

{if (dh) close();}
XrdSfsNativeDirectory::close
int close()
Definition XrdSfsNative.cc:235

References close().

Here is the call graph for this function:

## Member Function Documentation

## close()

int XrdSfsNativeDirectory::close | ( |  | ) |

virtual

Close the directory.

Returns
  One of SFS_OK or SFS_ERROR

Implements XrdSfsDirectory.

Definition at line 235 of file XrdSfsNative.cc.

{
static const char *epname = "closedir";
// Release the handle
//
if (dh && closedir(dh))
{XrdSfsNative::Emsg(epname, error, errno, "close directory", fname);
return SFS_ERROR;
}
// Do some clean-up
//
if (fname) free(fname);
dh = (DIR *)0;
return SFS_OK;
}
closedir
#define closedir(a)
Definition XrdPosix.hh:50
SFS_ERROR
#define SFS_ERROR
Definition XrdSfsInterface.hh:109
SFS_OK
#define SFS_OK
Definition XrdSfsInterface.hh:108
XrdSfsDirectory::error
XrdOucErrInfo & error
Definition XrdSfsInterface.hh:252
XrdSfsNative::Emsg
static int Emsg(const char *, XrdOucErrInfo &, int, const char *x, const char *y="")
Definition XrdSfsNative.cc:1022

References closedir, XrdSfsNative::Emsg(), XrdSfsDirectory::error, SFS_ERROR, and SFS_OK.

Referenced by ~XrdSfsNativeDirectory().

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

## FName()

const char * XrdSfsNativeDirectory::FName | ( |  | ) |

inline virtual

Get the directory path.

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

Implements XrdSfsDirectory.

Definition at line 57 of file XrdSfsNative.hh.

{return (const char *)fname;}

## nextEntry()

const char * XrdSfsNativeDirectory::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 171 of file XrdSfsNative.cc.

{
static const char *epname = "nextEntry";
struct dirent *rp;
int retc;
// Lock the direcrtory and do any required tracing
//
if (!dh)
{XrdSfsNative::Emsg(epname,error,EBADF,"read directory",fname);
return (const char *)0;
}
// Check if we are at EOF (once there we stay there)
//
if (ateof) return (const char *)0;
// Read the next directory entry
//
#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
errno = 0;
rp = readdir(dh);
if (!rp)
{if (!(retc = errno)) {ateof = 1; error.clear();}
else XrdSfsNative::Emsg(epname,error,retc,"read directory",fname);
d_pnt->d_name[0] = '\0';
return (const char *)0;
}
return (const char *)(rp->d_name);
#else
if ((retc = readdir_r(dh, d_pnt, &rp)))
{XrdSfsNative::Emsg(epname,error,retc,"read directory",fname);
d_pnt->d_name[0] = '\0';
return (const char *)0;
}
// Check if we have reached end of file
//
if (!rp || !d_pnt->d_name[0])
{ateof = 1;
error.clear();
return (const char *)0;
}
// Return the actual entry
//
return (const char *)(d_pnt->d_name);
#endif
}
readdir_r
#define readdir_r(a, b, c)
Definition XrdPosix.hh:89
readdir
#define readdir(a)
Definition XrdPosix.hh:86

References XrdSfsNative::Emsg(), XrdSfsDirectory::error, readdir, and readdir_r.

Here is the call graph for this function:

## open()

int XrdSfsNativeDirectory::open | ( | const char * | dirName,
|  | const XrdSecClientName * | client = 0,
|  | const char * | opaque = 0 )

Definition at line 131 of file XrdSfsNative.cc.

{
static const char *epname = "opendir";
// Verify that this object is not already associated with an open directory
//
if (dh) return
XrdSfsNative::Emsg(epname, error, EADDRINUSE,
"open directory", dir_path);
// Set up values for this directory object
//
ateof = 0;
fname = strdup(dir_path);
// Open the directory and get it's id
//
if (!(dh = opendir(dir_path))) return
XrdSfsNative::Emsg(epname,error,errno,"open directory",dir_path);
// All done
//
return SFS_OK;
}
opendir
#define opendir(a)
Definition XrdPosix.hh:78

References XrdSfsNative::Emsg(), XrdSfsDirectory::error, opendir, SFS_OK, and XrdSecClientName.

Here is the call graph for this function:

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

- XrdSfsNative.hh
- XrdSfsNative.cc