xrootd
Loading...
Searching...
No Matches
XrdOssSpace.hh
Go to the documentation of this file.
1#ifndef _OSS_SPACE_H
2#define _OSS_SPACE_H
3/******************************************************************************/
4/* */
5/* X r d O s s S p a c e . h h */
6/* */
7/* (c) 2008 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33class XrdSysError;
34
36{
37public:
38friend class XrdOssCache;
39
40 enum sType {Serv = 0, Pstg = 1, Purg = 2, Admin = 3,
41 RsvA = 4, RsvB = 5, RsvC = 6, addT = 7,
42 Totn = 8};
43
44static const int maxSNlen = 63; // Maximum space name length (+1 for null)
45static const int minSNbsz = 64;
46
47static void Adjust(int Gent, off_t Space, sType=Serv);
48
49static void Adjust(const char *GName, off_t Space, sType=Serv);
50
51static const int haveUsage = 1;
52static const int haveQuota = 2;
53
54static int Init(); // Return the "or" of havexxxx (above)
55
56static int Init(const char *aPath,const char *qFile,int isSOL,int us=0);
57
58static int Quotas();
59
60static int Unassign(const char *GName);
61
62static long long Usage(int gent);
63
64struct uEnt {char gName[minSNbsz];
65 long long Bytes[Totn]; // One of sType, above
66 };
67
68static long long Usage(const char *GName, struct uEnt &uVal, int rrd=0);
69
70 XrdOssSpace() {} // Everything is static
71 ~XrdOssSpace() {} // Never gets deleted
72
73private:
74
75static int Assign(const char *GName, long long &bytesUsed);
76static int findEnt(const char *GName);
77static int Readjust();
78static int Readjust(int);
79static int UsageLock(int Dolock=1);
80
81static const int ULen = sizeof(long long);
82static const int DataSz = 16384;
83static const int maxEnt = DataSz/sizeof(uEnt);
84
85static const char *qFname;
86static const char *uFname;
87static const char *uUname;
89static short uDvec[maxEnt];
90static time_t lastMtime;
91static time_t lastUtime;
92static int fencEnt;
93static int freeEnt;
94static int aFD;
95static int uSync;
96static int uAdj;
97static int Solitary;
98};
99#endif
Definition XrdOssCache.hh:213
Definition XrdOssSpace.hh:36
static int freeEnt
Definition XrdOssSpace.hh:93
static int Unassign(const char *GName)
static short uDvec[maxEnt]
Definition XrdOssSpace.hh:89
static int Solitary
Definition XrdOssSpace.hh:97
static const char * uFname
Definition XrdOssSpace.hh:86
static void Adjust(const char *GName, off_t Space, sType=Serv)
static int Quotas()
static int uAdj
Definition XrdOssSpace.hh:96
sType
Definition XrdOssSpace.hh:40
@ RsvC
Definition XrdOssSpace.hh:41
@ Serv
Definition XrdOssSpace.hh:40
@ RsvA
Definition XrdOssSpace.hh:41
@ Purg
Definition XrdOssSpace.hh:40
@ Totn
Definition XrdOssSpace.hh:42
@ RsvB
Definition XrdOssSpace.hh:41
@ Pstg
Definition XrdOssSpace.hh:40
@ addT
Definition XrdOssSpace.hh:41
@ Admin
Definition XrdOssSpace.hh:40
static void Adjust(int Gent, off_t Space, sType=Serv)
static long long Usage(const char *GName, struct uEnt &uVal, int rrd=0)
static time_t lastMtime
Definition XrdOssSpace.hh:90
static const int minSNbsz
Definition XrdOssSpace.hh:45
static int findEnt(const char *GName)
static const char * qFname
Definition XrdOssSpace.hh:85
static uEnt uData[maxEnt]
Definition XrdOssSpace.hh:88
static const int haveQuota
Definition XrdOssSpace.hh:52
static const char * uUname
Definition XrdOssSpace.hh:87
static const int maxEnt
Definition XrdOssSpace.hh:83
XrdOssSpace()
Definition XrdOssSpace.hh:70
static int uSync
Definition XrdOssSpace.hh:95
static long long Usage(int gent)
static time_t lastUtime
Definition XrdOssSpace.hh:91
static int Readjust(int)
static int UsageLock(int Dolock=1)
static const int DataSz
Definition XrdOssSpace.hh:82
~XrdOssSpace()
Definition XrdOssSpace.hh:71
static const int haveUsage
Definition XrdOssSpace.hh:51
static int fencEnt
Definition XrdOssSpace.hh:92
static int Init(const char *aPath, const char *qFile, int isSOL, int us=0)
static int Init()
static int Assign(const char *GName, long long &bytesUsed)
static int Readjust()
static const int maxSNlen
Definition XrdOssSpace.hh:44
static int aFD
Definition XrdOssSpace.hh:94
static const int ULen
Definition XrdOssSpace.hh:81
Definition XrdSysError.hh:90
Definition XrdOssSpace.hh:64
char gName[minSNbsz]
Definition XrdOssSpace.hh:64
long long Bytes[Totn]
Definition XrdOssSpace.hh:65