-
Notifications
You must be signed in to change notification settings - Fork 149
/
XrdOssAt.hh
149 lines (128 loc) · 7.22 KB
/
XrdOssAt.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef _XRDOSSAT_H
#define _XRDOSSAT_H
/******************************************************************************/
/* */
/* X r d O s s A t . h h */
/* */
/* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */
/* All Rights Reserved */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include <stdint.h>
#include <sys/types.h>
struct stat;
class XrdOss;
class XrdOssDF;
/******************************************************************************/
//!
//! This class defines the object that handles extended operations that are
//! relative to an open directory. Create a single instance of this class by
//! passing it the pointer to the asociated file system (XrdOss) and use the
//! methods herein to effect various operations relative to an XrdOss directory.
//!
//! @note
//! 1) The following relative methods are not currently implemented:
//! access() (aka faccessat), chmod() (aka fchmodat), chown() (aka fchownat),
//! mkdir() (aka mkdirat), readlink() (aka readlinkat),
//! rename (a.k.a renameat), symlink() (aka symlinkat), and
//! utimes() (a.k.a utimesat).
//! 2) The path argument must be relative and is not subject to name2name()
//! processing. This is in contrast to standard Unix "at" calls.
//! 3) Only the online copy of the target is subject to these calls. Use the
//! the standard calls for remote storage backed file systems.
/******************************************************************************/
class XrdOssAt
{
public:
//-----------------------------------------------------------------------------
//! Open a directory relative to an open directory.
//!
//! @param atDir - Reference to the directory object to use.
//! @param path - Pointer to the relative path of the directory to be opened.
//! @param env - Reference to environmental information.
//! @param ossDF - Reference to where the directory object pointer is to be
//! returned upon success.
//!
//! @return 0 upon success or -errno or -osserr (see XrdOssError.hh).
//-----------------------------------------------------------------------------
int Opendir(XrdOssDF &atDir, const char *path, XrdOucEnv &env, XrdOssDF *&ossDF);
//-----------------------------------------------------------------------------
//! Open a file in r/o mode relative to an open directory.
//!
//! @param atDir - Reference to the directory object to use.
//! @param path - Pointer to the relative path of the file to be opened.
//! @param env - Reference to environmental information.
//! @param ossDF - Reference to where the file object pointer is to be
//! returned upon success.
//!
//! @return 0 upon success or -errno or -osserr (see XrdOssError.hh).
//-----------------------------------------------------------------------------
int OpenRO(XrdOssDF &atDir, const char *path, XrdOucEnv &env, XrdOssDF *&ossDF);
//-----------------------------------------------------------------------------
//! Remove a directory relative to an open directory. Only the online entry
//! is removed (use standard remdir() for tape backed systems).
//!
//! @param atDir - Reference to the directory object to use.
//! @param path - Pointer to the path of the directory to be removed.
//!
//! @return 0 upon success or -errno or -osserr (see XrdOssError.hh).
//-----------------------------------------------------------------------------
int Remdir(XrdOssDF &atDir, const char *path);
//-----------------------------------------------------------------------------
//! Return state information on the target relative to an open directory.
//!
//! @param atDir - Reference to the directory object to use.
//! @param path - Pointer to the path of the target to be interrogated.
//! @param buf - Reference to the structure where info it to be returned.
//! @param opts - Options:
//! At_dInfo - provide bdevID in st_rdev and partID in st_dev
//!
//! @return 0 upon success or -errno or -osserr (see XrdOssError.hh).
//-----------------------------------------------------------------------------
static const int At_dInfo = 0x00000001;
int Stat(XrdOssDF &atDir, const char *path, struct stat &buf, int opts=0);
//-----------------------------------------------------------------------------
//! Remove a file relative to an open directory. Only the online copy is
//! is removed (use standard unlink() for tape backed systems).
//!
//! @param atDir - Reference to the directory object to use.
//! @param path - Pointer to the path of the file to be removed.
//!
//! @return 0 upon success or -errno or -osserr (see XrdOssError.hh).
//-----------------------------------------------------------------------------
int Unlink(XrdOssDF &atDir, const char *path);
//-----------------------------------------------------------------------------
//! Constructor
//!
//! @param ossfd - Reference to the OSS system interface.
//-----------------------------------------------------------------------------
XrdOssAt(XrdOss &ossfs) : ossFS(ossfs) {}
//-----------------------------------------------------------------------------
//! Destructor
//-----------------------------------------------------------------------------
~XrdOssAt() {}
private:
XrdOss &ossFS;
};
#endif