XRootD
Loading...
Searching...
No Matches
XrdFrmAdmin.hh
Go to the documentation of this file.
1#ifndef __FRMADMIN__HH
2#define __FRMADMIN__HH
3/******************************************************************************/
4/* */
5/* X r d F r m A d m i n . h h */
6/* */
7/* (c) 2009 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/******************************************************************************/
32
33#include <cstdlib>
34#include <sys/types.h>
35
36#include "XrdCks/XrdCksData.hh"
38
39class XrdFrcProxy;
40class XrdFrmFileset;
41class XrdOucArgs;
42class XrdOucTList;
43
45{
46public:
47
48int Audit();
49
50int Chksum();
51
52int Copy();
53
54int Create();
55
56int Find();
57
58int Help();
59
60int MakeLF();
61
62int Mark();
63
64int Mmap();
65
66int Mv();
67
68int Pin();
69
70int Query();
71
72int Quit() {exit(finalRC); return 0;}
73
74int Reloc();
75
76int Remove();
77
78int Rename();
79
80void setArgs(int argc, char **argv);
81
82void setArgs(char *argv);
83
84int xeqArgs(char *Cmd);
85
86 XrdFrmAdmin() : frmProxy(0), frmProxz(0), finalRC(0) {}
88
89private:
90int AuditNameNB(XrdFrmFileset *sP);
91int AuditNameNF(XrdFrmFileset *sP);
92int AuditNameNL(XrdFrmFileset *sP);
93int AuditNames();
94int AuditNameXA(XrdFrmFileset *sP);
95int AuditRemove(XrdFrmFileset *sP);
96int AuditSpace();
97int AuditSpaceAX(const char *Path);
98int AuditSpaceAXDB(const char *Path);
99int AuditSpaceAXDC(const char *Path, XrdOucNSWalk::NSEnt *nP);
100int AuditSpaceAXDL(int dorm, const char *Path, const char *Dest);
101int AuditSpaceXA(const char *Space, const char *Path);
102int AuditSpaceXA(XrdFrmFileset *sP);
103int AuditUsage();
104int AuditUsage(char *Space);
105int AuditUsageAX(const char *Path);
106int AuditUsageXA(const char *Path, const char *Space);
107int isXA(XrdOucNSWalk::NSEnt *nP);
108
109int ChksumList( const char *Lfn, const char *Pfn);
110void ChksumPrint(const char *Lfn, int rc);
111
112int FindFail(XrdOucArgs &Spec);
113int FindMmap(XrdOucArgs &Spec);
114int FindNocs(XrdOucArgs &Spec);
115int FindPins(XrdOucArgs &Spec);
116int FindPins(XrdFrmFileset *sP);
117int FindUnmi(XrdOucArgs &Spec);
118
119int Abbrev(const char *Spec, const char *Word, int minLen);
120
121void ConfigProxy();
122
123void Emsg(const char *tx1, const char *tx2=0, const char *tx3=0,
124 const char *tx4=0, const char *tx5=0);
125void Emsg(int Enum, const char *tx2=0, const char *tx3=0,
126 const char *tx4=0, const char *tx5=0);
127void Msg(const char *tx1, const char *tx2=0, const char *tx3=0,
128 const char *tx4=0, const char *tx5=0);
129
130int Parse(const char *What, XrdOucArgs &Spec, const char **Reqs);
131int ParseKeep(const char *What, const char *kTime);
132int ParseOwner(const char *What, char *Uname);
133XrdOucTList *ParseSpace(char *Space, char **Path);
134int ParseType(const char *What, char *Type);
135
136char ckAttr(int What, const char *Lfn, char *Pfn, int Pfnsz);
137int mkLock(const char *Lfn);
138int mkFile(int What, const char *Path, const char *Data=0, int Dlen=0);
139int mkMark(const char *Lfn);
140int mkMmap(const char *Lfn);
141int mkPin(const char *Lfn);
142char mkStat(int What, const char *Lfn, char *Pfn, int Pfnsz);
143
144// For mkFile and mkStat the following options may be passed via What
145//
146static const int isPFN= 0x0001; // Filename is actual physical name
147static const int mkLF = 0x0002; // Make lock file or copy attribute
148static const int mkMF = 0x0004; // Make mmap file or mmap attribute
149static const int mkPF = 0x0008; // Make pin file or pin attribute
150
151int QueryPfn(XrdOucArgs &Spec);
152int QueryRfn(XrdOucArgs &Spec);
153int QuerySpace(XrdOucArgs &Spec);
154int QuerySpace(const char *Pfn, char *Lnk=0, int Lsz=0);
155int QueryUsage(XrdOucArgs &Spec);
156int QueryXfrQ(XrdOucArgs &Spec);
157
158int Reloc(char *srcLfn, char *Space);
159int RelocCP(const char *srcpfn, const char *trgpfn, off_t srcSz);
160int RelocWR(const char *outFn, int oFD, char *Buff, size_t BLen, off_t Boff);
161
162int Unlink(const char *Path);
163int UnlinkDir(const char *Path, const char *lclPath);
164int UnlinkDir(XrdOucNSWalk::NSEnt *&nP, XrdOucNSWalk::NSEnt *&dP);
165int UnlinkFile(const char *lclPath);
166
167int VerifyAll(char *path);
168char VerifyMP(const char *func, const char *path);
169
170static const char *AuditHelp;
171static const char *ChksumHelp;
172static const char *FindHelp;
173static const char *HelpHelp;
174static const char *MakeLFHelp; // runOld
175static const char *MarkHelp;
176static const char *MmapHelp;
177static const char *MvHelp;
178static const char *PinHelp;
179static const char *QueryHelp;
180static const char *RelocHelp;
181static const char *RemoveHelp;
182
183// Frm agent/proxy control
184//
185XrdFrcProxy *frmProxy;
186int frmProxz;
187
188// Command control
189//
190char **ArgV;
191char *ArgS;
192int ArgC;
193
194// The following are common variables for audit functions
195//
196long long numBytes;
197long long numBLost;
198int numDirs;
199int numFiles;
200int numProb;
201int numFix;
202int finalRC;
203
204// Checksum control area
205//
206XrdCksData CksData;
207
208// Options from the command
209//
210struct {char All;
211 char Echo;
212 char Erase;
213 char Fix;
214 char Force;
215 char Keep;
216 char ktAlways;
217 char ktIdle;
218 char Local;
219 char MPType;
220 char Recurse;
221 char Verbose;
222 char *Args[2];
223 uid_t Uid;
224 gid_t Gid;
225 time_t KeepTime;
226 } Opt;
227};
228namespace XrdFrm
229{
230extern XrdFrmAdmin Admin;
231}
232#endif
XrdOucString Path
bool Force
void setArgs(int argc, char **argv)
int xeqArgs(char *Cmd)
XrdFrmAdmin Admin