Go to the documentation of this file.00001 #ifndef __FRMFILES__HH
00002 #define __FRMFILES__HH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <string.h>
00016 #include <sys/types.h>
00017
00018 #include "XrdOss/XrdOssPath.hh"
00019 #include "XrdOuc/XrdOucHash.hh"
00020 #include "XrdOuc/XrdOucNSWalk.hh"
00021
00022 class XrdOucTList;
00023
00024
00025
00026
00027
00028 class XrdFrmFileset
00029 {
00030 public:
00031 friend class XrdFrmFiles;
00032
00033
00034
00035 inline XrdOucNSWalk::NSEnt *baseFile() {return File[XrdOssPath::isBase];}
00036 const char *basePath() {return Mkfn(baseFile());}
00037 inline XrdOucNSWalk::NSEnt *failFile() {return File[XrdOssPath::isFail];}
00038 const char *failPath() {return Mkfn(failFile());}
00039 inline XrdOucNSWalk::NSEnt *lockFile() {return File[XrdOssPath::isLock];}
00040 const char *lockPath() {return Mkfn(lockFile());}
00041 inline XrdOucNSWalk::NSEnt * pfnFile() {return File[XrdOssPath::isPfn ];}
00042 const char * pfnPath() {return Mkfn(pfnFile());}
00043 inline XrdOucNSWalk::NSEnt * pinFile() {return File[XrdOssPath::isPin ];}
00044 const char * pinPath() {return Mkfn(pinFile());}
00045
00046 int dirPath(char *dBuff, int dBlen);
00047
00048 int Refresh(int isMig=0, int doLock=1);
00049
00050 void UnLock();
00051
00052 XrdFrmFileset(XrdFrmFileset *sP=0, XrdOucTList *diP=0)
00053 : Next(sP), dInfo(diP),
00054 dlkFD(-1), flkFD(-1)
00055 {memset(File, 0, sizeof(File));}
00056 ~XrdFrmFileset();
00057
00058
00059
00060 XrdFrmFileset *Next;
00061 int Age;
00062
00063 private:
00064 int chkLock(const char *Path);
00065 int getLock(char *Path, int Shared=0, int noWait=0);
00066 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
00067
00068
00069
00070
00071 XrdOucNSWalk::NSEnt *File[XrdOssPath::sfxNum];
00072
00073 XrdOucTList *dInfo;
00074 static const int dLen = 0;
00075 static const int dRef = 1;
00076
00077 int dlkFD;
00078 int flkFD;
00079 };
00080
00081
00082
00083
00084
00085 class XrdFrmFiles
00086 {
00087 public:
00088
00089 XrdFrmFileset *Get(int &rc, int noBase=0);
00090
00091 static const int Recursive = 0x0001;
00092 static const int CompressD = 0x0002;
00093 static const int NoAutoDel = 0x0004;
00094
00095 XrdFrmFiles(const char *dname, int opts=Recursive,
00096 XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
00097
00098 ~XrdFrmFiles() {}
00099
00100 private:
00101 int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
00102
00103 XrdOucHash<XrdFrmFileset>fsTab;
00104
00105 XrdOucNSWalk nsObj;
00106 XrdFrmFileset *fsList;
00107 XrdOucHash_Options manMem;
00108 int shareD;
00109 };
00110 #endif