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

Generated on Tue Jul 5 14:46:35 2011 for ROOT_528-00b_version by  doxygen 1.5.1