69 const int AMode = S_IRWXU|S_IRGRP|S_IXGRP;
70 const char *endMsg =
"completed.";
81 OfsEroute.
Say(
"++++++ Checkpoint initialization started.");
90 if (!(aPath = getenv(
"XRDADMINPATH")))
92 "Unable to determine adminpath for chkpnt files.");
108 if (!strncmp(
Path,
"/tmp/", 5))
110 "directory in '/tmp' is ill-advised!");
127 {Recover(nsX->
Path, stats);
136 snprintf(mBuff,
sizeof(mBuff),
137 "%d of %d checkpoints restored, %d failed, and %d skipped.",
138 stats.numRecov, stats.numFiles, stats.numError, stats.numSkipd);
141 {snprintf(mBuff,
sizeof(mBuff),
"%d", stats.numUnres);
142 OfsEroute.
Say(
"Config warning: ", mBuff,
" unresolved checkpoint "
143 "restore failures found!");
144 endMsg =
"requires attention!";
151 {
OfsEroute.
Say(
"Config warning: checkpoints disabled because the "
152 "checkpoint directory is rooted in '/tmp'!");
158 OfsEroute.
Say(
"++++++ Checkpoint initialization ", endMsg);
187 static const int minSZ = 1024*1024;
192 if (!(val =
Config.GetWord()) || !val[0])
193 {
OfsEroute.
Emsg(
"Config",
"chkpnt parameters not specified");
201 else if (!strcmp(val,
"cprerr"))
202 {
if (!strcmp(val,
"makero"))
cprErrNA =
false;
203 else if (!strcmp(val,
"stopio"))
cprErrNA =
true;
204 else {
OfsEroute.
Emsg(
"Config",
"invalid chkpnt cperr option -",val);
208 else if (!strcmp(val,
"maxsz"))
209 {
if (!(val =
Config.GetWord()) || !val[0])
210 {
OfsEroute.
Emsg(
"Config",
"chkpnt maxsz value not specified");
216 else if (!strcmp(val,
"path"))
217 {
if (!(val =
Config.GetWord()) || !val[0])
218 {
OfsEroute.
Emsg(
"Config",
"chkpnt path value not specified");
227 if (val[n-1] ==
'/')
Path = strdup(val);
229 pstr = val; pstr.
append(
'/');
233 else {
OfsEroute.
Emsg(
"Config",
"invalid chkpnt parameter -", val);
237 }
while((val =
Config.GetWord()));
248 void XrdOfsConfigCP::Recover(
const char *ckpPath,
struct Stats &stats)
250 const char *sfx = rindex(ckpPath,
'.');
258 if ( sfx && !strcmp(sfx,
".ckperr"))
260 OfsEroute.
Say(
"Config warning: unresolved checkpoint error in '",
261 ckpPath,
"' for file '", fName,
"'!");
269 if (!sfx || strcmp(sfx,
".ckp"))
270 {
OfsEroute.
Say(
"Config warning: unrecognized checkpoint file '",
271 ckpPath,
"' skipped!");
280 if (chkPnt.Restore()) stats.numError++;
281 else stats.numRecov++;
static char * Target(const char *ckpfn)
static bool Parse(XrdOucStream &Config)
virtual XrdOssDF * newFile(const char *tident)=0
NSEnt * Index(int &rc, const char **dPath=0)
const char * c_str() const
static char * genPath(const char *path, const char *inst, const char *psfx=0)
static const char * InstName(int TranOpt=0)
static int makePath(char *path, mode_t mode, bool reset=false)
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
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)