XRootD
XrdFrmConfig.hh
Go to the documentation of this file.
1 #ifndef _XRD_FRMCONFIG_H
2 #define _XRD_FRMCONFIG_H
3 /******************************************************************************/
4 /* */
5 /* X r d F r m C o n f i g . h h */
6 /* */
7 /* (C) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Deprtment of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 #include <cstring>
33 #include <unistd.h>
34 
35 #include "XrdOss/XrdOssSpace.hh"
36 
37 class XrdCks;
38 class XrdNetCmsNotify;
39 class XrdOfsConfigPI;
40 class XrdOss;
41 class XrdOucMsubs;
42 class XrdOucName2Name;
43 class XrdOucProg;
44 class XrdOucStream;
45 class XrdOucTList;
46 class XrdSysLogger;
47 
48 class XrdFrmConfigSE;
49 
50 struct XrdVersionInfo;
51 struct stat;
52 
54 {
55 public:
56 
57 const char *myProg;
58 const char *myName;
59 const char *myInst;
60 const char *mySite;
61 const char *myFrmid;
62 const char *myFrmID;
63 const char *lockFN;
64 char *AdminPath;
65 char *QPath;
66 char *PidPath;
67 char *myInstance;
68 char *StopPurge;
69 char *MSSCmd;
71 
72 struct Cmd
73  {const char *Desc;
74  char *theCmd;
76  int TLimit;
77  int Opts;
78  } xfrCmd[4];
79 static const int cmdAlloc = 0x0001;
80 static const int cmdMDP = 0x0002;
81 static const int cmdStats = 0x0004;
82 static const int cmdXPD = 0x0008;
83 static const int cmdRME = 0x0010;
84 
85 int xfrIN;
86 int xfrOUT;
87 
88 XrdOfsConfigPI *OfsCfg; // -> Plugin Configurator
89 XrdCks *CksMan; // -> Checksum Manager
90 XrdOucName2Name *the_N2N; // -> File mapper object
93 uid_t myUid;
94 gid_t myGid;
95 long long cmdFree;
96 int cmdHold;
98 int isAgent;
99 int xfrMax;
108 int isOTO;
109 int Fix;
110 int Test;
113 int runOld; // Backward compatibility
114 int runNew; // Forward compatibility
115 int nonXA; // Backward compatibility for noXA spaces
116 int hasCache; // Backward compatibility for noXA spaces
117 char **vectArg;
120 
121 struct VPInfo
123  char *Name;
125  int Val;
126  VPInfo(char *n, int m=0, struct VPInfo *p=0)
127  : Next(p), Name(strdup(n)), Dir(0), Val(m) {}
128  ~VPInfo() {} // Deletes are not important
129  } *VPList;
130 VPInfo *pathList; // Migr/Purg list of paths
131 XrdOucTList *spacList; // Migr/Purg list of spaces
132 
133 struct Policy
134  {long long minFree;
135  long long maxFree;
136  int Hold;
137  int Ext;
140  Policy(const char *snv, long long minV, long long maxV,
141  int hV, int xV) : minFree(minV), maxFree(maxV),
142  Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
143  ~Policy() {}
144  };
146 
148 int pVecNum; // Number of policy variables
149 static const int pVecMax=8;
150 char pVec[pVecMax];
151 char *pProg;
152 char *xfrFdir;
154 
157 
158 int Configure(int argc, char **argv, int (*ppf)());
159 
160 int LocalPath (const char *oldp, char *newp, int newpsz);
161 
162 int LogicalPath(const char *oldp, char *newp, int newpsz);
163 
164 int NeedsCTA(const char *Lfn);
165 
166 unsigned
167 long long PathOpts(const char *Lfn);
168 
169 int RemotePath (const char *oldp, char *newp, int newpsz);
170 
171 XrdOucTList *Space(const char *Name, const char *Path=0);
172 
173 int Stat(const char *xLfn, const char *xPfn, struct stat *buff);
174 
176 
177  XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
179 
180 private:
181 XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
182 int ConfigMum(XrdFrmConfigSE &theSE);
183 int ConfigN2N();
184 int ConfigMon(int isxfr);
185 int ConfigMP(const char *);
186 int ConfigMss();
187 int ConfigOTO(char *Parms);
188 int ConfigPaths();
189 void ConfigPF(const char *pFN);
190 int ConfigProc();
191 int ConfigXeq(char *var, int mbok);
192 int ConfigXfr();
193 int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
194 int Grab(const char *var, char **Dest, int nosubs);
195 XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
196 void InsertXD(const char *Path);
197 void Usage(int rc);
198 int xapath();
199 int xcks();
200 int xcnsd();
201 int xcopy();
202 int xcopy(int &TLim);
203 int xcmax();
204 int xdpol();
205 int xitm(const char *What, int &tDest);
206 int xnml();
207 int xmon();
208 int xpol();
209 int xpolprog();
210 int xqchk();
211 int xsit();
212 int xspace(int isPrg=0, int isXA=1);
213 void xspaceBuild(char *grp, char *fn, int isxa);
214 int xxfr();
215 
216 char *ConfigFN;
217 char *LocalRoot;
218 char *RemoteRoot;
219 XrdOucStream *cFile;
220 XrdVersionInfo *myVersion;
221 
222 bool doStatPF;
223 int plnDTS;
224 const char *pfxDTS;
225 const char *vOpts;
226 const char *uInfo;
227 char *N2N_Lib; // -> Name2Name Library Path
228 char *N2N_Parms; // -> Name2Name Object Parameters
229 XrdOucName2Name *lcl_N2N; // -> File mapper for local files
230 XrdOucName2Name *rmt_N2N; // -> File mapper for remote files
231 SubSys ssID;
232 };
233 namespace XrdFrm
234 {
235 extern XrdFrmConfig Config;
236 }
237 #endif
int stat(const char *path, struct stat *buf)
XrdOucString Path
Definition: XrdCks.hh:92
struct XrdFrmConfig::Cmd xfrCmd[4]
XrdOucTList * Space(const char *Name, const char *Path=0)
int LogicalPath(const char *oldp, char *newp, int newpsz)
int NeedsCTA(const char *Lfn)
XrdOfsConfigPI * OfsCfg
Definition: XrdFrmConfig.hh:88
XrdNetCmsNotify * cmsPath
Definition: XrdFrmConfig.hh:92
static const int cmdStats
Definition: XrdFrmConfig.hh:81
static const int cmdAlloc
Definition: XrdFrmConfig.hh:79
struct XrdFrmConfig::VPInfo * VPList
const char * myInst
Definition: XrdFrmConfig.hh:59
XrdOucProg * MSSProg
Definition: XrdFrmConfig.hh:70
XrdCks * CksMan
Definition: XrdFrmConfig.hh:89
char * StopPurge
Definition: XrdFrmConfig.hh:68
static const int cmdRME
Definition: XrdFrmConfig.hh:83
int RemotePath(const char *oldp, char *newp, int newpsz)
char * myInstance
Definition: XrdFrmConfig.hh:67
XrdOss * ossFS
Definition: XrdFrmConfig.hh:91
XrdOucMsubs * theVec
Definition: XrdFrmConfig.hh:75
const char * mySite
Definition: XrdFrmConfig.hh:60
VPInfo * pathList
static const int cmdXPD
Definition: XrdFrmConfig.hh:82
unsigned long long PathOpts(const char *Lfn)
XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo)
const char * myFrmID
Definition: XrdFrmConfig.hh:62
const char * Desc
Definition: XrdFrmConfig.hh:73
XrdOucTList * spacList
const char * myFrmid
Definition: XrdFrmConfig.hh:61
int Stat(const char *xLfn, const char *xPfn, struct stat *buff)
char ** vectArg
char pVec[pVecMax]
long long cmdFree
Definition: XrdFrmConfig.hh:95
static const int cmdMDP
Definition: XrdFrmConfig.hh:80
static const int pVecMax
XrdOucName2Name * the_N2N
Definition: XrdFrmConfig.hh:90
int LocalPath(const char *oldp, char *newp, int newpsz)
Policy dfltPolicy
char * PidPath
Definition: XrdFrmConfig.hh:66
const char * myProg
Definition: XrdFrmConfig.hh:57
char * AdminPath
Definition: XrdFrmConfig.hh:64
int Configure(int argc, char **argv, int(*ppf)())
const char * lockFN
Definition: XrdFrmConfig.hh:63
const char * myName
Definition: XrdFrmConfig.hh:58
static const int minSNbsz
Definition: XrdOssSpace.hh:45
XrdFrmConfig Config
Policy(const char *snv, long long minV, long long maxV, int hV, int xV)
char Sname[XrdOssSpace::minSNbsz]
VPInfo(char *n, int m=0, struct VPInfo *p=0)