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