xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdSfs
XrdSfsNative.hh
Go to the documentation of this file.
1
#ifndef __SFS_NATIVE_H__
2
#define __SFS_NATIVE_H__
3
/******************************************************************************/
4
/* */
5
/* X r d S f s N a t i v e . h h */
6
/* */
7
/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* Produced by Andrew Hanushevsky for Stanford University under contract */
9
/* DE-AC02-76-SFO0515 with the Department of Energy */
10
/* */
11
/* This file is part of the XRootD software suite. */
12
/* */
13
/* XRootD is free software: you can redistribute it and/or modify it under */
14
/* the terms of the GNU Lesser General Public License as published by the */
15
/* Free Software Foundation, either version 3 of the License, or (at your */
16
/* option) any later version. */
17
/* */
18
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21
/* License for more details. */
22
/* */
23
/* You should have received a copy of the GNU Lesser General Public License */
24
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26
/* */
27
/* The copyright holder's institutional names and contributor's names may not */
28
/* be used to endorse or promote products derived from this software without */
29
/* specific prior written permission of the institution or contributor. */
30
/******************************************************************************/
31
32
#include <sys/types.h>
33
#include <string.h>
34
#include <dirent.h>
35
36
#include "
XrdSfs/XrdSfsInterface.hh
"
37
38
class
XrdSysError
;
39
class
XrdSysLogger
;
40
41
/******************************************************************************/
42
/* X r d S f s N a t i v e D i r e c t o r y */
43
/******************************************************************************/
44
45
class
XrdSfsNativeDirectory
:
public
XrdSfsDirectory
46
{
47
public
:
48
49
int
open
(
const
char
*dirName,
50
const
XrdSecClientName
*client = 0,
51
const
char
*opaque = 0);
52
53
const
char
*
nextEntry
();
54
55
int
close
();
56
57
const
char
*
FName
() {
return
(
const
char
*)
fname
;}
58
59
XrdSfsNativeDirectory
(
char
*user=0,
int
monid=0)
60
:
XrdSfsDirectory
(user, monid)
61
{
ateof
= 0;
fname
= 0;
62
dh
= (DIR *)0;
63
d_pnt
= &
dirent_full
.d_entry;
64
}
65
66
~XrdSfsNativeDirectory
() {
if
(
dh
)
close
();}
67
private
:
68
69
DIR *
dh
;
// Directory stream handle
70
char
ateof
;
71
char
*
fname
;
72
73
struct
{
struct
dirent d_entry;
74
char
pad
[MAXNAMLEN];
// This is only required for Solaris!
75
}
dirent_full
;
76
77
struct
dirent *
d_pnt
;
78
79
};
80
81
/******************************************************************************/
82
/* X r d S f s N a t i v e F i l e */
83
/******************************************************************************/
84
85
class
XrdSfsAio
;
86
87
class
XrdSfsNativeFile
:
public
XrdSfsFile
88
{
89
public
:
90
91
int
open
(
const
char
*fileName,
92
XrdSfsFileOpenMode
openMode,
93
mode_t createMode,
94
const
XrdSecClientName
*client = 0,
95
const
char
*opaque = 0);
96
97
int
close
();
98
99
int
fctl
(
const
int
cmd,
100
const
char
*args,
101
XrdOucErrInfo
&out_error);
102
103
const
char
*
FName
() {
return
fname
;}
104
105
int
getMmap
(
void
**Addr, off_t &Size)
106
{
if
(Addr) Addr = 0; Size = 0;
return
SFS_OK
;}
107
108
int
read
(
XrdSfsFileOffset
fileOffset,
109
XrdSfsXferSize
preread_sz) {
return
SFS_OK
;}
110
111
XrdSfsXferSize
read
(
XrdSfsFileOffset
fileOffset,
112
char
*buffer,
113
XrdSfsXferSize
buffer_size);
114
115
int
read
(
XrdSfsAio
*aioparm);
116
117
XrdSfsXferSize
write
(
XrdSfsFileOffset
fileOffset,
118
const
char
*buffer,
119
XrdSfsXferSize
buffer_size);
120
121
int
write
(
XrdSfsAio
*aioparm);
122
123
int
sync
();
124
125
int
sync
(
XrdSfsAio
*aiop);
126
127
int
stat
(
struct
stat
*buf);
128
129
int
truncate
(
XrdSfsFileOffset
fileOffset);
130
131
int
getCXinfo
(
char
cxtype[4],
int
&cxrsz) {
return
cxrsz = 0;}
132
133
XrdSfsNativeFile
(
char
*user=0,
int
monid=0)
134
:
XrdSfsFile
(user, monid)
135
{
oh
= -1;
fname
= 0;}
136
~XrdSfsNativeFile
() {
if
(
oh
)
close
();}
137
private
:
138
139
int
oh
;
140
char
*
fname
;
141
142
};
143
144
/******************************************************************************/
145
/* X r d S f s N a t i v e */
146
/******************************************************************************/
147
148
class
XrdSfsNative
:
public
XrdSfsFileSystem
149
{
150
public
:
151
152
// Object Allocation Functions
153
//
154
XrdSfsDirectory
*
newDir
(
char
*user=0,
int
monid=0)
155
{
return
(
XrdSfsDirectory
*)
new
XrdSfsNativeDirectory
(user,monid);}
156
157
XrdSfsFile
*
newFile
(
char
*user=0,
int
monid=0)
158
{
return
(
XrdSfsFile
*)
new
XrdSfsNativeFile
(user,monid);}
159
160
// Other Functions
161
//
162
int
chmod
(
const
char
*Name,
163
XrdSfsMode
Mode
,
164
XrdOucErrInfo
&out_error,
165
const
XrdSecClientName
*client = 0,
166
const
char
*opaque = 0);
167
168
int
exists
(
const
char
*fileName,
169
XrdSfsFileExistence
&exists_flag,
170
XrdOucErrInfo
&out_error,
171
const
XrdSecClientName
*client = 0,
172
const
char
*opaque = 0);
173
174
int
fsctl
(
const
int
cmd,
175
const
char
*args,
176
XrdOucErrInfo
&out_error,
177
const
XrdSecClientName
*client = 0);
178
179
int
getStats
(
char
*buff,
int
blen) {
return
0;}
180
181
const
char
*
getVersion
();
182
183
int
mkdir
(
const
char
*dirName,
184
XrdSfsMode
Mode
,
185
XrdOucErrInfo
&out_error,
186
const
XrdSecClientName
*client = 0,
187
const
char
*opaque = 0);
188
189
int
prepare
(
XrdSfsPrep
&pargs,
190
XrdOucErrInfo
&out_error,
191
const
XrdSecClientName
*client = 0) {
return
0;}
192
193
int
rem
(
const
char
*path,
194
XrdOucErrInfo
&out_error,
195
const
XrdSecClientName
*client = 0,
196
const
char
*opaque = 0);
197
198
int
remdir
(
const
char
*dirName,
199
XrdOucErrInfo
&out_error,
200
const
XrdSecClientName
*client = 0,
201
const
char
*opaque = 0);
202
203
int
rename
(
const
char
*oldFileName,
204
const
char
*newFileName,
205
XrdOucErrInfo
&out_error,
206
const
XrdSecClientName
*client = 0,
207
const
char
*opaqueO = 0,
208
const
char
*opaqueN = 0);
209
210
int
stat
(
const
char
*Name,
211
struct
stat
*buf,
212
XrdOucErrInfo
&out_error,
213
const
XrdSecClientName
*client = 0,
214
const
char
*opaque = 0);
215
216
int
stat
(
const
char
*Name,
217
mode_t &mode,
218
XrdOucErrInfo
&out_error,
219
const
XrdSecClientName
*client = 0,
220
const
char
*opaque = 0)
221
{
struct
stat
bfr;
222
int
rc =
stat
(Name, &bfr, out_error, client);
223
if
(!rc) mode = bfr.st_mode;
224
return
rc;
225
}
226
227
int
truncate
(
const
char
*Name,
228
XrdSfsFileOffset
fileOffset,
229
XrdOucErrInfo
&out_error,
230
const
XrdSecEntity
*client = 0,
231
const
char
*opaque = 0);
232
233
// Common functions
234
//
235
static
int
Mkpath
(
const
char
*path, mode_t mode,
236
const
char
*info=0);
237
238
static
int
Emsg
(
const
char
*,
XrdOucErrInfo
&,
int
,
const
char
*x,
239
const
char
*y=
""
);
240
241
XrdSfsNative
(
XrdSysError
*lp);
242
virtual
~XrdSfsNative
() {}
243
244
private
:
245
246
static
XrdSysError
*
eDest
;
247
};
248
#endif
Generated by
1.8.3.1