#include <XrdDigFS.hh>
Definition at line 45 of file XrdDigFS.hh.
◆ XrdDigDirectory()
XrdDigDirectory::XrdDigDirectory |
( |
char * |
user = 0 , |
|
|
int |
monid = 0 |
|
) |
| |
|
inline |
Definition at line 61 of file XrdDigFS.hh.
63 dh((DIR *)0), fname(0), sBuff(0),
64 d_pnt(&dirent_full.d_entry),
65 dirFD(-1), ateof(
false),
66 isProc(
false), isBase(
false) {}
XrdSfsDirectory(const char *user=0, int MonID=0)
◆ ~XrdDigDirectory()
XrdDigDirectory::~XrdDigDirectory |
( |
| ) |
|
|
inline |
◆ autoStat()
int XrdDigDirectory::autoStat |
( |
struct stat * |
buf | ) |
|
|
inlinevirtual |
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 59 of file XrdDigFS.hh.
59 {sBuff = buf;
return SFS_OK;}
References SFS_OK.
◆ close()
int XrdDigDirectory::close |
( |
| ) |
|
|
virtual |
◆ FName()
const char* XrdDigDirectory::FName |
( |
| ) |
|
|
inlinevirtual |
Get the directory path.
- Returns
- Null terminated string of the path used in open().
Implements XrdSfsDirectory.
Definition at line 57 of file XrdDigFS.hh.
57 {
return (
const char *)fname;}
◆ nextEntry()
const char * XrdDigDirectory::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 204 of file XrdDigFS.cc.
216 static const char *epname =
"nextEntry";
217 static const int wMask = ~(S_IWUSR | S_IWGRP | S_IWOTH);
224 {
if (dirFD > 0)
return dirent_full.aEnt[--dirFD];
226 return (
const char *)0;
233 return (
const char *)0;
238 if (ateof)
return (
const char *)0;
242 #if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
246 {
if (!(retc = errno)) {ateof = 1;
error.
clear();}
248 d_pnt->d_name[0] =
'\0';
249 return (
const char *)0;
252 do{
if ((retc =
readdir_r(dh, d_pnt, &rp)))
254 d_pnt->d_name[0] =
'\0';
255 return (
const char *)0;
260 if (!rp || !d_pnt->d_name[0])
263 return (
const char *)0;
272 int sFlags = (isProc ? AT_SYMLINK_NOFOLLOW : 0);
273 if (fstatat(dirFD, rp->d_name, sBuff, sFlags))
continue;
274 sBuff->st_mode = (sBuff->st_mode & wMask) | S_IRUSR;
277 snprintf(dPath,
sizeof(dPath),
"%s%s", fname, rp->d_name);
278 if (
stat(dPath, sBuff))
continue;
279 sBuff->st_mode = (sBuff->st_mode & wMask) | S_IRUSR;
291 rc = (sBuff ? 0:fstatat(dirFD,rp->d_name,&
Stat,AT_SYMLINK_NOFOLLOW));
292 if (!rc && !noTag && S_ISLNK(sP->st_mode))
293 {n = strlen(rp->d_name);
294 dP = rp->d_name + n + 4;
295 n =
sizeof(dirent_full.nbf) - (n + 8);
296 if ((n = readlinkat(dirFD,rp->d_name,dP,n)) < 0) strcpy(dP,
"?");
298 memcpy(dP-4,
" -> ", 4);
305 return (
const char *)(rp->d_name);
#define readdir_r(a, b, c)
void clear()
Reset data and error information to null. Any appenadges are released.
References XrdDigFS::Emsg(), readdir, readdir_r, Stat, and stat.
◆ open()
int XrdDigDirectory::open |
( |
const char * |
dirName, |
|
|
const XrdSecClientName * |
client = 0 , |
|
|
const char * |
opaque = 0 |
|
) |
| |
Definition at line 135 of file XrdDigFS.cc.
148 static const char *epname =
"opendir";
154 "open directory", dir_path);
160 if ((dirFD =
Config.GenAccess(client, dirent_full.aEnt, aESZ)) < 0)
169 || !(fname =
Config.GenPath(retc, client,
"opendir",
180 {
if (fname) {free(fname); fname = 0;}
187 if (IS_PROC(dir_path))
DIR * opendir(const char *path)
static int Validate(const char *)
References XrdDig::Config, dirfd, XrdDigFS::Emsg(), XrdDigConfig::GenAccess(), XrdDigConfig::GenPath(), XrdDigConfig::isDir, opendir(), SFS_LCLPLEN, SFS_LCLPRFX, SFS_LCLPRFY, SFS_OK, and XrdDigFS::Validate().
The documentation for this class was generated from the following files: