00001 #ifndef _OSS_SPACE_H
00002 #define _OSS_SPACE_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 class XrdSysError;
00034
00035 class XrdOssSpace
00036 {
00037 public:
00038
00039 enum sType {Serv = 0, Pstg = 1, Purg = 2, Admin = 3,
00040 RsvA = 4, RsvB = 5, RsvC = 6, addT = 7,
00041 Totn = 8};
00042
00043 static const int maxSNlen = 63;
00044 static const int minSNbsz = 64;
00045
00046 static void Adjust(int Gent, off_t Space, sType=Serv);
00047
00048 static void Adjust(const char *GName, off_t Space, sType=Serv);
00049
00050 static int Assign(const char *GName, long long &bytesUsed);
00051
00052 static const int haveUsage = 1;
00053 static const int haveQuota = 2;
00054
00055 static int Init();
00056
00057 static int Init(const char *aPath, const char *qFile, int isSOL);
00058
00059 static int Quotas();
00060
00061 static int Readjust();
00062
00063 static void Refresh();
00064
00065 static int Unassign(const char *GName);
00066
00067 static long long Usage(int gent) {return (gent < 0 || gent >= maxEnt
00068 ? 0 : uData[gent].Bytes[Serv]);}
00069
00070 XrdOssSpace() {}
00071 ~XrdOssSpace() {}
00072
00073 struct uEnt {char gName[minSNbsz];
00074 long long Bytes[Totn];
00075 };
00076
00077 static long long Usage(const char *GName, struct uEnt &uVal, int rrd=0);
00078
00079 private:
00080 static int findEnt(const char *GName);
00081 static int Readjust(int);
00082 static int UsageLock(int Dolock=1);
00083
00084 static const int ULen = sizeof(long long);
00085 static const int DataSz = 16384;
00086 static const int maxEnt = DataSz/sizeof(uEnt);
00087
00088 static const char *qFname;
00089 static const char *uFname;
00090 static uEnt uData[maxEnt];
00091 static short uDvec[maxEnt];
00092 static time_t lastMtime;
00093 static int fencEnt;
00094 static int freeEnt;
00095 static int aFD;
00096 static int Solitary;
00097 };
00098 #endif