00001 #ifndef __FRMADMIN__HH
00002 #define __FRMADMIN__HH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <stdlib.h>
00034 #include <sys/types.h>
00035
00036 #include "XrdCks/XrdCksData.hh"
00037 #include "XrdOuc/XrdOucNSWalk.hh"
00038
00039 class XrdFrcProxy;
00040 class XrdFrmFileset;
00041 class XrdOucArgs;
00042 class XrdOucTList;
00043
00044 class XrdFrmAdmin
00045 {
00046 public:
00047
00048 int Audit();
00049
00050 int Chksum();
00051
00052 int Copy();
00053
00054 int Create();
00055
00056 int Find();
00057
00058 int Help();
00059
00060 int MakeLF();
00061
00062 int Mark();
00063
00064 int Mmap();
00065
00066 int Mv();
00067
00068 int Pin();
00069
00070 int Query();
00071
00072 int Quit() {exit(finalRC); return 0;}
00073
00074 int Reloc();
00075
00076 int Remove();
00077
00078 int Rename();
00079
00080 void setArgs(int argc, char **argv);
00081
00082 void setArgs(char *argv);
00083
00084 int xeqArgs(char *Cmd);
00085
00086 XrdFrmAdmin() : frmProxy(0), frmProxz(0), finalRC(0) {}
00087 ~XrdFrmAdmin() {}
00088
00089 private:
00090 int AuditNameNB(XrdFrmFileset *sP);
00091 int AuditNameNF(XrdFrmFileset *sP);
00092 int AuditNameNL(XrdFrmFileset *sP);
00093 int AuditNames();
00094 int AuditNameXA(XrdFrmFileset *sP);
00095 int AuditNameXB(XrdFrmFileset *sP);
00096 int AuditNameXL(XrdFrmFileset *sP, int dorm);
00097 int AuditRemove(XrdFrmFileset *sP);
00098 int AuditSpace();
00099 int AuditSpaceAX(const char *Path);
00100 int AuditSpaceAXDB(const char *Path);
00101 int AuditSpaceAXDC(const char *Path, XrdOucNSWalk::NSEnt *nP);
00102 int AuditSpaceAXDL(int dorm, const char *Path, const char *Dest);
00103 int AuditSpaceXA(const char *Space, const char *Path);
00104 int AuditSpaceXA(XrdFrmFileset *sP);
00105 int AuditSpaceXB(const char *Space, const char *Path);
00106 int AuditSpaceXANB(XrdFrmFileset *sP);
00107 int AuditUsage();
00108 int AuditUsage(char *Space);
00109 int AuditUsageAX(const char *Path);
00110 int AuditUsageXA(const char *Path, const char *Space);
00111 int isXA(XrdOucNSWalk::NSEnt *nP);
00112
00113 int ChksumList( const char *Lfn, const char *Pfn);
00114 void ChksumPrint(const char *Lfn, int rc);
00115
00116 int FindFail(XrdOucArgs &Spec);
00117 int FindMmap(XrdOucArgs &Spec);
00118 int FindNocs(XrdOucArgs &Spec);
00119 int FindNolk(XrdOucArgs &Spec);
00120 int FindPins(XrdOucArgs &Spec);
00121 int FindPins(XrdFrmFileset *sP);
00122 int FindUnmi(XrdOucArgs &Spec);
00123
00124 int Abbrev(const char *Spec, const char *Word, int minLen);
00125
00126 void ConfigProxy();
00127
00128 void Emsg(const char *tx1, const char *tx2=0, const char *tx3=0,
00129 const char *tx4=0, const char *tx5=0);
00130 void Emsg(int Enum, const char *tx2=0, const char *tx3=0,
00131 const char *tx4=0, const char *tx5=0);
00132 void Msg(const char *tx1, const char *tx2=0, const char *tx3=0,
00133 const char *tx4=0, const char *tx5=0);
00134
00135 int Parse(const char *What, XrdOucArgs &Spec, const char **Reqs);
00136 int ParseKeep(const char *What, const char *kTime);
00137 int ParseOwner(const char *What, char *Uname);
00138 XrdOucTList *ParseSpace(char *Space, char **Path);
00139 int ParseType(const char *What, char *Type);
00140
00141 char ckAttr(int What, const char *Lfn, char *Pfn, int Pfnsz);
00142 int mkLock(const char *Lfn);
00143 int mkFile(int What, const char *Path, const char *Data=0, int Dlen=0);
00144 int mkMark(const char *Lfn);
00145 int mkMmap(const char *Lfn);
00146 int mkPin(const char *Lfn);
00147 char mkStat(int What, const char *Lfn, char *Pfn, int Pfnsz);
00148
00149
00150
00151 static const int isPFN= 0x0001;
00152 static const int mkLF = 0x0002;
00153 static const int mkMF = 0x0004;
00154 static const int mkPF = 0x0008;
00155
00156 int QueryPfn(XrdOucArgs &Spec);
00157 int QueryRfn(XrdOucArgs &Spec);
00158 int QuerySpace(XrdOucArgs &Spec);
00159 int QuerySpace(const char *Pfn, char *Lnk=0, int Lsz=0);
00160 int QueryUsage(XrdOucArgs &Spec);
00161 int QueryXfrQ(XrdOucArgs &Spec);
00162
00163 int Reloc(char *srcLfn, char *Space);
00164 int RelocCP(const char *srcpfn, const char *trgpfn, off_t srcSz);
00165 int RelocWR(const char *outFn, int oFD, char *Buff, size_t BLen, off_t Boff);
00166
00167 int Unlink(const char *Path);
00168 int UnlinkDir(const char *Path, const char *lclPath);
00169 int UnlinkDir(XrdOucNSWalk::NSEnt *&nP, XrdOucNSWalk::NSEnt *&dP);
00170 int UnlinkFile(const char *lclPath);
00171
00172 int VerifyAll(char *path);
00173 char VerifyMP(const char *func, const char *path);
00174
00175
00176
00177 int Convert();
00178 int ConvTest(int doNames, int doSpaces);
00179 int New2Old(int doNames, int doSpaces);
00180 int Old2New(int doNames, int doSpaces);
00181 int o2nFiles(XrdFrmFileset *sP, int &numOld);
00182 int o2nSpace(XrdFrmFileset *sP, const char *Space);
00183 XrdOucTList *x2xPaths();
00184 int x2xRemove(const char *Type, const char *Path, int cvt=0);
00185 XrdOucTList *x2xSpaces();
00186
00187 static const char *AuditHelp;
00188 static const char *ChksumHelp;
00189 static const char *FindHelp;
00190 static const char *HelpHelp;
00191 static const char *MakeLFHelp;
00192 static const char *MarkHelp;
00193 static const char *MmapHelp;
00194 static const char *MvHelp;
00195 static const char *PinHelp;
00196 static const char *QueryHelp;
00197 static const char *RelocHelp;
00198 static const char *RemoveHelp;
00199
00200
00201
00202 XrdFrcProxy *frmProxy;
00203 int frmProxz;
00204
00205
00206
00207 char **ArgV;
00208 char *ArgS;
00209 int ArgC;
00210
00211
00212
00213 long long numBytes;
00214 long long numBLost;
00215 int numDirs;
00216 int numFiles;
00217 int numProb;
00218 int numFix;
00219 int finalRC;
00220
00221
00222
00223 XrdCksData CksData;
00224
00225
00226
00227 struct {char All;
00228 char Echo;
00229 char Erase;
00230 char Fix;
00231 char Force;
00232 char Keep;
00233 char ktAlways;
00234 char ktIdle;
00235 char Local;
00236 char MPType;
00237 char Recurse;
00238 char Verbose;
00239 char *Args[2];
00240 uid_t Uid;
00241 gid_t Gid;
00242 time_t KeepTime;
00243 } Opt;
00244 };
00245 namespace XrdFrm
00246 {
00247 extern XrdFrmAdmin Admin;
00248 }
00249 #endif