00001 #ifndef __XRDRMCDATA_HH__
00002 #define __XRDRMCDATA_HH__
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
00034
00035
00036
00037 #include "XrdOuc/XrdOucCache.hh"
00038 #include "XrdRmc/XrdRmcReal.hh"
00039 #include "XrdSys/XrdSysPthread.hh"
00040 #include "XrdSys/XrdSysXSLock.hh"
00041
00042 class XrdRmcData : public XrdOucCacheIO
00043 {
00044 public:
00045
00046 bool Detach(XrdOucCacheIOCD &iocd);
00047
00048 long long FSize() {return (ioObj ? ioObj->FSize() : 0);}
00049
00050 const char *Path() {return ioObj->Path();}
00051
00052 void Preread();
00053
00054 void Preread(aprParms &Parms);
00055
00056 void Preread(long long Offs, int rLen, int Opts=0);
00057
00058 int Read (char *Buffer, long long Offset, int Length);
00059
00060 static int setAPR(aprParms &Dest, aprParms &Src, int pSize);
00061
00062 int Sync() {return 0;}
00063
00064 int Trunc(long long Offset);
00065
00066 int Write(char *Buffer, long long Offset, int Length);
00067
00068 XrdRmcData(XrdRmcReal *cP, XrdOucCacheIO *ioP,
00069 long long vn, int opts);
00070
00071 private:
00072 ~XrdRmcData() {}
00073 void QueuePR(long long SegOffs, int rLen, int prHow, int isAuto=0);
00074 int Read (XrdOucCacheStats &Now,
00075 char *Buffer, long long Offs, int Length);
00076
00077
00078
00079 class MrSw
00080 {
00081 public:
00082 inline void UnLock() {if (myLock) {myLock->UnLock(myUsage); myLock = 0;}}
00083
00084 MrSw(XrdSysXSLock *lP, XrdSysXS_Type usage) : myUsage(usage)
00085 {if ((myLock = lP)) lP->Lock(usage);}
00086 ~MrSw() {if (myLock) myLock->UnLock(myUsage);}
00087
00088 private:
00089 XrdSysXSLock *myLock;
00090 XrdSysXS_Type myUsage;
00091 };
00092
00093
00094
00095 XrdOucCacheStats Statistics;
00096
00097
00098
00099 XrdSysXSLock rwLock;
00100 XrdSysXSLock *pPLock;
00101 XrdSysXSLock *rPLock;
00102 XrdSysXSLock *wPLock;
00103 XrdSysXS_Type pPLopt;
00104 XrdSysXS_Type rPLopt;
00105
00106 XrdSysMutex DMutex;
00107 XrdRmcReal *Cache;
00108 XrdOucCacheIO *ioObj;
00109 long long VNum;
00110 long long SegSize;
00111 long long OffMask;
00112 long long SegShft;
00113 int maxCache;
00114 char isFIS;
00115 char isRW;
00116 char Debug;
00117
00118 static const int okRW = 1;
00119 static const int xqRW = 2;
00120
00121
00122
00123 XrdRmcReal::prTask prReq;
00124 XrdSysSemaphore *prStop;
00125
00126 long long prNSS;
00127
00128 static const int prRRMax= 5;
00129 long long prRR[prRRMax];
00130 int prRRNow;
00131
00132 static const int prMax = 8;
00133 static const int prRun = 1;
00134 static const int prWait = 2;
00135
00136 static const int prLRU = 1;
00137 static const int prSUSE = 2;
00138 static const int prSKIP = 3;
00139
00140 aprParms Apr;
00141 long long prCalc;
00142 long long prBeg[prMax];
00143 long long prEnd[prMax];
00144 int prNext;
00145 int prFree;
00146 int prPerf;
00147 char prOpt[prMax];
00148 char prOK;
00149 char prActive;
00150 char prAuto;
00151 };
00152 #endif