00001 #ifndef __OFSPOSCQ_H__
00002 #define __OFSPOSCQ_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "XrdSys/XrdSysPthread.hh"
00034
00035 class XrdOss;
00036 class XrdSysError;
00037
00038 class XrdOfsPoscq
00039 {
00040 public:
00041
00042 struct Request
00043 {
00044 long long addT;
00045 char LFN[1024];
00046 char User[288];
00047 char Reserved[24];
00048 };
00049
00050 static const int ReqOffs = 64;
00051 static const int ReqSize = sizeof(Request);
00052
00053 struct recEnt
00054 {
00055 recEnt *Next;
00056 int Offset;
00057 int Mode;
00058 struct Request reqData;
00059 recEnt(struct Request &reqref, int mval, recEnt *nval=0)
00060 {Next = nval; Offset = 0; Mode = mval; reqData = reqref;}
00061 };
00062
00063 int Add(const char *Tident, const char *Lfn);
00064
00065 int Commit(const char *Lfn, int Offset);
00066
00067 int Del(const char *Lfn, int Offset, int Unlink=0);
00068
00069 recEnt *Init(int &Ok);
00070
00071 static recEnt *List(XrdSysError *Say, const char *theFN);
00072
00073 inline int Num() {return pocIQ;}
00074
00075 XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn,
00076 int sv=1);
00077 ~XrdOfsPoscq() {}
00078
00079 private:
00080 void FailIni(const char *lfn);
00081 int reqRead(void *Buff, int Offs);
00082 int reqWrite(void *Buff, int Bsz, int Offs);
00083 int ReWrite(recEnt *rP);
00084 int VerOffset(const char *Lfn, int Offset);
00085
00086 struct FileSlot
00087 {FileSlot *Next;
00088 int Offset;
00089 };
00090
00091 XrdSysMutex myMutex;
00092 XrdSysError *eDest;
00093 XrdOss *ossFS;
00094 FileSlot *SlotList;
00095 FileSlot *SlotLust;
00096 char *pocFN;
00097 int pocSZ;
00098 int pocFD;
00099 int pocIQ;
00100 unsigned
00101 short pocWS;
00102 unsigned
00103 short pocSV;
00104 };
00105 #endif