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 ~XrdFrmFileset();
00054
00055
00056
00057 XrdFrmFileset *Next;
00058 int Age;
00059
00060 private:
00061 int chkLock(const char *Path);
00062 int getLock(char *Path, int Shared=0, int noWait=0);
00063 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
00064
00065
00066
00067
00068 XrdOucNSWalk::NSEnt *File[XrdOssPath::sfxNum];
00069
00070 XrdOucTList *dInfo;
00071 static const int dLen = 0;
00072 static const int dRef = 1;
00073
00074 int dlkFD;
00075 int flkFD;
00076 };
00077
00078
00079
00080
00081
00082 class XrdFrmFiles
00083 {
00084 public:
00085
00086 XrdFrmFileset *Get(int &rc, int noBase=0);
00087
00088 static const int Recursive = 0x0001;
00089 static const int CompressD = 0x0002;
00090 static const int NoAutoDel = 0x0004;
00091
00092 XrdFrmFiles(const char *dname, int opts=Recursive,
00093 XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
00094
00095 ~XrdFrmFiles() {}
00096
00097 private:
00098 int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
00099
00100 XrdOucHash<XrdFrmFileset>fsTab;
00101
00102 XrdOucNSWalk nsObj;
00103 XrdFrmFileset *fsList;
00104 XrdOucHash_Options manMem;
00105 int shareD;
00106 };
00107 #endif