Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

XrdFrmAdmin.hh

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

Generated on Sun Nov 6 13:39:23 2011 for xrootd by  doxygen 1.3.9.1