XrdOssSpace.hh

Go to the documentation of this file.
00001 #ifndef _OSS_SPACE_H
00002 #define _OSS_SPACE_H
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d O s s S p a c e . h h                         */
00006 /*                                                                            */
00007 /* (c) 2008 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 //         $Id: XrdOssSpace.hh 30949 2009-11-02 16:37:58Z ganis $
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;  // Maximum space name length (+1 for null)
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(); // Return the "or" of havexxxx (above)
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() {}  // Everything is static
00053                  ~XrdOssSpace() {}  // Never gets deleted
00054 
00055 struct uEnt {char      gName[minSNbsz];
00056              long long Bytes[Totn]; // One of sType, above
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

Generated on Tue Jul 5 14:46:48 2011 for ROOT_528-00b_version by  doxygen 1.5.1