xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdPosix
XrdPosixXrootd.hh
Go to the documentation of this file.
1
#ifndef __XRDPOSIXXROOTD_H__
2
#define __XRDPOSIXXROOTD_H__
3
/******************************************************************************/
4
/* */
5
/* X r d P o s i x X r o o t d */
6
/* */
7
/* (c) 2010 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
#include <unistd.h>
36
#include <sys/stat.h>
37
#include <sys/statvfs.h>
38
#include <sys/types.h>
39
40
#if defined(__APPLE__) || defined(__FreeBSD__)
41
#include <sys/param.h>
42
#include <sys/mount.h>
43
#else
44
#include <sys/statfs.h>
45
#endif
46
47
#include "
XrdPosix/XrdPosixOsDep.hh
"
48
#include "
XrdSys/XrdSysPthread.hh
"
49
50
struct
XrdOucIOVec
;
51
52
class
XrdScheduler
;
53
class
XrdOucCache
;
54
class
XrdOucEnv
;
55
class
XrdPosixCallBack
;
56
class
XrdPosixFile;
57
58
//-----------------------------------------------------------------------------
60
//-----------------------------------------------------------------------------
61
62
class
XrdPosixXrootd
63
{
64
public
:
65
66
//-----------------------------------------------------------------------------
68
//-----------------------------------------------------------------------------
69
70
static
int
Access
(
const
char
*path,
int
amode);
71
72
//-----------------------------------------------------------------------------
74
//-----------------------------------------------------------------------------
75
76
static
int
Close
(
int
fildes);
77
78
//-----------------------------------------------------------------------------
80
//-----------------------------------------------------------------------------
81
82
static
int
Closedir
(DIR *dirp);
83
84
//-----------------------------------------------------------------------------
93
//-----------------------------------------------------------------------------
94
95
static
int
endPoint
(
int
FD,
char
*Buff,
int
Blen);
96
97
//-----------------------------------------------------------------------------
99
//-----------------------------------------------------------------------------
100
101
static
int
Fstat
(
int
fildes,
struct
stat *buf);
102
103
//-----------------------------------------------------------------------------
105
//-----------------------------------------------------------------------------
106
107
static
int
Fsync
(
int
fildes);
108
109
//-----------------------------------------------------------------------------
111
//-----------------------------------------------------------------------------
112
113
static
int
Ftruncate
(
int
fildes, off_t offset);
114
115
//-----------------------------------------------------------------------------
133
134
static
long
long
Getxattr
(
const
char
*path,
const
char
*name,
135
void
*value,
unsigned
long
long
size);
136
137
//-----------------------------------------------------------------------------
139
//-----------------------------------------------------------------------------
140
141
static
off_t
Lseek
(
int
fildes, off_t offset,
int
whence);
142
143
//-----------------------------------------------------------------------------
145
//-----------------------------------------------------------------------------
146
147
static
int
Mkdir
(
const
char
*path, mode_t mode);
148
149
//-----------------------------------------------------------------------------
159
//-----------------------------------------------------------------------------
160
161
static
const
int
isStream
= 0x40000000;
// Internal for Open oflag
162
163
static
int
Open
(
const
char
*path,
int
oflag, mode_t mode=0,
164
XrdPosixCallBack
*cbP=0);
165
166
//-----------------------------------------------------------------------------
168
//-----------------------------------------------------------------------------
169
170
static
DIR*
Opendir
(
const
char
*path);
171
172
//-----------------------------------------------------------------------------
174
//-----------------------------------------------------------------------------
175
176
static
ssize_t
Pread
(
int
fildes,
void
*buf,
size_t
nbyte, off_t offset);
177
178
//-----------------------------------------------------------------------------
180
//-----------------------------------------------------------------------------
181
182
static
ssize_t
Pwrite
(
int
fildes,
const
void
*buf,
size_t
nbyte, off_t offset);
183
184
//-----------------------------------------------------------------------------
195
//-----------------------------------------------------------------------------
196
197
static
int
QueryChksum
(
const
char
*path, time_t &mtime,
198
char
*buff,
int
blen);
199
200
//-----------------------------------------------------------------------------
210
//-----------------------------------------------------------------------------
211
212
static
long
long
QueryOpaque
(
const
char
*path,
char
*buff,
int
blen);
213
214
//-----------------------------------------------------------------------------
216
//-----------------------------------------------------------------------------
217
218
static
ssize_t
Read
(
int
fildes,
void
*buf,
size_t
nbyte);
219
220
//-----------------------------------------------------------------------------
222
//-----------------------------------------------------------------------------
223
224
static
ssize_t
Readv
(
int
fildes,
const
struct
iovec *iov,
int
iovcnt);
225
226
//-----------------------------------------------------------------------------
230
//-----------------------------------------------------------------------------
231
232
static
struct
dirent*
Readdir
(DIR *dirp);
233
static
struct
dirent64*
Readdir64
(DIR *dirp);
234
235
//-----------------------------------------------------------------------------
239
//-----------------------------------------------------------------------------
240
241
static
int
Readdir_r
(DIR *dirp,
struct
dirent *entry,
struct
dirent **result);
242
static
int
Readdir64_r
(DIR *dirp,
struct
dirent64 *entry,
struct
dirent64 **result);
243
244
//-----------------------------------------------------------------------------
246
//-----------------------------------------------------------------------------
247
248
static
int
Rename
(
const
char
*oldpath,
const
char
*newpath);
249
250
//-----------------------------------------------------------------------------
252
//-----------------------------------------------------------------------------
253
254
static
void
Rewinddir
(DIR *dirp);
255
256
//-----------------------------------------------------------------------------
258
//-----------------------------------------------------------------------------
259
260
static
int
Rmdir
(
const
char
*path);
261
262
//-----------------------------------------------------------------------------
264
//-----------------------------------------------------------------------------
265
266
static
void
Seekdir
(DIR *dirp,
long
loc);
267
268
//-----------------------------------------------------------------------------
270
//-----------------------------------------------------------------------------
271
272
static
int
Stat
(
const
char
*path,
struct
stat *buf);
273
274
//-----------------------------------------------------------------------------
277
//-----------------------------------------------------------------------------
278
279
static
int
Statfs
(
const
char
*path,
struct
statfs *buf);
280
281
//-----------------------------------------------------------------------------
283
//-----------------------------------------------------------------------------
284
285
static
int
Statvfs
(
const
char
*path,
struct
statvfs *buf);
286
287
//-----------------------------------------------------------------------------
289
//-----------------------------------------------------------------------------
290
291
static
long
Telldir
(DIR *dirp);
292
293
//-----------------------------------------------------------------------------
295
//-----------------------------------------------------------------------------
296
297
static
int
Truncate
(
const
char
*path, off_t offset);
298
299
//-----------------------------------------------------------------------------
301
//-----------------------------------------------------------------------------
302
303
static
int
Unlink
(
const
char
*path);
304
305
//-----------------------------------------------------------------------------
316
//-----------------------------------------------------------------------------
317
318
static
ssize_t
VRead
(
int
fildes,
const
XrdOucIOVec
*readV,
int
n);
319
320
//-----------------------------------------------------------------------------
322
//-----------------------------------------------------------------------------
323
324
static
ssize_t
Write
(
int
fildes,
const
void
*buf,
size_t
nbyte);
325
326
//-----------------------------------------------------------------------------
328
//-----------------------------------------------------------------------------
329
330
static
ssize_t
Writev
(
int
fildes,
const
struct
iovec *iov,
int
iovcnt);
331
332
//-----------------------------------------------------------------------------
335
//-----------------------------------------------------------------------------
336
337
inline
int
fdOrigin
() {
return
baseFD
;}
338
339
static
bool
isXrootdDir
(DIR *dirp);
340
341
static
bool
myFD
(
int
fd);
342
343
static
void
setCache
(
XrdOucCache
*cP);
344
345
static
void
setDebug
(
int
val,
bool
doDebug=
false
);
346
347
static
void
setEnv
(
const
char
*kword,
int
kval);
348
349
static
void
setIPV4
(
bool
userv4);
350
351
static
void
setSched
(
XrdScheduler
*sP);
352
353
/* There must be one instance of this object per executable image. Typically,
354
this object is declared in main() or at file level. This is necessary to
355
properly do one-time initialization of the static members. When declaring
356
this object, you can pass the following information:
357
maxfd - maximum number of simultaneous files and directories to support.
358
The value returned by getrlimit() over-rides the passed value
359
unless maxfd is negative. When negative, abs(maxfd) becomes the
360
absolute maximum and shadow file descriptors are not used.
361
maxdir - Ignored, only here for backward compatability.
362
maxthr - Ignored, only here for backward compatability.
363
*/
364
XrdPosixXrootd
(
int
maxfd=255,
int
maxdir=0,
int
maxthr=0);
365
~XrdPosixXrootd
();
366
367
private
:
368
369
static
void
initEnv
();
370
static
void
initEnv
(
char
*eData);
371
static
void
initEnv
(
XrdOucEnv
&,
const
char
*,
long
long
&);
372
static
int
Fault
(XrdPosixFile *fp,
int
ecode);
373
static
void
initStat
(
struct
stat *buf);
374
static
void
initXdev
(dev_t &st_dev, dev_t &st_rdev);
375
376
static
XrdOucCache
*
myCache
;
377
static
int
baseFD
;
378
static
int
initDone
;
379
};
380
#endif
Generated by
1.8.3.1