Loading...
Searching...
No Matches
XrdFrmConfig.hh
Go to the documentation of this file.
#ifndef _XRD_FRMCONFIG_H
#define _XRD_FRMCONFIG_H
/******************************************************************************/
/* */
/* X r d F r m C o n f i g . h h */
/* */
/* (C) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Deprtment of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include <cstring>
#include <unistd.h>
#include "XrdOss/XrdOssSpace.hh"
class XrdCks;
class XrdNetCmsNotify;
class XrdOfsConfigPI;
class XrdOss;
class XrdOucMsubs;
class XrdOucName2Name;
class XrdOucProg;
class XrdOucStream;
class XrdOucTList;
class XrdSysLogger;
class XrdFrmConfigSE;
struct XrdVersionInfo;
struct stat;
class XrdFrmConfig
{
public:
const char *myProg;
const char *myName;
const char *myInst;
const char *mySite;
const char *myFrmid;
const char *myFrmID;
const char *lockFN;
char *AdminPath;
char *QPath;
char *PidPath;
char *myInstance;
char *StopPurge;
char *MSSCmd;
XrdOucProg *MSSProg;
struct Cmd
{const char *Desc;
char *theCmd;
XrdOucMsubs *theVec;
int TLimit;
int Opts;
} xfrCmd[4];
static const int cmdAlloc = 0x0001;
static const int cmdMDP = 0x0002;
static const int cmdStats = 0x0004;
static const int cmdXPD = 0x0008;
static const int cmdRME = 0x0010;
int xfrIN;
int xfrOUT;
XrdOfsConfigPI *OfsCfg; // -> Plugin Configurator
XrdCks *CksMan; // -> Checksum Manager
XrdOucName2Name *the_N2N; // -> File mapper object
XrdOss *ossFS;
XrdNetCmsNotify *cmsPath;
uid_t myUid;
gid_t myGid;
long long cmdFree;
int cmdHold;
int AdminMode;
int isAgent;
int xfrMax;
int xfrMaxIn;
int xfrMaxOt;
int FailHold;
int IdleHold;
int WaitQChk;
int WaitPurge;
int WaitMigr;
int haveCMS;
int isOTO;
int Fix;
int Test;
int TrackDC;
int Verbose;
int runOld; // Backward compatibility
int runNew; // Forward compatibility
int nonXA; // Backward compatibility for noXA spaces
int hasCache; // Backward compatibility for noXA spaces
char **vectArg;
int nextArg;
int numcArg;
struct VPInfo
{VPInfo *Next;
char *Name;
XrdOucTList *Dir;
int Val;
VPInfo(char *n, int m=0, struct VPInfo *p=0)
: Next(p), Name(strdup(n)), Dir(0), Val(m) {}
~VPInfo() {} // Deletes are not important
} *VPList;
VPInfo *pathList; // Migr/Purg list of paths
XrdOucTList *spacList; // Migr/Purg list of spaces
struct Policy
{long long minFree;
long long maxFree;
int Hold;
int Ext;
Policy *Next;
char Sname[XrdOssSpace::minSNbsz];
Policy(const char *snv, long long minV, long long maxV,
int hV, int xV) : minFree(minV), maxFree(maxV),
Hold(hV), Ext(xV), Next(0) {strcpy(Sname, snv);}
~Policy() {}
};
Policy dfltPolicy;
int dirHold;
int pVecNum; // Number of policy variables
static const int pVecMax=8;
char pVec[pVecMax];
char *pProg;
char *xfrFdir;
int xfrFdln;
enum PPVar {PP_atime=0, PP_ctime, PP_fname, PP_fsize, PP_fspace,
PP_mtime, PP_pfn, PP_sname, PP_tspace, PP_usage};
int Configure(int argc, char **argv, int (*ppf)());
int LocalPath (const char *oldp, char *newp, int newpsz);
int LogicalPath(const char *oldp, char *newp, int newpsz);
int NeedsCTA(const char *Lfn);
unsigned
long long PathOpts(const char *Lfn);
int RemotePath (const char *oldp, char *newp, int newpsz);
XrdOucTList *Space(const char *Name, const char *Path=0);
int Stat(const char *xLfn, const char *xPfn, struct stat *buff);
enum SubSys {ssAdmin, ssMigr, ssPstg, ssPurg, ssXfr};
XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo);
~XrdFrmConfig() {}
private:
XrdOucMsubs *ConfigCmd(const char *cname, char *cdata);
int ConfigMum(XrdFrmConfigSE &theSE);
int ConfigN2N();
int ConfigMon(int isxfr);
int ConfigMP(const char *);
int ConfigMss();
int ConfigOTO(char *Parms);
int ConfigPaths();
void ConfigPF(const char *pFN);
int ConfigProc();
int ConfigXeq(char *var, int mbok);
int ConfigXfr();
int getTime(const char *, const char *, int *, int mnv=-1, int mxv=-1);
int Grab(const char *var, char **Dest, int nosubs);
XrdOucTList *InsertPL(XrdOucTList *pP, const char *Path, int Plen, int isRW);
void InsertXD(const char *Path);
void Usage(int rc);
int xapath();
int xcks();
int xcnsd();
int xcopy();
int xcopy(int &TLim);
int xcmax();
int xdpol();
int xitm(const char *What, int &tDest);
int xnml();
int xmon();
int xpol();
int xpolprog();
int xqchk();
int xsit();
int xspace(int isPrg=0, int isXA=1);
void xspaceBuild(char *grp, char *fn, int isxa);
int xxfr();
char *ConfigFN;
char *LocalRoot;
char *RemoteRoot;
XrdOucStream *cFile;
XrdVersionInfo *myVersion;
bool doStatPF;
int plnDTS;
const char *pfxDTS;
const char *vOpts;
const char *uInfo;
char *N2N_Lib; // -> Name2Name Library Path
char *N2N_Parms; // -> Name2Name Object Parameters
XrdOucName2Name *lcl_N2N; // -> File mapper for local files
XrdOucName2Name *rmt_N2N; // -> File mapper for remote files
SubSys ssID;
};
namespace XrdFrm
{
extern XrdFrmConfig Config;
}
#endif
Usage
void Usage(const char *msg)
Definition XrdAccTest.cc:105
Stat
struct stat Stat
Definition XrdCks.cc:49
XrdOssSpace.hh
stat
#define stat(a, b)
Definition XrdPosix.hh:101
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
XrdCks
Definition XrdCks.hh:92
XrdFrmConfigSE
Definition XrdFrmConfig.cc:81
XrdFrmConfig::PPVar
PPVar
Definition XrdFrmConfig.hh:155
XrdFrmConfig::PP_tspace
@ PP_tspace
Definition XrdFrmConfig.hh:156
XrdFrmConfig::PP_sname
@ PP_sname
Definition XrdFrmConfig.hh:156
XrdFrmConfig::PP_usage
@ PP_usage
Definition XrdFrmConfig.hh:156
XrdFrmConfig::PP_fspace
@ PP_fspace
Definition XrdFrmConfig.hh:155
XrdFrmConfig::PP_fname
@ PP_fname
Definition XrdFrmConfig.hh:155
XrdFrmConfig::PP_atime
@ PP_atime
Definition XrdFrmConfig.hh:155
XrdFrmConfig::PP_mtime
@ PP_mtime
Definition XrdFrmConfig.hh:156
XrdFrmConfig::PP_fsize
@ PP_fsize
Definition XrdFrmConfig.hh:155
XrdFrmConfig::PP_ctime
@ PP_ctime
Definition XrdFrmConfig.hh:155
XrdFrmConfig::PP_pfn
@ PP_pfn
Definition XrdFrmConfig.hh:156
XrdFrmConfig::xfrCmd
struct XrdFrmConfig::Cmd xfrCmd[4]
XrdFrmConfig::Space
XrdOucTList * Space(const char *Name, const char *Path=0)
Definition XrdFrmConfig.cc:551
XrdFrmConfig::LogicalPath
int LogicalPath(const char *oldp, char *newp, int newpsz)
Definition XrdFrmConfig.cc:495
XrdFrmConfig::WaitQChk
int WaitQChk
Definition XrdFrmConfig.hh:104
XrdFrmConfig::NeedsCTA
int NeedsCTA(const char *Lfn)
Definition XrdFrmConfig.cc:512
XrdFrmConfig::hasCache
int hasCache
Definition XrdFrmConfig.hh:116
XrdFrmConfig::Verbose
int Verbose
Definition XrdFrmConfig.hh:112
XrdFrmConfig::QPath
char * QPath
Definition XrdFrmConfig.hh:65
XrdFrmConfig::xfrMaxOt
int xfrMaxOt
Definition XrdFrmConfig.hh:101
XrdFrmConfig::xfrFdln
int xfrFdln
Definition XrdFrmConfig.hh:153
XrdFrmConfig::OfsCfg
XrdOfsConfigPI * OfsCfg
Definition XrdFrmConfig.hh:88
XrdFrmConfig::pProg
char * pProg
Definition XrdFrmConfig.hh:151
XrdFrmConfig::cmsPath
XrdNetCmsNotify * cmsPath
Definition XrdFrmConfig.hh:92
XrdFrmConfig::xfrOUT
int xfrOUT
Definition XrdFrmConfig.hh:86
XrdFrmConfig::cmdStats
static const int cmdStats
Definition XrdFrmConfig.hh:81
XrdFrmConfig::cmdAlloc
static const int cmdAlloc
Definition XrdFrmConfig.hh:79
XrdFrmConfig::myGid
gid_t myGid
Definition XrdFrmConfig.hh:94
XrdFrmConfig::xfrMaxIn
int xfrMaxIn
Definition XrdFrmConfig.hh:100
XrdFrmConfig::cmdHold
int cmdHold
Definition XrdFrmConfig.hh:96
XrdFrmConfig::VPList
struct XrdFrmConfig::VPInfo * VPList
XrdFrmConfig::myInst
const char * myInst
Definition XrdFrmConfig.hh:59
XrdFrmConfig::MSSProg
XrdOucProg * MSSProg
Definition XrdFrmConfig.hh:70
XrdFrmConfig::CksMan
XrdCks * CksMan
Definition XrdFrmConfig.hh:89
XrdFrmConfig::StopPurge
char * StopPurge
Definition XrdFrmConfig.hh:68
XrdFrmConfig::numcArg
int numcArg
Definition XrdFrmConfig.hh:119
XrdFrmConfig::runNew
int runNew
Definition XrdFrmConfig.hh:114
XrdFrmConfig::haveCMS
int haveCMS
Definition XrdFrmConfig.hh:107
XrdFrmConfig::cmdRME
static const int cmdRME
Definition XrdFrmConfig.hh:83
XrdFrmConfig::RemotePath
int RemotePath(const char *oldp, char *newp, int newpsz)
Definition XrdFrmConfig.cc:534
XrdFrmConfig::myInstance
char * myInstance
Definition XrdFrmConfig.hh:67
XrdFrmConfig::FailHold
int FailHold
Definition XrdFrmConfig.hh:102
XrdFrmConfig::isOTO
int isOTO
Definition XrdFrmConfig.hh:108
XrdFrmConfig::~XrdFrmConfig
~XrdFrmConfig()
Definition XrdFrmConfig.hh:178
XrdFrmConfig::ossFS
XrdOss * ossFS
Definition XrdFrmConfig.hh:91
XrdFrmConfig::Cmd::theVec
XrdOucMsubs * theVec
Definition XrdFrmConfig.hh:75
XrdFrmConfig::WaitMigr
int WaitMigr
Definition XrdFrmConfig.hh:106
XrdFrmConfig::Cmd::theCmd
char * theCmd
Definition XrdFrmConfig.hh:74
XrdFrmConfig::mySite
const char * mySite
Definition XrdFrmConfig.hh:60
XrdFrmConfig::pathList
VPInfo * pathList
Definition XrdFrmConfig.hh:130
XrdFrmConfig::Cmd::Opts
int Opts
Definition XrdFrmConfig.hh:77
XrdFrmConfig::cmdXPD
static const int cmdXPD
Definition XrdFrmConfig.hh:82
XrdFrmConfig::PathOpts
unsigned long long PathOpts(const char *Lfn)
Definition XrdFrmConfig.cc:523
XrdFrmConfig::XrdFrmConfig
XrdFrmConfig(SubSys ss, const char *vopts, const char *uinfo)
Definition XrdFrmConfig.cc:136
XrdFrmConfig::xfrIN
int xfrIN
Definition XrdFrmConfig.hh:85
XrdFrmConfig::xfrMax
int xfrMax
Definition XrdFrmConfig.hh:99
XrdFrmConfig::myFrmID
const char * myFrmID
Definition XrdFrmConfig.hh:62
XrdFrmConfig::nextArg
int nextArg
Definition XrdFrmConfig.hh:118
XrdFrmConfig::Cmd::Desc
const char * Desc
Definition XrdFrmConfig.hh:73
XrdFrmConfig::IdleHold
int IdleHold
Definition XrdFrmConfig.hh:103
XrdFrmConfig::spacList
XrdOucTList * spacList
Definition XrdFrmConfig.hh:131
XrdFrmConfig::xfrFdir
char * xfrFdir
Definition XrdFrmConfig.hh:152
XrdFrmConfig::myFrmid
const char * myFrmid
Definition XrdFrmConfig.hh:61
XrdFrmConfig::runOld
int runOld
Definition XrdFrmConfig.hh:113
XrdFrmConfig::Test
int Test
Definition XrdFrmConfig.hh:110
XrdFrmConfig::vectArg
char ** vectArg
Definition XrdFrmConfig.hh:117
XrdFrmConfig::pVec
char pVec[pVecMax]
Definition XrdFrmConfig.hh:150
XrdFrmConfig::MSSCmd
char * MSSCmd
Definition XrdFrmConfig.hh:69
XrdFrmConfig::WaitPurge
int WaitPurge
Definition XrdFrmConfig.hh:105
XrdFrmConfig::Fix
int Fix
Definition XrdFrmConfig.hh:109
XrdFrmConfig::cmdFree
long long cmdFree
Definition XrdFrmConfig.hh:95
XrdFrmConfig::nonXA
int nonXA
Definition XrdFrmConfig.hh:115
XrdFrmConfig::cmdMDP
static const int cmdMDP
Definition XrdFrmConfig.hh:80
XrdFrmConfig::pVecMax
static const int pVecMax
Definition XrdFrmConfig.hh:149
XrdFrmConfig::SubSys
SubSys
Definition XrdFrmConfig.hh:175
XrdFrmConfig::ssMigr
@ ssMigr
Definition XrdFrmConfig.hh:175
XrdFrmConfig::ssPstg
@ ssPstg
Definition XrdFrmConfig.hh:175
XrdFrmConfig::ssPurg
@ ssPurg
Definition XrdFrmConfig.hh:175
XrdFrmConfig::ssAdmin
@ ssAdmin
Definition XrdFrmConfig.hh:175
XrdFrmConfig::ssXfr
@ ssXfr
Definition XrdFrmConfig.hh:175
XrdFrmConfig::TrackDC
int TrackDC
Definition XrdFrmConfig.hh:111
XrdFrmConfig::the_N2N
XrdOucName2Name * the_N2N
Definition XrdFrmConfig.hh:90
XrdFrmConfig::LocalPath
int LocalPath(const char *oldp, char *newp, int newpsz)
Definition XrdFrmConfig.cc:478
XrdFrmConfig::dfltPolicy
Policy dfltPolicy
Definition XrdFrmConfig.hh:145
XrdFrmConfig::isAgent
int isAgent
Definition XrdFrmConfig.hh:98
XrdFrmConfig::AdminMode
int AdminMode
Definition XrdFrmConfig.hh:97
XrdFrmConfig::myUid
uid_t myUid
Definition XrdFrmConfig.hh:93
XrdFrmConfig::PidPath
char * PidPath
Definition XrdFrmConfig.hh:66
XrdFrmConfig::myProg
const char * myProg
Definition XrdFrmConfig.hh:57
XrdFrmConfig::AdminPath
char * AdminPath
Definition XrdFrmConfig.hh:64
XrdFrmConfig::Configure
int Configure(int argc, char **argv, int(*ppf)())
Definition XrdFrmConfig.cc:232
XrdFrmConfig::dirHold
int dirHold
Definition XrdFrmConfig.hh:147
XrdFrmConfig::pVecNum
int pVecNum
Definition XrdFrmConfig.hh:148
XrdFrmConfig::lockFN
const char * lockFN
Definition XrdFrmConfig.hh:63
XrdFrmConfig::myName
const char * myName
Definition XrdFrmConfig.hh:58
XrdFrmConfig::Cmd::TLimit
int TLimit
Definition XrdFrmConfig.hh:76
XrdFrmConfig::Cmd
Definition XrdFrmConfig.hh:73
XrdNetCmsNotify
Definition XrdNetCmsNotify.hh:37
XrdOfsConfigPI
Definition XrdOfsConfigPI.hh:61
XrdOssSpace::minSNbsz
static const int minSNbsz
Definition XrdOssSpace.hh:45
XrdOss
Definition XrdOss.hh:499
XrdOucMsubs
Definition XrdOucMsubs.hh:91
XrdOucName2Name
Definition XrdOucName2Name.hh:49
XrdOucProg
Definition XrdOucProg.hh:38
XrdOucStream
Definition XrdOucStream.hh:47
XrdOucTList
Definition XrdOucTList.hh:42
XrdSysLogger
Definition XrdSysLogger.hh:53
XrdFrm
Definition XrdFrmAdmin.hh:229
XrdFrm::Config
XrdFrmConfig Config
XrdFrmConfig::Policy
Definition XrdFrmConfig.hh:134
XrdFrmConfig::Policy::~Policy
~Policy()
Definition XrdFrmConfig.hh:143
XrdFrmConfig::Policy::Policy
Policy(const char *snv, long long minV, long long maxV, int hV, int xV)
Definition XrdFrmConfig.hh:140
XrdFrmConfig::Policy::maxFree
long long maxFree
Definition XrdFrmConfig.hh:135
XrdFrmConfig::Policy::Hold
int Hold
Definition XrdFrmConfig.hh:136
XrdFrmConfig::Policy::Sname
char Sname[XrdOssSpace::minSNbsz]
Definition XrdFrmConfig.hh:139
XrdFrmConfig::Policy::minFree
long long minFree
Definition XrdFrmConfig.hh:134
XrdFrmConfig::Policy::Ext
int Ext
Definition XrdFrmConfig.hh:137
XrdFrmConfig::Policy::Next
Policy * Next
Definition XrdFrmConfig.hh:138
XrdFrmConfig::VPInfo
Definition XrdFrmConfig.hh:122
XrdFrmConfig::VPInfo::Val
int Val
Definition XrdFrmConfig.hh:125
XrdFrmConfig::VPInfo::Name
char * Name
Definition XrdFrmConfig.hh:123
XrdFrmConfig::VPInfo::Next
VPInfo * Next
Definition XrdFrmConfig.hh:122
XrdFrmConfig::VPInfo::VPInfo
VPInfo(char *n, int m=0, struct VPInfo *p=0)
Definition XrdFrmConfig.hh:126
XrdFrmConfig::VPInfo::Dir
XrdOucTList * Dir
Definition XrdFrmConfig.hh:124
XrdFrmConfig::VPInfo::~VPInfo
~VPInfo()
Definition XrdFrmConfig.hh:128