XRootD
Loading...
Searching...
No Matches
XrdPosixDir.hh
Go to the documentation of this file.
1
#ifndef __XRDPOSIXDIR_H__
2
#define __XRDPOSIXDIR_H__
3
/******************************************************************************/
4
/* */
5
/* X r d P o s i x D i r . h h */
6
/* */
7
/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC02-76-SFO0515 with the Department of Energy */
11
/* */
12
/* This file is part of the XRootD software suite. */
13
/* */
14
/* XRootD is free software: you can redistribute it and/or modify it under */
15
/* the terms of the GNU Lesser General Public License as published by the */
16
/* Free Software Foundation, either version 3 of the License, or (at your */
17
/* option) any later version. */
18
/* */
19
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22
/* License for more details. */
23
/* */
24
/* You should have received a copy of the GNU Lesser General Public License */
25
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27
/* */
28
/* The copyright holder's institutional names and contributor's names may not */
29
/* be used to endorse or promote products derived from this software without */
30
/* specific prior written permission of the institution or contributor. */
31
/* Modified by Frank Winklmeier to add the full Posix file system definition. */
32
/******************************************************************************/
33
34
#include <dirent.h>
35
36
#if defined(__APPLE__) || defined(__FreeBSD__)
37
#if !defined(dirent64)
38
#define dirent64 dirent
39
#endif
40
#endif
41
42
#include <unistd.h>
43
#include <sys/types.h>
44
45
#include "
XrdPosix/XrdPosixAdmin.hh
"
46
#include "
XrdPosix/XrdPosixObject.hh
"
47
48
class
XrdPosixDir
:
public
XrdPosixObject
49
{
50
public
:
51
XrdPosixDir
(
const
char
*path)
52
: DAdmin(path,
ecMsg
), myDirVec(0), myDirEnt(0),
53
nxtEnt(0), numEnt(0), eNum(0)
54
{}
55
56
~XrdPosixDir
() {
delete
myDirVec;
57
if
(myDirEnt) free(myDirEnt);
58
}
59
60
static
int
dirNo
(DIR *dirP) {
return
*(
int
*)dirP;}
61
62
long
getEntries
() {
return
numEnt;}
63
64
long
getOffset
() {
return
nxtEnt; }
65
66
void
setOffset
(
long
offset) { nxtEnt = offset; }
67
68
dirent64 *
nextEntry
(dirent64 *dp=0);
69
70
DIR *
Open
();
71
72
void
rewind
() {
objMutex
.
WriteLock
();
73
nxtEnt = 0;
delete
myDirVec; myDirVec = 0;
74
objMutex
.
UnLock
();
75
}
76
int
Status
() {
return
eNum;}
77
78
bool
Unread
() {
return
myDirVec == 0;}
79
80
using
XrdPosixObject::Who
;
81
82
bool
Who
(
XrdPosixDir
**dirP) {*dirP =
this
;
return
true
;}
83
84
static
const
size_t
maxDlen
= 256;
85
86
private
:
87
XrdPosixAdmin
DAdmin;
88
XrdCl::DirectoryList
*myDirVec;
89
dirent64 *myDirEnt;
90
uint32_t nxtEnt;
91
uint32_t numEnt;
92
int
eNum;
93
};
94
#endif
XrdPosixAdmin.hh
XrdPosixObject.hh
XrdCl::DirectoryList
Directory list.
Definition
XrdClXRootDResponses.hh:651
XrdPosixAdmin
Definition
XrdPosixAdmin.hh:48
XrdPosixDir
Definition
XrdPosixDir.hh:49
XrdPosixDir::XrdPosixDir
XrdPosixDir(const char *path)
Definition
XrdPosixDir.hh:51
XrdPosixDir::dirNo
static int dirNo(DIR *dirP)
Definition
XrdPosixDir.hh:60
XrdPosixDir::rewind
void rewind()
Definition
XrdPosixDir.hh:72
XrdPosixDir::getOffset
long getOffset()
Definition
XrdPosixDir.hh:64
XrdPosixDir::Open
DIR * Open()
Definition
XrdPosixDir.cc:94
XrdPosixDir::Unread
bool Unread()
Definition
XrdPosixDir.hh:78
XrdPosixDir::nextEntry
dirent64 * nextEntry(dirent64 *dp=0)
Definition
XrdPosixDir.cc:48
XrdPosixDir::setOffset
void setOffset(long offset)
Definition
XrdPosixDir.hh:66
XrdPosixDir::Status
int Status()
Definition
XrdPosixDir.hh:76
XrdPosixDir::~XrdPosixDir
~XrdPosixDir()
Definition
XrdPosixDir.hh:56
XrdPosixDir::getEntries
long getEntries()
Definition
XrdPosixDir.hh:62
XrdPosixDir::maxDlen
static const size_t maxDlen
Definition
XrdPosixDir.hh:84
XrdPosixDir::Who
bool Who(XrdPosixDir **dirP)
Definition
XrdPosixDir.hh:82
XrdPosixObject
Definition
XrdPosixObject.hh:43
XrdPosixObject::objMutex
XrdSysRWLock objMutex
Definition
XrdPosixObject.hh:100
XrdPosixObject::Who
virtual bool Who(XrdPosixDir **dirP)
Definition
XrdPosixObject.hh:89
XrdPosixObject::ecMsg
XrdOucECMsg ecMsg
Definition
XrdPosixObject.hh:96
XrdSysRWLock::WriteLock
void WriteLock()
Definition
XrdSysPthread.hh:343
XrdSysRWLock::UnLock
void UnLock()
Definition
XrdSysPthread.hh:348
XrdPosix
XrdPosixDir.hh
Generated by
1.9.8