XRootD
XrdOssSys Class Reference

#include <XrdOssApi.hh>

+ Inheritance diagram for XrdOssSys:
+ Collaboration diagram for XrdOssSys:

Public Member Functions

 XrdOssSys ()
 
virtual ~XrdOssSys ()
 
int Chmod (const char *, mode_t mode, XrdOucEnv *eP=0)
 
void Config_Display (XrdSysError &)
 
int Configure (const char *, XrdSysError &, XrdOucEnv *envP)
 
virtual int Create (const char *, const char *, mode_t, XrdOucEnv &, int opts=0)
 
uint64_t Features ()
 
int GenLocalPath (const char *, char *)
 
int GenRemotePath (const char *, char *)
 
int Init (XrdSysLogger *, const char *, XrdOucEnv *envP)
 
int Init (XrdSysLogger *lP, const char *cP)
 
int IsRemote (const char *path)
 
int Lfn2Pfn (const char *Path, char *buff, int blen)
 
const char * Lfn2Pfn (const char *Path, char *buff, int blen, int &rc)
 
int Mkdir (const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0)
 
int Mkpath (const char *, mode_t mode)
 
int MSS_Closedir (void *)
 
int MSS_Create (const char *path, mode_t, XrdOucEnv &)
 
void * MSS_Opendir (const char *, int &rc)
 
int MSS_Readdir (void *fd, char *buff, int blen)
 
int MSS_Remdir (const char *, const char *)
 
int MSS_Rename (const char *, const char *)
 
int MSS_Stat (const char *, struct stat *buff=0)
 
int MSS_Unlink (const char *)
 
virtual XrdOssDFnewDir (const char *tident)
 
virtual XrdOssDFnewFile (const char *tident)
 
unsigned long long PathOpts (const char *path)
 
int Reloc (const char *tident, const char *path, const char *cgName, const char *anchor=0)
 
int Remdir (const char *, int Opts=0, XrdOucEnv *eP=0)
 
int Rename (const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0)
 
virtual int Stage (const char *, const char *, XrdOucEnv &, int, mode_t, unsigned long long)
 
void * Stage_In (void *carg)
 
int Stat (const char *, struct stat *, int opts=0, XrdOucEnv *Env=0)
 
int StatFS (const char *path, char *buff, int &blen, XrdOucEnv *Env=0)
 
int StatFS (const char *path, unsigned long long &Opt, long long &fSize, long long &fSpace)
 
int StatLS (XrdOucEnv &env, const char *path, char *buff, int &blen)
 
int StatPF (const char *, struct stat *, int)
 
int Stats (char *bp, int bl)
 
int StatVS (XrdOssVSInfo *sP, const char *sname=0, int updt=0)
 
int StatXA (const char *path, char *buff, int &blen, XrdOucEnv *Env=0)
 
int StatXP (const char *path, unsigned long long &attr, XrdOucEnv *Env=0)
 
int Truncate (const char *, unsigned long long Size, XrdOucEnv *eP=0)
 
int Unlink (const char *, int Opts=0, XrdOucEnv *eP=0)
 
- Public Member Functions inherited from XrdOss
 XrdOss ()
 Constructor and Destructor. More...
 
virtual ~XrdOss ()
 
virtual void Connect (XrdOucEnv &env)
 
virtual void Disc (XrdOucEnv &env)
 
virtual void EnvInfo (XrdOucEnv *envP)
 
virtual int FSctl (int cmd, int alen, const char *args, char **resp=0)
 
virtual bool getErrMsg (std::string &eText)
 
virtual int StatPF (const char *path, struct stat *buff)
 

Static Public Member Functions

static int AioInit ()
 

Public Attributes

union {
XrdOssStatInfo_t STT_Func
 
XrdOssStatInfo2_t STT_Fund
 
}; 
 
char * ConfigFN
 
unsigned long long DirFlags
 
OssDPathDPList
 
int FDFence
 
int FDLimit
 
int isMSSC
 
XrdOucName2Namelcl_N2N
 
int lenDP
 
char * LocalRoot
 
long long MaxSize
 
int MaxTwiddle
 
XrdVersionInfo * myVersion
 
char * N2N_Lib
 
char * N2N_Parms
 
short numCG
 
short numDP
 
int OptFlags
 
int prActive
 
int prBytes
 
short prDepth
 
long long prPBits
 
long long prPMask
 
int prPSize
 
short prQSize
 
char * RemoteRoot
 
XrdOucName2Namermt_N2N
 
XrdOucPListAnchor RPList
 
char * RSSCmd
 
int RSSTout
 
int Solitary
 
XrdOucPListAnchor SPList
 
char * StageAction
 
int StageActLen
 
int StageAln [MaxArgs]
 
int StageAnum
 
char * StageArg [MaxArgs]
 
int StageAsync
 
char * StageCmd
 
int StageCreate
 
char * StageEvents
 
int StageEvSize
 
int StageFormat
 
XrdFrcProxyStageFrm
 
char * StageMsg
 
int StageRealTime
 
XrdOucMsubsStageSnd
 
char STT_DoARE
 
char STT_DoN2N
 
char * STT_Lib
 
char * STT_Parms
 
int STT_PreOp
 
char STT_V2
 
XrdOucName2Namethe_N2N
 
int Trace
 

Static Public Attributes

static int AioAllOk = 0
 
static char chkMmap = 0
 
static const int MaxArgs = 15
 
static char tryMmap = 0
 
- Static Public Attributes inherited from XrdOss
static const int PF_csVer = 0x00000001
 verified file checksums present More...
 
static const int PF_csVun = 0x00000002
 unverified file checksums present More...
 
static const int PF_dInfo = 0x00000001
 
static const int PF_dNums = 0x00000002
 
static const int PF_dStat = 0x00000008
 
static const int PF_isLFN = 0x00000004
 

Protected Member Functions

int Alloc_Cache (XrdOssCreateInfo &, XrdOucEnv &, bool)
 
int Alloc_Local (XrdOssCreateInfo &, XrdOucEnv &)
 
int BreakLink (const char *local_path, struct stat &statbuff)
 
int CalcTime ()
 
int CalcTime (XrdOssStage_Req *req)
 
void ConfigCache (XrdSysError &Eroute, bool pass2=false)
 
void ConfigMio (XrdSysError &Eroute)
 
int ConfigN2N (XrdSysError &Eroute, XrdOucEnv *envP)
 
int ConfigProc (XrdSysError &Eroute)
 
void ConfigSpace (const char *Lfn)
 
void ConfigSpace (XrdSysError &Eroute)
 
void ConfigSpath (XrdSysError &Eroute, const char *Pn, unsigned long long &Fv, int noMSS)
 
int ConfigStage (XrdSysError &Eroute)
 
int ConfigStageC (XrdSysError &Eroute)
 
int ConfigStatLib (XrdSysError &Eroute, XrdOucEnv *envP)
 
void ConfigStats (dev_t Devnum, char *lP)
 
void ConfigStats (XrdSysError &Eroute)
 
int ConfigXeq (char *, XrdOucStream &, XrdSysError &)
 
void doScrub ()
 
int Find (XrdOssStage_Req *req, void *carg)
 
int getCname (const char *path, struct stat *sbuff, char *cgbuff)
 
int GetFile (XrdOssStage_Req *req)
 
int getID (const char *, XrdOucEnv &, char *, int)
 
int getStats (char *buff, int blen)
 
time_t HasFile (const char *fn, const char *sfx, time_t *mTime=0)
 
void List_Path (const char *, const char *, unsigned long long, XrdSysError &)
 
int MSS_Xeq (XrdOucStream **xfd, int okerr, const char *cmd, const char *arg1=0, const char *arg2=0)
 
int RenameLink (char *old_path, char *new_path)
 
int RenameLink3 (char *cPath, char *old_path, char *new_path)
 
int SetFattr (XrdOssCreateInfo &crInfo, int datfd, time_t mtime)
 
int Stage_QT (const char *, const char *, XrdOucEnv &, int, mode_t)
 
int Stage_RT (const char *, const char *, XrdOucEnv &, unsigned long long)
 
int tranmode (char *)
 
int xalloc (XrdOucStream &Config, XrdSysError &Eroute)
 
int xcache (XrdOucStream &Config, XrdSysError &Eroute)
 
int xcachescan (XrdOucStream &Config, XrdSysError &Eroute)
 
int xdefault (XrdOucStream &Config, XrdSysError &Eroute)
 
int xfdlimit (XrdOucStream &Config, XrdSysError &Eroute)
 
int xmaxsz (XrdOucStream &Config, XrdSysError &Eroute)
 
int xmemf (XrdOucStream &Config, XrdSysError &Eroute)
 
int xnml (XrdOucStream &Config, XrdSysError &Eroute)
 
int xpath (XrdOucStream &Config, XrdSysError &Eroute)
 
int xprerd (XrdOucStream &Config, XrdSysError &Eroute)
 
int xspace (XrdOucStream &Config, XrdSysError &Eroute, const char *grp, bool isAsgn)
 
int xspace (XrdOucStream &Config, XrdSysError &Eroute, int *isCD=0)
 
int xspaceBuild (OssSpaceConfig &sInfo, XrdSysError &Eroute)
 
int xstg (XrdOucStream &Config, XrdSysError &Eroute)
 
int xstl (XrdOucStream &Config, XrdSysError &Eroute)
 
int xtrace (XrdOucStream &Config, XrdSysError &Eroute)
 
int xusage (XrdOucStream &Config, XrdSysError &Eroute)
 
int xxfr (XrdOucStream &Config, XrdSysError &Eroute)
 

Protected Attributes

int badreqs
 
int cscanint
 
int fuzalloc
 
long long minalloc
 
int ovhalloc
 
bool pfcMode
 
long long pndbytes
 
char * QFile
 
XrdOucProgRSSProg
 
XrdOucProgStageProg
 
long long stgbytes
 
long long totbytes
 
int totreqs
 
char * UDir
 
short USync
 
char * xfrFdir
 
int xfrFdln
 
int xfrhold
 
int xfrkeep
 
int xfrovhd
 
int xfrspeed
 
int xfrtcount
 
int xfrthreads
 

Detailed Description

Definition at line 160 of file XrdOssApi.hh.

Constructor & Destructor Documentation

◆ XrdOssSys()

XrdOssSys::XrdOssSys ( )

Definition at line 185 of file XrdOssConfig.cc.

186 {
187  static XrdVERSIONINFODEF(myVer, XrdOss, XrdVNUMBER, XrdVERSION);
188  myVersion = &myVer;
189  xfrtcount = 0;
190  pndbytes = 0;
191  stgbytes = 0;
192  totbytes = 0;
193  totreqs = 0;
194  badreqs = 0;
195  MaxTwiddle = 3;
196  tryMmap = 0;
197  chkMmap = 0;
198  lcl_N2N = rmt_N2N = the_N2N = 0;
199  N2N_Lib = N2N_Parms = 0;
200  StageCmd = 0;
201  StageMsg = 0;
202  StageSnd = 0;
203  StageFrm = 0;
204  StageRealTime = 1;
205  StageAsync = 0;
206  StageCreate = 0;
207  StageEvents = (char *)"-";
208  StageEvSize = 1;
209  StageAction = (char *)"wq ";
210  StageActLen = 3;
211  RSSCmd = 0;
212  isMSSC = 0;
213  RSSTout =15*1000;
214  DirFlags = 0;
215  OptFlags = 0;
216  LocalRoot = 0;
217  RemoteRoot = 0;
218  cscanint = 600;
219  FDFence = -1;
220  FDLimit = -1;
221  MaxSize = 0;
222  minalloc = 0;
223  ovhalloc = 0;
224  fuzalloc = 0;
225  xfrspeed = 9*1024*1024;
226  xfrovhd = 30;
227  xfrhold = 3*60*60;
228  xfrkeep = 20*60;
229  xfrthreads = 1;
230  ConfigFN = 0;
231  QFile = 0;
232  UDir = 0;
233  USync = 0;
234  Solitary = 0;
235  DPList = 0;
236  lenDP = 0;
237  numCG = numDP = 0;
238  xfrFdir = 0;
239  xfrFdln = 0;
240  pfcMode = false;
241  RSSProg = 0;
242  StageProg = 0;
243  prPBits = (long long)sysconf(_SC_PAGESIZE);
244  prPSize = static_cast<int>(prPBits);
245  prPBits--;
246  prPMask = ~prPBits;
247  prBytes = 0;
248  prActive = 0;
249  prDepth = 0;
250  prQSize = 0;
251  STT_Lib = 0;
252  STT_Parms = 0;
253  STT_Func = 0;
254  STT_Fund = 0;
255  STT_PreOp = 0;
256  STT_DoN2N = 1;
257  STT_V2 = 0;
258  STT_DoARE = 0;
259 }
int badreqs
Definition: XrdOssApi.hh:311
int StageCreate
Definition: XrdOssApi.hh:230
char STT_DoN2N
Definition: XrdOssApi.hh:277
char STT_V2
Definition: XrdOssApi.hh:278
int FDLimit
Definition: XrdOssApi.hh:250
int totreqs
Definition: XrdOssApi.hh:310
char * LocalRoot
Definition: XrdOssApi.hh:225
OssDPath * DPList
Definition: XrdOssApi.hh:265
int STT_PreOp
Definition: XrdOssApi.hh:276
char * N2N_Parms
Definition: XrdOssApi.hh:260
short numCG
Definition: XrdOssApi.hh:268
long long totbytes
Definition: XrdOssApi.hh:309
long long minalloc
Definition: XrdOssApi.hh:297
char * StageEvents
Definition: XrdOssApi.hh:237
int StageRealTime
Definition: XrdOssApi.hh:228
short prDepth
Definition: XrdOssApi.hh:286
int FDFence
Definition: XrdOssApi.hh:249
static char chkMmap
Definition: XrdOssApi.hh:211
int xfrthreads
Definition: XrdOssApi.hh:305
int OptFlags
Definition: XrdOssApi.hh:254
int isMSSC
Definition: XrdOssApi.hh:246
char * QFile
Definition: XrdOssApi.hh:317
int prBytes
Definition: XrdOssApi.hh:284
char * ConfigFN
Definition: XrdOssApi.hh:224
int ovhalloc
Definition: XrdOssApi.hh:298
char * StageAction
Definition: XrdOssApi.hh:240
char STT_DoARE
Definition: XrdOssApi.hh:279
char * UDir
Definition: XrdOssApi.hh:316
int StageActLen
Definition: XrdOssApi.hh:239
short USync
Definition: XrdOssApi.hh:320
XrdOucProg * StageProg
Definition: XrdOssApi.hh:313
XrdOucName2Name * the_N2N
Definition: XrdOssApi.hh:263
short prQSize
Definition: XrdOssApi.hh:287
long long MaxSize
Definition: XrdOssApi.hh:248
int prPSize
Definition: XrdOssApi.hh:283
int RSSTout
Definition: XrdOssApi.hh:247
int prActive
Definition: XrdOssApi.hh:285
int xfrspeed
Definition: XrdOssApi.hh:301
XrdOucName2Name * lcl_N2N
Definition: XrdOssApi.hh:261
long long prPMask
Definition: XrdOssApi.hh:282
long long prPBits
Definition: XrdOssApi.hh:281
int fuzalloc
Definition: XrdOssApi.hh:299
int cscanint
Definition: XrdOssApi.hh:300
int StageAsync
Definition: XrdOssApi.hh:229
XrdOucProg * RSSProg
Definition: XrdOssApi.hh:314
char * STT_Parms
Definition: XrdOssApi.hh:271
long long pndbytes
Definition: XrdOssApi.hh:307
static char tryMmap
Definition: XrdOssApi.hh:210
XrdVersionInfo * myVersion
Definition: XrdOssApi.hh:289
char * N2N_Lib
Definition: XrdOssApi.hh:259
int xfrovhd
Definition: XrdOssApi.hh:302
long long stgbytes
Definition: XrdOssApi.hh:308
char * STT_Lib
Definition: XrdOssApi.hh:270
int xfrFdln
Definition: XrdOssApi.hh:319
XrdOucMsubs * StageSnd
Definition: XrdOssApi.hh:234
short numDP
Definition: XrdOssApi.hh:267
XrdFrcProxy * StageFrm
Definition: XrdOssApi.hh:235
unsigned long long DirFlags
Definition: XrdOssApi.hh:251
int StageEvSize
Definition: XrdOssApi.hh:238
int xfrhold
Definition: XrdOssApi.hh:303
bool pfcMode
Definition: XrdOssApi.hh:321
int xfrtcount
Definition: XrdOssApi.hh:306
char * StageCmd
Definition: XrdOssApi.hh:232
char * StageMsg
Definition: XrdOssApi.hh:233
char * RemoteRoot
Definition: XrdOssApi.hh:226
int xfrkeep
Definition: XrdOssApi.hh:304
int Solitary
Definition: XrdOssApi.hh:253
int MaxTwiddle
Definition: XrdOssApi.hh:227
char * RSSCmd
Definition: XrdOssApi.hh:245
XrdOucName2Name * rmt_N2N
Definition: XrdOssApi.hh:262
char * xfrFdir
Definition: XrdOssApi.hh:318
XrdVERSIONINFODEF(myVersion, cmsclient, XrdVNUMBER, XrdVERSION)

References badreqs, chkMmap, ConfigFN, cscanint, DirFlags, DPList, FDFence, FDLimit, fuzalloc, isMSSC, lcl_N2N, lenDP, LocalRoot, MaxSize, MaxTwiddle, minalloc, myVersion, N2N_Lib, N2N_Parms, numCG, numDP, OptFlags, ovhalloc, pfcMode, pndbytes, prActive, prBytes, prDepth, prPBits, prPMask, prPSize, prQSize, QFile, RemoteRoot, rmt_N2N, RSSCmd, RSSProg, RSSTout, Solitary, StageAction, StageActLen, StageAsync, StageCmd, StageCreate, StageEvents, StageEvSize, StageFrm, StageMsg, StageProg, StageRealTime, StageSnd, stgbytes, STT_DoARE, STT_DoN2N, STT_Lib, STT_Parms, STT_PreOp, STT_V2, the_N2N, totbytes, totreqs, tryMmap, UDir, USync, xfrFdir, xfrFdln, xfrhold, xfrkeep, xfrovhd, xfrspeed, xfrtcount, xfrthreads, and XrdCms::XrdVERSIONINFODEF().

+ Here is the call graph for this function:

◆ ~XrdOssSys()

virtual XrdOssSys::~XrdOssSys ( )
inlinevirtual

Definition at line 292 of file XrdOssApi.hh.

292 {}

Member Function Documentation

◆ AioInit()

int XrdOssSys::AioInit ( )
static

Definition at line 281 of file XrdOssAio.cc.

282 {
283 #if defined(_POSIX_ASYNCHRONOUS_IO)
284  EPNAME("AioInit");
285  extern void *XrdOssAioWait(void *carg);
286  pthread_t tid;
287  int retc;
288 
289 #ifndef HAVE_SIGWTI
290 // For those platforms that do not have sigwaitinfo(), we provide the
291 // appropriate emulation using a signal handler. We actually provide for
292 // two handlers since we separate reads from writes. To emulate synchronous
293 // signals, we prohibit one signal hander from interrupting another one.
294 //
295  struct sigaction sa;
296 
297  sa.sa_sigaction = XrdOssAioRSH;
298  sa.sa_flags = SA_SIGINFO;
299  sigemptyset(&sa.sa_mask);
300  sigaddset(&sa.sa_mask, OSS_AIO_WRITE_DONE);
301  if (sigaction(OSS_AIO_READ_DONE, &sa, NULL) < 0)
302  {OssEroute.Emsg("AioInit", errno, "creating AIO read signal handler; "
303  "AIO support terminated.");
304  return 0;
305  }
306 
307  sa.sa_sigaction = XrdOssAioWSH;
308  sa.sa_flags = SA_SIGINFO;
309  sigemptyset(&sa.sa_mask);
310  sigaddset(&sa.sa_mask, OSS_AIO_READ_DONE);
311  if (sigaction(OSS_AIO_WRITE_DONE, &sa, NULL) < 0)
312  {OssEroute.Emsg("AioInit", errno, "creating AIO write signal handler; "
313  "AIO support terminated.");
314  return 0;
315  }
316 #endif
317 
318 // The AIO signal handler consists of two thread (one for read and one for
319 // write) that synhronously wait for AIO events. We assume, blithely, that
320 // the first two real-time signals have been blocked for all threads.
321 //
322  if ((retc = XrdSysThread::Run(&tid, XrdOssAioWait,
323  (void *)(&OSS_AIO_READ_DONE))) < 0)
324  OssEroute.Emsg("AioInit", retc, "creating AIO read signal thread; "
325  "AIO support terminated.");
326 #ifdef __FreeBSD__
327  else {DEBUG("started AIO read signal thread.");
328 #else
329  else {DEBUG("started AIO read signal thread; tid=" <<(unsigned int)tid);
330 #endif
331  if ((retc = XrdSysThread::Run(&tid, XrdOssAioWait,
332  (void *)(&OSS_AIO_WRITE_DONE))) < 0)
333  OssEroute.Emsg("AioInit", retc, "creating AIO write signal thread; "
334  "AIO support terminated.");
335 #ifdef __FreeBSD__
336  else {DEBUG("started AIO write signal thread.");
337 #else
338  else {DEBUG("started AIO write signal thread; tid=" <<(unsigned int)tid);
339 #endif
340  AioAllOk = 1;
341  }
342  }
343 
344 // All done
345 //
346  return AioAllOk;
347 #else
348  return 1;
349 #endif
350 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
void * XrdOssAioWait(void *mySigarg)
Definition: XrdOssAio.cc:356
XrdSysError OssEroute
static int AioAllOk
Definition: XrdOssApi.hh:208
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:116
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)

References AioAllOk, DEBUG, XrdSysError::Emsg(), EPNAME, OssEroute, XrdSysThread::Run(), and XrdOssAioWait().

Referenced by Configure().

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

◆ Alloc_Cache()

int XrdOssSys::Alloc_Cache ( XrdOssCreateInfo crInfo,
XrdOucEnv env,
bool  forcecg 
)
protected

Definition at line 247 of file XrdOssCreate.cc.

248 {
249  EPNAME("Alloc_Cache")
250  int datfd, rc;
251  const char *spName;
252  char pbuff[MAXPATHLEN+1], cgbuff[XrdOssSpace::minSNbsz], *tmp;
253  XrdOssCache::allocInfo aInfo(crInfo.Path, pbuff, sizeof(pbuff));
254 
255 // Grab the suggested size from the environment
256 //
257  if ((tmp = env.Get(OSS_ASIZE))
258  && XrdOuca2x::a2sz(OssEroute,"invalid asize",tmp,&aInfo.cgSize,0))
259  return -XRDOSS_E8018;
260 
261 // Determine the space we should use for this allocation
262 //
263  spName = env.Get(OSS_CGROUP);
264  if (!spName || (!forcecg && SPList.NotEmpty() && SPList.Default() == spAssign))
265  {XrdOucPList *pl = SPList.About(crInfo.LFN);
266  if (pl && (!spName || pl->Attr() == spAssign)) spName = pl->Name();
267  }
268 
269 // Get the correct cache group and partition path
270 //
271  if ((aInfo.cgPath=XrdOssCache::Parse(spName,cgbuff,sizeof(cgbuff))))
272  aInfo.cgPlen = strlen(aInfo.cgPath);
273 
274 // Allocate space in the cache.
275 //
276  aInfo.cgName = cgbuff;
277  aInfo.aMode = crInfo.Amode;
278  if ((datfd = XrdOssCache::Alloc(aInfo)) < 0) return datfd;
279 
280 // Set the pfn as the extended attribute if we are in new mode
281 //
282  if (!(crInfo.pOpts & XRDEXP_NOXATTR)
283  && (rc = XrdSysFAttr::Xat->Set(XrdFrcXAttrPfn::Name(), crInfo.Path,
284  strlen(crInfo.Path)+1, pbuff, datfd)))
285  {close(datfd); return rc;}
286 
287 // Set extended attributes for this newly created file if allowed to do so.
288 // SetFattr() alaways closes the provided file descriptor!
289 //
290  if ((rc = SetFattr(crInfo, datfd, 1))) return rc;
291 
292 // Now create a symbolic link to the target
293 //
294  if ((symlink(pbuff, crInfo.Path) && errno != EEXIST)
295  || unlink(crInfo.Path) || symlink(pbuff, crInfo.Path))
296  {rc = -errno; unlink(pbuff);}
297 
298 // All done
299 //
300  DEBUG(aInfo.cgName <<" cache for " <<pbuff);
301  return rc;
302 }
#define spAssign
Definition: XrdOssApi.hh:257
XrdSysError OssEroute
#define XRDOSS_E8018
Definition: XrdOssError.hh:52
#define OSS_ASIZE
Definition: XrdOssOpaque.hh:37
#define OSS_CGROUP
Definition: XrdOssOpaque.hh:38
#define XRDEXP_NOXATTR
Definition: XrdOucExport.hh:64
#define close(a)
Definition: XrdPosix.hh:48
#define unlink(a)
Definition: XrdPosix.hh:121
@ Default
XrdOucString Path
if(Avsz)
static const char * Name()
Definition: XrdFrcXAttr.hh:184
static int Alloc(allocInfo &aInfo)
Definition: XrdOssCache.cc:492
static char * Parse(const char *token, char *cbuff, int cblen)
Definition: XrdOssCache.cc:814
const char * Path
Definition: XrdOssCreate.cc:85
const char * LFN
Definition: XrdOssCreate.cc:86
unsigned long long pOpts
Definition: XrdOssCreate.cc:84
XrdOucPListAnchor SPList
Definition: XrdOssApi.hh:256
int SetFattr(XrdOssCreateInfo &crInfo, int datfd, time_t mtime)
XrdOucPList * About(const char *pathname)
Definition: XrdOucPList.hh:92
const char * Name()
Definition: XrdOucPList.hh:43
static XrdSysXAttr * Xat
Definition: XrdSysFAttr.hh:51
virtual int Set(const char *Aname, const void *Aval, int Avsz, const char *Path, int fd=-1, int isNew=0)=0

References XrdOuca2x::a2sz(), XrdOucPListAnchor::About(), XrdOssCache::Alloc(), XrdOssCache::allocInfo::aMode, XrdOssCreateInfo::Amode, XrdOucPList::Attr(), XrdOssCache::allocInfo::cgName, XrdOssCache::allocInfo::cgPath, XrdOssCache::allocInfo::cgPlen, XrdOssCache::allocInfo::cgSize, close, DEBUG, XrdOucPListAnchor::Default(), EPNAME, XrdOucEnv::Get(), XrdOssCreateInfo::LFN, XrdOssSpace::minSNbsz, XrdFrcXAttrPfn::Name(), XrdOucPList::Name(), XrdOucPListAnchor::NotEmpty(), OSS_ASIZE, OSS_CGROUP, OssEroute, XrdOssCache::Parse(), XrdOssCreateInfo::Path, XrdOssCreateInfo::pOpts, XrdSysXAttr::Set(), SetFattr(), spAssign, SPList, unlink, XrdSysFAttr::Xat, XRDEXP_NOXATTR, and XRDOSS_E8018.

Referenced by Create().

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

◆ Alloc_Local()

int XrdOssSys::Alloc_Local ( XrdOssCreateInfo crInfo,
XrdOucEnv env 
)
protected

Definition at line 308 of file XrdOssCreate.cc.

309 {
310  int datfd, rc;
311 
312 // Simply open the file in the local filesystem, creating it if need be.
313 //
314  do {datfd = open(crInfo.Path, O_RDWR|O_CREAT|O_TRUNC, crInfo.Amode);}
315  while(datfd < 0 && errno == EINTR);
316  if (datfd < 0) return -errno;
317 
318 // Set extended attributes for this newly created file if allowed to do so.
319 // SetFattr() alaways closes the provided file descriptor!
320 //
321  if ((rc = SetFattr(crInfo, datfd, 1))) return rc;
322 
323 // All done
324 //
325  return XrdOssOK;
326 }
#define XrdOssOK
Definition: XrdOss.hh:54
#define open
Definition: XrdPosix.hh:78

References XrdOssCreateInfo::Amode, open, XrdOssCreateInfo::Path, SetFattr(), and XrdOssOK.

Referenced by Create().

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

◆ BreakLink()

int XrdOssSys::BreakLink ( const char *  local_path,
struct stat statbuff 
)
protected

Definition at line 172 of file XrdOssUnlink.cc.

173 {
174  EPNAME("BreakLink")
175  char *lP, lnkbuff[MAXPATHLEN+64];
176  int lnklen, retc = 0;
177 
178 // Read the contents of the link
179 //
180  if ((lnklen = readlink(local_path, lnkbuff, sizeof(lnkbuff)-1)) < 0)
181  return -errno;
182 
183 // Return the actual stat information on the target (which might not exist
184 //
185  lnkbuff[lnklen] = '\0';
186  if (stat(lnkbuff, &statbuff)) statbuff.st_size = 0;
187  else if (unlink(lnkbuff) && errno != ENOENT)
188  {retc = -errno;
189  OssEroute.Emsg("BreakLink",retc,"unlink symlink target",lnkbuff);
190  } else {DEBUG("broke link " <<local_path <<"->" <<lnkbuff);}
191 
192 // If this is a new-style cache, then we must also remove the pfn file.
193 // In any case, return the appropriate cache group.
194 //
195  lP = lnkbuff+lnklen-1;
196  if (*lP == XrdOssPath::xChar)
197  {if (statbuff.st_size)
199  XrdOssCache::Adjust(lnkbuff, -statbuff.st_size);
200  }
201  } else if (statbuff.st_size)
202  XrdOssCache::Adjust(statbuff.st_dev, -statbuff.st_size);
203 
204 // All done
205 //
206  return retc;
207 }
#define stat(a, b)
Definition: XrdPosix.hh:105
static void Adjust(dev_t devid, off_t size)
Definition: XrdOssCache.cc:397
static void Trim2Base(char *eP)
Definition: XrdOssPath.cc:304
static const char xChar
Definition: XrdOssPath.hh:47

References XrdOssCache::Adjust(), DEBUG, XrdSysError::Emsg(), EPNAME, OssEroute, stat, XrdOssPath::Trim2Base(), unlink, and XrdOssPath::xChar.

Referenced by Unlink().

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

◆ CalcTime() [1/2]

int XrdOssSys::CalcTime ( )
protected

Definition at line 384 of file XrdOssStage.cc.

385 {
386 
387 // For queued staging we have no good way to estimate the time, as of yet.
388 // So, return 60 seconds. Note that the following code, which is far more
389 // elaborate, rarely returns the right estimate anyway.
390 //
391  return (StageAsync ? -EINPROGRESS : 60);
392 }

References StageAsync.

Referenced by Stage_QT(), and Stage_RT().

+ Here is the caller graph for this function:

◆ CalcTime() [2/2]

int XrdOssSys::CalcTime ( XrdOssStage_Req req)
protected

Definition at line 394 of file XrdOssStage.cc.

395 {
396  unsigned long long numq = 1;
397  unsigned long long tbytes = req->size + stgbytes/2;
398  int xfrtime;
399  time_t now;
400  XrdOssStage_Req *rqp = req;
401 
402 // Return an EINP{ROG if we are doing async staging
403 //
404  if (StageAsync) return -EINPROGRESS;
405 
406 // If the request is active, recalculate the time based on previous estimate
407 //
408  if (req->flags & XRDOSS_REQ_ACTV)
409  {if ((xfrtime = req->sigtod - time(0)) > xfrovhd) return xfrtime;
410  else return (xfrovhd < 4 ? 2 : xfrovhd / 2);
411  }
412 
413 // Calculate the number of pending bytes being transferred plus 1/2 of the
414 // current number of bytes being transferred
415 //
416  while ((rqp=(rqp->pendList.Next()->Item()))) {tbytes += rqp->size; numq++;}
417 
418 // Calculate when this request should be completed
419 //
420  now = time(0);
421  req->sigtod = tbytes / xfrspeed + numq * xfrovhd + now;
422 
423 // Calculate the time it will take to get this file
424 //
425  if ((xfrtime = req->sigtod - now) <= xfrovhd) return xfrovhd+3;
426  return xfrtime;
427 }
#define XRDOSS_REQ_ACTV
Definition: XrdOssStage.hh:47
XrdOucDLlist< XrdOssStage_Req > pendList
Definition: XrdOssStage.hh:54
unsigned long long size
Definition: XrdOssStage.hh:58
XrdOucDLlist * Next()
Definition: XrdOucDLlist.hh:94

References XrdOssStage_Req::flags, XrdOucDLlist< T >::Item(), XrdOucDLlist< T >::Next(), XrdOssStage_Req::pendList, XrdOssStage_Req::sigtod, XrdOssStage_Req::size, StageAsync, stgbytes, xfrovhd, xfrspeed, and XRDOSS_REQ_ACTV.

+ Here is the call graph for this function:

◆ Chmod()

int XrdOssSys::Chmod ( const char *  path,
mode_t  mode,
XrdOucEnv envP = 0 
)
virtual

Change file mode settings.

Parameters
path- Pointer to the path of the file in question.
mode- The new file mode setting.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 332 of file XrdOssApi.cc.

333 {
334  char actual_path[MAXPATHLEN+1], *local_path;
335  int retc;
336 
337 // Generate local path
338 //
339  if (lcl_N2N)
340  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
341  return retc;
342  else local_path = actual_path;
343  else local_path = (char *)path;
344 
345 // Change the file only in the local filesystem.
346 //
347  return (chmod(local_path, mode) ? -errno : XrdOssOK);
348 }
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0

References lcl_N2N, XrdOucName2Name::lfn2pfn(), and XrdOssOK.

+ Here is the call graph for this function:

◆ Config_Display()

void XrdOssSys::Config_Display ( XrdSysError Eroute)

Definition at line 457 of file XrdOssConfig.cc.

458 {
459  char buff[4096], *cloc;
460  XrdOucPList *fp;
461 
462  // Preset some tests
463  //
464  int HaveRSSCmd = (RSSCmd && RSSCmd[0]);
465  int HaveStageCmd = (StageCmd && StageCmd[0]);
466  int HaveRemoteRoot = (RemoteRoot && RemoteRoot[0]);
467  int HaveLocalRoot = (LocalRoot && LocalRoot[0]);
468  int HaveStageMsg = (StageMsg && StageMsg[0]);
469  int HaveN2N_Lib = (N2N_Lib != 0);
470 
471  if (!ConfigFN || !ConfigFN[0]) cloc = (char *)"Default";
472  else cloc = ConfigFN;
473 
474  snprintf(buff, sizeof(buff), "Config effective %s oss configuration:\n"
475  " oss.alloc %lld %d %d\n"
476  " oss.spacescan %d\n"
477  " oss.fdlimit %d %d\n"
478  " oss.maxsize %lld\n"
479  "%s%s%s"
480  "%s%s%s"
481  "%s%s%s"
482  "%s%s%s%s%s"
483  "%s%s%s"
484  "%s%s%s"
485  " oss.trace %x\n"
486  " oss.xfr %d deny %d keep %d",
487  cloc,
489  cscanint,
491  XrdOssConfig_Val(N2N_Lib, namelib),
492  XrdOssConfig_Val(LocalRoot, localroot),
493  XrdOssConfig_Val(RemoteRoot, remoteroot),
494  XrdOssConfig_Vop(StageCmd, stagecmd, StageAsync, "async ","sync ",
495  StageCreate, "creates ", ""),
496  XrdOssConfig_Val(StageMsg, stagemsg),
497  XrdOssConfig_Val(RSSCmd, rsscmd),
498  OssTrace.What,
500 
501  Eroute.Say(buff);
502 
503  XrdOssMio::Display(Eroute);
504 
505  XrdOssCache::List(" oss.", Eroute);
506  List_Path(" oss.defaults ", "", DirFlags, Eroute);
507  fp = RPList.First();
508  while(fp)
509  {List_Path(" oss.path ", fp->Path(), fp->Flag(), Eroute);
510  fp = fp->Next();
511  }
512  fp = SPList.First();
513  while(fp)
514  {Eroute.Say(" oss.space ", fp->Name(),
515  (fp->Attr() == spAssign ? " assign " : " default "),
516  fp->Path());
517  fp = fp->Next();
518  }
519 }
#define XrdOssConfig_Vop(base, opt, optchk0, opt1, opt2, optchk1, opt3, opt4)
XrdSysTrace OssTrace
#define XrdOssConfig_Val(base, opt)
static void List(const char *lname, XrdSysError &Eroute)
Definition: XrdOssCache.cc:682
static void Display(XrdSysError &Eroute)
Definition: XrdOssMio.cc:80
void List_Path(const char *, const char *, unsigned long long, XrdSysError &)
XrdOucPListAnchor RPList
Definition: XrdOssApi.hh:264
XrdOucPList * First()
Definition: XrdOucPList.hh:132
XrdOucPList * Next()
Definition: XrdOucPList.hh:44
char * Path()
Definition: XrdOucPList.hh:45
unsigned long long Flag()
Definition: XrdOucPList.hh:42
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:162

References XrdOucPList::Attr(), ConfigFN, cscanint, DirFlags, XrdOssMio::Display(), FDFence, FDLimit, XrdOucPListAnchor::First(), XrdOucPList::Flag(), fuzalloc, XrdOssCache::List(), List_Path(), LocalRoot, MaxSize, minalloc, N2N_Lib, XrdOucPList::Name(), XrdOucPList::Next(), OssTrace, ovhalloc, XrdOucPList::Path(), RemoteRoot, RPList, RSSCmd, XrdSysError::Say(), spAssign, SPList, StageAsync, StageCmd, StageCreate, StageMsg, XrdSysTrace::What, xfrhold, xfrkeep, xfrthreads, XrdOssConfig_Val, and XrdOssConfig_Vop.

Referenced by Configure().

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

◆ ConfigCache()

void XrdOssSys::ConfigCache ( XrdSysError Eroute,
bool  pass2 = false 
)
protected

Definition at line 528 of file XrdOssConfig.cc.

529 {
530  const unsigned long long conFlags =
535 
536  XrdOucPList *fp = RPList.First();
537  unsigned long long oflag, pflag;
538 
539 // If this is pass 2 then if we are in pfcMode, then reset r/o flag to r/w
540 // to allow the pfc to actually write into the cache paths.
541 //
542  if (pass2)
543  {if (pfcMode)
544  {while(fp)
545  {pflag = fp->Flag();
546  if (pflag & XRDEXP_PFCACHE) fp->Set(pflag & ~XRDEXP_NOTRW);
547  fp = fp->Next();
548  }
549  }
550  return;
551  }
552 
553 // Run through all the paths and resolve any conflicts with a cache
554 //
555  while(fp)
556  {oflag = pflag = fp->Flag();
557  if ((pflag & XRDEXP_PFCACHE)
558  || (pfcMode && !(pflag & XRDEXP_PFCACHE_X)))
559  {if (!(pflag & XRDEXP_NOTRW)) pflag |= XRDEXP_READONLY;
560  pflag &= ~conFlags;
561  pflag |= XRDEXP_PFCACHE | XRDEXP_NOFICL;
562  if (oflag != pflag) fp->Set(pflag);
563  }
564  fp = fp->Next();
565  }
566 
567 // Handle default settings
568 //
569  if (DirFlags & XRDEXP_PFCACHE)
571  DirFlags &= ~conFlags;
572  }
573 }
#define XRDEXP_NOTRW
Definition: XrdOucExport.hh:45
#define XRDEXP_NODREAD
Definition: XrdOucExport.hh:46
#define XRDEXP_PURGE
Definition: XrdOucExport.hh:62
#define XRDEXP_MMAP
Definition: XrdOucExport.hh:56
#define XRDEXP_MKEEP
Definition: XrdOucExport.hh:60
#define XRDEXP_PFCACHE
Definition: XrdOucExport.hh:70
#define XRDEXP_MLOK
Definition: XrdOucExport.hh:58
#define XRDEXP_STAGEMM
Definition: XrdOucExport.hh:76
#define XRDEXP_NOFICL
Definition: XrdOucExport.hh:89
#define XRDEXP_MWMODE
Definition: XrdOucExport.hh:68
#define XRDEXP_NOCHECK
Definition: XrdOucExport.hh:50
#define XRDEXP_RCREATE
Definition: XrdOucExport.hh:48
#define XRDEXP_READONLY
Definition: XrdOucExport.hh:42
#define XRDEXP_STAGE
Definition: XrdOucExport.hh:52
#define XRDEXP_MIG
Definition: XrdOucExport.hh:54
#define XRDEXP_PFCACHE_X
Definition: XrdOucExport.hh:71
void Set(int aval)
Definition: XrdOucPList.hh:51

References DirFlags, XrdOucPListAnchor::First(), XrdOucPList::Flag(), XrdOucPList::Next(), pfcMode, RPList, XrdOucPList::Set(), XRDEXP_MIG, XRDEXP_MKEEP, XRDEXP_MLOK, XRDEXP_MMAP, XRDEXP_MWMODE, XRDEXP_NOCHECK, XRDEXP_NODREAD, XRDEXP_NOFICL, XRDEXP_NOTRW, XRDEXP_PFCACHE, XRDEXP_PFCACHE_X, XRDEXP_PURGE, XRDEXP_RCREATE, XRDEXP_READONLY, XRDEXP_STAGE, and XRDEXP_STAGEMM.

Referenced by Configure().

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

◆ ConfigMio()

void XrdOssSys::ConfigMio ( XrdSysError Eroute)
protected

Definition at line 579 of file XrdOssConfig.cc.

580 {
581  XrdOucPList *fp;
582  unsigned long long flags = 0;
583  int setoff = 0;
584 
585 // Initialize memory mapping setting to speed execution
586 //
587  if (!(tryMmap = XrdOssMio::isOn())) return;
589 
590 // Run through all the paths and get the composite flags
591 //
592  fp = RPList.First();
593  while(fp)
594  {flags |= fp->Flag();
595  fp = fp->Next();
596  }
597 
598 // Handle default settings
599 //
602  flags |= DirFlags;
604 
605 // Produce warnings if unsupported features have been selected
606 //
607 #if !defined(_POSIX_MAPPED_FILES)
608  if (flags & XRDEXP_MEMAP)
609  {Eroute.Say("Config warning: memory mapped files not supported; "
610  "feature disabled.");
611  setoff = 1;
612  fp = RPList.First();
613  while(fp)
614  {fp->Set(fp->Flag() & ~XRDEXP_MEMAP);
615  fp = fp->Next();
616  }
618  }
619 #elif !defined(_POSIX_MEMLOCK)
620  if (flags & XRDEXP_MLOK)
621  {Eroute.Say("Config warning: memory locked files not supported; "
622  "feature disabled.");
623  fp = RPList.First();
624  while(fp)
625  {fp->Set(fp->Flag() & ~XRDEXP_MLOK);
626  fp = fp->Next();
627  }
629  }
630 #endif
631 
632 // If no memory flags are set, turn off memory mapped files
633 //
634  if (!(flags & XRDEXP_MEMAP) || setoff)
635  {XrdOssMio::Set(0, 0, 0);
636  tryMmap = 0; chkMmap = 0;
637  }
638 }
#define XRDEXP_FORCERO
Definition: XrdOucExport.hh:43
#define XRDEXP_MEMAP
Definition: XrdOucExport.hh:84
static char isOn()
Definition: XrdOssMio.hh:51
static char isAuto()
Definition: XrdOssMio.hh:49
static void Set(int V_off, int V_preld, int V_check)
Definition: XrdOssMio.cc:320

References chkMmap, DirFlags, XrdOucPListAnchor::First(), XrdOucPList::Flag(), XrdOssMio::isAuto(), XrdOssMio::isOn(), XrdOucPList::Next(), RPList, XrdSysError::Say(), XrdOucPList::Set(), XrdOssMio::Set(), tryMmap, XRDEXP_FORCERO, XRDEXP_MEMAP, XRDEXP_MKEEP, XRDEXP_MLOK, XRDEXP_MMAP, and XRDEXP_NOTRW.

Referenced by Configure().

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

◆ ConfigN2N()

int XrdOssSys::ConfigN2N ( XrdSysError Eroute,
XrdOucEnv envP 
)
protected

Definition at line 644 of file XrdOssConfig.cc.

645 {
647 
648 // Get the plugin
649 //
650  if (!(the_N2N = n2nLoader.Load(N2N_Lib, *myVersion, envP))) return 1;
651 
652 // Optimize the local case
653 //
654  if (N2N_Lib) rmt_N2N = lcl_N2N = the_N2N;
655  else {if (LocalRoot) lcl_N2N = the_N2N;
656  if (RemoteRoot) rmt_N2N = the_N2N;
657  }
658 
659 // All done
660 //
661  return 0;
662 }
XrdOucEnv * envP
Definition: XrdPss.cc:110

References ConfigFN, XrdProxy::envP, lcl_N2N, XrdOucN2NLoader::Load(), LocalRoot, myVersion, N2N_Lib, N2N_Parms, RemoteRoot, rmt_N2N, and the_N2N.

Referenced by Configure().

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

◆ ConfigProc()

int XrdOssSys::ConfigProc ( XrdSysError Eroute)
protected

Definition at line 668 of file XrdOssConfig.cc.

669 {
670  char *var;
671  int cfgFD, retc, NoGo = XrdOssOK;
672  XrdOucEnv myEnv;
673  XrdOucStream Config(&Eroute, getenv("XRDINSTANCE"), &myEnv, "=====> ");
674 
675 // If there is no config file, return with the defaults sets.
676 //
677  if( !ConfigFN || !*ConfigFN)
678  {Eroute.Say("Config warning: config file not specified; defaults assumed.");
679  return XrdOssOK;
680  }
681 
682 // Try to open the configuration file.
683 //
684  if ( (cfgFD = open(ConfigFN, O_RDONLY, 0)) < 0)
685  {Eroute.Emsg("Config", errno, "open config file", ConfigFN);
686  return 1;
687  }
688  Config.Attach(cfgFD);
689  static const char *cvec[] = { "*** oss plugin config:", 0 };
690  Config.Capture(cvec);
691 
692 // Now start reading records until eof.
693 //
694  while((var = Config.GetMyFirstWord()))
695  {if (!strncmp(var, "oss.", 4))
696  {if (ConfigXeq(var+4, Config, Eroute)) {Config.Echo(); NoGo = 1;}}
697  else if (!strcmp(var,"all.export")
698  && xpath(Config, Eroute)) {Config.Echo(); NoGo = 1;}
699  }
700 
701 // Now check if any errors occurred during file i/o
702 //
703  if ((retc = Config.LastError()))
704  NoGo = Eroute.Emsg("Config", retc, "read config file", ConfigFN);
705  Config.Close();
706 
707 // Return final return code
708 //
709  return NoGo;
710 }
int ConfigXeq(char *, XrdOucStream &, XrdSysError &)
int xpath(XrdOucStream &Config, XrdSysError &Eroute)
XrdCmsConfig Config

References XrdCms::Config, ConfigFN, ConfigXeq(), XrdSysError::Emsg(), open, XrdSysError::Say(), xpath(), and XrdOssOK.

Referenced by Configure().

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

◆ ConfigSpace() [1/2]

void XrdOssSys::ConfigSpace ( const char *  Lfn)
protected

Definition at line 755 of file XrdOssConfig.cc.

756 {
757  struct stat statbuff;
758  char Pfn[MAXPATHLEN+1+8], *Slash;
759 
760 // Get local path for this lfn
761 //
762  if (GenLocalPath(Lfn, Pfn)) return;
763 
764 // Now try to find the actual existing base path
765 //
766  while(stat(Pfn, &statbuff))
767  {if (!(Slash = rindex(Pfn, '/')) || Slash == Pfn) return;
768  *Slash = '\0';
769  }
770 
771 // Add this path to the file system data. We need to do this to track space
772 //
773  XrdOssCache_FS::Add(Pfn);
774 }
static int Add(const char *Path)
Definition: XrdOssCache.cc:250
int GenLocalPath(const char *, char *)
Definition: XrdOssApi.cc:237

References XrdOssCache_FS::Add(), GenLocalPath(), and stat.

+ Here is the call graph for this function:

◆ ConfigSpace() [2/2]

void XrdOssSys::ConfigSpace ( XrdSysError Eroute)
protected

Definition at line 716 of file XrdOssConfig.cc.

717 {
718  XrdOucPList *fp = RPList.First();
719  int noCacheFS = !(OptFlags & XrdOss_CacheFS);
720 
721 // Configure space for each non-cached exported path. We only keep track of
722 // space that can actually be modified in some way.
723 //
724  while(fp)
725  {if ( ((noCacheFS || (fp->Flag() & XRDEXP_INPLACE)) &&
726  (fp->Flag() & (XRDEXP_STAGE | XRDEXP_PURGE)))
727  || !(fp->Flag() & XRDEXP_NOTRW)
728  || (fp->Flag() & XRDEXP_PFCACHE) )
729  ConfigSpace(fp->Path());
730  fp = fp->Next();
731  }
732 
733 // If there is a space list then verify it
734 //
735  if ((fp = SPList.First()))
736  {XrdOssCache_Group *fsg;
737  const char *what;
738  bool zAssign = false;
739  while(fp)
740  {if (fp->Attr() != spAssign) what = "default space ";
741  else {zAssign = true; what = "assign space ";}
742  const char *grp = fp->Name();
744  while(fsg) {if (!strcmp(fsg->group,grp)) break; fsg = fsg->next;}
745  if (!fsg) Eroute.Say("Config warning: unable to ", what, grp,
746  " to ", fp->Path(), "; space not defined.");
747  fp = fp->Next();
748  }
749  if (zAssign) SPList.Default(static_cast<unsigned long long>(spAssign));
750  }
751 }
#define XrdOss_CacheFS
Definition: XrdOssConfig.hh:44
#define XRDEXP_INPLACE
Definition: XrdOucExport.hh:66
static XrdOssCache_Group * fsgroups
Definition: XrdOssCache.hh:199
XrdOssCache_Group * next
Definition: XrdOssCache.hh:186
void ConfigSpace(XrdSysError &Eroute)
void Default(unsigned long long x)
Definition: XrdOucPList.hh:101

References XrdOucPList::Attr(), XrdOucPListAnchor::Default(), XrdOucPListAnchor::First(), XrdOucPList::Flag(), XrdOssCache_Group::fsgroups, XrdOssCache_Group::group, XrdOucPList::Name(), XrdOssCache_Group::next, XrdOucPList::Next(), OptFlags, XrdOucPList::Path(), RPList, XrdSysError::Say(), spAssign, SPList, XRDEXP_INPLACE, XRDEXP_NOTRW, XRDEXP_PFCACHE, XRDEXP_PURGE, XRDEXP_STAGE, and XrdOss_CacheFS.

Referenced by Configure().

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

◆ ConfigSpath()

void XrdOssSys::ConfigSpath ( XrdSysError Eroute,
const char *  Pn,
unsigned long long &  Fv,
int  noMSS 
)
protected

Definition at line 780 of file XrdOssConfig.cc.

782 {
783 // mig+r/w -> check unless nocheck was specified
784 //
785  if (!(flags & XRDEXP_CHECK_X))
786  {if ((flags & XRDEXP_MIG) && !(flags & XRDEXP_NOTRW))
787  flags &= ~XRDEXP_NOCHECK;
788  else flags |= XRDEXP_NOCHECK;
789  }
790 // rsscmd -> dread unless nodread was specified
791 //
792  if (!(flags & XRDEXP_DREAD_X))
793  {if (RSSCmd) flags &= ~XRDEXP_NODREAD;
794  else flags |= XRDEXP_NODREAD;
795  }
796 
797 // If there is no mss then turn off all mss related optionss, otherwise check
798 // if the options may leave the system in an inconsistent state
799 //
800  if (noMSS) flags=(flags & ~XRDEXP_RCREATE)|XRDEXP_NOCHECK|XRDEXP_NODREAD;
801  else if ((flags & XRDEXP_MIG) && (flags & XRDEXP_NOCHECK)
802  && !(flags & XRDEXP_NOTRW))
803  Eroute.Say("Config warning: 'all.export ", Path,
804  " nocheck mig r/w' allows file inconsistentcy!");
805 }
#define XRDEXP_DREAD_X
Definition: XrdOucExport.hh:47
#define XRDEXP_CHECK_X
Definition: XrdOucExport.hh:51

References Path, RSSCmd, XrdSysError::Say(), XRDEXP_CHECK_X, XRDEXP_DREAD_X, XRDEXP_MIG, XRDEXP_NOCHECK, XRDEXP_NODREAD, XRDEXP_NOTRW, and XRDEXP_RCREATE.

Referenced by ConfigStage().

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

◆ ConfigStage()

int XrdOssSys::ConfigStage ( XrdSysError Eroute)
protected

Definition at line 811 of file XrdOssConfig.cc.

812 {
813  const char *What;
814  char *tp, *stgp = 0;
815  unsigned long long flags;
816  int noMSS, needRSS = 0, NoGo = 0;
817  XrdOucPList *fp;
818 
819 // Determine if we are a manager/supervisor. These never stage files so we
820 // really don't need (nor want) a stagecmd or an msscmd.
821 //
822  noMSS = ((tp = getenv("XRDREDIRECT"))
823  && (!strcmp(tp, "R") || !strcmp(tp, "M"))) | Solitary;
824 
825 // A rsscmd implies check+dread. Note that nostage is now always the default.
826 //
827  flags = (RSSCmd ? 0 : XRDEXP_NOCHECK | XRDEXP_NODREAD);
828  DirFlags = DirFlags | (flags & (~(DirFlags >> XRDEXP_MASKSHIFT)));
829 
830 // Set default flags
831 //
833 
834 // Reprocess the paths to set correct defaults
835 //
836  fp = RPList.First();
837  while(fp)
838  {flags = fp->Flag(); ConfigSpath(Eroute, fp->Path(), flags, noMSS);
839 
840  // Record the fact that we have a stageable path
841  //
842  if (flags & XRDEXP_STAGE) stgp = fp->Path();
843 
844  // Check if path requires rsscmd and complain if we don't have one
845  //
846  if (!(flags & XRDEXP_NOCHECK)) What = "has check";
847  else if (!(flags & XRDEXP_NODREAD)) What = "has dread";
848  else if (flags & XRDEXP_RCREATE) What = "has recreate";
849  else What = 0;
850  if (!noMSS && !RSSCmd && What)
851  {Eroute.Emsg("Config", fp->Path(), What,
852  "export attribute but rsscmd not specified.");
853  NoGo = 1;
854  } else if (What) needRSS = 1;
855 
856  // Update flags and proceed to next path
857  //
858  fp->Set(flags); fp = fp->Next();
859  }
860 
861 // If we are a manager/supervisor, short circuit MSS initialization
862 //
863  if (noMSS)
864  {if (RSSCmd) {free(RSSCmd); RSSCmd = 0;}
865  if (StageCmd) {free(StageCmd); StageCmd = 0;}
866  RSSProg = 0; StageCreate = 0;
867  return NoGo;
868  }
869 
870 // Check if we don't need the stagecmd but one was specified
871 //
872  if (StageCmd && !stgp)
873  {Eroute.Say("Config warning: 'stagecmd' ignored; no stageable paths present.");
874  free(StageCmd); StageCmd = 0;
875  }
876 
877 // Check if we don't need a remote storage service but one was specified
878 //
879  if (RSSCmd && !needRSS)
880  {Eroute.Say("Config warning: 'rsscmd' ignored; no path exported with "
881  "check, dread, or rcreate.");
882  free(RSSCmd); RSSCmd = 0;
883  }
884 
885 // If we have any errors at this point, just return failure
886 //
887  if (NoGo) return 1;
888  if (!RSSCmd && !StageCmd && !stgp) return 0;
889  Eroute.Say("++++++ Remote Storage System interface initialization started.");
890 
891 // Allocate a pr0gram object for the gateway command
892 //
893  if (RSSCmd)
894  {RSSProg = new XrdOucProg(&Eroute);
895  if (RSSProg->Setup(RSSCmd)) NoGo = 1;
896  }
897 
898 // Initialize staging if we need to
899 //
900  if (!NoGo && (StageCmd || stgp))
901  {const int AMode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH; // 775
902  if (StageCmd && *StageCmd) NoGo = ConfigStageC(Eroute);
903  else {StageFrm = new XrdFrcProxy(Eroute.logger(),
906  getenv("XRDADMINPATH"), AMode);
907  StageRealTime = 0; StageAsync = 1;
908  }
909 
910  // Set up the event path
911  //
912  StageAction = (char *)"wfn "; StageActLen = 4;
913  if ((tp = getenv("XRDOFSEVENTS")))
914  {char sebuff[MAXPATHLEN+8];
915  StageEvSize = sprintf(sebuff, "file:///%s", tp);
916  StageEvents = strdup(sebuff);
917  } else {StageEvents = (char *)"-"; StageEvSize = 1;}
918  }
919 
920 // All done
921 //
922  tp = (NoGo ? (char *)"failed." : (char *)"completed.");
923  Eroute.Say("------ Remote Storage System interface initialization ", tp);
924  return NoGo;
925 }
#define TRACE_Debug
Definition: XrdCmsTrace.hh:37
#define XRDEXP_MASKSHIFT
Definition: XrdOucExport.hh:81
int Init(int opX, const char *aPath, int aMode, const char *qPath=0)
Definition: XrdFrcProxy.cc:229
static const int opStg
Definition: XrdFrcProxy.hh:52
void ConfigSpath(XrdSysError &Eroute, const char *Pn, unsigned long long &Fv, int noMSS)
int ConfigStageC(XrdSysError &Eroute)
int Setup(const char *prog, XrdSysError *errP=0, int(*Proc)(XrdOucStream *, char **, int)=0)
Definition: XrdOucProg.cc:296
static const char * InstName(int TranOpt=0)
Definition: XrdOucUtils.cc:851
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:175

References ConfigSpath(), ConfigStageC(), XrdOucPListAnchor::Default(), DirFlags, XrdSysError::Emsg(), XrdOucPListAnchor::First(), XrdOucPList::Flag(), XrdFrcProxy::Init(), XrdOucUtils::InstName(), XrdSysError::logger(), XrdOucPList::Next(), XrdFrcProxy::opStg, OssTrace, XrdOucPList::Path(), RPList, RSSCmd, RSSProg, XrdSysError::Say(), XrdOucPList::Set(), XrdOucProg::Setup(), Solitary, StageAction, StageActLen, StageAsync, StageCmd, StageCreate, StageEvents, StageEvSize, StageFrm, StageRealTime, TRACE_Debug, XrdSysTrace::What, XRDEXP_MASKSHIFT, XRDEXP_NOCHECK, XRDEXP_NODREAD, XRDEXP_RCREATE, and XRDEXP_STAGE.

Referenced by Configure().

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

◆ ConfigStageC()

int XrdOssSys::ConfigStageC ( XrdSysError Eroute)
protected

Definition at line 931 of file XrdOssConfig.cc.

932 {
933  pthread_t tid;
934  char *sp, *tp;
935  int numt, retc, NoGo = 0;
936 
937 // The stage command is interactive if it starts with an | (i.e., pipe in)
938 //
939  tp = StageCmd;
940  while(*tp && *tp == ' ') tp++;
941  if (*tp == '|') {StageRealTime = 0;
942  do {tp++;} while(*tp == ' ');
943  }
944  StageCmd = tp;
945 
946 // This is a bit of hackery to get the traceid sent over to the
947 // new file residency manager (frm). Keeps the config simple.
948 //
949  if ((sp = index(StageCmd, ' '))) *sp = '\0';
950  if (!(tp = rindex (StageCmd, '/'))) tp = StageCmd;
951  else tp++;
952  if (!strncmp("frm_", tp, 4)) StageFormat = 1;
953  if (sp) *sp = ' ';
954 
955 // Set up a program object for the command
956 //
957  StageProg = new XrdOucProg(&Eroute);
958  if (StageProg->Setup(StageCmd)) NoGo = 1;
959 
960 // For old-style real-time staging, create threads to handle the staging
961 // For queue-style staging, start the program that handles the queue
962 //
963  if (!NoGo)
964  {if (StageRealTime)
965  {if ((numt = xfrthreads - xfrtcount) > 0) while(numt--)
966  {if ((retc = XrdSysThread::Run(&tid,XrdOssxfr,(void *)0,0,"staging")))
967  Eroute.Emsg("Config", retc, "create staging thread");
968  else xfrtcount++;
969  }
970  } else NoGo = StageProg->Start();
971  }
972 
973 // Setup the additional stage information vector. Variable substitution:
974 // <data>$var;<data>.... (max of MaxArgs substitutions). This is only relevant
975 // when using an actual stagecmd.
976 //
977  if (!NoGo && !StageRealTime && StageMsg)
978  {XrdOucMsubs *msubs = new XrdOucMsubs(&Eroute);
979  if (msubs->Parse("stagemsg", StageMsg)) StageSnd = msubs;
980  else NoGo = 1; // We will exit no need to delete msubs
981  }
982 
983 // All done
984 //
985  return NoGo;
986 }
void * XrdOssxfr(void *carg)
int StageFormat
Definition: XrdOssApi.hh:231
int Parse(const char *oname, char *msg)
Definition: XrdOucMsubs.cc:100
int Start(void)
Definition: XrdOucProg.cc:349

References XrdSysError::Emsg(), XrdOucMsubs::Parse(), XrdSysThread::Run(), XrdOucProg::Setup(), StageCmd, StageFormat, StageMsg, StageProg, StageRealTime, StageSnd, XrdOucProg::Start(), xfrtcount, xfrthreads, and XrdOssxfr().

Referenced by ConfigStage().

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

◆ ConfigStatLib()

int XrdOssSys::ConfigStatLib ( XrdSysError Eroute,
XrdOucEnv envP 
)
protected

Definition at line 992 of file XrdOssConfig.cc.

993 {
994  XrdOucPinLoader myLib(&Eroute, myVersion, "statlib", STT_Lib);
995  const char *stName2 = "?XrdOssStatInfoInit2";
996 
997 // Get the plugin and stat function. Let's try version 2 first
998 //
999  XrdOssStatInfoInit2_t siGet2;
1000  if (STT_V2) stName2++;
1001  if ((siGet2=(XrdOssStatInfoInit2_t)myLib.Resolve(stName2)))
1002  {if (!(STT_Fund = siGet2(this,Eroute.logger(),ConfigFN,STT_Parms,envP)))
1003  return 1;
1004  if (STT_DoARE) envP->PutPtr("XrdOssStatInfo2*", (void *)STT_Fund);
1005  STT_V2 = 1;
1006  return 0;
1007  }
1008 
1009 // If we are here but the -2 was specified on the config then we fail
1010 //
1011  if (STT_V2) return 1;
1012 
1013 // OK, so we better find version 1 in the shared library
1014 //
1015  XrdOssStatInfoInit_t siGet;
1016  if (!(siGet = (XrdOssStatInfoInit_t)myLib.Resolve("XrdOssStatInfoInit"))
1017  || !(STT_Func = siGet (this,Eroute.logger(),ConfigFN,STT_Parms)))
1018  return 1;
1019 
1020 // Return success
1021 //
1022  return 0;
1023 }
XrdOssStatInfo_t(* XrdOssStatInfoInit_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms)
The typedef that describes the XRdOssStatInfoInit external.
XrdOssStatInfo2_t(* XrdOssStatInfoInit2_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
void PutPtr(const char *varname, void *value)
Definition: XrdOucEnv.cc:316

References ConfigFN, XrdProxy::envP, XrdSysError::logger(), myVersion, XrdOucEnv::PutPtr(), XrdOucPinLoader::Resolve(), STT_DoARE, STT_Lib, STT_Parms, and STT_V2.

Referenced by Configure().

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

◆ ConfigStats() [1/2]

void XrdOssSys::ConfigStats ( dev_t  Devnum,
char *  lP 
)
protected

Definition at line 1081 of file XrdOssConfig.cc.

1082 {
1083  struct stat Stat;
1084  char *Slash, pP[MAXPATHLEN+1];
1085 
1086 // Minimize the path
1087 //
1088  while((Slash = rindex(lP+1, '/')))
1089  {*Slash = '\0';
1090  if (GenLocalPath(lP, pP) || stat(pP, &Stat) || Stat.st_dev != Devnum)
1091  break;
1092  }
1093 
1094 // Extend path if need be and return
1095 //
1096  if (Slash) *Slash = '/';
1097 }
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *Env=0)
Definition: XrdOssStat.cc:70

References GenLocalPath(), stat, and Stat().

+ Here is the call graph for this function:

◆ ConfigStats() [2/2]

void XrdOssSys::ConfigStats ( XrdSysError Eroute)
protected

Definition at line 1029 of file XrdOssConfig.cc.

1030 {
1031  struct StatsDev
1032  {StatsDev *Next;
1033  dev_t st_dev;
1034  StatsDev(StatsDev *dP, dev_t dn) : Next(dP), st_dev(dn) {}
1035  };
1036 
1038  XrdOucPList *fP = RPList.First();
1039  StatsDev *dP1st = 0, *dP, *dPp;
1040  struct stat Stat;
1041  char LPath[MAXPATHLEN+1], PPath[MAXPATHLEN+1], *cP;
1042 
1043 // Count actual cache groups
1044 //
1045  while(fsg) {numCG++; fsg = fsg->next;}
1046 
1047 // Develop the list of paths that we will report on
1048 //
1049  if (fP) do
1050  {strcpy(LPath, fP->Path());
1051  if (GenLocalPath(LPath, PPath)) continue;
1052  if (stat(PPath, &Stat) && (cP = rindex(LPath, '/')))
1053  {*cP = '\0';
1054  if (GenLocalPath(LPath, PPath) || stat(PPath, &Stat)) continue;
1055  }
1056  dP = dP1st;
1057  while(dP && dP->st_dev != Stat.st_dev) dP = dP->Next;
1058  if (dP) continue;
1059  ConfigStats(Stat.st_dev, LPath);
1060  if (GenLocalPath(LPath, PPath)) continue;
1061  DPList = new OssDPath(DPList, strdup(LPath), strdup(PPath));
1062  lenDP += strlen(LPath) + strlen(PPath); numDP++;
1063  dP1st = new StatsDev(dP1st, Stat.st_dev);
1064  } while ((fP = fP->Next()));
1065 
1066 // If we have no exported paths then create a simple /tmp object
1067 //
1068  if (!numDP)
1069  {DPList = new OssDPath(0, strdup("/tmp"), strdup("/tmp"));
1070  lenDP = 4; numDP = 1;
1071  }
1072 
1073 // Now delete all of the device objects
1074 //
1075  dP = dP1st;
1076  while(dP) {dPp = dP; dP = dP->Next; delete dPp;}
1077 }
void ConfigStats(XrdSysError &Eroute)

References DPList, XrdOucPListAnchor::First(), XrdOssCache_Group::fsgroups, GenLocalPath(), lenDP, XrdOssCache_Group::next, XrdOucPList::Next(), numCG, numDP, XrdOucPList::Path(), RPList, stat, and Stat().

Referenced by Configure().

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

◆ Configure()

int XrdOssSys::Configure ( const char *  configfn,
XrdSysError Eroute,
XrdOucEnv envP 
)

Definition at line 265 of file XrdOssConfig.cc.

267 {
268 /*
269  Function: Establish default values using a configuration file.
270 
271  Input: None.
272 
273  Output: 0 upon success or !0 otherwise.
274 */
279 
280  static const int maxFD = 1048576;
281  struct rlimit rlim;
282  char *val;
283  int retc, NoGo = XrdOssOK;
284  pthread_t tid;
285  bool setfd = false;
286 
287 // Do the herald thing
288 //
289  Eroute.Say("++++++ Storage system initialization started.");
290  Eroute.addTable(ETab);
291  Eroute.addTable(ETabErrno);
292  if (getenv("XRDDEBUG")) OssTrace.What = TRACE_ALL;
293 
294 // Preset all variables with common defaults
295 //
296  ConfigFN = (configfn && *configfn ? strdup(configfn) : 0);
297 
298 // Establish the FD limit and the fence (half way)
299 //
300  if (getrlimit(RLIMIT_NOFILE, &rlim))
301  {Eroute.Emsg("Config", errno, "get fd limit");
302  rlim.rlim_cur = maxFD;
303  }
304  else {if (rlim.rlim_max == RLIM_INFINITY)
305  {rlim.rlim_cur = maxFD;
306  setfd = true;
307  } else {
308  if (rlim.rlim_cur != rlim.rlim_max)
309  {rlim.rlim_cur = rlim.rlim_max;
310  setfd = true;
311  }
312  }
313  if (setfd)
314  {if (setrlimit(RLIMIT_NOFILE, &rlim))
315  Eroute.Emsg("Config", errno, "set fd limit");
316  else
317  {
318 #ifdef __APPLE__
319 //
320 // As of macOS Sequoia 15.6, setrlimit above will be successful but the limit on the
321 // file descriptor table size may still be lower than RLIMIT_NOFILE. Calls to
322 // `fcntl(fd, F_DUPFD, arg)` as is done in `XrdSysFD_Dup1` will fail if the provided
323 // `arg` is greater than `getdtablesize()` per the online man pages. After testing,
324 // it seems the two limits exist independently.
325 //
326 // One can verify this by (a) testing `getrlimit()` again to see the larger limit and
327 // then doing a `XrdSysFD_Dup1` that's below `rlim.rlim_cur` and above `getdtablesize()`;
328 // it will fail with "Invalid Argument".
329 //
330 // On Linux, the man pages note that `getdtablesize()` is implemented via the equivalent
331 // `getrlimit` call; hence, there's no need for this extra check.
332 //
333  FDLimit = static_cast<rlim_t>(getdtablesize()) < rlim.rlim_cur ? getdtablesize() : rlim.rlim_cur;
334 #else
335  FDLimit = rlim.rlim_cur;
336 #endif
337  }
338  } else {FDFence = static_cast<int>(rlim.rlim_cur)>>1;
339  FDLimit = rlim.rlim_cur;
340  }
341  }
342  if (FDFence < 0 || FDFence >= FDLimit) FDFence = FDLimit >> 1;
343 
344 // Configure devices
345 //
347 
348 // Process the configuration file
349 //
350  NoGo = ConfigProc(Eroute);
351 
352 // Configure dependent plugins
353 //
354  if (!NoGo)
355  {if (N2N_Lib || LocalRoot || RemoteRoot) NoGo |= ConfigN2N(Eroute, envP);
356  if (STT_Lib && !NoGo) NoGo |= ConfigStatLib(Eroute, envP);
357  }
358 
359 // If the export list is empty, add at least "/tmp" to it otherwise we will
360 // fail to correctly track space.
361 //
362  if (RPList.First() == 0)
363  RPList.Insert(new XrdOucPList("/tmp", (unsigned long long)0));
364 
365 // Establish usage tracking and quotas, if need be. Note that if we are not
366 // a true data server, those services will be initialized but then disabled.
367 //
368  Solitary = ((val = getenv("XRDREDIRECT")) && !strcmp(val, "Q"));
369  pfcMode = (envP && (val = envP->Get("oss.runmode")) && !strcmp(val,"pfc"));
370  {const char *m1 = (Solitary ? "standalone " : 0);
371  const char *m2 = (pfcMode ? "pfc " : 0);
372  if (m1 || m2) Eroute.Say("++++++ Configuring ", m1, m2, "mode . . .");
373  }
376 
377 // Configure the MSS interface including staging
378 //
379  if (!NoGo) NoGo = ConfigStage(Eroute);
380 
381 // Configure async I/O
382 //
383  if (!NoGo) NoGo = !AioInit();
384 
385 // Initialize memory mapping setting to speed execution
386 //
387  if (!NoGo) ConfigMio(Eroute);
388 
389 // Provide support for the PFC. This also resolve cache attribute conflicts.
390 //
391  if (!NoGo) ConfigCache(Eroute);
392 
393 // Establish the actual default path settings (modified by the above)
394 //
396 
397 // Configure space (final pass)
398 //
399  ConfigSpace(Eroute);
400 
401 // Set the prefix for files in cache file systems
402  if ( OptFlags & XrdOss_CacheFS )
403  if (!NoGo) {
404  NoGo = XrdOssPath::InitPrefix();
405  if (NoGo) Eroute.Emsg("Config", "space initialization failed");
406  }
407 
408 // Configure statiscal reporting
409 //
410  if (!NoGo) ConfigStats(Eroute);
411 
412 // Start up the space scan thread unless specifically told not to. Some programs
413 // like the cmsd manually handle space updates.
414 //
415  if (!(val = getenv("XRDOSSCSCAN")) || strcmp(val, "off"))
416  {if ((retc = XrdSysThread::Run(&tid, XrdOssCacheScan,
417  (void *)&cscanint, 0, "space scan")))
418  Eroute.Emsg("Config", retc, "create space scan thread");
419  }
420 
421 // Display the final config if we can continue
422 //
423  if (!NoGo) Config_Display(Eroute);
424 
425 // Do final reset of paths if we are in proxy file cache mode
426 //
427  if (pfcMode && !NoGo) ConfigCache(Eroute, true);
428 
429 // Export the real path list (for frm et. al.)
430 //
431  XrdOssRPList = &RPList;
432  if (envP) envP->PutPtr("XrdOssRPList*", &RPList);
433 
434 // All done, close the stream and return the return code.
435 //
436  val = (NoGo ? (char *)"failed." : (char *)"completed.");
437  Eroute.Say("------ Storage system initialization ", val);
438  return NoGo;
439 }
static const int XrdOssErrnoMap[]
Definition: XrdOssConfig.cc:86
const char * XrdOssErrorText[]
void * XrdOssCacheScan(void *carg)
XrdOucPListAnchor * XrdOssRPList
Definition: XrdOssConfig.cc:80
#define XRDOSS_ELAST
Definition: XrdOssError.hh:64
#define XRDOSS_EBASE
Definition: XrdOssError.hh:33
#define TRACE_ALL
Definition: XrdTrace.hh:35
static int Init(const char *UDir, const char *Qfile, int isSOL, int usync=0)
Definition: XrdOssCache.cc:644
static void MapDevs(bool dBug=false)
Definition: XrdOssCache.cc:709
static int InitPrefix()
Definition: XrdOssPath.cc:340
void Config_Display(XrdSysError &)
int ConfigStage(XrdSysError &Eroute)
static int AioInit()
Definition: XrdOssAio.cc:281
void ConfigMio(XrdSysError &Eroute)
int ConfigN2N(XrdSysError &Eroute, XrdOucEnv *envP)
int ConfigStatLib(XrdSysError &Eroute, XrdOucEnv *envP)
int ConfigProc(XrdSysError &Eroute)
void ConfigCache(XrdSysError &Eroute, bool pass2=false)
char * Get(const char *varname)
Definition: XrdOucEnv.hh:69
void Insert(XrdOucPList *newitem)
Definition: XrdOucPList.hh:134
static void addTable(XrdSysError_Table *etp)
Definition: XrdSysError.hh:134

References XrdSysError::addTable(), AioInit(), Config_Display(), ConfigCache(), ConfigFN, ConfigMio(), ConfigN2N(), ConfigProc(), ConfigSpace(), ConfigStage(), ConfigStatLib(), ConfigStats(), cscanint, DirFlags, XrdSysError::Emsg(), XrdProxy::envP, FDFence, FDLimit, XrdOucPListAnchor::First(), fuzalloc, XrdOucEnv::Get(), XrdOssCache::Init(), XrdOssPath::InitPrefix(), XrdOucPListAnchor::Insert(), LocalRoot, XrdOssCache::MapDevs(), minalloc, N2N_Lib, OptFlags, OssTrace, ovhalloc, pfcMode, XrdOucEnv::PutPtr(), QFile, RemoteRoot, RPList, XrdSysThread::Run(), XrdSysError::Say(), XrdOucPList::Set(), Solitary, STT_Lib, TRACE_ALL, UDir, USync, XrdSysTrace::What, XrdOss_CacheFS, XRDOSS_EBASE, XRDOSS_ELAST, XrdOssCacheScan(), XrdOssErrnoMap, XrdOssErrorText, XrdOssOK, and XrdOssRPList.

Referenced by Init().

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

◆ ConfigXeq()

int XrdOssSys::ConfigXeq ( char *  var,
XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1103 of file XrdOssConfig.cc.

1104 {
1105  char myVar[80], buff[2048], *val;
1106  int nosubs;
1107  XrdOucEnv *myEnv = 0;
1108 
1109  TS_Xeq("alloc", xalloc);
1110  TS_Xeq("cache", xcache);
1111  TS_Xeq("cachescan", xcachescan); // Backward compatibility
1112  TS_Xeq("spacescan", xcachescan);
1113  TS_Xeq("defaults", xdefault);
1114  TS_Xeq("fdlimit", xfdlimit);
1115  TS_Xeq("maxsize", xmaxsz);
1116  TS_Xeq("memfile", xmemf);
1117  TS_Xeq("namelib", xnml);
1118  TS_Xeq("path", xpath);
1119  TS_Xeq("preread", xprerd);
1120  TS_Xeq("space", xspace);
1121  TS_Xeq("stagecmd", xstg);
1122  TS_Xeq("statlib", xstl);
1123  TS_Xeq("trace", xtrace);
1124  TS_Xeq("usage", xusage);
1125  TS_Xeq("xfr", xxfr);
1126 
1127  // Check if var substitutions are prohibited (e.g., stagemsg). Note that
1128  // TS_String() returns upon success so be careful when adding new opts.
1129  //
1130  if ((nosubs = !strcmp(var, "stagemsg"))) myEnv = Config.SetEnv(0);
1131 
1132  // Copy the variable name as this may change because it points to an
1133  // internal buffer in Config. The vagaries of effeciency.
1134  //
1135  strlcpy(myVar, var, sizeof(myVar));
1136  var = myVar;
1137 
1138  // We need to suck all the tokens to the end of the line for remaining
1139  // options. Do so, until we run out of space in the buffer.
1140  //
1141  if (!Config.GetRest(buff, sizeof(buff)))
1142  {Eroute.Emsg("Config", "arguments too long for", var);
1143  if (nosubs) Config.SetEnv(myEnv);
1144  return 1;
1145  }
1146  val = buff;
1147 
1148  // Restore substititions at this point if need be
1149  //
1150  if (nosubs) Config.SetEnv(myEnv);
1151 
1152  // At this point, make sure we have a value
1153  //
1154  if (!(*val))
1155  {Eroute.Emsg("Config", "no value for directive", var);
1156  return 1;
1157  }
1158 
1159  // Check for tokens taking a variable number of parameters
1160  //
1161  TS_String("localroot", LocalRoot);
1162  TS_String("remoteroot", RemoteRoot);
1163  TS_String("stagemsg", StageMsg);
1164 
1165  // The following differentiates between a deprecated and a preferred command
1166  //
1167  if (!strcmp("msscmd", var)) {isMSSC = 1; Duplicate(val, RSSCmd); return 0;}
1168  if (!strcmp("rsscmd", var)) {isMSSC = 0; Duplicate(val, RSSCmd); return 0;}
1169 
1170  // No match found, complain.
1171  //
1172  Eroute.Say("Config warning: ignoring unknown directive '",var,"'.");
1173  Config.Echo();
1174  return 0;
1175 }
#define TS_String(x, m)
#define TS_Xeq(x, m)
#define Duplicate(x, y)
size_t strlcpy(char *dst, const char *src, size_t sz)
int xstg(XrdOucStream &Config, XrdSysError &Eroute)
int xtrace(XrdOucStream &Config, XrdSysError &Eroute)
int xstl(XrdOucStream &Config, XrdSysError &Eroute)
int xusage(XrdOucStream &Config, XrdSysError &Eroute)
int xspace(XrdOucStream &Config, XrdSysError &Eroute, int *isCD=0)
int xmemf(XrdOucStream &Config, XrdSysError &Eroute)
int xcachescan(XrdOucStream &Config, XrdSysError &Eroute)
int xfdlimit(XrdOucStream &Config, XrdSysError &Eroute)
int xprerd(XrdOucStream &Config, XrdSysError &Eroute)
int xcache(XrdOucStream &Config, XrdSysError &Eroute)
int xxfr(XrdOucStream &Config, XrdSysError &Eroute)
int xmaxsz(XrdOucStream &Config, XrdSysError &Eroute)
int xdefault(XrdOucStream &Config, XrdSysError &Eroute)
int xnml(XrdOucStream &Config, XrdSysError &Eroute)
int xalloc(XrdOucStream &Config, XrdSysError &Eroute)

References XrdCms::Config, Duplicate, XrdSysError::Emsg(), isMSSC, LocalRoot, RemoteRoot, RSSCmd, XrdSysError::Say(), StageMsg, strlcpy(), TS_String, TS_Xeq, xalloc(), xcache(), xcachescan(), xdefault(), xfdlimit(), xmaxsz(), xmemf(), xnml(), xpath(), xprerd(), xspace(), xstg(), xstl(), xtrace(), xusage(), and xxfr().

Referenced by ConfigProc().

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

◆ Create()

int XrdOssSys::Create ( const char *  tid,
const char *  path,
mode_t  mode,
XrdOucEnv env,
int  opts = 0 
)
virtual

Create file.

Parameters
tid- Pointer to the trace identifier.
path- Pointer to the path of the file to create.
mode- The new file mode setting.
env- Reference to environmental information.
opts- Create options: XRDOSS_coloc - Colocate file using the URL encoded path in env "oss.coloc" XRDOSS_mkpath - create dir path if it does not exist. XRDOSS_new - the file must not already exist. oflags<<8 - open flags shifted 8 bits to the left/
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 113 of file XrdOssCreate.cc.

115 {
116  EPNAME("Create")
117  const int AMode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH; // 775
118  char local_path[MAXPATHLEN+1], *p, pc;
119  local_path[0] = '\0';
120  unsigned long long remotefs;
121  int isLink = 0, Missing = 1, retc = 0, datfd;
122  XrdOssCreateInfo crInfo(local_path, path, access_mode, Opts);
123  struct stat buf;
124 
125 // Get options associated with this path and check if it's r/w
126 //
127  remotefs = Check_RO(Create, crInfo.pOpts, path, "create");
128 
129 // Generate the actual local path for this file.
130 //
131  if ((retc = GenLocalPath(path, local_path))) return retc;
132 
133 // Determine the state of the file. We will need this information as we go on.
134 //
135  if ((Missing = lstat(local_path, &buf))) retc = errno;
136  else {if ((isLink = ((buf.st_mode & S_IFMT) == S_IFLNK)))
137  {if (stat(local_path, &buf))
138  {if (errno != ENOENT) return -errno;
139  OssEroute.Emsg("Create","removing dangling link",local_path);
140  if (unlink(local_path)) retc = errno;
141  Missing = 1; isLink = 0;
142  }
143  }
144  }
145  if (retc && retc != ENOENT) return -retc;
146 
147 // Check if we are requested to create the file at a specific location.
148 // If so set the cgroup to match the location we have been passed in the env.
149  bool forcecg = false;
150  if (Opts & XRDOSS_coloc)
151  {if (crInfo.pOpts & XRDEXP_NOFICL) return -EPERM;
152  const char *colocenv = env.Get("oss.coloc");
153  std::string coloc(colocenv ? colocenv : "");
154  coloc = XrdOucUtils::UrlDecode(coloc);
155  char coloc_local[MAXPATHLEN+1];
156  coloc_local[0] = '\0';
157  if ((retc = GenLocalPath(coloc.c_str(), coloc_local))) return retc;
158  XrdOssCache_FS *cp = XrdOssCache::Find(coloc_local);
159  std::string gpath;
160  if (cp) gpath = cp->group + std::string(":") + cp->path;
161  env.Put(OSS_CGROUP, gpath.c_str());
162  forcecg = true;
163  }
164 
165 // At this point, creation requests may need to be routed via the stagecmd.
166 // This is done if the file/link do not exist. Otherwise, we drop through.
167 //
168  if (StageCreate && Missing)
169  return XrdOssSS->Stage(tident, path, env, Opts>>8,
170  access_mode, crInfo.pOpts);
171 
172 // The file must not exist if it's declared "new". Otherwise, reuse the space.
173 // SetFattr() alaways closes the provided file descriptor!
174 //
175  if (!Missing)
176  {if (Opts & XRDOSS_new) return -EEXIST;
177  if ((buf.st_mode & S_IFMT) == S_IFDIR) return -EISDIR;
178  do {datfd = open(local_path, Opts>>8, access_mode);}
179  while(datfd < 0 && errno == EINTR);
180  if (datfd < 0) return -errno;
181  if ((retc = SetFattr(crInfo, datfd, buf.st_mtime))) return retc;
182  if (Opts>>8 & O_TRUNC && buf.st_size)
183  {off_t theSize = buf.st_size;
184  if (isLink) {buf.st_mode = (buf.st_mode & ~S_IFMT) | S_IFLNK;
185  XrdOssCache::Adjust(local_path, -theSize, &buf);
186  }
187  }
188  return 0;
189  }
190 
191 // If the path is to be created, make sure the path exists at this point
192 //
193  if ((Opts & XRDOSS_mkpath) && (p = rindex(local_path, '/')))
194  {p++; pc = *p; *p = '\0';
195  XrdOucUtils::makePath(local_path, AMode);
196  *p = pc;
197  }
198 
199 // If this is a staging filesystem then we have lots more work to do.
200 //
201  if (remotefs)
202  {char remote_path[MAXPATHLEN+1];
203 
204  // Generate the remote path for this file
205  //
206  if ((retc = GenRemotePath(path,remote_path))) return retc;
207 
208  // Create the file in remote system unless not wanted so
209  //
210  if (crInfo.pOpts & XRDEXP_RCREATE)
211  {if ((retc = MSS_Create(remote_path, access_mode, env)) < 0)
212  {DEBUG("rc" <<retc <<" mode=" <<Xrd::oct1 <<access_mode
213  <<" remote path=" <<remote_path);
214  return retc;
215  }
216  } else if (!(crInfo.pOpts & XRDEXP_NOCHECK))
217  {if (!(retc = MSS_Stat(remote_path))) return -EEXIST;
218  else if (retc != -ENOENT) return retc;
219  }
220  }
221 
222 // Created file in the extended cache or the local name space
223 //
224  if (XrdOssCache::fsfirst && !(crInfo.pOpts & XRDEXP_INPLACE))
225  retc = Alloc_Cache(crInfo, env, forcecg);
226  else retc = Alloc_Local(crInfo, env);
227 
228 // If successful then check if xattrs were actually set
229 //
230  if (retc == XrdOssOK && crInfo.cOpts & XRDOSS_setnoxa)
231  {XrdOucPList *plP = RPList.About(path);
232  if (plP) plP->Set(plP->Flag() | XRDEXP_NOXATTR);
233  }
234 
235 // All done.
236 //
237  return retc;
238 }
#define tident
#define Check_RO(act, flags, path, opname)
Definition: XrdOssApi.hh:394
XrdOssSys * XrdOssSS
Definition: XrdOssApi.cc:82
#define XRDOSS_coloc
Definition: XrdOss.hh:529
#define XRDOSS_setnoxa
Definition: XrdOss.hh:532
#define XRDOSS_new
Definition: XrdOss.hh:527
#define XRDOSS_mkpath
Definition: XrdOss.hh:526
#define lstat(a, b)
Definition: XrdPosix.hh:107
const char * group
Definition: XrdOssCache.hh:139
const char * path
Definition: XrdOssCache.hh:140
static XrdOssCache_FS * fsfirst
Definition: XrdOssCache.hh:269
static XrdOssCache_FS * Find(const char *Path, int lklen=0)
Definition: XrdOssCache.cc:611
int GenRemotePath(const char *, char *)
Definition: XrdOssApi.cc:254
virtual int Stage(const char *, const char *, XrdOucEnv &, int, mode_t, unsigned long long)
Definition: XrdOssStage.cc:110
int Alloc_Cache(XrdOssCreateInfo &, XrdOucEnv &, bool)
virtual int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0)
int MSS_Stat(const char *, struct stat *buff=0)
Definition: XrdOssMSS.cc:253
int MSS_Create(const char *path, mode_t, XrdOucEnv &)
Definition: XrdOssMSS.cc:206
int Alloc_Local(XrdOssCreateInfo &, XrdOucEnv &)
void Put(const char *varname, const char *value)
Definition: XrdOucEnv.hh:85
static std::string UrlDecode(const std::string &input)
static int makePath(char *path, mode_t mode, bool reset=false)
int Opts
Definition: XrdMpxStats.cc:58
@ oct1
Definition: XrdSysTrace.hh:42

References XrdOucPListAnchor::About(), XrdOssCache::Adjust(), Alloc_Cache(), Alloc_Local(), Check_RO, XrdOssCreateInfo::cOpts, DEBUG, XrdSysError::Emsg(), EPNAME, XrdOssCache::Find(), XrdOucPList::Flag(), XrdOssCache::fsfirst, GenLocalPath(), GenRemotePath(), XrdOucEnv::Get(), XrdOssCache_FS::group, lstat, XrdOucUtils::makePath(), MSS_Create(), MSS_Stat(), Xrd::oct1, open, XrdMpx::Opts, OSS_CGROUP, OssEroute, XrdOssCache_FS::path, XrdOssCreateInfo::pOpts, XrdOucEnv::Put(), RPList, XrdOucPList::Set(), SetFattr(), Stage(), StageCreate, stat, tident, unlink, XrdOucUtils::UrlDecode(), XRDEXP_INPLACE, XRDEXP_NOCHECK, XRDEXP_NOFICL, XRDEXP_NOXATTR, XRDEXP_RCREATE, XRDOSS_coloc, XRDOSS_mkpath, XRDOSS_new, XRDOSS_setnoxa, XrdOssOK, and XrdOssSS.

+ Here is the call graph for this function:

◆ doScrub()

void XrdOssSys::doScrub ( )
protected

◆ Features()

uint64_t XrdOssSys::Features ( )
inlinevirtual

Return storage system features.

Returns
Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOss.

Definition at line 173 of file XrdOssApi.hh.

173 {return XRDOSS_HASNAIO|XRDOSS_HASFICL;} // Turn async I/O off for disk and clone aware
#define XRDOSS_HASFICL
Definition: XrdOss.hh:544
#define XRDOSS_HASNAIO
Definition: XrdOss.hh:541

References XRDOSS_HASFICL, and XRDOSS_HASNAIO.

◆ Find()

int XrdOssSys::Find ( XrdOssStage_Req req,
void *  carg 
)
protected

◆ GenLocalPath()

int XrdOssSys::GenLocalPath ( const char *  oldp,
char *  newp 
)

Definition at line 237 of file XrdOssApi.cc.

238 {
239  if (lcl_N2N) return -(lcl_N2N->lfn2pfn(oldp, newp, MAXPATHLEN));
240  if (strlen(oldp) >= MAXPATHLEN) return -ENAMETOOLONG;
241  strcpy(newp, oldp);
242  return 0;
243 }

References lcl_N2N, and XrdOucName2Name::lfn2pfn().

Referenced by ConfigSpace(), ConfigStats(), Create(), GetFile(), HasFile(), Reloc(), Remdir(), Rename(), and Unlink().

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

◆ GenRemotePath()

int XrdOssSys::GenRemotePath ( const char *  oldp,
char *  newp 
)

Definition at line 254 of file XrdOssApi.cc.

255 {
256  if (rmt_N2N) return -(rmt_N2N->lfn2rfn(oldp, newp, MAXPATHLEN));
257  if (strlen(oldp) >= MAXPATHLEN) return -ENAMETOOLONG;
258  strcpy(newp, oldp);
259  return 0;
260 }
virtual int lfn2rfn(const char *lfn, char *buff, int blen)=0

References XrdOucName2Name::lfn2rfn(), and rmt_N2N.

Referenced by Create(), GetFile(), Rename(), and Unlink().

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

◆ getCname()

int XrdOssSys::getCname ( const char *  path,
struct stat sbuff,
char *  cgbuff 
)
protected

Definition at line 455 of file XrdOssStat.cc.

456 {
457  const char *thePath;
458  char actual_path[MAXPATHLEN+1];
459  int retc;
460 
461 // Get the pfn for this path
462 //
463  if (lcl_N2N)
464  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
465  return retc;
466  else thePath = actual_path;
467  else thePath = path;
468 
469 // Get regular stat informtion for this file
470 //
471  if ((retc = stat(thePath, sbuff))) return -errno;
472 
473 // Now determine if we should get the cache group name. There is none
474 // for offline files and it's always public for directories.
475 //
476  if (S_ISDIR(sbuff->st_mode)) strcpy(cgbuff, "public");
477  else if (S_ISBLK(sbuff->st_mode)) strcpy(cgbuff, "*");
478  else XrdOssPath::getCname(thePath, cgbuff);
479 
480 // All done
481 //
482  return 0;
483 }
static int getCname(const char *path, char *Cache, char *lbuf=0, int lbsz=0)
Definition: XrdOssPath.cc:241

References XrdOssPath::getCname(), lcl_N2N, XrdOucName2Name::lfn2pfn(), and stat.

Referenced by StatLS(), and StatXA().

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

◆ GetFile()

int XrdOssSys::GetFile ( XrdOssStage_Req req)
protected

Definition at line 433 of file XrdOssStage.cc.

434 {
435  char rfs_fn[MAXPATHLEN+1];
436  char lfs_fn[MAXPATHLEN+1];
437  int retc;
438 
439 // Convert the local filename and generate the corresponding remote name.
440 //
441  if ( (retc = GenLocalPath(req->path, lfs_fn)) ) return retc;
442  if ( (retc = GenRemotePath(req->path, rfs_fn)) ) return retc;
443 
444 // Run the command to get the file
445 //
446  if ((retc = StageProg->Run(rfs_fn, lfs_fn)))
447  {OssEroute.Emsg("Stage", retc, "stage", req->path);
448  return (retc == 2 ? -ENOENT : -XRDOSS_E8009);
449  }
450 
451 // All went well
452 //
453  return 0;
454 }
#define XRDOSS_E8009
Definition: XrdOssError.hh:43
XrdSysError OssEroute
const char * path
Definition: XrdOssStage.hh:57
int Run(XrdOucStream *Sp, const char *argV[], int argc=0, const char *envV[]=0) const
Definition: XrdOucProg.cc:108

References XrdSysError::Emsg(), GenLocalPath(), GenRemotePath(), OssEroute, XrdOssStage_Req::path, XrdOucProg::Run(), StageProg, and XRDOSS_E8009.

Referenced by Stage_In().

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

◆ getID()

int XrdOssSys::getID ( const char *  Tid,
XrdOucEnv Env,
char *  buff,
int  bsz 
)
protected

Definition at line 460 of file XrdOssStage.cc.

461 {
462  char *bP;
463  int n;
464 
465 // The buffer always starts with a '+'
466 //
467  *buff = '+'; bP = buff+1; bsz -= 3;
468 
469 // Get the trace id
470 //
471  if (Tid && (n = strlen(Tid)) <= bsz) {strcpy(bP, Tid); bP += n;}
472 
473 // Insert space
474 //
475  *bP++ = ' '; *bP = '\0';
476  return bP - buff;
477 }

Referenced by Stage_QT().

+ Here is the caller graph for this function:

◆ getStats()

int XrdOssSys::getStats ( char *  buff,
int  blen 
)
protected

Definition at line 489 of file XrdOssStat.cc.

490 {
491  static const char ptag1[] = "<paths>%d";
492  static const char ptag2[] = "<stats id=\"%d\"><lp>\"%s\"</lp><rp>\"%s\"</rp>"
493  "<tot>%lld</tot><free>%lld</free><ino>%lld</ino><ifr>%lld</ifr></stats>";
494  static const char ptag3[] = "</paths>";
495 
496  static const int ptag1sz = sizeof(ptag1);
497  static const int ptag2sz = sizeof(ptag2) + (16*4);
498  static const int ptag3sz = sizeof(ptag3);
499 
500  static const char stag1[] = "<space>%d";
501  static const char stag2[] = "<stats id=\"%d\"><name>%s</name>"
502  "<tot>%lld</tot><free>%lld</free><maxf>%lld</maxf>"
503  "<fsn>%d</fsn><usg>%lld</usg>";
504  static const char stagq[] = "<qta>%lld</qta>";
505  static const char stags[] = "</stats>";
506  static const char stag3[] = "</space>";
507 
508  static const int stag1sz = sizeof(stag1);
509  static const int stag2sz = sizeof(stag2) + XrdOssSpace::maxSNlen + (16*5);
510  static const int stagqsz = sizeof(stagq) + 16;
511  static const int stagssz = sizeof(stags);
512  static const int stag3sz = sizeof(stag3);
513 
514  static const int stagsz = ptag1sz + ptag2sz + ptag3sz + 1024 +
515  + stag1sz + stag2sz + stag3sz
516  + stagqsz + stagssz;
517 
519  OssDPath *dpP = DPList;
520  char *bp = buff;
521  int dpNum = 0, spNum = 0, n, flen;
522 
523 // If no buffer spupplied, return how much data we will generate. We also
524 // do one-time initialization here.
525 //
526  if (!buff) return ptag1sz + (ptag2sz * numDP) + stag3sz + lenDP
527  + stag1sz + (stag2sz * numCG) + stag3sz
528  + stagqsz + stagssz;
529 
530 // Make sure we have enough space for one entry
531 //
532  if (blen <= stagsz) return 0;
533 
534 // Output first header (we know we have one path, at least)
535 //
536  flen = sprintf(bp, ptag1, numDP); bp += flen; blen -= flen;
537 
538 // Output individual entries
539 //
540  while(dpP && blen > 0)
541  {XrdOssCache_Space CSpace;
542  XrdOssCache_FS::freeSpace(CSpace, dpP->Path2);
543  flen = snprintf(bp, blen, ptag2, dpNum, dpP->Path1, dpP->Path2,
544  CSpace.Total>>10, CSpace.Free>>10,
545  CSpace.Inodes, CSpace.Inleft);
546  dpP = dpP->Next; bp += flen; blen -= flen; dpNum++;
547  }
548 
549 // Output closing tag
550 //
551  if (blen <= ptag3sz) return 0;
552  strcpy(bp, ptag3); bp += (ptag3sz-1); blen -= (ptag3sz-1);
553  dpNum = bp - buff;
554 
555 // Output header
556 //
557  if (blen <= stag1sz) return (blen < 0 ? 0 : dpNum);
558  flen = snprintf(bp, blen, stag1, numCG); bp += flen; blen -= flen;
559  if (blen <= stag1sz) return dpNum;
560 
561 // Generate info for each path
562 //
563  while(fsg && blen > 0)
564  {XrdOssCache_Space CSpace;
565  n = XrdOssCache_FS::getSpace(CSpace, fsg);
566  flen = snprintf(bp, blen, stag2, spNum, fsg->group, CSpace.Total>>10,
567  CSpace.Free>>10, CSpace.Maxfree>>10, n, CSpace.Usage>>10);
568  bp += flen; blen -= flen; spNum++;
569  if (CSpace.Quota >= 0 && blen > stagqsz)
570  {flen = sprintf(bp, stagq, CSpace.Quota); bp += flen; blen -= flen;}
571  if (blen < stagssz) return dpNum;
572  strcpy(bp, stags); bp += (stagssz-1); blen -= (stagssz-1);
573  fsg = fsg->next;
574  }
575 
576 // Insert trailer
577 //
578  if (blen >= stag3sz) {strcpy(bp, stag3); bp += (stag3sz-1);}
579  else return dpNum;
580 
581 // All done
582 //
583  return bp - buff;
584 }
static int getSpace(XrdOssCache_Space &Space, const char *sname, XrdOssVSPart **vsPart=0)
Definition: XrdOssCache.cc:327
static long long freeSpace(long long &Size, const char *path=0)
Definition: XrdOssCache.cc:279
long long Inodes
Definition: XrdOssCache.hh:86
long long Inleft
Definition: XrdOssCache.hh:87
long long Maxfree
Definition: XrdOssCache.hh:84
static const int maxSNlen
Definition: XrdOssSpace.hh:44
char * Path2
Definition: XrdOssConfig.hh:51
OssDPath * Next
Definition: XrdOssConfig.hh:49
char * Path1
Definition: XrdOssConfig.hh:50

References DPList, XrdOssCache_Space::Free, XrdOssCache_FS::freeSpace(), XrdOssCache_Group::fsgroups, XrdOssCache_FS::getSpace(), XrdOssCache_Group::group, XrdOssCache_Space::Inleft, XrdOssCache_Space::Inodes, lenDP, XrdOssCache_Space::Maxfree, XrdOssSpace::maxSNlen, XrdOssCache_Group::next, OssDPath::Next, numCG, numDP, OssDPath::Path1, OssDPath::Path2, XrdOssCache_Space::Quota, XrdOssCache_Space::Total, and XrdOssCache_Space::Usage.

Referenced by Stats().

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

◆ HasFile()

time_t XrdOssSys::HasFile ( const char *  fn,
const char *  sfx,
time_t *  mTime = 0 
)
protected

Definition at line 483 of file XrdOssStage.cc.

484 {
485  struct stat statbuff;
486  int fnlen;
487  char path[MAXPATHLEN+8];
488  char *pp = path;
489 
490 // Copy the path with possible conversion
491 //
492  if (xfrFdir)
493  {strcpy(path, xfrFdir);
494  pp = path + xfrFdln;
495  }
496  if (GenLocalPath(fn, pp)) return 0;
497  fnlen = strlen(path);
498 
499 // Add the suffix
500 //
501  if ((fnlen + strlen(fsfx)) >= sizeof(path)) return 0;
502  strcpy(path+fnlen, fsfx);
503 
504 // Now check if the file actually exists
505 //
506  if (stat(path, &statbuff)) return 0;
507  if (mTime) *mTime = statbuff.st_mtime;
508  return statbuff.st_ctime;
509 }

References GenLocalPath(), stat, xfrFdir, and xfrFdln.

Referenced by Stage_QT(), and Stage_RT().

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

◆ Init() [1/2]

int XrdOssSys::Init ( XrdSysLogger lp,
const char *  cfn,
XrdOucEnv envP 
)
virtual

Initialize the storage system V2.

Parameters
lp- Pointer to the message logging object.
cfn- Pointer to the configuration file.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 191 of file XrdOssApi.cc.

192 {
193  int retc;
194 
195 // No need to do the herald thing as we are the default storage system
196 //
197  OssEroute.logger(lp);
198 
199 // Initialize the subsystems
200 //
201  XrdOssSS = this;
202  if ( (retc = Configure(configfn, OssEroute, envP)) ) return retc;
203 
204 // All done.
205 //
206  return XrdOssOK;
207 }
XrdSysError OssEroute(0, "oss_")
XrdOssSys * XrdOssSS
Definition: XrdOssApi.cc:82
int Configure(const char *, XrdSysError &, XrdOucEnv *envP)

References Configure(), XrdProxy::envP, XrdSysError::logger(), OssEroute, XrdOssOK, and XrdOssSS.

Referenced by XrdOssGetSS().

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

◆ Init() [2/2]

int XrdOssSys::Init ( XrdSysLogger lp,
const char *  cfn 
)
inlinevirtual

Initialize the storage system V1 (deprecated).

Parameters
lp- Pointer to the message logging object.
cfn- Pointer to the configuration file.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 177 of file XrdOssApi.hh.

177 {return Init(lP, cP, 0);}
int Init(XrdSysLogger *, const char *, XrdOucEnv *envP)
Definition: XrdOssApi.cc:191

References Init().

Referenced by Init().

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

◆ IsRemote()

int XrdOssSys::IsRemote ( const char *  path)
inline

Definition at line 178 of file XrdOssApi.hh.

179  {return (RPList.Find(path) & XRDEXP_REMOTE) != 0;}
#define XRDEXP_REMOTE
Definition: XrdOucExport.hh:85
unsigned long long Find(const char *pathname)
Definition: XrdOucPList.hh:112

References XrdOucPListAnchor::Find(), RPList, and XRDEXP_REMOTE.

Referenced by Stat().

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

◆ Lfn2Pfn() [1/2]

int XrdOssSys::Lfn2Pfn ( const char *  Path,
char *  buff,
int  blen 
)
virtual

Translate logical name to physical name V1 (deprecated).

Parameters
Path- Path in whose information is wanted.
buff- Pointer to the buffer to hold the new path.
blen- Length of the buffer.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 213 of file XrdOssApi.cc.

214 {
215  if (lcl_N2N) return -(lcl_N2N->lfn2pfn(oldp, newp, blen));
216  if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
217  strcpy(newp, oldp);
218  return 0;
219 }

References lcl_N2N, and XrdOucName2Name::lfn2pfn().

+ Here is the call graph for this function:

◆ Lfn2Pfn() [2/2]

const char * XrdOssSys::Lfn2Pfn ( const char *  Path,
char *  buff,
int  blen,
int &  rc 
)
virtual

Translate logical name to physical name V2.

Parameters
Path- Path in whose information is wanted.
buff- Pointer to the buffer to hold the new path.
blen- Length of the buffer.
rc- Place where failure return code is to be returned: -errno or -osserr (see XrdOssError.hh).
Returns
Pointer to the translated path upon success or nil on failure.

Reimplemented from XrdOss.

Definition at line 221 of file XrdOssApi.cc.

222 {
223  if (!lcl_N2N) {rc = 0; return oldp;}
224  if ((rc = -(lcl_N2N->lfn2pfn(oldp, newp, blen)))) return 0;
225  return newp;
226 }

References lcl_N2N, and XrdOucName2Name::lfn2pfn().

+ Here is the call graph for this function:

◆ List_Path()

void XrdOssSys::List_Path ( const char *  pfx,
const char *  pname,
unsigned long long  flags,
XrdSysError Eroute 
)
protected

Definition at line 2147 of file XrdOssConfig.cc.

2149 {
2150  std::string ss;
2151  const char *rwmode;
2152 
2153  if (flags & XRDEXP_FORCERO) rwmode = " forcero";
2154  else if (flags & XRDEXP_READONLY) rwmode = " r/o";
2155  else rwmode = " r/w";
2156 
2157  if (flags & XRDEXP_INPLACE) ss += " inplace";
2158  if (flags & XRDEXP_LOCAL) ss += " local";
2159  if (flags & XRDEXP_GLBLRO) ss += " globalro";
2160 
2161  if (!(flags & XRDEXP_PFCACHE))
2162  {if (flags & XRDEXP_PFCACHE_X) ss += " nocache";
2163  ss += (flags & XRDEXP_NOCHECK ? " nocheck" : " check");
2164  ss += (flags & XRDEXP_NODREAD ? " nodread" : " dread");
2165  ss += (flags & XRDEXP_MIG ? " mig" : " nomig");
2166  ss += (flags & XRDEXP_PURGE ? " purge" : " nopurge");
2167  ss += (flags & XRDEXP_RCREATE ? " rcreate" : " norcreate");
2168  ss += (flags & XRDEXP_STAGE ? " stage" : " nostage");
2169  ss += (flags & XRDEXP_NOFICL ? " noficl" : " ficl");
2170  } else ss += " cache";
2171 
2172 
2173  if (flags & XRDEXP_MMAP)
2174  {ss += " mmap";
2175  ss += (flags & XRDEXP_MKEEP ? " mkeep" : " nomkeep");
2176  ss += (flags & XRDEXP_MLOK ? " mlock" : " nomlock");
2177  }
2178 
2179  Eroute.Say(pfx, pname, rwmode, ss.c_str());
2180 }
#define XRDEXP_GLBLRO
Definition: XrdOucExport.hh:74
#define XRDEXP_LOCAL
Definition: XrdOucExport.hh:72

References XrdSysError::Say(), XRDEXP_FORCERO, XRDEXP_GLBLRO, XRDEXP_INPLACE, XRDEXP_LOCAL, XRDEXP_MIG, XRDEXP_MKEEP, XRDEXP_MLOK, XRDEXP_MMAP, XRDEXP_NOCHECK, XRDEXP_NODREAD, XRDEXP_NOFICL, XRDEXP_PFCACHE, XRDEXP_PFCACHE_X, XRDEXP_PURGE, XRDEXP_RCREATE, XRDEXP_READONLY, and XRDEXP_STAGE.

Referenced by Config_Display().

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

◆ Mkdir()

int XrdOssSys::Mkdir ( const char *  path,
mode_t  mode,
int  mkpath = 0,
XrdOucEnv envP = 0 
)
virtual

Create a directory.

Parameters
path- Pointer to the path of the directory to be created.
mode- The directory mode setting.
mkpath- When true the path is created if it does not exist.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 366 of file XrdOssApi.cc.

367 {
368  char actual_path[MAXPATHLEN+1], *local_path;
369  int retc;
370 
371 // Make sure we can modify this path
372 //
373  Check_RW(Mkdir, path, "create directory");
374 
375 // Generate local path
376 //
377  if (lcl_N2N)
378  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
379  return retc;
380  else local_path = actual_path;
381  else local_path = (char *)path;
382 
383 // Create the directory or full path only in the loal file system
384 //
385  if (!mkdir(local_path, mode)) return XrdOssOK;
386  if (mkpath && errno == ENOENT){return Mkpath(local_path, mode);}
387  if (errno != EEXIST) return -errno;
388 
389 // Check if this is a duplicate request
390 //
391  struct stat Stat;
392  static const mode_t accBits = (S_IRWXU|S_IRWXG|S_IRWXO);
393 
394  if (!stat(local_path, &Stat) && S_ISDIR(Stat.st_mode)
395  && mode == (Stat.st_mode & accBits)) return XrdOssOK;
396  return -EEXIST;
397 }
#define Check_RW(act, path, opname)
Definition: XrdOssApi.hh:399
int mkdir(const char *path, mode_t mode)
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0)
Definition: XrdOssApi.cc:366
int Mkpath(const char *, mode_t mode)
Definition: XrdOssApi.cc:413

References Check_RW, lcl_N2N, XrdOucName2Name::lfn2pfn(), mkdir(), Mkpath(), stat, Stat(), and XrdOssOK.

+ Here is the call graph for this function:

◆ Mkpath()

int XrdOssSys::Mkpath ( const char *  path,
mode_t  mode 
)

Definition at line 413 of file XrdOssApi.cc.

414 {
415  char local_path[MAXPATHLEN+1], *next_path;
416  int i = strlen(path);
417 
418 // Copy the path so we can modify it
419 //
420  strcpy(local_path, path);
421 
422 // Trim off the trailing slashes so we can have predictable behaviour
423 //
424  while(i && local_path[--i] == '/') local_path[i] = '\0';
425  if (!i) return -ENOENT;
426 
427 // Start creating directories starting with the root
428 //
429  next_path = local_path;
430  while((next_path = index(next_path+1, int('/'))))
431  {*next_path = '\0';
432  if (mkdir(local_path, mode) && errno != EEXIST) return -errno;
433  *next_path = '/';
434  }
435 
436 // Create last component and return
437 //
438  if (mkdir(local_path, mode) && errno != EEXIST) return -errno;
439  return XrdOssOK;
440 }

References mkdir(), and XrdOssOK.

Referenced by Mkdir().

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

◆ MSS_Closedir()

int XrdOssSys::MSS_Closedir ( void *  dir_handle)

Definition at line 185 of file XrdOssMSS.cc.

185  {
186 /*
187  Function: Close the directory associated with handle "dir_handle".
188 
189  Input: dir_handle - The handle returned by opendir().
190 
191  Output: Returns 0 upon success and (-errno) upon failure.
192 */
193  const char *epname = "MSS_Closedir";
194  struct XrdOssHandle *oh = (struct XrdOssHandle *)dir_handle;
195 
196  if ( !(oh->hflag & XRDOSS_HT_DIR) )
197  {OssEroute.Emsg(epname, "invalid mss handle"); return -EBADF;}
198  delete oh;
199  return XrdOssOK;
200 }
#define XRDOSS_HT_DIR
Definition: XrdOssMSS.cc:92
XrdSysError OssEroute

References XrdSysError::Emsg(), XrdOssHandle::hflag, OssEroute, XRDOSS_HT_DIR, and XrdOssOK.

Referenced by XrdOssDir::Close().

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

◆ MSS_Create()

int XrdOssSys::MSS_Create ( const char *  path,
mode_t  file_mode,
XrdOucEnv env 
)

Definition at line 206 of file XrdOssMSS.cc.

218 {
219  const char *epname = "MSS_Create";
220  char myMode[16];
221 
222  // Make sure the path is not too long.
223  //
224  if (strlen(path) > MAXPATHLEN)
225  {OssEroute.Emsg(epname, "mss path too long - ", path);
226  return -ENAMETOOLONG;
227  }
228 
229  // Construct the cmd to create the file. We currently don't support cosid.
230  //
231  sprintf(myMode, "%o", static_cast<int>(file_mode));
232 
233  // Create the file in in the mass store system
234  //
235  return MSS_Xeq(0, 0, "create", path, myMode);
236 }
int MSS_Xeq(XrdOucStream **xfd, int okerr, const char *cmd, const char *arg1=0, const char *arg2=0)
Definition: XrdOssMSS.cc:383

References XrdSysError::Emsg(), MSS_Xeq(), and OssEroute.

Referenced by Create().

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

◆ MSS_Opendir()

void * XrdOssSys::MSS_Opendir ( const char *  dir_path,
int &  rc 
)

Definition at line 102 of file XrdOssMSS.cc.

102  {
103 /*
104  Function: Open the directory `path' and prepare for reading.
105 
106  Input: path - The fully qualified name of the directory to open.
107 
108  Output: Returns a directory handle to be used for subsequent
109  operations. If an error occurs, (-errno) is returned.
110 */
111  const char *epname = "MSS_Opendir";
112  struct XrdOssHandle *oh;
113  XrdOucStream *sp;
114 
115  // Make sure the path is not too long.
116  //
117  if (strlen(dir_path) > MAXPATHLEN)
118  {OssEroute.Emsg(epname, "mss path too long - ", dir_path);
119  rc = -ENAMETOOLONG;
120  return (void *)0;
121  }
122 
123  // Issue it now to trap any errors but defer reading the result until
124  // readdir() is called. This does tie up a process, sigh.
125  //
126  if ( (rc = MSS_Xeq(&sp, ENOENT, "dlist", dir_path)))
127  return (void *)0;
128 
129  // Allocate storage for the handle and return a copy of it.
130  //
131  if (!(oh = new XrdOssHandle(XRDOSS_HT_DIR, sp)))
132  {delete sp; rc = -ENOMEM; return (void *)0;}
133  return (void *)oh;
134 }
XrdOssHandle(int type, XrdOucStream *newsp=0)
Definition: XrdOssMSS.cc:86
XrdOucStream * sp
Definition: XrdOssMSS.cc:84

References XrdOssHandle::XrdOssHandle(), XrdSysError::Emsg(), MSS_Xeq(), OssEroute, XrdOssHandle::sp, and XRDOSS_HT_DIR.

Referenced by XrdOssDir::Opendir().

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

◆ MSS_Readdir()

int XrdOssSys::MSS_Readdir ( void *  fd,
char *  buff,
int  blen 
)

Definition at line 140 of file XrdOssMSS.cc.

140  {
141 /*
142  Function: Read the next entry if directory 'dir_handle'.
143 
144  Input: dir_handle - The value returned by a successful opendir() call.
145  buff - Buffer to hold directory name.
146  blen - Size of the buffer.
147 
148  Output: Upon success, places the contents of the next directory entry
149  in buff. When the end of the directory is encountered buff
150  will be set to a null string.
151 
152  Upon failure, returns a (-errno).
153 */
154  const char *epname = "MSS_Readdir";
155  int retc;
156  struct XrdOssHandle *oh = (struct XrdOssHandle *)dir_handle;
157  char *resp;
158 
159  // Verify that the handle is correct.
160  //
161  if ( !(oh->hflag & XRDOSS_HT_DIR) )
162  {OssEroute.Emsg(epname, "invalid mss handle"); return -EBADF;}
163 
164  // Read a record from the directory, if possible.
165  //
166  if (oh->hflag & XRDOSS_HT_EOF) *buff = '\0';
167  else if ((resp = oh->sp->GetLine()))
168  {if ( ((int)strlen(resp)) >= blen )
169  {*buff = '\0';
170  return OssEroute.Emsg(epname, -EOVERFLOW,
171  "readdir rmt", resp);
172  }
173  strlcpy(buff, resp, blen);
174  } else {
175  if ((retc = oh->sp->LastError())) return NegVal(retc);
176  else {*buff = '\0'; oh->hflag |= XRDOSS_HT_EOF;}
177  }
178  return XrdOssOK;
179 }
#define NegVal(x)
Definition: XrdOssMSS.cc:72
#define XRDOSS_HT_EOF
Definition: XrdOssMSS.cc:91
char * GetLine()

References XrdSysError::Emsg(), XrdOucStream::GetLine(), XrdOssHandle::hflag, XrdOucStream::LastError(), NegVal, OssEroute, XrdOssHandle::sp, strlcpy(), XRDOSS_HT_DIR, XRDOSS_HT_EOF, and XrdOssOK.

Referenced by XrdOssDir::Readdir().

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

◆ MSS_Remdir()

int XrdOssSys::MSS_Remdir ( const char *  ,
const char *   
)
inline

Definition at line 217 of file XrdOssApi.hh.

217 {return -ENOTSUP;}

◆ MSS_Rename()

int XrdOssSys::MSS_Rename ( const char *  oldname,
const char *  newname 
)

Definition at line 360 of file XrdOssMSS.cc.

360  {
361  const char *epname = "MSS_Rename";
362 
363  // Make sure the path is not too long.
364  //
365  if (strlen(oldname) > MAXPATHLEN
366  || strlen(newname) > MAXPATHLEN)
367  {OssEroute.Emsg(epname,"mss path too long - ", oldname, newname);
368  return -ENAMETOOLONG;
369  }
370 
371  // Rename the file in Mass Store System
372  //
373  return MSS_Xeq(0, 0, "mv", oldname, newname);
374 }

References XrdSysError::Emsg(), MSS_Xeq(), and OssEroute.

Referenced by Rename().

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

◆ MSS_Stat()

int XrdOssSys::MSS_Stat ( const char *  path,
struct stat buff = 0 
)

Definition at line 253 of file XrdOssMSS.cc.

254 {
255  const char *epname = "MSS_Stat";
256  char ftype, mtype[10], *resp;
257  int retc, xt_nlink;
258  long xt_uid, xt_gid, atime, ctime, mtime, xt_blksize, xt_blocks;
259  long long xt_size;
260  XrdOucStream *sfd;
261 
262  // Make sure the path is not too long.
263  //
264  if (strlen(path) > MAXPATHLEN)
265  {OssEroute.Emsg(epname, "mss path too long - ", path);
266  return -ENAMETOOLONG;
267  }
268 
269  // Issue the command. This may be an immediate exists a or full statx.
270  //
271  if (!buff) return MSS_Xeq(0, ENOENT, (isMSSC ? "statx" : "exists"), path);
272  if ((retc = MSS_Xeq(&sfd, ENOENT, "statx", path))) return retc;
273 
274  // Read in the results.
275  //
276  if ( !(resp = sfd ->GetLine()))
277  return OssEroute.Emsg(epname,-XRDOSS_E8012,"process ",path);
278 
279  // Extract data from the response.
280  //
281  sscanf(resp, "%c %9s %d %ld %ld %ld %ld %ld %lld %ld %ld", &ftype, mtype,
282  &xt_nlink, &xt_uid, &xt_gid, &atime, &ctime, &mtime,
283  &xt_size, &xt_blksize, &xt_blocks);
284 
285  // Set the stat buffer, appropriately.
286  //
287  memset( (char *)buff, 0, sizeof(struct stat) );
288  buff->st_nlink = static_cast<nlink_t>(xt_nlink);
289  buff->st_uid = static_cast<uid_t>(xt_uid);
290  buff->st_gid = static_cast<gid_t>(xt_gid);
291  buff->st_atime = static_cast<time_t>(atime);
292  buff->st_ctime = static_cast<time_t>(ctime);
293  buff->st_mtime = static_cast<time_t>(mtime);
294  buff->st_size = static_cast<off_t>(xt_size);
295  buff->st_blksize=static_cast<long>(xt_blksize);
296 #ifdef __APPLE__
297  buff->st_blocks = xt_blocks;
298 #else
299  buff->st_blocks =static_cast<blkcnt_t>(xt_blocks);
300 #endif
301 
302  if (ftype == 'd') buff->st_mode |= S_IFDIR;
303  else if (ftype == 'l') buff->st_mode |= S_IFLNK;
304  else buff->st_mode |= S_IFREG;
305 
306  buff->st_mode |= tranmode(&mtype[0]) << 6;
307  buff->st_mode |= tranmode(&mtype[3]) << 3;
308  buff->st_mode |= tranmode(&mtype[6]);
309 
310  delete sfd;
311  return 0;
312 }
#define XRDOSS_E8012
Definition: XrdOssError.hh:46
int tranmode(char *)
Definition: XrdOssMSS.cc:314

References XrdSysError::Emsg(), isMSSC, MSS_Xeq(), OssEroute, stat, tranmode(), and XRDOSS_E8012.

Referenced by Create(), Stage_RT(), and Stat().

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

◆ MSS_Unlink()

int XrdOssSys::MSS_Unlink ( const char *  path)

Definition at line 333 of file XrdOssMSS.cc.

333  {
334  const char *epname = "MSS_Unlink";
335 
336  // Make sure the path is not too long.
337  //
338  if (strlen(path) > MAXPATHLEN)
339  {OssEroute.Emsg(epname, "mss path too long - ", path);
340  return -ENAMETOOLONG;
341  }
342 
343  // Remove the file in Mass Store System.
344  //
345  return MSS_Xeq(0, ENOENT, "rm", path);
346 }

References XrdSysError::Emsg(), MSS_Xeq(), and OssEroute.

Referenced by Unlink().

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

◆ MSS_Xeq()

int XrdOssSys::MSS_Xeq ( XrdOucStream **  xfd,
int  okerr,
const char *  cmd,
const char *  arg1 = 0,
const char *  arg2 = 0 
)
protected

Definition at line 383 of file XrdOssMSS.cc.

385 {
386  EPNAME("MSS_Xeq")
387  static int NoResp = 0;
388  char *resp;
389  int retc;
390  XrdOucStream *sp;
391 
392 // If we have no gateway command, return an error
393 //
394  if (!RSSProg) return -XRDOSS_E8013;
395 
396 // Allocate a stream for this command
397 //
398  if (!(sp = new XrdOucStream(&OssEroute)))
399  return OssEroute.Emsg("MSS_Xeq",-ENOMEM,"create stream for",RSSCmd);
400 
401 // Run the command
402 //
403  DEBUG("Invoking '" <<RSSCmd <<' ' <<cmd <<' ' <<(arg1 ? arg1 : "")
404  <<' ' <<(arg2 ? arg2 : ""));
405  if ((retc = RSSProg->Run(sp, cmd, arg1, arg2)))
406  {delete sp; return NegVal(retc);}
407 
408 // Wait for data to appear. We do this to avoid hanging up and chewing through
409 // all of the threads while clients retry the requests with a new connection.
410 //
411  if ((retc = sp->Wait4Data(RSSTout)))
412  {if (retc < 0)
413  {if (!(0xff & NoResp++))
414  OssEroute.Emsg("MSS_Xeq", -ETIMEDOUT, "execute", cmd);
415  retc = ETIMEDOUT;
416  }
417  delete sp; return NegVal(retc);
418  }
419 
420 // Read back the first record. The first records must be the return code
421 // from the command followed by any output. Make sure that this is the case.
422 //
423  if ( !(resp = sp->GetLine()) ) retc = XRDOSS_E8023;
424  else
425  {DEBUG("received '" <<resp <<"'");
426  if (sscanf(resp, "%d", &retc) <= 0) retc = XRDOSS_E8024;
427  }
428  if (retc)
429  {if (retc != -okerr)
430  OssEroute.Emsg("MSS_Xeq", NegVal(retc), "execute", cmd);
431  delete sp;
432  return NegVal(retc);
433  }
434 
435 // If the caller wants the stream pointer; return it. Otherwise close it.
436 //
437  if (xfd) *xfd = sp;
438  else delete sp;
439  return 0;
440 }
#define XRDOSS_E8013
Definition: XrdOssError.hh:47
#define XRDOSS_E8023
Definition: XrdOssError.hh:57
#define XRDOSS_E8024
Definition: XrdOssError.hh:58

References DEBUG, XrdSysError::Emsg(), EPNAME, XrdOucStream::GetLine(), NegVal, OssEroute, RSSCmd, RSSProg, RSSTout, XrdOucProg::Run(), XrdOssHandle::sp, XrdOucStream::Wait4Data(), XRDOSS_E8013, XRDOSS_E8023, and XRDOSS_E8024.

Referenced by MSS_Create(), MSS_Opendir(), MSS_Rename(), MSS_Stat(), and MSS_Unlink().

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

◆ newDir()

virtual XrdOssDF* XrdOssSys::newDir ( const char *  tident)
inlinevirtual

Obtain a new director object to be used for future directory requests.

Parameters
tident- The trace identifier.
Returns
pointer- Pointer to an XrdOssDF object.
nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 163 of file XrdOssApi.hh.

164  {return (XrdOssDF *)new XrdOssDir(tident);}

References tident.

◆ newFile()

virtual XrdOssDF* XrdOssSys::newFile ( const char *  tident)
inlinevirtual

Obtain a new file object to be used for a future file requests.

Parameters
tident- The trace identifier.
Returns
pointer- Pointer to an XrdOssDF object.
nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 165 of file XrdOssApi.hh.

166  {return (XrdOssDF *)new XrdOssFile(tident);}

References tident.

◆ PathOpts()

unsigned long long XrdOssSys::PathOpts ( const char *  path)
inline

Definition at line 184 of file XrdOssApi.hh.

184 {return RPList.Find(path);}

References XrdOucPListAnchor::Find(), and RPList.

Referenced by XrdOssFile::Open(), XrdOssDir::Opendir(), Stat(), StatFS(), and StatXP().

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

◆ Reloc()

int XrdOssSys::Reloc ( const char *  tident,
const char *  path,
const char *  cgName,
const char *  anchor = 0 
)
virtual

Relocate/Copy the file at ‘path’ to a new location.

Parameters
tident- -> trace identifier for this operation.
path- -> fully qualified name of the file to relocate.
cgName- -> target space name[:path]
anchor- Processing directions (see XrdOssReloc.cc example).
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 83 of file XrdOssReloc.cc.

85 {
86  EPNAME("Reloc")
87  const int AMode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH; // 775
88  class pendFiles
89  {public:
90  char *pbuff;
91  char *tbuff;
92  int datfd;
93  pendFiles(char *pb, char *tb) : datfd(-1)
94  {pbuff = pb; *pb = '\0';
95  tbuff = tb; *tb = '\0';
96  }
97  ~pendFiles() {if (datfd >= 0) close(datfd);
98  if (pbuff && *pbuff) unlink(pbuff);
99  if (tbuff && *tbuff) unlink(tbuff);
100  }
101  };
102  char cgNow[XrdOssSpace::minSNbsz], cgbuff[XrdOssSpace::minSNbsz];
103  char lbuff[MAXPATHLEN+8];
104  char pbuff[MAXPATHLEN+8];
105  char tbuff[MAXPATHLEN+8];
106  char local_path[MAXPATHLEN+8];
107  pendFiles PF(pbuff, tbuff);
108  XrdOssCache::allocInfo aInfo(path, pbuff, sizeof(pbuff));
109  int rc, lblen, datfd, Pure = (anchor && !strcmp(anchor, "."));
110  off_t rc_c;
111  struct stat buf;
112 
113 // Generate the actual local path for this file.
114 //
115  if (Pure) {strcpy(local_path, path); anchor = 0;}
116  else if ((rc = GenLocalPath(path, local_path))) return rc;
117 
118 // Determine the state of the file.
119 //
120  if (stat(local_path, &buf)) return -errno;
121  if ((buf.st_mode & S_IFMT) == S_IFDIR) return -EISDIR;
122  if ((buf.st_mode & S_IFMT) != S_IFREG) return -ENOTBLK;
123 
124 // Get the correct cache group and partition path
125 //
126  if ((aInfo.cgPath = XrdOssCache::Parse(cgName, cgbuff, sizeof(cgbuff))))
127  aInfo.cgPlen = strlen(aInfo.cgPath);
128 
129 // Verify that this file will go someplace other than where it is now
130 //
131  lblen = XrdOssPath::getCname(local_path, cgNow, lbuff, sizeof(lbuff)-7);
132  lbuff[lblen] = '\0';
133  if (!Pure && !strcmp(cgbuff, cgNow)
134  && (!aInfo.cgPath || !strncmp(aInfo.cgPath, lbuff, aInfo.cgPlen)))
135  return -EEXIST;
136 
137 // Allocate space in the cache. Note that the target must be an xa cache
138 //
139  aInfo.aMode = buf.st_mode & S_IAMB;
140  aInfo.cgSize = (Pure ? 0 : buf.st_size);
141  aInfo.cgName = cgbuff;
142  if ((PF.datfd = datfd = XrdOssCache::Alloc(aInfo)) < 0) return datfd;
143  if (!aInfo.cgPsfx) return -ENOTSUP;
144 
145 // Copy the original file to the new location. Copy() always closes the fd.
146 //
147  PF.datfd = -1;
148  if ((rc_c = XrdOssCopy::Copy(local_path, pbuff, datfd)) < 0) return (int)rc_c;
149 
150 // If the file is to be merely copied, substitute the desired destination
151 //
152  if (!anchor) {strcpy(tbuff, local_path); strcat(tbuff, ".anew");}
153  else {struct stat sbuf;
154  char *Slash;
155  if (strlen(anchor)+strlen(path) >= sizeof(local_path))
156  return -ENAMETOOLONG;
157  strcpy(local_path, anchor); strcat(local_path, path);
158  if (!(Slash = rindex(local_path, '/'))) return -ENOTDIR;
159  *Slash = '\0'; rc = stat(local_path, &sbuf); *Slash = '/';
160  if (rc && (rc = XrdOucUtils::makePath(local_path, AMode)))
161  return rc;
162  strcpy(tbuff, local_path);
163  }
164 
165 // Now create a symbolic link to the target
166 //
167  if ((symlink(pbuff, tbuff) && errno != EEXIST)
168  || unlink(tbuff) || symlink(pbuff, tbuff)) return -errno;
169 
170 // Rename the link atomically over the existing name
171 //
172  if (!anchor && rename(tbuff, local_path) < 0) return -errno;
173  PF.tbuff = 0; PF.pbuff = 0; rc = 0;
174 
175 // Issue warning if the pfn file could not be created (very very rare).
176 // At this point we can't do much about it.
177 //
178  if (rc) OssEroute.Emsg("Reloc", rc, "create symlink", pbuff);
179  *(aInfo.cgPsfx) = '\0';
180 
181 // If this was a copy operation, we are done
182 //
183  DEBUG(cgNow <<':' <<local_path <<" -> " <<aInfo.cgName <<':' <<pbuff);
184  if (anchor) return XrdOssOK;
185 
186 // Check if the original file was a symlink and that has to be deleted
187 // Adjust the space usage numbers at this point as well.
188 //
189  if (*lbuff)
190  {if (unlink(lbuff)) OssEroute.Emsg("Reloc",errno,"removing",lbuff);
191  XrdOssCache::Adjust(XrdOssCache::Find(lbuff, lblen), -buf.st_size);
192  } else XrdOssCache::Adjust(buf.st_dev, -buf.st_size);
193 
194 // All done (permanently adjust usage for the target)
195 //
196  XrdOssCache::Adjust(aInfo.cgFSp, buf.st_size);
197  return XrdOssOK;
198 }
#define S_IAMB
Definition: XrdConfig.cc:163
XrdSysError OssEroute
int rename(const char *oldpath, const char *newpath)
static off_t Copy(const char *inFn, const char *outFn, int outFD)
Definition: XrdOssCopy.cc:59
static const int minSNbsz
Definition: XrdOssSpace.hh:45

References XrdOssCache::Adjust(), XrdOssCache::Alloc(), XrdOssCache::allocInfo::aMode, XrdOssCache::allocInfo::cgFSp, XrdOssCache::allocInfo::cgName, XrdOssCache::allocInfo::cgPath, XrdOssCache::allocInfo::cgPlen, XrdOssCache::allocInfo::cgPsfx, XrdOssCache::allocInfo::cgSize, close, XrdOssCopy::Copy(), DEBUG, XrdSysError::Emsg(), EPNAME, XrdOssCache::Find(), GenLocalPath(), XrdOssPath::getCname(), XrdOucUtils::makePath(), XrdOssSpace::minSNbsz, OssEroute, XrdOssCache::Parse(), rename(), S_IAMB, stat, unlink, and XrdOssOK.

+ Here is the call graph for this function:

◆ Remdir()

int XrdOssSys::Remdir ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
virtual

Remove a directory.

Parameters
path- Pointer to the path of the directory to be removed.
Opts- The processing options: XRDOSS_Online - only remove online copy XRDOSS_isPFN - path is already translated.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 70 of file XrdOssUnlink.cc.

71 {
72  unsigned long long opts;
73  int retc;
74  struct stat statbuff;
75  char local_path[MAXPATHLEN+1+8];
76 
77 // Build the right local and remote paths.
78 //
79  if (Opts & XRDOSS_isPFN) strcpy(local_path, path);
80  else {retc = Check_RO(Unlink, opts, path, "remove");
81  if ( (retc = GenLocalPath( path, local_path))) return retc;
82  }
83 
84 // Check if this path is really a directory
85 //
86  if (lstat(local_path, &statbuff)) return (errno == ENOENT ? 0 : -errno);
87  if ((statbuff.st_mode & S_IFMT) != S_IFDIR) return -ENOTDIR;
88 
89 // Complete by calling Unlink()
90 //
91  return Unlink(path, Opts);
92 }
#define XRDOSS_isPFN
Definition: XrdOss.hh:530
struct myOpts opts
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0)

References Check_RO, GenLocalPath(), lstat, XrdMpx::Opts, opts, stat, Unlink(), and XRDOSS_isPFN.

+ Here is the call graph for this function:

◆ Rename()

int XrdOssSys::Rename ( const char *  oPath,
const char *  nPath,
XrdOucEnv oEnvP = 0,
XrdOucEnv nEnvP = 0 
)
virtual

Rename a file or directory.

Parameters
oPath- Pointer to the path to be renamed.
nPath- Pointer to the path oPath is to have.
oEnvP- Environmental information for oPath.
nEnvP- Environmental information for nPath.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 74 of file XrdOssRename.cc.

76 {
77  EPNAME("Rename")
78  static const mode_t pMode = S_IRWXU | S_IRWXG;
79  unsigned long long remotefs_Old, remotefs_New, remotefs;
80  unsigned long long old_popts, new_popts;
81  int retc2, retc = XrdOssOK;
82  struct stat statbuff;
83  char *slashPlus, sPChar;
84  char local_path_Old[MAXPATHLEN+8];
85  char local_path_New[MAXPATHLEN+8];
86  char remote_path_Old[MAXPATHLEN+1];
87  char remote_path_New[MAXPATHLEN+1];
88 
89 // Determine whether we can actually rename a file on this server.
90 //
91  remotefs_Old = Check_RO(Rename, old_popts, oldname, "rename");
92  remotefs_New = Check_RO(Rename, new_popts, newname, "rename to");
93 
94 // Make sure we are renaming within compatible file systems
95 //
96  if (remotefs_Old ^ remotefs_New
97  || ((old_popts & XRDEXP_MIG) ^ (new_popts & XRDEXP_MIG)))
98  {char buff[MAXPATHLEN+128];
99  snprintf(buff, sizeof(buff), "rename %s to ", oldname);
100  return OssEroute.Emsg("Rename",-XRDOSS_E8011,buff,(char *)newname);
101  }
102  remotefs = remotefs_Old | remotefs_New;
103 
104 // Construct the filename that we will be dealing with.
105 //
106  if ( (retc = GenLocalPath( oldname, local_path_Old))
107  || (retc = GenLocalPath( newname, local_path_New)) ) return retc;
108  if (remotefs
109  && (((retc = GenRemotePath(oldname, remote_path_Old))
110  || (retc = GenRemotePath(newname, remote_path_New)))) ) return retc;
111 
112 // If on a remote FS or symlink, make sure that the target path does not exist
113 //
114  if (!(retc2 = lstat(local_path_New, &statbuff)))
115  { if (remotefs || (statbuff.st_mode & S_IFMT) == S_IFLNK) return -EEXIST;
116  }
117 
118 // We need to create the directory path if it does not exist.
119 //
120  if (!(slashPlus = rindex(local_path_New, '/'))) return -EINVAL;
121  slashPlus++; sPChar = *slashPlus; *slashPlus = '\0';
122  retc2 = XrdOucUtils::makePath(local_path_New, pMode);
123  *slashPlus = sPChar;
124  if (retc2) return retc2;
125 
126 // Check if this path is really a symbolic link elsewhere
127 //
128  if (lstat(local_path_Old, &statbuff)) retc = -errno;
129  else if ((statbuff.st_mode & S_IFMT) == S_IFLNK)
130  retc = RenameLink(local_path_Old, local_path_New);
131  else if (rename(local_path_Old, local_path_New)) retc = -errno;
132  DEBUG("lcl rc=" <<retc <<" op=" <<local_path_Old <<" np=" <<local_path_New);
133 
134 // Now rename the data file in the remote system if the local rename "worked".
135 // Do not do this if we really should not use the MSS.
136 //
137  if (remotefs)
138  {if (remotefs && (!retc || retc == -ENOENT) && RSSCmd)
139  {if ( (retc2 = MSS_Rename(remote_path_Old, remote_path_New))
140  != -ENOENT) retc = retc2;
141  DEBUG("rmt rc=" <<retc2 <<" op=" <<remote_path_Old <<" np=" <<remote_path_New);
142  }
143  }
144 
145 // All done.
146 //
147  return retc;
148 }
#define XRDOSS_E8011
Definition: XrdOssError.hh:45
XrdSysError OssEroute
int MSS_Rename(const char *, const char *)
Definition: XrdOssMSS.cc:360
int Rename(const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0)
Definition: XrdOssRename.cc:74
int RenameLink(char *old_path, char *new_path)
static INT to(const char *buffer)
Definition: XrdZipUtils.hh:91

References Check_RO, DEBUG, XrdSysError::Emsg(), EPNAME, GenLocalPath(), GenRemotePath(), lstat, XrdOucUtils::makePath(), MSS_Rename(), OssEroute, rename(), RenameLink(), RSSCmd, stat, XRDEXP_MIG, XRDOSS_E8011, and XrdOssOK.

+ Here is the call graph for this function:

◆ RenameLink()

int XrdOssSys::RenameLink ( char *  old_path,
char *  new_path 
)
protected

Definition at line 157 of file XrdOssRename.cc.

158 {
159  struct stat statbuff;
160  char oldlnk[MAXPATHLEN+32], newlnk[MAXPATHLEN+32];
161  int lnklen, n, rc = 0;
162 
163 // Read the contents of the link
164 //
165  if ((lnklen = readlink(old_path,oldlnk,sizeof(oldlnk)-1)) < 0) return -errno;
166  oldlnk[lnklen] = '\0';
167 
168 // Check if this is new or old style cache. Check if this is an offline rename
169 // and if so, add the space to the usage to account for stage-ins
170 //
171  if (oldlnk[lnklen-1] == XrdOssPath::xChar)
172  {rc = RenameLink3(oldlnk, old_path, new_path);
173  if (rc) return rc;
174  if (Solitary && UDir)
175  {n = strlen(old_path);
176  if (n < 6 || strcmp(old_path+n-5, ".anew")
177  || stat(new_path, &statbuff) || !statbuff.st_size) return 0;
178  XrdOssPath::Trim2Base(oldlnk+lnklen-1);
179  XrdOssCache::Adjust(oldlnk, statbuff.st_size);
180  }
181  return 0;
182  }
183 
184 // Convert old name to the new name
185 //
186  if ((rc = XrdOssPath::Convert(newlnk, sizeof(newlnk), oldlnk, new_path)))
187  {OssEroute.Emsg("RenameLink", rc, "convert", oldlnk);
188  return rc;
189  }
190 
191 // Make sure that the target name does not exist
192 //
193  if (!lstat(newlnk, &statbuff))
194  {OssEroute.Emsg("RenameLink",-EEXIST,"check new target", newlnk);
195  return -EEXIST;
196  }
197 
198 // Insert a new link in the target cache
199 //
200  if (symlink(newlnk, new_path))
201  {rc = errno;
202  OssEroute.Emsg("RenameLink", rc, "symlink to", newlnk);
203  return -rc;
204  }
205 
206 // Rename the actual target file
207 //
208  if (rename(oldlnk, newlnk))
209  {rc = errno;
210  OssEroute.Emsg("RenameLink", rc, "rename", oldlnk);
211  unlink(new_path);
212  return -rc;
213  }
214 
215 // Now, unlink the source path
216 //
217  if (unlink(old_path))
218  OssEroute.Emsg("RenameLink", rc, "unlink", old_path);
219 
220 // All done
221 //
222  return 0;
223 }
static int Convert(char *dst, int dln, const char *oldP, const char *newP)
Definition: XrdOssPath.cc:75
int RenameLink3(char *cPath, char *old_path, char *new_path)

References XrdOssCache::Adjust(), XrdOssPath::Convert(), XrdSysError::Emsg(), lstat, OssEroute, rename(), RenameLink3(), Solitary, stat, XrdOssPath::Trim2Base(), UDir, unlink, and XrdOssPath::xChar.

Referenced by Rename().

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

◆ RenameLink3()

int XrdOssSys::RenameLink3 ( char *  cPath,
char *  old_path,
char *  new_path 
)
protected

Definition at line 229 of file XrdOssRename.cc.

230 {
231  int rc;
232 
233 // First set the new extended attribute on this file
234 //
235  if ((rc = XrdSysFAttr::Xat->Set(XrdFrcXAttrPfn::Name(), new_path,
236  strlen(new_path)+1, cPath))) return rc;
237 
238 // Now merely rename the old to the new
239 //
240  if (!rename(old_path, new_path)) return 0;
241 
242 // Rename failed, restore old attribute
243 //
244  rc = -errno;
245  XrdSysFAttr::Xat->Set(XrdFrcXAttrPfn::Name(),old_path,strlen(old_path)+1,cPath);
246  OssEroute.Emsg("RenameLink", rc, "rename", old_path);
247  return rc;
248 }

References XrdSysError::Emsg(), XrdFrcXAttrPfn::Name(), OssEroute, rename(), XrdSysXAttr::Set(), and XrdSysFAttr::Xat.

Referenced by RenameLink().

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

◆ SetFattr()

int XrdOssSys::SetFattr ( XrdOssCreateInfo crInfo,
int  datfd,
time_t  mtime 
)
protected

Definition at line 332 of file XrdOssCreate.cc.

333 {
334  class fdCloser
335  {public:
336  const char *Path;
337  int theFD;
338  int Done(int rc) {if (rc) unlink(Path); return rc;}
339  fdCloser(const char *pn, int fd) : Path(pn), theFD(fd) {}
340  ~fdCloser() {close(theFD);}
341  } Act(crInfo.Path, fd);
342 
344  int rc;
345 
346 // Check if we need or can record the create time
347 //
348  if (!(XRDEXP_MIGPRG & crInfo.pOpts)
349  || (crInfo.pOpts & XRDEXP_NOXATTR)) return Act.Done(0);
350 
351 // Set copy time
352 //
353  crX.Attr.cpyTime = static_cast<long long>(mtime);
354  rc = crX.Set(crInfo.Path, fd);
355 
356 // Check if extended attribute were set and indicate whether it is supported
357 //
358  if (rc == -ENOTSUP) {rc = 0; crInfo.cOpts |= XRDOSS_setnoxa;}
359  return Act.Done(rc);
360 }
#define XRDEXP_MIGPRG
Definition: XrdOucExport.hh:86
long long cpyTime
Definition: XrdFrcXAttr.hh:55
int Set(const char *Path, int fd=-1)
Definition: XrdOucXAttr.hh:139

References XrdOucXAttr< T >::Attr, close, XrdOssCreateInfo::cOpts, XrdFrcXAttrCpy::cpyTime, XrdOssCreateInfo::Path, Path, XrdOssCreateInfo::pOpts, XrdOucXAttr< T >::Set(), unlink, XRDEXP_MIGPRG, XRDEXP_NOXATTR, and XRDOSS_setnoxa.

Referenced by Alloc_Cache(), Alloc_Local(), and Create().

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

◆ Stage()

int XrdOssSys::Stage ( const char *  Tid,
const char *  fn,
XrdOucEnv env,
int  Oflag,
mode_t  Mode,
unsigned long long  Popts 
)
virtual

Definition at line 110 of file XrdOssStage.cc.

112 {
113 // Use the appropriate method here: queued staging or real-time staging
114 //
115  return (StageRealTime ? Stage_RT(Tid, fn, env, Popts)
116  : Stage_QT(Tid, fn, env, Oflag, Mode));
117 }
int Mode
int Stage_RT(const char *, const char *, XrdOucEnv &, unsigned long long)
Definition: XrdOssStage.cc:206
int Stage_QT(const char *, const char *, XrdOucEnv &, int, mode_t)
Definition: XrdOssStage.cc:123

References Mode, Stage_QT(), Stage_RT(), and StageRealTime.

Referenced by Create(), and XrdOssFile::Open().

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

◆ Stage_In()

void * XrdOssSys::Stage_In ( void *  carg)

Definition at line 303 of file XrdOssStage.cc.

304 {
306  XrdOssStage_Req *req;
307  int rc, alldone = 0;
308  time_t etime;
309 
310  // Wait until something shows up in the ready queue and process
311  //
313 
314  // Obtain exclusive control over the queues
315  //
317 
318  // Check if we really have something in the queue
319  //
320  if (XrdOssStage_Req::StageQ.pendList.Singleton())
322  continue;
323  }
324 
325  // Remove the last entry in the queue
326  //
328  req = rnode->Item();
329  rnode->Remove();
330  req->flags |= XRDOSS_REQ_ACTV;
331 
332  // Account for bytes being moved
333  //
334  pndbytes -= req->size;
335  stgbytes += req->size;
336 
337  // Bring in the file (don't hold the stage lock while doing so)
338  //
340  etime = time(0);
341  rc = GetFile(req);
342  etime = time(0) - etime;
344 
345  // Account for resources and adjust xfr rate
346  //
347  stgbytes -= req->size;
348  if (!rc)
349  {if (etime > 1)
350  {xfrspeed=((xfrspeed*(totreqs+1))+(req->size/etime))/(totreqs+1);
351  if (xfrspeed < 512000) xfrspeed = 512000;
352  }
353  totreqs++; // Successful requests
354  totbytes += req->size;
355  delete req;
356  }
357  else {req->flags &= ~XRDOSS_REQ_ACTV;
358  req->flags |= (rc == 2 ? XRDOSS_REQ_ENOF : XRDOSS_REQ_FAIL);
359  req->sigtod = xfrhold + time(0);
360  badreqs++;
361  }
362 
363  // Check if we should continue or be terminated and unlock staging
364  //
365  if ((alldone = (xfrthreads < xfrtcount)))
366  xfrtcount--;
368 
369  } while (!alldone);
370 
371 // Notmally we would never get here
372 //
373  return (void *)0;
374 }
#define XRDOSS_REQ_FAIL
Definition: XrdOssStage.hh:45
#define XRDOSS_REQ_ENOF
Definition: XrdOssStage.hh:46
static XrdSysSemaphore ReadyRequest
Definition: XrdOssStage.hh:64
static XrdOssStage_Req StageQ
Definition: XrdOssStage.hh:65
static XrdSysMutex StageMutex
Definition: XrdOssStage.hh:63
int GetFile(XrdOssStage_Req *req)
Definition: XrdOssStage.cc:433
XrdOucDLlist * Prev()
Definition: XrdOucDLlist.hh:98

References badreqs, XrdOssStage_Req::flags, GetFile(), XrdOucDLlist< T >::Item(), XrdSysMutex::Lock(), XrdOssStage_Req::pendList, pndbytes, XrdOucDLlist< T >::Prev(), XrdOssStage_Req::ReadyRequest, XrdOucDLlist< T >::Remove(), XrdOssStage_Req::sigtod, XrdOssStage_Req::size, XrdOssStage_Req::StageMutex, XrdOssStage_Req::StageQ, stgbytes, totbytes, totreqs, XrdSysMutex::UnLock(), XrdSysSemaphore::Wait(), xfrhold, xfrspeed, xfrtcount, xfrthreads, XRDOSS_REQ_ACTV, XRDOSS_REQ_ENOF, and XRDOSS_REQ_FAIL.

Referenced by XrdOssxfr().

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

◆ Stage_QT()

int XrdOssSys::Stage_QT ( const char *  Tid,
const char *  fn,
XrdOucEnv env,
int  Oflag,
mode_t  Mode 
)
protected

Definition at line 123 of file XrdOssStage.cc.

125 {
126  static XrdOucReqID ReqID;
127  static XrdSysMutex PTMutex;
128  static XrdOucHash<char> PTable;
129  static time_t nextScrub = xfrkeep + time(0);
130  char *Found, *pdata[XrdOucMsubs::maxElem + 2];
131  int pdlen[XrdOucMsubs::maxElem + 2];
132  time_t cTime, mTime, tNow = time(0);
133 
134 // If there is a fail file and the error occurred within the hold time,
135 // fail the request. Otherwise, try it again. This avoids tight loops.
136 //
137  if ((cTime = HasFile(fn, XRDOSS_FAIL_FILE, &mTime))
138  && xfrhold && (tNow - cTime) < xfrhold)
139  return (mTime != 2 ? -XRDOSS_E8009 : -ENOENT);
140 
141 // If enough time has gone by between the last scrub, do it now
142 //
143  if (nextScrub < tNow)
144  {PTMutex.Lock();
145  if (nextScrub < tNow)
146  {PTable.Apply(XrdOssScrubScan, (void *)0);
147  nextScrub = xfrkeep + tNow;
148  }
149  PTMutex.UnLock();
150  }
151 
152 // Check if this file is already being brought in. If so, return calculated
153 // wait time for this file.
154 //
155  PTMutex.Lock();
156  Found = PTable.Add(fn, 0, xfrkeep, Hash_data_is_key);
157  PTMutex.UnLock();
158  if (Found) return CalcTime();
159 
160 // Check if we should use our built-in frm interface
161 //
162  if (StageFrm)
163  {char idbuff[64];
164  ReqID.ID(idbuff, sizeof(idbuff));
165  int n;
166  return (n = StageFrm->Add('+', fn, env.Env(n), Tid, idbuff,
167  StageEvents, StageAction)) ? n : CalcTime();
168  }
169 
170 // If a stagemsg template was not defined; use our default template
171 //
172  if (!StageSnd)
173  {char idbuff[64], usrbuff[512];
174  ReqID.ID(idbuff, sizeof(idbuff));
175  if (!StageFormat)
176  {pdata[0] = (char *)"+ "; pdlen[0] = 2;}
177 else {pdlen[0] = getID(Tid,env,usrbuff,sizeof(usrbuff)); pdata[0] = usrbuff;}
178  pdata[1] = idbuff; pdlen[1] = strlen(idbuff); // Request ID
179  pdata[2] = (char *)" "; pdlen[2] = 1;
180  pdata[3] = StageEvents; pdlen[3] = StageEvSize; // notification
181  pdata[4] = (char *)" "; pdlen[4] = 1;
182  pdata[5] = (char *)"0 "; pdlen[5] = 2; // prty
183  pdata[6] = StageAction; pdlen[6] = StageActLen; // action
184  pdata[7] = (char *)fn; pdlen[7] = strlen(fn);
185  pdata[8] = (char *)"\n"; pdlen[8] = 1;
186  pdata[9] = 0; pdlen[9] = 0;
187  if (StageProg->Feed((const char **)pdata, pdlen)) return -XRDOSS_E8025;
188  } else {
189  XrdOucMsubsInfo Info(Tid, &env, lcl_N2N, fn, 0,
190  Mode, Oflag, StageAction, "n/a");
191  int k = StageSnd->Subs(Info, pdata, pdlen);
192  pdata[k] = (char *)"\n"; pdlen[k++] = 1;
193  pdata[k] = 0; pdlen[k] = 0;
194  if (StageProg->Feed((const char **)pdata, pdlen)) return -XRDOSS_E8025;
195  }
196 
197 // All done
198 //
199  return CalcTime();
200 }
#define XRDOSS_E8025
Definition: XrdOssError.hh:59
int XrdOssScrubScan(const char *key, char *cip, void *xargp)
Definition: XrdOssStage.cc:84
#define XRDOSS_FAIL_FILE
Definition: XrdOssStage.cc:76
@ Hash_data_is_key
Definition: XrdOucHash.hh:52
int Add(char Opc, const char *Lfn, const char *Opq, const char *Usr, const char *Rid, const char *Nop, const char *Pop, int Prty=1)
Definition: XrdFrcProxy.cc:95
time_t HasFile(const char *fn, const char *sfx, time_t *mTime=0)
Definition: XrdOssStage.cc:483
int CalcTime()
Definition: XrdOssStage.cc:384
int getID(const char *, XrdOucEnv &, char *, int)
Definition: XrdOssStage.cc:460
char * Env(int &envlen)
Definition: XrdOucEnv.hh:48
T * Apply(int(*func)(const char *, T *, void *), void *Arg)
Definition: XrdOucHash.icc:102
T * Add(const char *KeyVal, T *KeyData, const int LifeTime=0, XrdOucHash_Options opt=Hash_default)
Definition: XrdOucHash.icc:61
int Subs(XrdOucMsubsInfo &Info, char **Data, int *Dlen)
Definition: XrdOucMsubs.cc:146
static const int maxElem
Definition: XrdOucMsubs.hh:94
int Feed(const char *data[], const int dlen[])
Definition: XrdOucProg.cc:63
char * ID(char *buff, int blen)
Definition: XrdOucReqID.cc:139

References XrdFrcProxy::Add(), XrdOucHash< T >::Add(), XrdOucHash< T >::Apply(), CalcTime(), XrdOucEnv::Env(), XrdOucProg::Feed(), getID(), HasFile(), Hash_data_is_key, XrdOucReqID::ID(), TPC::Info, lcl_N2N, XrdSysMutex::Lock(), XrdOucMsubs::maxElem, Mode, StageAction, StageActLen, StageEvents, StageEvSize, StageFormat, StageFrm, StageProg, StageSnd, XrdOucMsubs::Subs(), XrdSysMutex::UnLock(), xfrhold, xfrkeep, XRDOSS_E8009, XRDOSS_E8025, XRDOSS_FAIL_FILE, and XrdOssScrubScan().

Referenced by Stage().

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

◆ Stage_RT()

int XrdOssSys::Stage_RT ( const char *  Tid,
const char *  fn,
XrdOucEnv env,
unsigned long long  Popts 
)
protected

Definition at line 206 of file XrdOssStage.cc.

208 {
209  extern int XrdOssFind_Prty(XrdOssStage_Req *req, void *carg);
211  XrdOssStage_Req req, *newreq, *oldreq;
212  struct stat statbuff;
213  extern int XrdOssFind_Req(XrdOssStage_Req *req, void *carg);
214  char actual_path[MAXPATHLEN+1], *remote_path;
215  char *val;
216  int rc, prty;
217 
218 // If there is no stagecmd then return an error
219 //
220  if (!StageCmd) return -XRDOSS_E8006;
221 
222 // Set up the minimal new request structure
223 //
224  req.hash = XrdOucHashVal(fn);
225  req.path = strdup(fn);
226 
227 // Check if this file is already being brought in. If it's in the chain but
228 // has an error associated with it. If the error window is still in effect,
229 // check if a fail file exists. If one does exist, fail the request. If it
230 // doesn't exist or if the window has expired, delete the error element and
231 // retry the request. This keeps us from getting into tight loops.
232 //
233  if ((oldreq = XrdOssStage_Req::StageQ.fullList.Apply(XrdOssFind_Req,(void *)&req)))
234  {if (!(oldreq->flags & XRDOSS_REQ_FAIL)) return CalcTime(oldreq);
235  if (oldreq->sigtod > time(0) && HasFile(fn, XRDOSS_FAIL_FILE))
236  return (oldreq->flags & XRDOSS_REQ_ENOF ? -ENOENT : -XRDOSS_E8009);
237  delete oldreq;
238  }
239 
240 // Generate remote path
241 //
242  if (rmt_N2N)
243  if ((rc = rmt_N2N->lfn2rfn(fn, actual_path, sizeof(actual_path))))
244  return rc;
245  else remote_path = actual_path;
246  else remote_path = (char *)fn;
247 
248 // Obtain the size of this file, if possible. Note that an exposure exists in
249 // that a request for the file may come in again before we have the size. This
250 // is ok, it just means that we'll be off in our time estimate
251 //
252  if (Popts & XRDEXP_NOCHECK) statbuff.st_size = 1024*1024*1024;
253  else {StageAccess.UnLock();
254  if ((rc = MSS_Stat(remote_path, &statbuff))) return rc;
255  StageAccess.Lock(&XrdOssStage_Req::StageMutex);
256  }
257 
258 // Create a new request
259 //
260  if (!(newreq = new XrdOssStage_Req(req.hash, fn)))
261  return OssEroute.Emsg("Stage",-ENOMEM,"create req for",fn);
262 
263 // Add this request to the list of requests
264 //
266 
267 // Recalculate the cumalitive pending stage queue and
268 //
269  newreq->size = statbuff.st_size;
270  pndbytes += statbuff.st_size;
271 
272 // Calculate the system priority
273 //
274  if (!(val = env.Get(OSS_SYSPRTY))) prty = OSS_USE_PRTY;
275  else if (XrdOuca2x::a2i(OssEroute,"system prty",val,&prty,0)
276  || prty > OSS_MAX_PRTY) return -XRDOSS_E8010;
277  else prty = prty << 8;
278 
279 // Calculate the user priority
280 //
281  if (OptFlags & XrdOss_USRPRTY && (val = env.Get(OSS_USRPRTY)))
282  {if (XrdOuca2x::a2i(OssEroute,"user prty",val,&rc,0)
283  || rc > OSS_MAX_PRTY) return -XRDOSS_E8010;
284  prty |= rc;
285  }
286 
287 // Queue the request at the right position and signal an xfr thread
288 //
289  if ((oldreq = XrdOssStage_Req::StageQ.pendList.Apply(XrdOssFind_Prty,(void *)&prty)))
290  oldreq->pendList.Insert(&newreq->pendList);
293 
294 // Return the estimated time to arrival
295 //
296  return CalcTime(newreq);
297 }
#define XrdOss_USRPRTY
Definition: XrdOssConfig.hh:43
#define XRDOSS_E8006
Definition: XrdOssError.hh:40
#define XRDOSS_E8010
Definition: XrdOssError.hh:44
#define OSS_SYSPRTY
Definition: XrdOssOpaque.hh:40
#define OSS_MAX_PRTY
Definition: XrdOssOpaque.hh:45
#define OSS_USE_PRTY
Definition: XrdOssOpaque.hh:46
#define OSS_USRPRTY
Definition: XrdOssOpaque.hh:39
int XrdOssFind_Prty(XrdOssStage_Req *req, void *carg)
Definition: XrdOssStage.cc:90
int XrdOssFind_Req(XrdOssStage_Req *req, void *carg)
Definition: XrdOssStage.cc:100
unsigned long XrdOucHashVal(const char *KeyVal)
unsigned long hash
Definition: XrdOssStage.hh:56
XrdOucDLlist< XrdOssStage_Req > fullList
Definition: XrdOssStage.hh:53
void Insert(XrdOucDLlist *Node, T *Item=0)
Definition: XrdOucDLlist.hh:71
static int a2i(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
Definition: XrdOuca2x.cc:45

References XrdOuca2x::a2i(), CalcTime(), XrdSysError::Emsg(), XrdOssStage_Req::flags, XrdOssStage_Req::fullList, XrdOucEnv::Get(), HasFile(), XrdOssStage_Req::hash, XrdOucDLlist< T >::Insert(), XrdOucName2Name::lfn2rfn(), XrdSysMutexHelper::Lock(), MSS_Stat(), OptFlags, OSS_MAX_PRTY, OSS_SYSPRTY, OSS_USE_PRTY, OSS_USRPRTY, OssEroute, XrdOssStage_Req::path, XrdOssStage_Req::pendList, pndbytes, XrdSysSemaphore::Post(), XrdOssStage_Req::ReadyRequest, rmt_N2N, XrdOssStage_Req::sigtod, XrdOssStage_Req::size, StageCmd, XrdOssStage_Req::StageMutex, XrdOssStage_Req::StageQ, stat, XrdSysMutexHelper::UnLock(), XRDEXP_NOCHECK, XRDOSS_E8006, XRDOSS_E8009, XRDOSS_E8010, XRDOSS_FAIL_FILE, XRDOSS_REQ_ENOF, XRDOSS_REQ_FAIL, XrdOss_USRPRTY, XrdOssFind_Prty(), XrdOssFind_Req(), and XrdOucHashVal().

Referenced by Stage().

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

◆ Stat()

int XrdOssSys::Stat ( const char *  path,
struct stat buff,
int  opts = 0,
XrdOucEnv envP = 0 
)
virtual

Return state information on a file or directory.

Parameters
path- Pointer to the path in question.
buff- Pointer to the structure where info it to be returned.
opts- Options: XRDOSS_preop - this is a stat prior to open. XRDOSS_resonly - only look for resident files. XRDOSS_updtatm - update file access time.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 70 of file XrdOssStat.cc.

72 {
73  const int ro_Mode = ~(S_IWUSR | S_IWGRP | S_IWOTH);
74  char actual_path[MAXPATHLEN+1], *local_path, *remote_path;
75  unsigned long long popts;
76  int retc;
77 
78 // Construct the processing options for this path
79 //
80  popts = PathOpts(path);
81 
82 // Generate local path
83 //
84  if (lcl_N2N && STT_DoN2N)
85  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
86  return retc;
87  else local_path = actual_path;
88  else local_path = (char *)path;
89 
90 // Stat the file in the local filesystem first. If there. make sure the mode
91 // bits correspond to our reality and update access time if so requested.
92 //
93  if (STT_Func)
94  {retc = (STT_V2 ? (*STT_Fund)(local_path, buff, opts, EnvP, path)
95  : (*STT_Func)(local_path, buff, opts, EnvP));
96  } else retc = stat(local_path, buff);
97  if (!retc)
98  {if (popts & XRDEXP_NOTRW) buff->st_mode &= ro_Mode;
99  if (opts & XRDOSS_updtatm && (buff->st_mode & S_IFMT) == S_IFREG)
100  {struct utimbuf times;
101  times.actime = time(0);
102  times.modtime = buff->st_mtime;
103  utime(local_path, &times);
104  }
105  return XrdOssOK;
106  } else if (errno != ENOENT) return (errno ? -errno : -ENOMSG);
107 
108 // The file may be offline in a mass storage system, check if this is possible
109 //
110  if (!IsRemote(path) || opts & XRDOSS_resonly
111  || (EnvP && EnvP->Get("oss.lcl"))) return -errno;
112  if (!RSSCmd) return (popts & XRDEXP_NOCHECK ? -ENOENT : -ENOMSG);
113 
114 // Generate remote path
115 //
116  if (rmt_N2N)
117  if ((retc = rmt_N2N->lfn2rfn(path, actual_path, sizeof(actual_path))))
118  return retc;
119  else remote_path = actual_path;
120  else remote_path = (char *)path;
121 
122 // Now stat the file in the remote system (it doesn't exist locally)
123 //
124  if ((retc = MSS_Stat(remote_path, buff))) return retc;
125  if (popts & XRDEXP_NOTRW) buff->st_mode &= ro_Mode;
126  return XrdOssOK;
127 }
#define XRDOSS_resonly
Definition: XrdOss.hh:548
#define XRDOSS_updtatm
Definition: XrdOss.hh:549
int IsRemote(const char *path)
Definition: XrdOssApi.hh:178
unsigned long long PathOpts(const char *path)
Definition: XrdOssApi.hh:184

References XrdOucEnv::Get(), IsRemote(), lcl_N2N, XrdOucName2Name::lfn2pfn(), XrdOucName2Name::lfn2rfn(), MSS_Stat(), opts, PathOpts(), rmt_N2N, RSSCmd, stat, STT_DoN2N, STT_V2, XRDEXP_NOCHECK, XRDEXP_NOTRW, XRDOSS_resonly, XRDOSS_updtatm, and XrdOssOK.

Referenced by ConfigStats(), Mkdir(), xspace(), and xspaceBuild().

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

◆ StatFS() [1/2]

int XrdOssSys::StatFS ( const char *  path,
char *  buff,
int &  blen,
XrdOucEnv envP = 0 
)
virtual

Return filesystem physical space information associated with a path.

Parameters
path- Path in the partition in question.
buff- Pointer to the buffer to hold the information.
blen- Length of the buffer. This is updated with the actual number of bytes placed in the buffer as in snprintf().
envP- Pointer to environmental information.
Returns
"<wval> <fsp> <utl> <sval> <fsp> <utl>" where: <wval> is "0" if XRDEXP_NOTRW specified, otherwise "1" <fsp> is free space in megabytes. <utl> is percentage utilization (i.e. allocated space) <sval> is "1' if XRDEXP_STAGE specified, otherwise "0" Upon failure -errno or -osserr (see XrdOssError.hh) returned.

Reimplemented from XrdOss.

Definition at line 145 of file XrdOssStat.cc.

146 {
147  int sVal, wVal, Util;
148  long long fSpace, fSize;
149  unsigned long long Opt;
150 
151 // Get the values for this file system
152 //
153  StatFS(path, Opt, fSize, fSpace);
154  sVal = (Opt & XRDEXP_STAGE ? 1 : 0);
155  wVal = (Opt & XRDEXP_NOTRW ? 0 : 1);
156 
157 // Size the value to fit in an int
158 //
159  if (fSpace <= 0) {fSize = fSpace = 0; Util = 0;}
160  else {Util = (fSize ? (fSize - fSpace)*100LL/fSize : 0);
161  fSpace = fSpace >> 20LL;
162  if ((fSpace >> 31LL)) fSpace = 0x7fffffff;
163  }
164 
165 // Return the result
166 //
167  blen = snprintf(buff, blen, "%d %lld %d %d %lld %d",
168  wVal, (wVal ? fSpace : 0LL), (wVal ? Util : 0),
169  sVal, (sVal ? fSpace : 0LL), (sVal ? Util : 0));
170  return XrdOssOK;
171 }
int StatFS(const char *path, char *buff, int &blen, XrdOucEnv *Env=0)
Definition: XrdOssStat.cc:145

References XRDEXP_NOTRW, XRDEXP_STAGE, and XrdOssOK.

Referenced by StatLS().

+ Here is the caller graph for this function:

◆ StatFS() [2/2]

int XrdOssSys::StatFS ( const char *  path,
unsigned long long &  Opt,
long long &  fSize,
long long &  fSpace 
)

Definition at line 187 of file XrdOssStat.cc.

189 {
190 // Establish the path options
191 //
192  Opt = PathOpts(path);
193 
194 // For in-place paths we just get the free space in that partition, otherwise
195 // get the maximum available in any partition.
196 //
197  if ((Opt & XRDEXP_STAGE) || !(Opt & XRDEXP_NOTRW))
199  {char lcl_path[MAXPATHLEN+1];
200  if (lcl_N2N)
201  if (lcl_N2N->lfn2pfn(path, lcl_path, sizeof(lcl_path)))
202  fSpace = -1;
203  else fSpace = XrdOssCache_FS::freeSpace(fSize, lcl_path);
204  else fSpace = XrdOssCache_FS::freeSpace(fSize, path);
205  } else {fSpace = XrdOssCache_FS::freeSpace(fSize);}
206  else {fSpace = 0; fSize = 0;}
207  return XrdOssOK;
208 }

References XrdOssCache_FS::freeSpace(), XrdOssCache_Group::fsgroups, lcl_N2N, XrdOucName2Name::lfn2pfn(), PathOpts(), XRDEXP_INPLACE, XRDEXP_NOTRW, XRDEXP_STAGE, and XrdOssOK.

+ Here is the call graph for this function:

◆ StatLS()

int XrdOssSys::StatLS ( XrdOucEnv env,
const char *  path,
char *  buff,
int &  blen 
)
virtual

Return filesystem physical space information associated with a space name.

Parameters
env- Ref to environmental information. If the environment has the key oss.cgroup defined, the associated value is used as the space name and the path is ignored.
path- Path in the name space in question. The space name associated with gthe path is used unless overridden.
buff- Pointer to the buffer to hold the information.
blen- Length of the buffer. This is updated with the actual number of bytes placed in the buffer as in snprintf().
Returns
"oss.cgroup=<name>&oss.space=<totbytes>&oss.free=<freebytes> &oss.maxf=<maxcontigbytes>&oss.used=<bytesused> &oss.quota=<quotabytes>" in buff upon success. Upon failure -errno or -osserr (see XrdOssError.hh) returned.

Reimplemented from XrdOss.

Definition at line 225 of file XrdOssStat.cc.

226 {
227  static const char *Resp="oss.cgroup=%s&oss.space=%lld&oss.free=%lld"
228  "&oss.maxf=%lld&oss.used=%lld&oss.quota=%lld";
229  struct stat sbuff;
230  XrdOssCache_Space CSpace;
231  char *cgrp, cgbuff[XrdOssSpace::minSNbsz];
232  int retc;
233 
234 // We provide pseudo support whould be not have a cache
235 //
237  {unsigned long long Opt;
238  long long fSpace, fSize;
239  StatFS(path, Opt, fSize, fSpace);
240  if (fSpace < 0) fSpace = 0;
241  blen = snprintf(buff, blen, Resp, "public", fSize, fSpace, fSpace,
242  fSize-fSpace, XrdOssCache_Group::PubQuota);
243  return XrdOssOK;
244  }
245 
246 // Find the cache group. We provide pseudo support should we not have a cache
247 //
248  if (!(cgrp = env.Get(OSS_CGROUP)))
249  {if ((retc = getCname(path, &sbuff, cgbuff))) return retc;
250  else cgrp = cgbuff;
251  }
252 
253 // Accumulate the stats and format the result
254 //
255  blen = (XrdOssCache_FS::getSpace(CSpace, cgrp)
256  ? snprintf(buff,blen,Resp,cgrp,CSpace.Total,CSpace.Free,CSpace.Maxfree,
257  CSpace.Usage,CSpace.Quota)
258  : snprintf(buff, blen, Resp, cgrp, 0LL, 0LL, 0LL, 0LL, -1LL));
259  return XrdOssOK;
260 }
static long long PubQuota
Definition: XrdOssCache.hh:197
int getCname(const char *path, struct stat *sbuff, char *cgbuff)
Definition: XrdOssStat.cc:455

References XrdOssCache_Group::fsgroups, XrdOucEnv::Get(), getCname(), XrdOssCache_FS::getSpace(), XrdOssSpace::minSNbsz, OSS_CGROUP, XrdOssCache_Group::PubQuota, stat, StatFS(), and XrdOssOK.

+ Here is the call graph for this function:

◆ StatPF()

int XrdOssSys::StatPF ( const char *  path,
struct stat buff,
int  opts 
)
virtual

Reimplemented from XrdOss.

Definition at line 276 of file XrdOssStat.cc.

277 {
278  char lcl_path[MAXPATHLEN+1];
279  int retc;
280 
281 // If just the maximum values wanted then we can return these right away
282 //
283  if (opts & PF_dNums)
284  {XrdOssCache::DevInfo(*buff, true);
285  return 0;
286  }
287 
288 // Check if path is nil and do he appropriate thing
289 //
290  if (!path)
291  {if (opts & PF_dInfo) XrdOssCache::DevInfo(*buff, false);
292  else return -EINVAL;
293  return 0;
294  }
295 
296 // Check if we should do lfn2pfn conversion (previously we didn't allow it)
297 //
298  if (lcl_N2N && (opts & PF_isLFN))
299  {if ((retc = lcl_N2N->lfn2pfn(path, lcl_path, sizeof(lcl_path))))
300  return retc;
301  path = lcl_path;
302  }
303 
304 // We no longer use the custom stat plug-in for this function. It never
305 // worked in the first place, anyway.
306 //
307  if (stat(path, buff)) return (errno ? -errno : -ENOMSG);
308 
309 // Check of general stat information is to be returned
310 //
311  if (opts % PF_dStat)
312  {buff->st_rdev = 0;
313  return XrdOssOK;
314  }
315 
316 // Check if device info is to be returned
317 //
318  if (opts & PF_dInfo) XrdOssCache::DevInfo(*buff);
319 
320 // All done
321 //
322  return XrdOssOK;
323 }
static void DevInfo(struct stat &buf, bool limits=false)
Definition: XrdOssCache.cc:583
static const int PF_dStat
Definition: XrdOss.hh:854
static const int PF_dNums
Definition: XrdOss.hh:852
static const int PF_dInfo
Definition: XrdOss.hh:851
static const int PF_isLFN
Definition: XrdOss.hh:853

References XrdOssCache::DevInfo(), lcl_N2N, XrdOucName2Name::lfn2pfn(), opts, XrdOss::PF_dInfo, XrdOss::PF_dNums, XrdOss::PF_dStat, XrdOss::PF_isLFN, stat, and XrdOssOK.

+ Here is the call graph for this function:

◆ Stats()

int XrdOssSys::Stats ( char *  buff,
int  blen 
)
virtual

Return statistics.

Parameters
buff- Pointer to the buffer to hold statistics.
blen- Length of the buffer.
Returns
The number of bytes placed in the buffer excluding null byte.

Reimplemented from XrdOss.

Definition at line 456 of file XrdOssApi.cc.

457 {
458  static const char statfmt1[] = "<stats id=\"oss\" v=\"2\">";
459  static const char statfmt2[] = "</stats>";
460  static const int statflen = sizeof(statfmt1) + sizeof(statfmt2);
461  char *bp = buff;
462  int n;
463 
464 // If only size wanted, return what size we need
465 //
466  if (!buff) return statflen + getStats(0,0);
467 
468 // Make sure we have enough space
469 //
470  if (blen < statflen) return 0;
471  strcpy(bp, statfmt1);
472  bp += sizeof(statfmt1)-1; blen -= sizeof(statfmt1)-1;
473 
474 // Generate space statistics
475 //
476  n = getStats(bp, blen);
477  bp += n; blen -= n;
478 
479 // Add trailer
480 //
481  if (blen >= (int)sizeof(statfmt2))
482  {strcpy(bp, statfmt2); bp += (sizeof(statfmt2)-1);}
483  return bp - buff;
484 }
int getStats(char *buff, int blen)
Definition: XrdOssStat.cc:489

References getStats().

+ Here is the call graph for this function:

◆ StatVS()

int XrdOssSys::StatVS ( XrdOssVSInfo vsP,
const char *  sname = 0,
int  updt = 0 
)
virtual

Return space information for a space name.

Parameters
vsP- Pointer to the XrdOssVSInfo object to hold results. It should be fully initialized (i.e. a new copy).
sname- Pointer to the space name. If the name starts with a plus (e.g. "+public"), partition information is returned, should it exist. If nil, space information for all spaces is returned. See, XrdOssVS.hh for more info.
updt- When true, a space update occurrs prior to a query.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 339 of file XrdOssStat.cc.

340 {
341  XrdOssCache_Space CSpace;
342  XrdOssVSPart **vsP;
343 
344 // Check if we should update the statistics
345 //
346  if (updt) XrdOssCache::Scan(0);
347 
348 // If no space name present or no spaces defined and the space is public then
349 // return information on all spaces.
350 //
351  if (!sname || (!XrdOssCache_Group::fsgroups && !strcmp("public", sname)))
353  sP->Total = XrdOssCache::fsTotal;
354  sP->Free = XrdOssCache::fsTotFr;
355  sP->LFree = XrdOssCache::fsFree;
356  sP->Large = XrdOssCache::fsLarge;
357  sP->Extents= XrdOssCache::fsCount;
359  return XrdOssOK;
360  }
361 
362 // Check if partition table wanted
363 //
364  if (*sname != '+') vsP = 0;
365  else {sname++;
366  vsP = &(sP->vsPart);
367  }
368 
369 // Get the space stats
370 //
371  if (!(sP->Extents=XrdOssCache_FS::getSpace(CSpace, sname, vsP)))
372  return -ENOENT;
373 
374 // Return the result
375 //
376  sP->Total = CSpace.Total;
377  sP->Free = CSpace.Free;
378  sP->LFree = CSpace.Maxfree;
379  sP->Large = CSpace.Largest;
380  sP->Usage = CSpace.Usage;
381  sP->Quota = CSpace.Quota;
382  return XrdOssOK;
383 }
long long Largest
Definition: XrdOssCache.hh:85
static void * Scan(int cscanint)
Definition: XrdOssCache.cc:843
static long long fsLarge
Definition: XrdOssCache.hh:265
static long long fsTotal
Definition: XrdOssCache.hh:264
static long long fsTotFr
Definition: XrdOssCache.hh:266
static int fsCount
Definition: XrdOssCache.hh:272
static long long fsFree
Definition: XrdOssCache.hh:267
static XrdSysMutex Mutex
Definition: XrdOssCache.hh:262
long long Total
Definition: XrdOssVS.hh:68

References XrdOssVSInfo::Extents, XrdOssCache_Space::Free, XrdOssVSInfo::Free, XrdOssCache::fsCount, XrdOssCache::fsFree, XrdOssCache_Group::fsgroups, XrdOssCache::fsLarge, XrdOssCache::fsTotal, XrdOssCache::fsTotFr, XrdOssCache_FS::getSpace(), XrdOssVSInfo::Large, XrdOssCache_Space::Largest, XrdOssVSInfo::LFree, XrdSysMutex::Lock(), XrdOssCache_Space::Maxfree, XrdOssCache::Mutex, XrdOssCache_Space::Quota, XrdOssVSInfo::Quota, XrdOssCache::Scan(), XrdOssCache_Space::Total, XrdOssVSInfo::Total, XrdSysMutex::UnLock(), XrdOssCache_Space::Usage, XrdOssVSInfo::Usage, XrdOssVSInfo::vsPart, and XrdOssOK.

+ Here is the call graph for this function:

◆ StatXA()

int XrdOssSys::StatXA ( const char *  path,
char *  buff,
int &  blen,
XrdOucEnv envP = 0 
)
virtual

Return logical extended attributes associated with a path.

Parameters
path- Path in whose information is wanted.
buff- Pointer to the buffer to hold the information.
blen- Length of the buffer. This is updated with the actual number of bytes placed in the buffer as in snprintf().
envP- Pointer to environmental information.
Returns
"oss.cgroup=<name>&oss.type={'f'|'d'|'o'}&oss.used=<totbytes> &oss.mt=<mtime>&oss.ct=<ctime>&oss.at=<atime>&oss.u=*&oss.g=* &oss.fs={'w'|'r'}" Upon failure -errno or -osserr (see XrdOssError.hh) returned.

Reimplemented from XrdOss.

Definition at line 401 of file XrdOssStat.cc.

402 {
403  struct stat sbuff;
404  char cgbuff[XrdOssSpace::minSNbsz], fType;
405  long long Size, Mtime, Ctime, Atime;
406  int retc;
407 
408 // Get the cache group and stat info for the file
409 //
410  if ((retc = getCname(path, &sbuff, cgbuff))) return retc;
411  if (S_ISREG(sbuff.st_mode)) fType = 'f';
412  else if (S_ISDIR(sbuff.st_mode)) fType = 'd';
413  else fType = 'o';
414 
415 // Format the result
416 //
417  Size = sbuff.st_size;
418  Mtime = sbuff.st_mtime; Ctime = sbuff.st_ctime; Atime = sbuff.st_atime;
419  blen = snprintf(buff, blen,
420  "oss.cgroup=%s&oss.type=%c&oss.used=%lld&oss.mt=%lld"
421  "&oss.ct=%lld&oss.at=%lld&oss.u=*&oss.g=*&oss.fs=%c",
422  cgbuff, fType, Size, Mtime, Ctime, Atime,
423  (sbuff.st_mode & S_IWUSR ? 'w':'r'));
424  return XrdOssOK;
425 }

References getCname(), XrdOssSpace::minSNbsz, stat, and XrdOssOK.

+ Here is the call graph for this function:

◆ StatXP()

int XrdOssSys::StatXP ( const char *  path,
unsigned long long &  attr,
XrdOucEnv envP = 0 
)
virtual

Return export attributes associated with a path.

Parameters
path- Path in whose information is wanted.
attr- Reference to where the inforamation is to be stored.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 441 of file XrdOssStat.cc.

443 {
444 
445 // Construct the processing options for this path
446 //
447  attr = PathOpts(path);
448  return XrdOssOK;
449 }

References PathOpts(), and XrdOssOK.

+ Here is the call graph for this function:

◆ tranmode()

int XrdOssSys::tranmode ( char *  mode)
protected

Definition at line 314 of file XrdOssMSS.cc.

314  {
315  int mbits = 0;
316  if (mode[0] == 'r') mbits |= S_IROTH;
317  if (mode[1] == 'w') mbits |= S_IWOTH;
318  if (mode[2] == 'x') mbits |= S_IXOTH;
319  return mbits;
320 }

Referenced by MSS_Stat().

+ Here is the caller graph for this function:

◆ Truncate()

int XrdOssSys::Truncate ( const char *  path,
unsigned long long  fsize,
XrdOucEnv envP = 0 
)
virtual

Truncate a file.

Parameters
path- Pointer to the path of the file to be truncated.
fsize- The size that the file is to have.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 502 of file XrdOssApi.cc.

504 {
505  struct stat statbuff;
506  char actual_path[MAXPATHLEN+1], *local_path;
507  long long oldsz;
508  int retc;
509 
510 // Make sure we can modify this path
511 //
512  Check_RW(Truncate, path, "truncate");
513 
514 // Generate local path
515 //
516  if (lcl_N2N)
517  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
518  return retc;
519  else local_path = actual_path;
520  else local_path = (char *)path;
521 
522 // Get file info to do the correct adjustment
523 //
524  if (lstat(local_path, &statbuff)) return -errno;
525  else if ((statbuff.st_mode & S_IFMT) == S_IFDIR) return -EISDIR;
526  else if ((statbuff.st_mode & S_IFMT) == S_IFLNK)
527  {struct stat buff;
528  if (stat(local_path, &buff)) return -errno;
529  oldsz = buff.st_size;
530  } else oldsz = statbuff.st_size;
531 
532 // Change the file only in the local filesystem and make space adjustemt
533 //
534  if (truncate(local_path, size)) return -errno;
535  XrdOssCache::Adjust(local_path,static_cast<long long>(size)-oldsz,&statbuff);
536  return XrdOssOK;
537 }
#define truncate(a, b)
Definition: XrdPosix.hh:119
int Truncate(const char *, unsigned long long Size, XrdOucEnv *eP=0)
Definition: XrdOssApi.cc:502

References XrdOssCache::Adjust(), Check_RW, lcl_N2N, XrdOucName2Name::lfn2pfn(), lstat, stat, truncate, and XrdOssOK.

+ Here is the call graph for this function:

◆ Unlink()

int XrdOssSys::Unlink ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
virtual

Remove a file.

Parameters
path- Pointer to the path of the file to be removed.
Opts- Options: XRDOSS_isMIG - this is a migratable path. XRDOSS_isPFN - do not apply name2name to path. XRDOSS_Online - remove only the online copy.
envP- Pointer to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 106 of file XrdOssUnlink.cc.

107 {
108  EPNAME("Unlink")
109  unsigned long long dummy, remotefs;
110  int i, retc2, doAdjust = 0, retc = XrdOssOK;
111  struct stat statbuff;
112  //char *fnp;
113  char local_path[MAXPATHLEN+1+8];
114  char remote_path[MAXPATHLEN+1];
115 
116 // Build the right local and remote paths.
117 //
118  if (Opts & XRDOSS_isPFN)
119  {strcpy(local_path, path),
120  *remote_path = '\0';
121  remotefs = 0;
122  } else {
123  remotefs = Check_RO(Unlink, dummy, path, "remove");
124  if ( (retc = GenLocalPath( path, local_path))
125  || (retc = GenRemotePath(path, remote_path)) ) return retc;
126  }
127 
128 // Check if this path is really a directory of a symbolic link elsewhere
129 //
130  if (lstat(local_path, &statbuff)) retc = (errno == ENOENT ? 0 : -errno);
131  else if ((statbuff.st_mode & S_IFMT) == S_IFLNK)
132  retc = BreakLink(local_path, statbuff);
133  else if ((statbuff.st_mode & S_IFMT) == S_IFDIR)
134  {i = strlen(local_path);
135  if (local_path[i-1] != '/') strcpy(local_path+i, "/");
136  if ((retc = rmdir(local_path))) retc = -errno;
137  DEBUG("dir rc=" <<retc <<" path=" <<local_path);
138  return retc;
139  } else doAdjust = 1;
140 
141 // Delete the local copy and adjust usage
142 //
143  if (!retc)
144  {if (unlink(local_path)) retc = -errno;
145  else {i = strlen(local_path); //fnp = &local_path[i];
146  if (doAdjust && statbuff.st_size)
147  XrdOssCache::Adjust(statbuff.st_dev, -statbuff.st_size);
148  }
149  DEBUG("lcl rc=" <<retc <<" path=" <<local_path);
150  }
151 
152 // If local copy effectively deleted. delete the remote copy if need be
153 //
154  if (remotefs && !(Opts & XRDOSS_Online)
155  && (!retc || retc == -ENOENT) && RSSCmd)
156  {if ((retc2 = MSS_Unlink(remote_path)) != -ENOENT) retc = retc2;
157  DEBUG("rmt rc=" <<retc2 <<" path=" <<remote_path);
158  }
159 
160 // All done
161 //
162  return retc;
163 }
#define XRDOSS_Online
Definition: XrdOss.hh:528
int rmdir(const char *path)
int MSS_Unlink(const char *)
Definition: XrdOssMSS.cc:333
int BreakLink(const char *local_path, struct stat &statbuff)

References XrdOssCache::Adjust(), BreakLink(), Check_RO, DEBUG, EPNAME, GenLocalPath(), GenRemotePath(), lstat, MSS_Unlink(), XrdMpx::Opts, rmdir(), RSSCmd, stat, unlink, XRDOSS_isPFN, XRDOSS_Online, and XrdOssOK.

Referenced by Remdir().

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

◆ xalloc()

int XrdOssSys::xalloc ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1197 of file XrdOssConfig.cc.

1198 {
1199  char *val;
1200  long long mina = 0;
1201  int fuzz = 0;
1202  int hdrm = 0;
1203 
1204  if (!(val = Config.GetWord()))
1205  {Eroute.Emsg("Config", "alloc minfree not specified"); return 1;}
1206  if (strcmp(val, "*") &&
1207  XrdOuca2x::a2sz(Eroute, "alloc minfree", val, &mina, 0)) return 1;
1208 
1209  if ((val = Config.GetWord()))
1210  {if (strcmp(val, "*") &&
1211  XrdOuca2x::a2i(Eroute,"alloc headroom",val,&hdrm,0,100)) return 1;
1212 
1213  if ((val = Config.GetWord()))
1214  {if (strcmp(val, "*") &&
1215  XrdOuca2x::a2i(Eroute, "alloc fuzz", val, &fuzz, 0, 100)) return 1;
1216  }
1217  }
1218 
1219  minalloc = mina;
1220  ovhalloc = hdrm;
1221  fuzalloc = fuzz;
1222  return 0;
1223 }
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

References XrdOuca2x::a2i(), XrdOuca2x::a2sz(), XrdCms::Config, XrdSysError::Emsg(), fuzalloc, minalloc, and ovhalloc.

Referenced by ConfigXeq().

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

◆ xcache()

int XrdOssSys::xcache ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1240 of file XrdOssConfig.cc.

1241 {
1242  int rc, isXA = 0;
1243 
1244 // Skip out to process this entry and upon success indicate that it is
1245 // deprecated and "space" should be used instead if an XA-style space defined.
1246 //
1247  if (!(rc = xspace(Config, Eroute, &isXA)))
1248  {if (isXA) Eroute.Say("Config warning: 'oss.cache' is deprecated; "
1249  "use 'oss.space' instead!");
1250  else {Eroute.Say("Config failure: non-xa spaces are no longer "
1251  "supported!");
1252  rc = 1;
1253  }
1254  }
1255  return rc;
1256 }

References XrdCms::Config, XrdSysError::Say(), and xspace().

Referenced by ConfigXeq().

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

◆ xcachescan()

int XrdOssSys::xcachescan ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1270 of file XrdOssConfig.cc.

1271 { int cscan = 0;
1272  char *val;
1273 
1274  if (!(val = Config.GetWord()))
1275  {Eroute.Emsg("Config", "cachescan not specified"); return 1;}
1276  if (XrdOuca2x::a2tm(Eroute, "cachescan", val, &cscan, 30)) return 1;
1277  cscanint = cscan;
1278  return 0;
1279 }
static int a2tm(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
Definition: XrdOuca2x.cc:288

References XrdOuca2x::a2tm(), XrdCms::Config, cscanint, and XrdSysError::Emsg().

Referenced by ConfigXeq().

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

◆ xdefault()

int XrdOssSys::xdefault ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1295 of file XrdOssConfig.cc.

1296 {
1298  return 0;
1299 }
static unsigned long long ParseDefs(XrdOucStream &Config, XrdSysError &Eroute, unsigned long long Flags)
Definition: XrdOucExport.cc:60

References XrdCms::Config, DirFlags, and XrdOucExport::ParseDefs().

Referenced by ConfigXeq().

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

◆ xfdlimit()

int XrdOssSys::xfdlimit ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1318 of file XrdOssConfig.cc.

1319 {
1320  char *val;
1321  int fence = 0, FDHalf = FDLimit>>1;
1322 
1323  if (!(val = Config.GetWord()))
1324  {Eroute.Emsg("Config", "fdlimit fence not specified"); return 1;}
1325 
1326  if (!strcmp(val, "*")) FDFence = FDHalf;
1327  else {if (XrdOuca2x::a2i(Eroute,"fdlimit fence",val,&fence,0)) return 1;
1328  FDFence = (fence < FDHalf ? fence : FDHalf);
1329  }
1330 
1331  while(Config.GetWord()) {}
1332 
1333 // Eroute.Say("Config warning: ", "fdlimit directive no longer supported.");
1334 
1335  return 0;
1336 }

References XrdOuca2x::a2i(), XrdCms::Config, XrdSysError::Emsg(), FDFence, and FDLimit.

Referenced by ConfigXeq().

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

◆ xmaxsz()

int XrdOssSys::xmaxsz ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1351 of file XrdOssConfig.cc.

1352 { long long msz;
1353  char *val;
1354 
1355  if (!(val = Config.GetWord()))
1356  {Eroute.Emsg("Config", "maxsize value not specified"); return 1;}
1357  if (XrdOuca2x::a2sz(Eroute, "maxsize", val, &msz, 1024*1024)) return 1;
1358  MaxSize = msz;
1359  return 0;
1360 }

References XrdOuca2x::a2sz(), XrdCms::Config, XrdSysError::Emsg(), and MaxSize.

Referenced by ConfigXeq().

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

◆ xmemf()

int XrdOssSys::xmemf ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1383 of file XrdOssConfig.cc.

1384 {
1385  char *val;
1386  int i, j, V_check=-1, V_preld = -1, V_on=-1;
1387  long long V_max = 0;
1388 
1389  static struct mmapopts {const char *opname; int otyp;
1390  const char *opmsg;} mmopts[] =
1391  {
1392  {"off", 0, ""},
1393  {"preload", 1, "memfile preload"},
1394  {"check", 2, "memfile check"},
1395  {"max", 3, "memfile max"}};
1396  int numopts = sizeof(mmopts)/sizeof(struct mmapopts);
1397 
1398  if (!(val = Config.GetWord()))
1399  {Eroute.Emsg("Config", "memfile option not specified"); return 1;}
1400 
1401  while (val)
1402  {for (i = 0; i < numopts; i++)
1403  if (!strcmp(val, mmopts[i].opname)) break;
1404  if (i >= numopts)
1405  Eroute.Say("Config warning: ignoring invalid memfile option '",val,"'.");
1406  else {if (mmopts[i].otyp > 1 && !(val = Config.GetWord()))
1407  {Eroute.Emsg("Config","memfile",mmopts[i].opname,
1408  "value not specified");
1409  return 1;
1410  }
1411  switch(mmopts[i].otyp)
1412  {case 1: V_preld = 1;
1413  break;
1414  case 2: if (!strcmp("xattr",val)
1415  || !strcmp("lock", val)
1416  || !strcmp("map", val)
1417  || !strcmp("keep", val)) V_check=1;
1418  else {Eroute.Emsg("Config",
1419  "mmap check argument not xattr");
1420  return 1;
1421  }
1422  break;
1423  case 3: j = strlen(val);
1424  if (val[j-1] == '%')
1425  {val[j-1] = '\0';
1426  if (XrdOuca2x::a2i(Eroute,mmopts[i].opmsg,
1427  val, &j, 1, 1000)) return 1;
1428  V_max = -j;
1429  } else if (XrdOuca2x::a2sz(Eroute,
1430  mmopts[i].opmsg, val, &V_max,
1431  10*1024*1024)) return 1;
1432  break;
1433  default: V_on = 0; break;
1434  }
1435  val = Config.GetWord();
1436  }
1437  }
1438 
1439 // Set the values
1440 //
1441  XrdOssMio::Set(V_on, V_preld, V_check);
1442  XrdOssMio::Set(V_max);
1443  return 0;
1444 }

References XrdOuca2x::a2i(), XrdOuca2x::a2sz(), XrdCms::Config, XrdSysError::Emsg(), XrdSysError::Say(), and XrdOssMio::Set().

Referenced by ConfigXeq().

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

◆ xnml()

int XrdOssSys::xnml ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1460 of file XrdOssConfig.cc.

1461 {
1462  char *val, parms[1040];
1463 
1464 // Get the path
1465 //
1466  if (!(val = Config.GetWord()) || !val[0])
1467  {Eroute.Emsg("Config", "namelib not specified"); return 1;}
1468 
1469 // Record the path
1470 //
1471  if (N2N_Lib) free(N2N_Lib);
1472  N2N_Lib = strdup(val);
1473 
1474 // Record any parms
1475 //
1476  if (!Config.GetRest(parms, sizeof(parms)))
1477  {Eroute.Emsg("Config", "namelib parameters too long"); return 1;}
1478  if (N2N_Parms) free(N2N_Parms);
1479  N2N_Parms = (*parms ? strdup(parms) : 0);
1480  return 0;
1481 }

References XrdCms::Config, XrdSysError::Emsg(), N2N_Lib, and N2N_Parms.

Referenced by ConfigXeq().

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

◆ xpath()

int XrdOssSys::xpath ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1497 of file XrdOssConfig.cc.

1498 {
1499  XrdOucPList *pP;
1500 
1501 // Parse the arguments
1502 //
1504  if (!pP) return 1;
1505 
1506 // If this is an absolute path, we are done
1507 //
1508  if (*(pP->Path()) == '/') return 0;
1509 
1510 // If this is an objectid path then make sure to set the default for these
1511 //
1512  if (*(pP->Path()) == '*')
1513  {RPList.Defstar(pP->Flag());
1514  return 0;
1515  }
1516 
1517 // We do not (yet) support exporting specific object ID's
1518 //
1519  Eroute.Emsg("Config", "Unsupported export -", pP->Path());
1520  return 1;
1521 }
static XrdOucPList * ParsePath(XrdOucStream &Config, XrdSysError &Eroute, XrdOucPListAnchor &Export, unsigned long long Defopts)
void Defstar(unsigned long long x)
Definition: XrdOucPList.hh:104

References XrdCms::Config, XrdOucPListAnchor::Defstar(), DirFlags, XrdSysError::Emsg(), XrdOucPList::Flag(), XrdOucExport::ParsePath(), XrdOucPList::Path(), and RPList.

Referenced by ConfigProc(), and ConfigXeq().

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

◆ xprerd()

int XrdOssSys::xprerd ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1547 of file XrdOssConfig.cc.

1548 {
1549  static const long long m16 = 16777216LL;
1550  char *val;
1551  long long lim = 1048576;
1552  int depth, qeq = 0, qsz = 128;
1553 
1554  if (!(val = Config.GetWord()))
1555  {Eroute.Emsg("Config", "preread depth not specified"); return 1;}
1556 
1557  if (!strcmp(val, "on")) depth = 3;
1558  else if (XrdOuca2x::a2i(Eroute,"preread depth",val,&depth,0, 1024))
1559  return 1;
1560 
1561  while((val = Config.GetWord()))
1562  { if (!strcmp(val, "limit"))
1563  {if (!(val = Config.GetWord()))
1564  {Eroute.Emsg("Config","preread limit not specified");
1565  return 1;
1566  }
1567  if (XrdOuca2x::a2sz(Eroute,"preread limit",val,&lim,0,m16))
1568  return 1;
1569  }
1570  else if (!strcmp(val, "qsize"))
1571  {if (!(val = Config.GetWord()))
1572  {Eroute.Emsg("Config","preread qsize not specified");
1573  return 1;
1574  }
1575  if (XrdOuca2x::a2i(Eroute,"preread qsize",val,&qsz,0,1024))
1576  return 1;
1577  if (qsz < depth)
1578  {Eroute.Emsg("Config","preread qsize must be >= depth");
1579  return 1;
1580  }
1581  }
1582  else {Eroute.Emsg("Config","invalid preread option -",val); return 1;}
1583  }
1584 
1585  if (lim < prPSize || !qsz) depth = 0;
1586  if (!qeq && depth)
1587  {qsz = qsz/(depth/2+1);
1588  if (qsz < depth) qsz = depth;
1589  }
1590 
1591  prDepth = depth;
1592  prQSize = qsz;
1593  prBytes = lim;
1594  return 0;
1595 }

References XrdOuca2x::a2i(), XrdOuca2x::a2sz(), XrdCms::Config, XrdSysError::Emsg(), prBytes, prDepth, prPSize, and prQSize.

Referenced by ConfigXeq().

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

◆ xspace() [1/2]

int XrdOssSys::xspace ( XrdOucStream Config,
XrdSysError Eroute,
const char *  grp,
bool  isAsgn 
)
protected

Definition at line 1742 of file XrdOssConfig.cc.

1744 {
1745  XrdOucPList *pl;
1746  char *path;
1747 
1748 // Get the path
1749 //
1750  path = Config.GetWord();
1751  if (!path || !path[0])
1752  {Eroute.Emsg("Config", "space path not specified"); return 1;}
1753 
1754 // Create a new path list object and add it to list of paths
1755 //
1756 do{if ((pl = SPList.Match(path))) pl->Set(path, grp);
1757  else {pl = new XrdOucPList(path, grp);
1758  SPList.Insert(pl);
1759  }
1760  pl->Set((isAsgn ? spAssign : 0));
1761  } while((path = Config.GetWord()));
1762 
1763 // All done
1764 //
1765  return 0;
1766 }
XrdOucPList * Match(const char *pathname)
Definition: XrdOucPList.hh:122

References XrdCms::Config, XrdSysError::Emsg(), XrdOucPListAnchor::Insert(), XrdOucPListAnchor::Match(), XrdOucPList::Set(), spAssign, and SPList.

+ Here is the call graph for this function:

◆ xspace() [2/2]

int XrdOssSys::xspace ( XrdOucStream Config,
XrdSysError Eroute,
int *  isCD = 0 
)
protected

Definition at line 1615 of file XrdOssConfig.cc.

1616 {
1617  XrdOucString grp, fn, mn;
1618  OssSpaceConfig sInfo(grp, fn, mn);
1619  char *val;
1620  int k;
1621  bool isAsgn, isStar;
1622 
1623 // Get the space name
1624 //
1625  if (!(val = Config.GetWord()))
1626  {Eroute.Emsg("Config", "space name not specified"); return 1;}
1627  if ((int)strlen(val) > XrdOssSpace::maxSNlen)
1628  {Eroute.Emsg("Config","excessively long space name - ",val); return 1;}
1629  grp = val;
1630 
1631 // Get the path to the space
1632 //
1633  if (!(val = Config.GetWord()) || !(*val))
1634  {Eroute.Emsg("Config", "space path not specified"); return 1;}
1635 
1636 // Check if assignment
1637 //
1638  if (((isAsgn = !strcmp("assign",val)) || ! strcmp("default",val)) && !isCD)
1639  return xspace(Config, Eroute, grp.c_str(), isAsgn);
1640 
1641 // Preprocess this path and validate it
1642 //
1643  k = strlen(val)-1;
1644  if ((isStar = val[k] == '*')) val[k--] = 0;
1645  else while(k > 0 && val[k] == '/') val[k--] = 0;
1646 
1647  if (k >= MAXPATHLEN || val[0] != '/' || (k < 2 && !isStar))
1648  {Eroute.Emsg("Config", "invalid space path - ", val); return 1;}
1649  fn = val;
1650 
1651 // Sanitize the path as we are sensitive to proper placement of slashes
1652 //
1653  do {k = fn.replace("/./", "/");} while(k);
1654  do {k = fn.replace("//", "/");} while(k);
1655 
1656 // Additional options (for now) are only available to the old-style cache
1657 // directive. So, ignore any unless we entered via the directive.
1658 //
1659  if (isCD)
1660  {if ((val = Config.GetWord()))
1661  {if (strcmp("xa", val))
1662  {Eroute.Emsg("Config","invalid cache option - ",val); return 1;}
1663  else *isCD = 1;
1664  } else {*isCD = 0; sInfo.isXA = false;}
1665  } else {
1666  if ((val = Config.GetWord()) && !strcmp("chkmount", val))
1667  {if (!(val = Config.GetWord()))
1668  {Eroute.Emsg("Config","chkmount ID not specified"); return 1;}
1669  if ((int)strlen(val) > XrdOssSpace::maxSNlen)
1670  {Eroute.Emsg("Config","excessively long mount name - ",val);
1671  return 1;
1672  }
1673  mn = val;
1674  sInfo.chkMnt = true;
1675  if ((val = Config.GetWord()))
1676  {if (!strcmp("nofail", val)) sInfo.noFail = true;
1677  else {Eroute.Emsg("Config","invalid space option - ",val);
1678  return 1;
1679  }
1680  }
1681  }
1682  }
1683 
1684 // Check if this directory in the parent is only to be used for the space
1685 //
1686  if (!isStar)
1687  {if (!fn.endswith('/')) fn += '/';
1688  return !xspaceBuild(sInfo, Eroute);
1689  }
1690 
1691 // We now need to build a space for each directory in the parent
1692 //
1693  struct dirent *dp;
1694  struct stat Stat;
1695  XrdOucString pfx, basepath(fn);
1696  DIR *dirP;
1697  int dFD, rc, snum = 0;
1698  bool chkPfx, failed = false;
1699 
1700  if (basepath.endswith('/')) chkPfx = false;
1701  else {int pos = basepath.rfind('/');
1702  pfx = &basepath[pos+1];
1703  basepath.keep(0, pos+1);
1704  chkPfx = true;
1705  }
1706 
1707  if ((dFD=open(basepath.c_str(),O_DIRECTORY)) < 0 || !(dirP=fdopendir(dFD)))
1708  {Eroute.Emsg("Config",errno,"open space directory",fn.c_str()); return 1;}
1709 
1710  errno = 0;
1711  while((dp = readdir(dirP)))
1712  {if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")
1713  || (chkPfx && strncmp(dp->d_name,pfx.c_str(),pfx.length()))) continue;
1714 
1715  if (fstatat(dFD, dp->d_name, &Stat, AT_SYMLINK_NOFOLLOW))
1716  {basepath += dp->d_name;
1717  break;
1718  }
1719 
1720  if ((Stat.st_mode & S_IFMT) == S_IFDIR)
1721  {fn = basepath; fn += dp->d_name; fn += '/';
1722  if (!xspaceBuild(sInfo, Eroute)) failed = true;
1723  snum++;
1724  }
1725  errno = 0;
1726  }
1727 
1728 // Make sure we built all space successfully and have at least one space
1729 //
1730  if ((rc = errno))
1731  Eroute.Emsg("Config", errno, "process space directory", fn.c_str());
1732  else if (!snum)
1733  Eroute.Say("Config warning: no space directories found in ",
1734  fn.c_str());
1735 
1736  closedir(dirP);
1737  return rc != 0 || failed;
1738 }
int closedir(DIR *dirp)
#define fstatat(a, b, c, d)
Definition: XrdPosix.hh:64
#define readdir(a)
Definition: XrdPosix.hh:90
int xspaceBuild(OssSpaceConfig &sInfo, XrdSysError &Eroute)
const char * c_str() const
bool endswith(char c)
int replace(const char *s1, const char *s2, int from=0, int to=-1)

References XrdOucString::c_str(), OssSpaceConfig::chkMnt, closedir(), XrdCms::Config, XrdSysError::Emsg(), XrdOucString::endswith(), fstatat, OssSpaceConfig::isXA, XrdOssSpace::maxSNlen, OssSpaceConfig::noFail, open, readdir, XrdOucString::replace(), XrdSysError::Say(), stat, Stat(), and xspaceBuild().

Referenced by ConfigXeq(), and xcache().

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

◆ xspaceBuild()

int XrdOssSys::xspaceBuild ( OssSpaceConfig sInfo,
XrdSysError Eroute 
)
protected

Definition at line 1770 of file XrdOssConfig.cc.

1771 {
1774  int rc = 0;
1775 
1776 // Check if we need to verify the mount. Note: sPath must end with a '/'!
1777 //
1778  if (sInfo.chkMnt)
1779  {XrdOucString mFile(sInfo.mName), mPath(sInfo.sPath);
1780  struct stat Stat;
1781  mPath.erasefromend(1);
1782  mFile += '.';
1783  mFile += rindex(mPath.c_str(), '/')+1;
1784  mPath += '/'; mPath += mFile;
1785  if (stat(mPath.c_str(), &Stat))
1786  {char buff[2048];
1787  snprintf(buff, sizeof(buff), "%s@%s; ",
1788  mFile.c_str(), sInfo.sPath.c_str());
1789  Eroute.Say((sInfo.noFail ? "Config warning:" : "Config failure:"),
1790  " Unable to verify mount point ", buff, XrdSysE2T(errno));
1791  return (sInfo.noFail ? 1 : 0);
1792  }
1793  }
1794 
1795 // Add the space to the configuration
1796 
1797  XrdOssCache_FS *fsp = new XrdOssCache_FS(rc, sInfo.sName.c_str(),
1798  sInfo.sPath.c_str(), fopts);
1799  if (rc)
1800  {char buff[256];
1801  snprintf(buff, sizeof(buff), "create %s space at", sInfo.sName.c_str());
1802  Eroute.Emsg("Config", rc, buff, sInfo.sPath.c_str());
1803  if (fsp) delete fsp;
1804  return 0;
1805  }
1807  return 1;
1808 }
const char * XrdSysE2T(int errcode)
Definition: XrdSysE2T.cc:104
const XrdOucString & sPath
Definition: XrdOssConfig.hh:59
const XrdOucString & mName
Definition: XrdOssConfig.hh:60
const XrdOucString & sName
Definition: XrdOssConfig.hh:58

References XrdOucString::c_str(), OssSpaceConfig::chkMnt, XrdSysError::Emsg(), XrdOucString::erasefromend(), XrdOssCache_FS::isXA, OssSpaceConfig::isXA, OssSpaceConfig::mName, OssSpaceConfig::noFail, XrdOssCache_FS::None, OptFlags, XrdSysError::Say(), OssSpaceConfig::sName, OssSpaceConfig::sPath, stat, Stat(), XrdOss_CacheFS, and XrdSysE2T().

Referenced by xspace().

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

◆ xstg()

int XrdOssSys::xstg ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1828 of file XrdOssConfig.cc.

1829 {
1830  char *val, buff[2048], *bp = buff;
1831  int vlen, blen = sizeof(buff)-1, isAsync = 0, isCreate = 0;
1832 
1833 // Get the aync or async option
1834 //
1835  if ((val = Config.GetWord()))
1836  if ((isAsync = !strcmp(val, "async")) || !strcmp(val, "sync"))
1837  val = Config.GetWord();
1838 
1839 // Get the create option
1840 //
1841  if (val)
1842  if ((isCreate = !strcmp(val, "creates"))) val = Config.GetWord();
1843 
1844 // Get the command
1845 //
1846  if (!val) {Eroute.Emsg("Config", "stagecmd not specified"); return 1;}
1847 
1848 // Copy the command and all of it's arguments
1849 //
1850  do {if ((vlen = strlen(val)) >= blen)
1851  {Eroute.Emsg("Config", "stagecmd arguments too long"); break;}
1852  *bp = ' '; bp++; strcpy(bp, val); bp += vlen; blen -= vlen;
1853  } while((val = Config.GetWord()));
1854 
1855  if (val) return 1;
1856  *bp = '\0'; val = buff+1;
1857 
1858 // Record the command and operating mode
1859 //
1860  StageAsync = (isAsync ? 1 : 0);
1861  StageCreate= isCreate;
1862  if (StageCmd) free(StageCmd);
1863  StageCmd = strdup(val);
1864  return 0;
1865 }

References XrdCms::Config, XrdSysError::Emsg(), StageAsync, StageCmd, and StageCreate.

Referenced by ConfigXeq().

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

◆ xstl()

int XrdOssSys::xstl ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1886 of file XrdOssConfig.cc.

1887 {
1888  char *val, parms[1040];
1889 
1890 // Get the path or preopen option
1891 //
1892  if (!(val = Config.GetWord()) || !val[0])
1893  {Eroute.Emsg("Config", "statlib not specified"); return 1;}
1894 
1895 // Check for options we support the old and new versions here
1896 //
1897  STT_V2 = 0; STT_PreOp = 0; STT_DoN2N = 1; STT_DoARE = 0;
1898 do{ if (!strcmp(val, "-2")) STT_V2 = 1;
1899  else if (!strcmp(val, "arevents") || !strcmp(val, "-arevents")) STT_DoARE=1;
1900  else if (!strcmp(val, "non2n") || !strcmp(val, "-non2n")) STT_DoN2N=0;
1901  else if (!strcmp(val, "preopen") || !strcmp(val, "-preopen")) STT_PreOp=1;
1902  else break;
1903  } while((val = Config.GetWord()) && val[0]);
1904 
1905 // Make sure we have a statlib
1906 //
1907  if (!val || !(*val))
1908  {Eroute.Emsg("Config", "statlib not specified"); return 1;}
1909 
1910 // Record the path
1911 //
1912  if (STT_Lib) free(STT_Lib);
1913  STT_Lib = strdup(val);
1914 
1915 // Record any parms
1916 //
1917  if (!Config.GetRest(parms, sizeof(parms)))
1918  {Eroute.Emsg("Config", "statlib parameters too long"); return 1;}
1919  if (STT_Parms) free(STT_Parms);
1920  STT_Parms = (*parms ? strdup(parms) : 0);
1921  return 0;
1922 }

References XrdCms::Config, XrdSysError::Emsg(), STT_DoARE, STT_DoN2N, STT_Lib, STT_Parms, STT_PreOp, and STT_V2.

Referenced by ConfigXeq().

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

◆ xtrace()

int XrdOssSys::xtrace ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1938 of file XrdOssConfig.cc.

1939 {
1940  char *val;
1941  static struct traceopts {const char *opname; int opval;} tropts[] =
1942  {
1943  {"all", TRACE_ALL},
1944  {"debug", TRACE_Debug},
1945  {"open", TRACE_Open},
1946  {"opendir", TRACE_Opendir}
1947  };
1948  int i, neg, trval = 0, numopts = sizeof(tropts)/sizeof(struct traceopts);
1949 
1950  if (!(val = Config.GetWord()))
1951  {Eroute.Emsg("Config", "trace option not specified"); return 1;}
1952  while (val)
1953  {if (!strcmp(val, "off")) trval = 0;
1954  else {if ((neg = (val[0] == '-' && val[1]))) val++;
1955  for (i = 0; i < numopts; i++)
1956  {if (!strcmp(val, tropts[i].opname))
1957  {if (neg) trval &= ~tropts[i].opval;
1958  else trval |= tropts[i].opval;
1959  break;
1960  }
1961  }
1962  if (i >= numopts)
1963  Eroute.Say("Config warning: ignoring invalid trace option '",val,"'.");
1964  }
1965  val = Config.GetWord();
1966  }
1967  OssTrace.What = trval;
1968  return 0;
1969 }
#define TRACE_Opendir
Definition: XrdOssTrace.hh:38
#define TRACE_Open
Definition: XrdOssTrace.hh:39

References XrdCms::Config, XrdSysError::Emsg(), OssTrace, XrdSysError::Say(), TRACE_ALL, TRACE_Debug, TRACE_Open, TRACE_Opendir, and XrdSysTrace::What.

Referenced by ConfigXeq().

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

◆ xusage()

int XrdOssSys::xusage ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 1990 of file XrdOssConfig.cc.

1991 {
1992  char *val;
1993  int usval;
1994 
1995  if (!(val = Config.GetWord()))
1996  {Eroute.Emsg("Config", "usage option not specified"); return 1;}
1997 
1998  while(val)
1999  { if (!strcmp("nolog", val))
2000  {if (UDir) {free(UDir); UDir = 0;}}
2001  else if (!strcmp("log" , val))
2002  {if (UDir) {free(UDir); UDir = 0;}
2003  if (!(val = Config.GetWord()))
2004  {Eroute.Emsg("Config", "usage log path not specified");
2005  return 1;
2006  }
2007  if (*val != '/')
2008  {Eroute.Emsg("Config", "usage log path not absolute");
2009  return 1;
2010  }
2011  UDir = strdup(val);
2012  if (!(val = Config.GetWord()) || strcmp("sync", val))
2013  continue;
2014  if (!(val = Config.GetWord()))
2015  {Eroute.Emsg("Config", "log sync value not specified");
2016  return 1;
2017  }
2018  if (XrdOuca2x::a2i(Eroute,"sync value",val,&usval,1,32767))
2019  return 1;
2020  USync = usval;
2021  }
2022  else if (!strcmp("noquotafile",val))
2023  {if (QFile) {free(QFile); QFile= 0;}}
2024  else if (!strcmp("quotafile",val))
2025  {if (QFile) {free(QFile); QFile= 0;}
2026  if (!(val = Config.GetWord()))
2027  {Eroute.Emsg("Config", "quota file not specified");
2028  return 1;
2029  }
2030  QFile = strdup(val);
2031  }
2032  else {Eroute.Emsg("Config", "invalid usage option -",val); return 1;}
2033 
2034  val = Config.GetWord();
2035  }
2036  return 0;
2037 }

References XrdOuca2x::a2i(), XrdCms::Config, XrdSysError::Emsg(), QFile, UDir, and USync.

Referenced by ConfigXeq().

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

◆ xxfr()

int XrdOssSys::xxfr ( XrdOucStream Config,
XrdSysError Eroute 
)
protected

Definition at line 2064 of file XrdOssConfig.cc.

2065 {
2066  static const int maxfdln = 256;
2067  const char *wantParm = 0;
2068  char *val;
2069  int thrds = 1;
2070  long long speed = 9*1024*1024;
2071  int ovhd = 30;
2072  int htime = 3*60*60;
2073  int ktime;
2074  int upon = 0;
2075 
2076  while((val = Config.GetWord())) // deny |fdir | keep | up
2077  { if (!strcmp("deny", val))
2078  {wantParm = "xfr deny";
2079  if ((val = Config.GetWord())) // keep time
2080  {if (XrdOuca2x::a2tm(Eroute,wantParm,val,&htime,0))
2081  return 1;
2082  wantParm=0;
2083  }
2084  }
2085  else if (!strcmp("fdir", val))
2086  {wantParm = "xfr fdir";
2087  if ((val = Config.GetWord())) // fdir path
2088  {if (xfrFdir) free(xfrFdir);
2089  xfrFdln = strlen(val);
2090  if (xfrFdln > maxfdln)
2091  {Eroute.Emsg("Config","xfr fdir path too long");
2092  xfrFdir = 0; xfrFdln = 0; return 1;
2093  }
2094  xfrFdir = strdup(val);
2095  wantParm = 0;
2096  }
2097  }
2098  else if (!strcmp("keep", val))
2099  {wantParm = "xfr keep";
2100  if ((val = Config.GetWord())) // keep time
2101  {if (XrdOuca2x::a2tm(Eroute,wantParm,val,&ktime,0))
2102  return 1;
2103  xfrkeep=ktime; wantParm=0;
2104  }
2105  }
2106  else if (!strcmp("up", val)) {upon = 1; wantParm = 0;}
2107  else break;
2108  };
2109 
2110  xfrhold = htime;
2111  if (upon) OptFlags |= XrdOss_USRPRTY;
2112 
2113  if (!val) {if (!wantParm) return 0;
2114  else {Eroute.Emsg("Config", wantParm, "value not specified");
2115  return 1;
2116  }
2117  }
2118 
2119  if (strcmp(val, "*") && XrdOuca2x::a2i(Eroute,"xfr threads",val,&thrds,1))
2120  return 1;
2121 
2122  if ((val = Config.GetWord())) // <speed>
2123  {if (strcmp(val, "*") &&
2124  XrdOuca2x::a2sz(Eroute,"xfr speed",val,&speed,1024)) return 1;
2125 
2126  if ((val = Config.GetWord())) // <ovhd>
2127  {if (strcmp(val, "*") &&
2128  XrdOuca2x::a2tm(Eroute,"xfr overhead",val,&ovhd,0)) return 1;
2129 
2130  if ((val = Config.GetWord())) // <hold>
2131  if (strcmp(val, "*") &&
2132  XrdOuca2x::a2tm(Eroute,"xfr hold",val,&htime,0)) return 1;
2133  }
2134  }
2135 
2136  xfrhold = htime;
2137  xfrthreads = thrds;
2138  xfrspeed = speed;
2139  xfrovhd = ovhd;
2140  return 0;
2141 }

References XrdOuca2x::a2i(), XrdOuca2x::a2sz(), XrdOuca2x::a2tm(), XrdCms::Config, XrdSysError::Emsg(), OptFlags, xfrFdir, xfrFdln, xfrhold, xfrkeep, xfrovhd, xfrspeed, xfrthreads, and XrdOss_USRPRTY.

Referenced by ConfigXeq().

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

Member Data Documentation

◆ 

union { ... }

◆ AioAllOk

int XrdOssSys::AioAllOk = 0
static

◆ badreqs

int XrdOssSys::badreqs
protected

Definition at line 311 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and Stage_In().

◆ chkMmap

char XrdOssSys::chkMmap = 0
static

Definition at line 211 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigMio(), and XrdOssFile::Open().

◆ ConfigFN

char* XrdOssSys::ConfigFN

Definition at line 224 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigN2N(), ConfigProc(), ConfigStatLib(), and Configure().

◆ cscanint

int XrdOssSys::cscanint
protected

Definition at line 300 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Configure(), and xcachescan().

◆ DirFlags

unsigned long long XrdOssSys::DirFlags

◆ DPList

OssDPath* XrdOssSys::DPList

Definition at line 265 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStats(), and getStats().

◆ FDFence

int XrdOssSys::FDFence

Definition at line 249 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Configure(), and xfdlimit().

◆ FDLimit

int XrdOssSys::FDLimit

Definition at line 250 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Configure(), and xfdlimit().

◆ fuzalloc

int XrdOssSys::fuzalloc
protected

Definition at line 299 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Configure(), and xalloc().

◆ isMSSC

int XrdOssSys::isMSSC

Definition at line 246 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigXeq(), and MSS_Stat().

◆ lcl_N2N

◆ lenDP

int XrdOssSys::lenDP

Definition at line 266 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStats(), and getStats().

◆ LocalRoot

char* XrdOssSys::LocalRoot

Definition at line 225 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigN2N(), Configure(), and ConfigXeq().

◆ MaxArgs

const int XrdOssSys::MaxArgs = 15
static

Definition at line 222 of file XrdOssApi.hh.

◆ MaxSize

long long XrdOssSys::MaxSize

Definition at line 248 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), XrdOssFile::Write(), and xmaxsz().

◆ MaxTwiddle

int XrdOssSys::MaxTwiddle

Definition at line 227 of file XrdOssApi.hh.

Referenced by XrdOssSys().

◆ minalloc

long long XrdOssSys::minalloc
protected

Definition at line 297 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Configure(), and xalloc().

◆ myVersion

XrdVersionInfo* XrdOssSys::myVersion

Definition at line 289 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigN2N(), ConfigStatLib(), and XrdOssGetSS().

◆ N2N_Lib

char* XrdOssSys::N2N_Lib

Definition at line 259 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigN2N(), Configure(), and xnml().

◆ N2N_Parms

char* XrdOssSys::N2N_Parms

Definition at line 260 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigN2N(), and xnml().

◆ numCG

short XrdOssSys::numCG

Definition at line 268 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStats(), and getStats().

◆ numDP

short XrdOssSys::numDP

Definition at line 267 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStats(), and getStats().

◆ OptFlags

int XrdOssSys::OptFlags

Definition at line 254 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigSpace(), Configure(), Stage_RT(), xspaceBuild(), and xxfr().

◆ ovhalloc

int XrdOssSys::ovhalloc
protected

Definition at line 298 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Configure(), and xalloc().

◆ pfcMode

bool XrdOssSys::pfcMode
protected

Definition at line 321 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigCache(), and Configure().

◆ pndbytes

long long XrdOssSys::pndbytes
protected

Definition at line 307 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Stage_In(), and Stage_RT().

◆ prActive

int XrdOssSys::prActive

Definition at line 285 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and XrdOssFile::ReadV().

◆ prBytes

int XrdOssSys::prBytes

Definition at line 284 of file XrdOssApi.hh.

Referenced by XrdOssSys(), XrdOssFile::ReadV(), and xprerd().

◆ prDepth

short XrdOssSys::prDepth

Definition at line 286 of file XrdOssApi.hh.

Referenced by XrdOssSys(), XrdOssFile::ReadV(), and xprerd().

◆ prPBits

long long XrdOssSys::prPBits

Definition at line 281 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and XrdOssFile::ReadV().

◆ prPMask

long long XrdOssSys::prPMask

Definition at line 282 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and XrdOssFile::ReadV().

◆ prPSize

int XrdOssSys::prPSize

Definition at line 283 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and xprerd().

◆ prQSize

short XrdOssSys::prQSize

Definition at line 287 of file XrdOssApi.hh.

Referenced by XrdOssSys(), XrdOssFile::ReadV(), and xprerd().

◆ QFile

char* XrdOssSys::QFile
protected

Definition at line 317 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Configure(), and xusage().

◆ RemoteRoot

char* XrdOssSys::RemoteRoot

Definition at line 226 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigN2N(), Configure(), and ConfigXeq().

◆ rmt_N2N

XrdOucName2Name* XrdOssSys::rmt_N2N

Definition at line 262 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigN2N(), GenRemotePath(), XrdOssDir::Opendir(), Stage_RT(), and Stat().

◆ RPList

◆ RSSCmd

char* XrdOssSys::RSSCmd

◆ RSSProg

XrdOucProg* XrdOssSys::RSSProg
protected

Definition at line 314 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), and MSS_Xeq().

◆ RSSTout

int XrdOssSys::RSSTout

Definition at line 247 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and MSS_Xeq().

◆ Solitary

int XrdOssSys::Solitary

Definition at line 253 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), Configure(), and RenameLink().

◆ SPList

XrdOucPListAnchor XrdOssSys::SPList

Definition at line 256 of file XrdOssApi.hh.

Referenced by Alloc_Cache(), Config_Display(), ConfigSpace(), and xspace().

◆ StageAction

char* XrdOssSys::StageAction

Definition at line 240 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), and Stage_QT().

◆ StageActLen

int XrdOssSys::StageActLen

Definition at line 239 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), and Stage_QT().

◆ StageAln

int XrdOssSys::StageAln[MaxArgs]

Definition at line 243 of file XrdOssApi.hh.

◆ StageAnum

int XrdOssSys::StageAnum

Definition at line 244 of file XrdOssApi.hh.

◆ StageArg

char* XrdOssSys::StageArg[MaxArgs]

Definition at line 242 of file XrdOssApi.hh.

◆ StageAsync

int XrdOssSys::StageAsync

Definition at line 229 of file XrdOssApi.hh.

Referenced by XrdOssSys(), CalcTime(), Config_Display(), ConfigStage(), and xstg().

◆ StageCmd

char* XrdOssSys::StageCmd

Definition at line 232 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigStage(), ConfigStageC(), Stage_RT(), and xstg().

◆ StageCreate

int XrdOssSys::StageCreate

Definition at line 230 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigStage(), Create(), and xstg().

◆ StageEvents

char* XrdOssSys::StageEvents

Definition at line 237 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), and Stage_QT().

◆ StageEvSize

int XrdOssSys::StageEvSize

Definition at line 238 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), and Stage_QT().

◆ StageFormat

int XrdOssSys::StageFormat

Definition at line 231 of file XrdOssApi.hh.

Referenced by ConfigStageC(), and Stage_QT().

◆ StageFrm

XrdFrcProxy* XrdOssSys::StageFrm

Definition at line 235 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), and Stage_QT().

◆ StageMsg

char* XrdOssSys::StageMsg

Definition at line 233 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigStageC(), and ConfigXeq().

◆ StageProg

XrdOucProg* XrdOssSys::StageProg
protected

Definition at line 313 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStageC(), GetFile(), and Stage_QT().

◆ StageRealTime

int XrdOssSys::StageRealTime

Definition at line 228 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStage(), ConfigStageC(), and Stage().

◆ StageSnd

XrdOucMsubs* XrdOssSys::StageSnd

Definition at line 234 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStageC(), and Stage_QT().

◆ stgbytes

long long XrdOssSys::stgbytes
protected

Definition at line 308 of file XrdOssApi.hh.

Referenced by XrdOssSys(), CalcTime(), and Stage_In().

◆ STT_DoARE

char XrdOssSys::STT_DoARE

Definition at line 279 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStatLib(), and xstl().

◆ STT_DoN2N

char XrdOssSys::STT_DoN2N

Definition at line 277 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Stat(), and xstl().

◆ STT_Lib

char* XrdOssSys::STT_Lib

Definition at line 270 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStatLib(), Configure(), and xstl().

◆ STT_Parms

char* XrdOssSys::STT_Parms

Definition at line 271 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStatLib(), and xstl().

◆ STT_PreOp

int XrdOssSys::STT_PreOp

Definition at line 276 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and xstl().

◆ STT_V2

char XrdOssSys::STT_V2

Definition at line 278 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStatLib(), Stat(), and xstl().

◆ the_N2N

XrdOucName2Name* XrdOssSys::the_N2N

Definition at line 263 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and ConfigN2N().

◆ totbytes

long long XrdOssSys::totbytes
protected

Definition at line 309 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and Stage_In().

◆ totreqs

int XrdOssSys::totreqs
protected

Definition at line 310 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and Stage_In().

◆ Trace

int XrdOssSys::Trace

Definition at line 252 of file XrdOssApi.hh.

◆ tryMmap

char XrdOssSys::tryMmap = 0
static

Definition at line 210 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigMio(), and XrdOssFile::Open().

◆ UDir

char* XrdOssSys::UDir
protected

Definition at line 316 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Configure(), RenameLink(), and xusage().

◆ USync

short XrdOssSys::USync
protected

Definition at line 320 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Configure(), and xusage().

◆ xfrFdir

char* XrdOssSys::xfrFdir
protected

Definition at line 318 of file XrdOssApi.hh.

Referenced by XrdOssSys(), HasFile(), and xxfr().

◆ xfrFdln

int XrdOssSys::xfrFdln
protected

Definition at line 319 of file XrdOssApi.hh.

Referenced by XrdOssSys(), HasFile(), and xxfr().

◆ xfrhold

int XrdOssSys::xfrhold
protected

Definition at line 303 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Stage_In(), Stage_QT(), and xxfr().

◆ xfrkeep

int XrdOssSys::xfrkeep
protected

Definition at line 304 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), Stage_QT(), and xxfr().

◆ xfrovhd

int XrdOssSys::xfrovhd
protected

Definition at line 302 of file XrdOssApi.hh.

Referenced by XrdOssSys(), CalcTime(), and xxfr().

◆ xfrspeed

int XrdOssSys::xfrspeed
protected

Definition at line 301 of file XrdOssApi.hh.

Referenced by XrdOssSys(), CalcTime(), Stage_In(), and xxfr().

◆ xfrtcount

int XrdOssSys::xfrtcount
protected

Definition at line 306 of file XrdOssApi.hh.

Referenced by XrdOssSys(), ConfigStageC(), and Stage_In().

◆ xfrthreads

int XrdOssSys::xfrthreads
protected

Definition at line 305 of file XrdOssApi.hh.

Referenced by XrdOssSys(), Config_Display(), ConfigStageC(), Stage_In(), and xxfr().


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