Loading...
Searching...
No Matches
XrdOfsConfigCP Class Reference

`#include <XrdOfsConfigCP.hh>`

Collaboration diagram for XrdOfsConfigCP:

## Static Public Member Functions

static bool | Init ()
static bool | Parse (XrdOucStream &Config)

## Static Public Attributes

static bool | cprErrNA = true
static bool | Enabled = true
static bool | EnForce = false
static bool | isProxy = false
static long long | MaxSZ = 1024*1024
static int | MaxVZ = 16
static char * | Path = 0

## Detailed Description

Definition at line 35 of file XrdOfsConfigCP.hh.

## Member Function Documentation

## Init()

bool XrdOfsConfigCP::Init | ( |  | ) |

static

Definition at line 67 of file XrdOfsConfigCP.cc.

{
const int AMode = S_IRWXU|S_IRGRP|S_IXGRP;
const char *endMsg = "completed.";
char *aPath;
int rc;
bool autoDis = false;
// If we are not enabled then do nothing
//
if (!Enabled || isProxy) return true;
// Print warm-up message
//
OfsEroute.Say("++++++ Checkpoint initialization started.");
// If there is no path then generate the default path
//
if (Path)
{aPath = XrdOucUtils::genPath(Path, XrdOucUtils::InstName(-1), "chkpnt/");
free(Path);
Path = aPath;
} else {
if (!(aPath = getenv("XRDADMINPATH")))
{OfsEroute.Emsg("Config",
"Unable to determine adminpath for chkpnt files.");
return false;
}
Path = XrdOucUtils::genPath(aPath, (char *)0, "chkpnt/");
}
// Make sure directory path exists
//
if ((rc = XrdOucUtils::makePath(Path, AMode)))
{OfsEroute.Emsg("Config", rc, "create path for", Path);
return false;
}
// We generally prohibit placing the checkpoint directory in /tmp unless
// "enable" has been specified.
//
if (!strncmp(Path, "/tmp/", 5))
{if (EnForce) OfsEroute.Say("Config warning: rooting the checkpoint "
"directory in '/tmp' is ill-advised!");
else autoDis = true;
}
// Prepare to list contents of the directory
//
XrdOucNSWalk nsWalk(&OfsEroute, Path, 0, XrdOucNSWalk::retFile);
XrdOucNSWalk::NSEnt *nsX, *nsP = nsWalk.Index(rc);
if (rc)
{OfsEroute.Emsg("Config", rc, "list CKP path", Path);
return false;
}
// Process all files
//
Stats stats;
while((nsX = nsP))
{Recover(nsX->Path, stats);
nsP = nsP->Next;
delete nsX;
}
// Print message if we found anything
//
if (stats.numFiles)
{char mBuff[256];
snprintf(mBuff, sizeof(mBuff),
"%d of %d checkpoints restored, %d failed, and %d skipped.",
stats.numRecov, stats.numFiles, stats.numError, stats.numSkipd);
OfsEroute.Say("Config ", mBuff);
if (stats.numUnres)
{snprintf(mBuff, sizeof(mBuff), "%d", stats.numUnres);
OfsEroute.Say("Config warning: ", mBuff, " unresolved checkpoint "
"restore failures found!");
endMsg = "requires attention!";
}
}
// Check if we need to disable checkpoint processing at this point
//
if (autoDis)
{OfsEroute.Say("Config warning: checkpoints disabled because the "
"checkpoint directory is rooted in '/tmp'!");
Enabled = false;
}
// Print final mesage
//
OfsEroute.Say("++++++ Checkpoint initialization ", endMsg);
return true;
}
OfsEroute
XrdSysError OfsEroute(0)
XrdOfsConfigCP::isProxy
static bool isProxy
Definition XrdOfsConfigCP.hh:44
XrdOfsConfigCP::EnForce
static bool EnForce
Definition XrdOfsConfigCP.hh:45
XrdOfsConfigCP::Enabled
static bool Enabled
Definition XrdOfsConfigCP.hh:43
XrdOfsConfigCP::Path
static char * Path
Definition XrdOfsConfigCP.hh:39
XrdOucNSWalk::retFile
static const int retFile
Definition XrdOucNSWalk.hh:107
XrdOucUtils::genPath
static char * genPath(const char *path, const char *inst, const char *psfx=0)
Definition XrdOucUtils.cc:463
XrdOucUtils::InstName
static const char * InstName(int TranOpt=0)
Definition XrdOucUtils.cc:809
XrdOucUtils::makePath
static int makePath(char *path, mode_t mode, bool reset=false)
Definition XrdOucUtils.cc:994
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95
XrdSysError::Say
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition XrdSysError.cc:141
XrdOucNSWalk::NSEnt::Next
struct NSEnt * Next
Definition XrdOucNSWalk.hh:48
XrdOucNSWalk::NSEnt::Path
char * Path
Definition XrdOucNSWalk.hh:49

References Enabled, EnForce, XrdOucUtils::genPath(), XrdOucNSWalk::Index(), XrdOucUtils::InstName(), isProxy, XrdOucUtils::makePath(), XrdOucNSWalk::NSEnt::Next, OfsEroute, Path, XrdOucNSWalk::NSEnt::Path, and XrdOucNSWalk::retFile.

Referenced by XrdOfs::Configure().

Here is the call graph for this function:
Here is the caller graph for this function:

## Parse()

bool XrdOfsConfigCP::Parse | ( | XrdOucStream & | Config | ) |

static

Definition at line 185 of file XrdOfsConfigCP.cc.

{
static const int minSZ = 1024*1024;
char *val;
// Get the size
//
if (!(val = Config.GetWord()) || !val[0])
{OfsEroute.Emsg("Config", "chkpnt parameters not specified");
return false;
}
// Process options
//
do{ if (!strcmp(val, "disable")) Enabled = EnForce = false;
else if (!strcmp(val, "enable")) Enabled = EnForce = true;
else if (!strcmp(val, "cprerr"))
{ if (!strcmp(val, "makero")) cprErrNA = false;
else if (!strcmp(val, "stopio")) cprErrNA = true;
else {OfsEroute.Emsg("Config","invalid chkpnt cperr option -",val);
return false;
}
}
else if (!strcmp(val, "maxsz"))
{if (!(val = Config.GetWord()) || !val[0])
{OfsEroute.Emsg("Config", "chkpnt maxsz value not specified");
return false;
}
if (XrdOuca2x::a2sz(OfsEroute,"chkpnt maxsz", val, &MaxSZ, minSZ))
return false;
}
else if (!strcmp(val, "path"))
{if (!(val = Config.GetWord()) || !val[0])
{OfsEroute.Emsg("Config", "chkpnt path value not specified");
return false;
}
if (*val != '/')
{OfsEroute.Emsg("Config", "chkpnt path is not absolute");
return false;
}
if (Path) free(Path);
int n = strlen(val);
if (val[n-1] == '/') Path = strdup(val);
else {XrdOucString pstr(n+1);
pstr = val; pstr.append('/');
Path = strdup(pstr.c_str());
}
}
else {OfsEroute.Emsg("Config", "invalid chkpnt parameter -", val);
return false;
}
} while((val = Config.GetWord()));
// All done
//
return true;
}
XrdOfsConfigCP::MaxSZ
static long long MaxSZ
Definition XrdOfsConfigCP.hh:40
XrdOfsConfigCP::cprErrNA
static bool cprErrNA
Definition XrdOfsConfigCP.hh:42
XrdOuca2x::a2sz
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
Definition XrdOuca2x.cc:257
XrdCms::Config
XrdCmsConfig Config
Definition XrdCmsConfig.cc:108

References XrdOuca2x::a2sz(), XrdOucString::append(), XrdOucString::c_str(), cprErrNA, Enabled, EnForce, MaxSZ, OfsEroute, and Path.

Referenced by XrdOfs::ConfigXeq().

Here is the call graph for this function:
Here is the caller graph for this function:

## Member Data Documentation

## cprErrNA

bool XrdOfsConfigCP::cprErrNA = true

static

Definition at line 42 of file XrdOfsConfigCP.hh.

Referenced by Parse().

## Enabled

bool XrdOfsConfigCP::Enabled = true

static

Definition at line 43 of file XrdOfsConfigCP.hh.

Referenced by XrdOfsFile::checkpoint(), Init(), and Parse().

## EnForce

bool XrdOfsConfigCP::EnForce = false

static

Definition at line 45 of file XrdOfsConfigCP.hh.

Referenced by Init(), and Parse().

## isProxy

bool XrdOfsConfigCP::isProxy = false

static

Definition at line 44 of file XrdOfsConfigCP.hh.

Referenced by Init().

## MaxSZ

long long XrdOfsConfigCP::MaxSZ = 1024*1024

static

Definition at line 40 of file XrdOfsConfigCP.hh.

Referenced by Parse(), XrdOfsChkPnt::Query(), XrdOfsChkPnt::Truncate(), and XrdOfsChkPnt::Write().

## MaxVZ

int XrdOfsConfigCP::MaxVZ = 16

static

Definition at line 41 of file XrdOfsConfigCP.hh.

## Path

char * XrdOfsConfigCP::Path = 0

static

Definition at line 39 of file XrdOfsConfigCP.hh.

Referenced by Init(), and Parse().

The documentation for this class was generated from the following files:

- XrdOfsConfigCP.hh
- XrdOfsConfigCP.cc