00001 #ifndef _OSS_SPACE_H
00002 #define _OSS_SPACE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 class XrdSysError;
00016
00017 class XrdOssSpace
00018 {
00019 public:
00020
00021 enum sType {Serv = 0, Pstg = 1, Purg = 2, Admin = 3,
00022 RsvA = 4, RsvB = 5, RsvC = 6, addT = 7,
00023 Totn = 8};
00024
00025 static const int maxSNlen = 63;
00026 static const int minSNbsz = 64;
00027
00028 static void Adjust(int Gent, off_t Space, sType=Serv);
00029
00030 static void Adjust(const char *GName, off_t Space, sType=Serv);
00031
00032 static int Assign(const char *GName, long long &bytesUsed);
00033
00034 static const int haveUsage = 1;
00035 static const int haveQuota = 2;
00036
00037 static int Init();
00038
00039 static int Init(const char *aPath, const char *qFile, int isSOL);
00040
00041 static int Quotas();
00042
00043 static int Readjust();
00044
00045 static void Refresh();
00046
00047 static int Unassign(const char *GName);
00048
00049 static long long Usage(int gent) {return (gent < 0 || gent >= maxEnt
00050 ? 0 : uData[gent].Bytes[Serv]);}
00051
00052 XrdOssSpace() {}
00053 ~XrdOssSpace() {}
00054
00055 struct uEnt {char gName[minSNbsz];
00056 long long Bytes[Totn];
00057 };
00058
00059 static long long Usage(const char *GName, struct uEnt &uVal, int rrd=0);
00060
00061 private:
00062 static int findEnt(const char *GName);
00063 static int Readjust(int);
00064 static int UsageLock(int Dolock=1);
00065
00066 static const int ULen = sizeof(long long);
00067 static const int DataSz = 16384;
00068 static const int maxEnt = DataSz/sizeof(uEnt);
00069
00070 static const char *qFname;
00071 static const char *uFname;
00072 static uEnt uData[maxEnt];
00073 static short uDvec[maxEnt];
00074 static time_t lastMtime;
00075 static int fencEnt;
00076 static int freeEnt;
00077 static int aFD;
00078 static int Solitary;
00079 };
00080 #endif