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 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 &)
 
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 153 of file XrdOssApi.hh.

Constructor & Destructor Documentation

◆ XrdOssSys()

XrdOssSys::XrdOssSys ( )

Definition at line 150 of file XrdOssConfig.cc.

151 {
152  static XrdVERSIONINFODEF(myVer, XrdOss, XrdVNUMBER, XrdVERSION);
153  myVersion = &myVer;
154  xfrtcount = 0;
155  pndbytes = 0;
156  stgbytes = 0;
157  totbytes = 0;
158  totreqs = 0;
159  badreqs = 0;
160  MaxTwiddle = 3;
161  tryMmap = 0;
162  chkMmap = 0;
163  lcl_N2N = rmt_N2N = the_N2N = 0;
164  N2N_Lib = N2N_Parms = 0;
165  StageCmd = 0;
166  StageMsg = 0;
167  StageSnd = 0;
168  StageFrm = 0;
169  StageRealTime = 1;
170  StageAsync = 0;
171  StageCreate = 0;
172  StageEvents = (char *)"-";
173  StageEvSize = 1;
174  StageAction = (char *)"wq ";
175  StageActLen = 3;
176  RSSCmd = 0;
177  isMSSC = 0;
178  RSSTout =15*1000;
179  DirFlags = 0;
180  OptFlags = 0;
181  LocalRoot = 0;
182  RemoteRoot = 0;
183  cscanint = 600;
184  FDFence = -1;
185  FDLimit = -1;
186  MaxSize = 0;
187  minalloc = 0;
188  ovhalloc = 0;
189  fuzalloc = 0;
190  xfrspeed = 9*1024*1024;
191  xfrovhd = 30;
192  xfrhold = 3*60*60;
193  xfrkeep = 20*60;
194  xfrthreads = 1;
195  ConfigFN = 0;
196  QFile = 0;
197  UDir = 0;
198  USync = 0;
199  Solitary = 0;
200  DPList = 0;
201  lenDP = 0;
202  numCG = numDP = 0;
203  xfrFdir = 0;
204  xfrFdln = 0;
205  pfcMode = false;
206  RSSProg = 0;
207  StageProg = 0;
208  prPBits = (long long)sysconf(_SC_PAGESIZE);
209  prPSize = static_cast<int>(prPBits);
210  prPBits--;
211  prPMask = ~prPBits;
212  prBytes = 0;
213  prActive = 0;
214  prDepth = 0;
215  prQSize = 0;
216  STT_Lib = 0;
217  STT_Parms = 0;
218  STT_Func = 0;
219  STT_Fund = 0;
220  STT_PreOp = 0;
221  STT_DoN2N = 1;
222  STT_V2 = 0;
223  STT_DoARE = 0;
224 }
int badreqs
Definition: XrdOssApi.hh:304
int StageCreate
Definition: XrdOssApi.hh:223
char STT_DoN2N
Definition: XrdOssApi.hh:270
char STT_V2
Definition: XrdOssApi.hh:271
int FDLimit
Definition: XrdOssApi.hh:243
int totreqs
Definition: XrdOssApi.hh:303
char * LocalRoot
Definition: XrdOssApi.hh:218
OssDPath * DPList
Definition: XrdOssApi.hh:258
int STT_PreOp
Definition: XrdOssApi.hh:269
char * N2N_Parms
Definition: XrdOssApi.hh:253
short numCG
Definition: XrdOssApi.hh:261
long long totbytes
Definition: XrdOssApi.hh:302
long long minalloc
Definition: XrdOssApi.hh:290
char * StageEvents
Definition: XrdOssApi.hh:230
int StageRealTime
Definition: XrdOssApi.hh:221
short prDepth
Definition: XrdOssApi.hh:279
int FDFence
Definition: XrdOssApi.hh:242
static char chkMmap
Definition: XrdOssApi.hh:204
int xfrthreads
Definition: XrdOssApi.hh:298
int OptFlags
Definition: XrdOssApi.hh:247
int isMSSC
Definition: XrdOssApi.hh:239
char * QFile
Definition: XrdOssApi.hh:310
int prBytes
Definition: XrdOssApi.hh:277
char * ConfigFN
Definition: XrdOssApi.hh:217
int ovhalloc
Definition: XrdOssApi.hh:291
char * StageAction
Definition: XrdOssApi.hh:233
char STT_DoARE
Definition: XrdOssApi.hh:272
char * UDir
Definition: XrdOssApi.hh:309
int StageActLen
Definition: XrdOssApi.hh:232
short USync
Definition: XrdOssApi.hh:313
XrdOucProg * StageProg
Definition: XrdOssApi.hh:306
XrdOucName2Name * the_N2N
Definition: XrdOssApi.hh:256
short prQSize
Definition: XrdOssApi.hh:280
long long MaxSize
Definition: XrdOssApi.hh:241
int prPSize
Definition: XrdOssApi.hh:276
int RSSTout
Definition: XrdOssApi.hh:240
int prActive
Definition: XrdOssApi.hh:278
int xfrspeed
Definition: XrdOssApi.hh:294
XrdOucName2Name * lcl_N2N
Definition: XrdOssApi.hh:254
long long prPMask
Definition: XrdOssApi.hh:275
long long prPBits
Definition: XrdOssApi.hh:274
int fuzalloc
Definition: XrdOssApi.hh:292
int cscanint
Definition: XrdOssApi.hh:293
int StageAsync
Definition: XrdOssApi.hh:222
XrdOucProg * RSSProg
Definition: XrdOssApi.hh:307
char * STT_Parms
Definition: XrdOssApi.hh:264
long long pndbytes
Definition: XrdOssApi.hh:300
static char tryMmap
Definition: XrdOssApi.hh:203
XrdVersionInfo * myVersion
Definition: XrdOssApi.hh:282
char * N2N_Lib
Definition: XrdOssApi.hh:252
int xfrovhd
Definition: XrdOssApi.hh:295
long long stgbytes
Definition: XrdOssApi.hh:301
char * STT_Lib
Definition: XrdOssApi.hh:263
int xfrFdln
Definition: XrdOssApi.hh:312
XrdOucMsubs * StageSnd
Definition: XrdOssApi.hh:227
short numDP
Definition: XrdOssApi.hh:260
XrdFrcProxy * StageFrm
Definition: XrdOssApi.hh:228
unsigned long long DirFlags
Definition: XrdOssApi.hh:244
int StageEvSize
Definition: XrdOssApi.hh:231
int xfrhold
Definition: XrdOssApi.hh:296
bool pfcMode
Definition: XrdOssApi.hh:314
int xfrtcount
Definition: XrdOssApi.hh:299
char * StageCmd
Definition: XrdOssApi.hh:225
char * StageMsg
Definition: XrdOssApi.hh:226
char * RemoteRoot
Definition: XrdOssApi.hh:219
int xfrkeep
Definition: XrdOssApi.hh:297
int Solitary
Definition: XrdOssApi.hh:246
int MaxTwiddle
Definition: XrdOssApi.hh:220
char * RSSCmd
Definition: XrdOssApi.hh:238
XrdOucName2Name * rmt_N2N
Definition: XrdOssApi.hh:255
char * xfrFdir
Definition: XrdOssApi.hh:311
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 285 of file XrdOssApi.hh.

285 {}

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:201
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
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 
)
protected

Definition at line 229 of file XrdOssCreate.cc.

230 {
231  EPNAME("Alloc_Cache")
232  int datfd, rc;
233  const char *spName;
234  char pbuff[MAXPATHLEN+1], cgbuff[XrdOssSpace::minSNbsz], *tmp;
235  XrdOssCache::allocInfo aInfo(crInfo.Path, pbuff, sizeof(pbuff));
236 
237 // Grab the suggested size from the environment
238 //
239  if ((tmp = env.Get(OSS_ASIZE))
240  && XrdOuca2x::a2sz(OssEroute,"invalid asize",tmp,&aInfo.cgSize,0))
241  return -XRDOSS_E8018;
242 
243 // Determine the space we should use for this allocation
244 //
245  spName = env.Get(OSS_CGROUP);
246  if (!spName || (SPList.NotEmpty() && SPList.Default() == spAssign))
247  {XrdOucPList *pl = SPList.About(crInfo.LFN);
248  if (pl && (!spName || pl->Attr() == spAssign)) spName = pl->Name();
249  }
250 
251 // Get the correct cache group and partition path
252 //
253  if ((aInfo.cgPath=XrdOssCache::Parse(spName,cgbuff,sizeof(cgbuff))))
254  aInfo.cgPlen = strlen(aInfo.cgPath);
255 
256 // Allocate space in the cache.
257 //
258  aInfo.cgName = cgbuff;
259  aInfo.aMode = crInfo.Amode;
260  if ((datfd = XrdOssCache::Alloc(aInfo)) < 0) return datfd;
261 
262 // Set the pfn as the extended attribute if we are in new mode
263 //
264  if (!(crInfo.pOpts & XRDEXP_NOXATTR)
265  && (rc = XrdSysFAttr::Xat->Set(XrdFrcXAttrPfn::Name(), crInfo.Path,
266  strlen(crInfo.Path)+1, pbuff, datfd)))
267  {close(datfd); return rc;}
268 
269 // Set extended attributes for this newly created file if allowed to do so.
270 // SetFattr() alaways closes the provided file descriptor!
271 //
272  if ((rc = SetFattr(crInfo, datfd, 1))) return rc;
273 
274 // Now create a symbolic link to the target
275 //
276  if ((symlink(pbuff, crInfo.Path) && errno != EEXIST)
277  || unlink(crInfo.Path) || symlink(pbuff, crInfo.Path))
278  {rc = -errno; unlink(pbuff);}
279 
280 // All done
281 //
282  DEBUG(aInfo.cgName <<" cache for " <<pbuff);
283  return rc;
284 }
#define spAssign
Definition: XrdOssApi.hh:250
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
int unlink(const char *path)
#define close(a)
Definition: XrdPosix.hh:43
@ 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:249
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 290 of file XrdOssCreate.cc.

291 {
292  int datfd, rc;
293 
294 // Simply open the file in the local filesystem, creating it if need be.
295 //
296  do {datfd = open(crInfo.Path, O_RDWR|O_CREAT|O_TRUNC, crInfo.Amode);}
297  while(datfd < 0 && errno == EINTR);
298  if (datfd < 0) return -errno;
299 
300 // Set extended attributes for this newly created file if allowed to do so.
301 // SetFattr() alaways closes the provided file descriptor!
302 //
303  if ((rc = SetFattr(crInfo, datfd, 1))) return rc;
304 
305 // All done
306 //
307  return XrdOssOK;
308 }
#define XrdOssOK
Definition: XrdOss.hh:50
int open(const char *path, int oflag,...)

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 }
int stat(const char *path, struct stat *buf)
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 272 of file XrdOssApi.cc.

273 {
274  char actual_path[MAXPATHLEN+1], *local_path;
275  int retc;
276 
277 // Generate local path
278 //
279  if (lcl_N2N)
280  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
281  return retc;
282  else local_path = actual_path;
283  else local_path = (char *)path;
284 
285 // Change the file only in the local filesystem.
286 //
287  return (chmod(local_path, mode) ? -errno : XrdOssOK);
288 }
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 397 of file XrdOssConfig.cc.

398 {
399  char buff[4096], *cloc;
400  XrdOucPList *fp;
401 
402  // Preset some tests
403  //
404  int HaveRSSCmd = (RSSCmd && RSSCmd[0]);
405  int HaveStageCmd = (StageCmd && StageCmd[0]);
406  int HaveRemoteRoot = (RemoteRoot && RemoteRoot[0]);
407  int HaveLocalRoot = (LocalRoot && LocalRoot[0]);
408  int HaveStageMsg = (StageMsg && StageMsg[0]);
409  int HaveN2N_Lib = (N2N_Lib != 0);
410 
411  if (!ConfigFN || !ConfigFN[0]) cloc = (char *)"Default";
412  else cloc = ConfigFN;
413 
414  snprintf(buff, sizeof(buff), "Config effective %s oss configuration:\n"
415  " oss.alloc %lld %d %d\n"
416  " oss.spacescan %d\n"
417  " oss.fdlimit %d %d\n"
418  " oss.maxsize %lld\n"
419  "%s%s%s"
420  "%s%s%s"
421  "%s%s%s"
422  "%s%s%s%s%s"
423  "%s%s%s"
424  "%s%s%s"
425  " oss.trace %x\n"
426  " oss.xfr %d deny %d keep %d",
427  cloc,
429  cscanint,
431  XrdOssConfig_Val(N2N_Lib, namelib),
432  XrdOssConfig_Val(LocalRoot, localroot),
433  XrdOssConfig_Val(RemoteRoot, remoteroot),
434  XrdOssConfig_Vop(StageCmd, stagecmd, StageAsync, "async ","sync ",
435  StageCreate, "creates ", ""),
436  XrdOssConfig_Val(StageMsg, stagemsg),
437  XrdOssConfig_Val(RSSCmd, rsscmd),
438  OssTrace.What,
440 
441  Eroute.Say(buff);
442 
443  XrdOssMio::Display(Eroute);
444 
445  XrdOssCache::List(" oss.", Eroute);
446  List_Path(" oss.defaults ", "", DirFlags, Eroute);
447  fp = RPList.First();
448  while(fp)
449  {List_Path(" oss.path ", fp->Path(), fp->Flag(), Eroute);
450  fp = fp->Next();
451  }
452  fp = SPList.First();
453  while(fp)
454  {Eroute.Say(" oss.space ", fp->Name(),
455  (fp->Attr() == spAssign ? " assign " : " default "),
456  fp->Path());
457  fp = fp->Next();
458  }
459 }
#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:257
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:141

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 468 of file XrdOssConfig.cc.

469 {
470  const unsigned long long conFlags =
475 
476  XrdOucPList *fp = RPList.First();
477  unsigned long long oflag, pflag;
478 
479 // If this is pass 2 then if we are in pfcMode, then reset r/o flag to r/w
480 // to allow the pfc to actually write into the cache paths.
481 //
482  if (pass2)
483  {if (pfcMode)
484  {while(fp)
485  {pflag = fp->Flag();
486  if (pflag & XRDEXP_PFCACHE) fp->Set(pflag & ~XRDEXP_NOTRW);
487  fp = fp->Next();
488  }
489  }
490  return;
491  }
492 
493 // Run through all the paths and resolve any conflicts with a cache
494 //
495  while(fp)
496  {oflag = pflag = fp->Flag();
497  if ((pflag & XRDEXP_PFCACHE)
498  || (pfcMode && !(pflag & XRDEXP_PFCACHE_X)))
499  {if (!(pflag & XRDEXP_NOTRW)) pflag |= XRDEXP_READONLY;
500  pflag &= ~conFlags;
501  pflag |= XRDEXP_PFCACHE;
502  if (oflag != pflag) fp->Set(pflag);
503  }
504  fp = fp->Next();
505  }
506 
507 // Handle default settings
508 //
509  if (DirFlags & XRDEXP_PFCACHE)
511  DirFlags &= ~conFlags;
512  }
513 }
#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_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_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 519 of file XrdOssConfig.cc.

520 {
521  XrdOucPList *fp;
522  unsigned long long flags = 0;
523  int setoff = 0;
524 
525 // Initialize memory mapping setting to speed execution
526 //
527  if (!(tryMmap = XrdOssMio::isOn())) return;
529 
530 // Run through all the paths and get the composite flags
531 //
532  fp = RPList.First();
533  while(fp)
534  {flags |= fp->Flag();
535  fp = fp->Next();
536  }
537 
538 // Handle default settings
539 //
542  flags |= DirFlags;
544 
545 // Produce warnings if unsupported features have been selected
546 //
547 #if !defined(_POSIX_MAPPED_FILES)
548  if (flags & XRDEXP_MEMAP)
549  {Eroute.Say("Config warning: memory mapped files not supported; "
550  "feature disabled.");
551  setoff = 1;
552  fp = RPList.First();
553  while(fp)
554  {fp->Set(fp->Flag() & ~XRDEXP_MEMAP);
555  fp = fp->Next();
556  }
558  }
559 #elif !defined(_POSIX_MEMLOCK)
560  if (flags & XRDEXP_MLOK)
561  {Eroute.Say("Config warning: memory locked files not supported; "
562  "feature disabled.");
563  fp = RPList.First();
564  while(fp)
565  {fp->Set(fp->Flag() & ~XRDEXP_MLOK);
566  fp = fp->Next();
567  }
569  }
570 #endif
571 
572 // If no memory flags are set, turn off memory mapped files
573 //
574  if (!(flags & XRDEXP_MEMAP) || setoff)
575  {XrdOssMio::Set(0, 0, 0);
576  tryMmap = 0; chkMmap = 0;
577  }
578 }
#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 584 of file XrdOssConfig.cc.

585 {
587 
588 // Get the plugin
589 //
590  if (!(the_N2N = n2nLoader.Load(N2N_Lib, *myVersion, envP))) return 1;
591 
592 // Optimize the local case
593 //
594  if (N2N_Lib) rmt_N2N = lcl_N2N = the_N2N;
595  else {if (LocalRoot) lcl_N2N = the_N2N;
596  if (RemoteRoot) rmt_N2N = the_N2N;
597  }
598 
599 // All done
600 //
601  return 0;
602 }
XrdOucEnv * envP
Definition: XrdPss.cc:109

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 608 of file XrdOssConfig.cc.

609 {
610  char *var;
611  int cfgFD, retc, NoGo = XrdOssOK;
612  XrdOucEnv myEnv;
613  XrdOucStream Config(&Eroute, getenv("XRDINSTANCE"), &myEnv, "=====> ");
614 
615 // If there is no config file, return with the defaults sets.
616 //
617  if( !ConfigFN || !*ConfigFN)
618  {Eroute.Say("Config warning: config file not specified; defaults assumed.");
619  return XrdOssOK;
620  }
621 
622 // Try to open the configuration file.
623 //
624  if ( (cfgFD = open(ConfigFN, O_RDONLY, 0)) < 0)
625  {Eroute.Emsg("Config", errno, "open config file", ConfigFN);
626  return 1;
627  }
628  Config.Attach(cfgFD);
629  static const char *cvec[] = { "*** oss plugin config:", 0 };
630  Config.Capture(cvec);
631 
632 // Now start reading records until eof.
633 //
634  while((var = Config.GetMyFirstWord()))
635  {if (!strncmp(var, "oss.", 4))
636  {if (ConfigXeq(var+4, Config, Eroute)) {Config.Echo(); NoGo = 1;}}
637  else if (!strcmp(var,"all.export")
638  && xpath(Config, Eroute)) {Config.Echo(); NoGo = 1;}
639  }
640 
641 // Now check if any errors occurred during file i/o
642 //
643  if ((retc = Config.LastError()))
644  NoGo = Eroute.Emsg("Config", retc, "read config file", ConfigFN);
645  Config.Close();
646 
647 // Return final return code
648 //
649  return NoGo;
650 }
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 695 of file XrdOssConfig.cc.

696 {
697  struct stat statbuff;
698  char Pfn[MAXPATHLEN+1+8], *Slash;
699 
700 // Get local path for this lfn
701 //
702  if (GenLocalPath(Lfn, Pfn)) return;
703 
704 // Now try to find the actual existing base path
705 //
706  while(stat(Pfn, &statbuff))
707  {if (!(Slash = rindex(Pfn, '/')) || Slash == Pfn) return;
708  *Slash = '\0';
709  }
710 
711 // Add this path to the file system data. We need to do this to track space
712 //
713  XrdOssCache_FS::Add(Pfn);
714 }
static int Add(const char *Path)
Definition: XrdOssCache.cc:250
int GenLocalPath(const char *, char *)
Definition: XrdOssApi.cc:232

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 656 of file XrdOssConfig.cc.

657 {
658  XrdOucPList *fp = RPList.First();
659  int noCacheFS = !(OptFlags & XrdOss_CacheFS);
660 
661 // Configure space for each non-cached exported path. We only keep track of
662 // space that can actually be modified in some way.
663 //
664  while(fp)
665  {if ( ((noCacheFS || (fp->Flag() & XRDEXP_INPLACE)) &&
666  (fp->Flag() & (XRDEXP_STAGE | XRDEXP_PURGE)))
667  || !(fp->Flag() & XRDEXP_NOTRW)
668  || (fp->Flag() & XRDEXP_PFCACHE) )
669  ConfigSpace(fp->Path());
670  fp = fp->Next();
671  }
672 
673 // If there is a space list then verify it
674 //
675  if ((fp = SPList.First()))
676  {XrdOssCache_Group *fsg;
677  const char *what;
678  bool zAssign = false;
679  while(fp)
680  {if (fp->Attr() != spAssign) what = "default space ";
681  else {zAssign = true; what = "assign space ";}
682  const char *grp = fp->Name();
684  while(fsg) {if (!strcmp(fsg->group,grp)) break; fsg = fsg->next;}
685  if (!fsg) Eroute.Say("Config warning: unable to ", what, grp,
686  " to ", fp->Path(), "; space not defined.");
687  fp = fp->Next();
688  }
689  if (zAssign) SPList.Default(static_cast<unsigned long long>(spAssign));
690  }
691 }
#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 720 of file XrdOssConfig.cc.

722 {
723 // mig+r/w -> check unless nocheck was specified
724 //
725  if (!(flags & XRDEXP_CHECK_X))
726  {if ((flags & XRDEXP_MIG) && !(flags & XRDEXP_NOTRW))
727  flags &= ~XRDEXP_NOCHECK;
728  else flags |= XRDEXP_NOCHECK;
729  }
730 // rsscmd -> dread unless nodread was specified
731 //
732  if (!(flags & XRDEXP_DREAD_X))
733  {if (RSSCmd) flags &= ~XRDEXP_NODREAD;
734  else flags |= XRDEXP_NODREAD;
735  }
736 
737 // If there is no mss then turn off all mss related optionss, otherwise check
738 // if the options may leave the system in an inconsistent state
739 //
740  if (noMSS) flags=(flags & ~XRDEXP_RCREATE)|XRDEXP_NOCHECK|XRDEXP_NODREAD;
741  else if ((flags & XRDEXP_MIG) && (flags & XRDEXP_NOCHECK)
742  && !(flags & XRDEXP_NOTRW))
743  Eroute.Say("Config warning: 'all.export ", Path,
744  " nocheck mig r/w' allows file inconsistentcy!");
745 }
#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 751 of file XrdOssConfig.cc.

752 {
753  const char *What;
754  char *tp, *stgp = 0;
755  unsigned long long flags;
756  int noMSS, needRSS = 0, NoGo = 0;
757  XrdOucPList *fp;
758 
759 // Determine if we are a manager/supervisor. These never stage files so we
760 // really don't need (nor want) a stagecmd or an msscmd.
761 //
762  noMSS = ((tp = getenv("XRDREDIRECT"))
763  && (!strcmp(tp, "R") || !strcmp(tp, "M"))) | Solitary;
764 
765 // A rsscmd implies check+dread. Note that nostage is now always the default.
766 //
767  flags = (RSSCmd ? 0 : XRDEXP_NOCHECK | XRDEXP_NODREAD);
768  DirFlags = DirFlags | (flags & (~(DirFlags >> XRDEXP_MASKSHIFT)));
769 
770 // Set default flags
771 //
773 
774 // Reprocess the paths to set correct defaults
775 //
776  fp = RPList.First();
777  while(fp)
778  {flags = fp->Flag(); ConfigSpath(Eroute, fp->Path(), flags, noMSS);
779 
780  // Record the fact that we have a stageable path
781  //
782  if (flags & XRDEXP_STAGE) stgp = fp->Path();
783 
784  // Check if path requires rsscmd and complain if we don't have one
785  //
786  if (!(flags & XRDEXP_NOCHECK)) What = "has check";
787  else if (!(flags & XRDEXP_NODREAD)) What = "has dread";
788  else if (flags & XRDEXP_RCREATE) What = "has recreate";
789  else What = 0;
790  if (!noMSS && !RSSCmd && What)
791  {Eroute.Emsg("Config", fp->Path(), What,
792  "export attribute but rsscmd not specified.");
793  NoGo = 1;
794  } else if (What) needRSS = 1;
795 
796  // Update flags and proceed to next path
797  //
798  fp->Set(flags); fp = fp->Next();
799  }
800 
801 // If we are a manager/supervisor, short circuit MSS initialization
802 //
803  if (noMSS)
804  {if (RSSCmd) {free(RSSCmd); RSSCmd = 0;}
805  if (StageCmd) {free(StageCmd); StageCmd = 0;}
806  RSSProg = 0; StageCreate = 0;
807  return NoGo;
808  }
809 
810 // Check if we don't need the stagecmd but one was specified
811 //
812  if (StageCmd && !stgp)
813  {Eroute.Say("Config warning: 'stagecmd' ignored; no stageable paths present.");
814  free(StageCmd); StageCmd = 0;
815  }
816 
817 // Check if we don't need a remote storage service but one was specified
818 //
819  if (RSSCmd && !needRSS)
820  {Eroute.Say("Config warning: 'rsscmd' ignored; no path exported with "
821  "check, dread, or rcreate.");
822  free(RSSCmd); RSSCmd = 0;
823  }
824 
825 // If we have any errors at this point, just return failure
826 //
827  if (NoGo) return 1;
828  if (!RSSCmd && !StageCmd && !stgp) return 0;
829  Eroute.Say("++++++ Remote Storage System interface initialization started.");
830 
831 // Allocate a pr0gram object for the gateway command
832 //
833  if (RSSCmd)
834  {RSSProg = new XrdOucProg(&Eroute);
835  if (RSSProg->Setup(RSSCmd)) NoGo = 1;
836  }
837 
838 // Initialize staging if we need to
839 //
840  if (!NoGo && (StageCmd || stgp))
841  {const int AMode = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH; // 775
842  if (StageCmd && *StageCmd) NoGo = ConfigStageC(Eroute);
843  else {StageFrm = new XrdFrcProxy(Eroute.logger(),
846  getenv("XRDADMINPATH"), AMode);
847  StageRealTime = 0; StageAsync = 1;
848  }
849 
850  // Set up the event path
851  //
852  StageAction = (char *)"wfn "; StageActLen = 4;
853  if ((tp = getenv("XRDOFSEVENTS")))
854  {char sebuff[MAXPATHLEN+8];
855  StageEvSize = sprintf(sebuff, "file:///%s", tp);
856  StageEvents = strdup(sebuff);
857  } else {StageEvents = (char *)"-"; StageEvSize = 1;}
858  }
859 
860 // All done
861 //
862  tp = (NoGo ? (char *)"failed." : (char *)"completed.");
863  Eroute.Say("------ Remote Storage System interface initialization ", tp);
864  return NoGo;
865 }
#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:732
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141

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 871 of file XrdOssConfig.cc.

872 {
873  pthread_t tid;
874  char *sp, *tp;
875  int numt, retc, NoGo = 0;
876 
877 // The stage command is interactive if it starts with an | (i.e., pipe in)
878 //
879  tp = StageCmd;
880  while(*tp && *tp == ' ') tp++;
881  if (*tp == '|') {StageRealTime = 0;
882  do {tp++;} while(*tp == ' ');
883  }
884  StageCmd = tp;
885 
886 // This is a bit of hackery to get the traceid sent over to the
887 // new file residency manager (frm). Keeps the config simple.
888 //
889  if ((sp = index(StageCmd, ' '))) *sp = '\0';
890  if (!(tp = rindex (StageCmd, '/'))) tp = StageCmd;
891  else tp++;
892  if (!strncmp("frm_", tp, 4)) StageFormat = 1;
893  if (sp) *sp = ' ';
894 
895 // Set up a program object for the command
896 //
897  StageProg = new XrdOucProg(&Eroute);
898  if (StageProg->Setup(StageCmd)) NoGo = 1;
899 
900 // For old-style real-time staging, create threads to handle the staging
901 // For queue-style staging, start the program that handles the queue
902 //
903  if (!NoGo)
904  {if (StageRealTime)
905  {if ((numt = xfrthreads - xfrtcount) > 0) while(numt--)
906  {if ((retc = XrdSysThread::Run(&tid,XrdOssxfr,(void *)0,0,"staging")))
907  Eroute.Emsg("Config", retc, "create staging thread");
908  else xfrtcount++;
909  }
910  } else NoGo = StageProg->Start();
911  }
912 
913 // Setup the additional stage information vector. Variable substitution:
914 // <data>$var;<data>.... (max of MaxArgs substitutions). This is only relevant
915 // when using an actual stagecmd.
916 //
917  if (!NoGo && !StageRealTime && StageMsg)
918  {XrdOucMsubs *msubs = new XrdOucMsubs(&Eroute);
919  if (msubs->Parse("stagemsg", StageMsg)) StageSnd = msubs;
920  else NoGo = 1; // We will exit no need to delete msubs
921  }
922 
923 // All done
924 //
925  return NoGo;
926 }
void * XrdOssxfr(void *carg)
int StageFormat
Definition: XrdOssApi.hh:224
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 932 of file XrdOssConfig.cc.

933 {
934  XrdOucPinLoader myLib(&Eroute, myVersion, "statlib", STT_Lib);
935  const char *stName2 = "?XrdOssStatInfoInit2";
936 
937 // Get the plugin and stat function. Let's try version 2 first
938 //
939  XrdOssStatInfoInit2_t siGet2;
940  if (STT_V2) stName2++;
941  if ((siGet2=(XrdOssStatInfoInit2_t)myLib.Resolve(stName2)))
942  {if (!(STT_Fund = siGet2(this,Eroute.logger(),ConfigFN,STT_Parms,envP)))
943  return 1;
944  if (STT_DoARE) envP->PutPtr("XrdOssStatInfo2*", (void *)STT_Fund);
945  STT_V2 = 1;
946  return 0;
947  }
948 
949 // If we are here but the -2 was specified on the config then we fail
950 //
951  if (STT_V2) return 1;
952 
953 // OK, so we better find version 1 in the shared library
954 //
955  XrdOssStatInfoInit_t siGet;
956  if (!(siGet = (XrdOssStatInfoInit_t)myLib.Resolve("XrdOssStatInfoInit"))
957  || !(STT_Func = siGet (this,Eroute.logger(),ConfigFN,STT_Parms)))
958  return 1;
959 
960 // Return success
961 //
962  return 0;
963 }
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 1021 of file XrdOssConfig.cc.

1022 {
1023  struct stat Stat;
1024  char *Slash, pP[MAXPATHLEN+1];
1025 
1026 // Minimize the path
1027 //
1028  while((Slash = rindex(lP+1, '/')))
1029  {*Slash = '\0';
1030  if (GenLocalPath(lP, pP) || stat(pP, &Stat) || Stat.st_dev != Devnum)
1031  break;
1032  }
1033 
1034 // Extend path if need be and return
1035 //
1036  if (Slash) *Slash = '/';
1037 }
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 969 of file XrdOssConfig.cc.

970 {
971  struct StatsDev
972  {StatsDev *Next;
973  dev_t st_dev;
974  StatsDev(StatsDev *dP, dev_t dn) : Next(dP), st_dev(dn) {}
975  };
976 
978  XrdOucPList *fP = RPList.First();
979  StatsDev *dP1st = 0, *dP, *dPp;
980  struct stat Stat;
981  char LPath[MAXPATHLEN+1], PPath[MAXPATHLEN+1], *cP;
982 
983 // Count actual cache groups
984 //
985  while(fsg) {numCG++; fsg = fsg->next;}
986 
987 // Develop the list of paths that we will report on
988 //
989  if (fP) do
990  {strcpy(LPath, fP->Path());
991  if (GenLocalPath(LPath, PPath)) continue;
992  if (stat(PPath, &Stat) && (cP = rindex(LPath, '/')))
993  {*cP = '\0';
994  if (GenLocalPath(LPath, PPath) || stat(PPath, &Stat)) continue;
995  }
996  dP = dP1st;
997  while(dP && dP->st_dev != Stat.st_dev) dP = dP->Next;
998  if (dP) continue;
999  ConfigStats(Stat.st_dev, LPath);
1000  if (GenLocalPath(LPath, PPath)) continue;
1001  DPList = new OssDPath(DPList, strdup(LPath), strdup(PPath));
1002  lenDP += strlen(LPath) + strlen(PPath); numDP++;
1003  dP1st = new StatsDev(dP1st, Stat.st_dev);
1004  } while ((fP = fP->Next()));
1005 
1006 // If we have no exported paths then create a simple /tmp object
1007 //
1008  if (!numDP)
1009  {DPList = new OssDPath(0, strdup("/tmp"), strdup("/tmp"));
1010  lenDP = 4; numDP = 1;
1011  }
1012 
1013 // Now delete all of the device objects
1014 //
1015  dP = dP1st;
1016  while(dP) {dPp = dP; dP = dP->Next; delete dPp;}
1017 }
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 230 of file XrdOssConfig.cc.

232 {
233 /*
234  Function: Establish default values using a configuration file.
235 
236  Input: None.
237 
238  Output: 0 upon success or !0 otherwise.
239 */
242  static const int maxFD = 1048576;
243  struct rlimit rlim;
244  char *val;
245  int retc, NoGo = XrdOssOK;
246  pthread_t tid;
247  bool setfd = false;
248 
249 // Do the herald thing
250 //
251  Eroute.Say("++++++ Storage system initialization started.");
252  Eroute.addTable(ETab);
253  if (getenv("XRDDEBUG")) OssTrace.What = TRACE_ALL;
254 
255 // Preset all variables with common defaults
256 //
257  ConfigFN = (configfn && *configfn ? strdup(configfn) : 0);
258 
259 // Establish the FD limit and the fence (half way)
260 //
261  if (getrlimit(RLIMIT_NOFILE, &rlim))
262  {Eroute.Emsg("Config", errno, "get fd limit");
263  rlim.rlim_cur = maxFD;
264  }
265  else {if (rlim.rlim_max == RLIM_INFINITY)
266  {rlim.rlim_cur = maxFD;
267  setfd = true;
268  } else {
269  if (rlim.rlim_cur != rlim.rlim_max)
270  {rlim.rlim_cur = rlim.rlim_max;
271  setfd = true;
272  }
273  }
274  if (setfd)
275  {if (setrlimit(RLIMIT_NOFILE, &rlim))
276  Eroute.Emsg("Config", errno, "set fd limit");
277  else FDLimit = rlim.rlim_cur;
278  } else {FDFence = static_cast<int>(rlim.rlim_cur)>>1;
279  FDLimit = rlim.rlim_cur;
280  }
281  }
282  if (FDFence < 0 || FDFence >= FDLimit) FDFence = FDLimit >> 1;
283 
284 // Configure devices
285 //
287 
288 // Process the configuration file
289 //
290  NoGo = ConfigProc(Eroute);
291 
292 // Configure dependent plugins
293 //
294  if (!NoGo)
295  {if (N2N_Lib || LocalRoot || RemoteRoot) NoGo |= ConfigN2N(Eroute, envP);
296  if (STT_Lib && !NoGo) NoGo |= ConfigStatLib(Eroute, envP);
297  }
298 
299 // If the export list is empty, add at least "/tmp" to it otherwise we will
300 // fail to correctly track space.
301 //
302  if (RPList.First() == 0)
303  RPList.Insert(new XrdOucPList("/tmp", (unsigned long long)0));
304 
305 // Establish usage tracking and quotas, if need be. Note that if we are not
306 // a true data server, those services will be initialized but then disabled.
307 //
308  Solitary = ((val = getenv("XRDREDIRECT")) && !strcmp(val, "Q"));
309  pfcMode = (envP && (val = envP->Get("oss.runmode")) && !strcmp(val,"pfc"));
310  {const char *m1 = (Solitary ? "standalone " : 0);
311  const char *m2 = (pfcMode ? "pfc " : 0);
312  if (m1 || m2) Eroute.Say("++++++ Configuring ", m1, m2, "mode . . .");
313  }
316 
317 // Configure the MSS interface including staging
318 //
319  if (!NoGo) NoGo = ConfigStage(Eroute);
320 
321 // Configure async I/O
322 //
323  if (!NoGo) NoGo = !AioInit();
324 
325 // Initialize memory mapping setting to speed execution
326 //
327  if (!NoGo) ConfigMio(Eroute);
328 
329 // Provide support for the PFC. This also resolve cache attribute conflicts.
330 //
331  if (!NoGo) ConfigCache(Eroute);
332 
333 // Establish the actual default path settings (modified by the above)
334 //
336 
337 // Configure space (final pass)
338 //
339  ConfigSpace(Eroute);
340 
341 // Set the prefix for files in cache file systems
342  if ( OptFlags & XrdOss_CacheFS )
343  if (!NoGo) {
344  NoGo = XrdOssPath::InitPrefix();
345  if (NoGo) Eroute.Emsg("Config", "space initialization failed");
346  }
347 
348 // Configure statiscal reporting
349 //
350  if (!NoGo) ConfigStats(Eroute);
351 
352 // Start up the space scan thread unless specifically told not to. Some programs
353 // like the cmsd manually handle space updates.
354 //
355  if (!(val = getenv("XRDOSSCSCAN")) || strcmp(val, "off"))
356  {if ((retc = XrdSysThread::Run(&tid, XrdOssCacheScan,
357  (void *)&cscanint, 0, "space scan")))
358  Eroute.Emsg("Config", retc, "create space scan thread");
359  }
360 
361 // Display the final config if we can continue
362 //
363  if (!NoGo) Config_Display(Eroute);
364 
365 // Do final reset of paths if we are in proxy file cache mode
366 //
367  if (pfcMode && !NoGo) ConfigCache(Eroute, true);
368 
369 // Export the real path list (for frm et. al.)
370 //
371  XrdOssRPList = &RPList;
372  if (envP) envP->PutPtr("XrdOssRPList*", &RPList);
373 
374 // All done, close the stream and return the return code.
375 //
376  val = (NoGo ? (char *)"failed." : (char *)"completed.");
377  Eroute.Say("------ Storage system initialization ", val);
378  return NoGo;
379 }
const char * XrdOssErrorText[]
Definition: XrdOssConfig.cc:86
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:106

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(), 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 1043 of file XrdOssConfig.cc.

1044 {
1045  char myVar[80], buff[2048], *val;
1046  int nosubs;
1047  XrdOucEnv *myEnv = 0;
1048 
1049  TS_Xeq("alloc", xalloc);
1050  TS_Xeq("cache", xcache);
1051  TS_Xeq("cachescan", xcachescan); // Backward compatibility
1052  TS_Xeq("spacescan", xcachescan);
1053  TS_Xeq("defaults", xdefault);
1054  TS_Xeq("fdlimit", xfdlimit);
1055  TS_Xeq("maxsize", xmaxsz);
1056  TS_Xeq("memfile", xmemf);
1057  TS_Xeq("namelib", xnml);
1058  TS_Xeq("path", xpath);
1059  TS_Xeq("preread", xprerd);
1060  TS_Xeq("space", xspace);
1061  TS_Xeq("stagecmd", xstg);
1062  TS_Xeq("statlib", xstl);
1063  TS_Xeq("trace", xtrace);
1064  TS_Xeq("usage", xusage);
1065  TS_Xeq("xfr", xxfr);
1066 
1067  // Check if var substitutions are prohibited (e.g., stagemsg). Note that
1068  // TS_String() returns upon success so be careful when adding new opts.
1069  //
1070  if ((nosubs = !strcmp(var, "stagemsg"))) myEnv = Config.SetEnv(0);
1071 
1072  // Copy the variable name as this may change because it points to an
1073  // internal buffer in Config. The vagaries of effeciency.
1074  //
1075  strlcpy(myVar, var, sizeof(myVar));
1076  var = myVar;
1077 
1078  // We need to suck all the tokens to the end of the line for remaining
1079  // options. Do so, until we run out of space in the buffer.
1080  //
1081  if (!Config.GetRest(buff, sizeof(buff)))
1082  {Eroute.Emsg("Config", "arguments too long for", var);
1083  if (nosubs) Config.SetEnv(myEnv);
1084  return 1;
1085  }
1086  val = buff;
1087 
1088  // Restore substititions at this point if need be
1089  //
1090  if (nosubs) Config.SetEnv(myEnv);
1091 
1092  // At this point, make sure we have a value
1093  //
1094  if (!(*val))
1095  {Eroute.Emsg("Config", "no value for directive", var);
1096  return 1;
1097  }
1098 
1099  // Check for tokens taking a variable number of parameters
1100  //
1101  TS_String("localroot", LocalRoot);
1102  TS_String("remoteroot", RemoteRoot);
1103  TS_String("stagemsg", StageMsg);
1104 
1105  // The following differentiates between a deprecated and a preferred command
1106  //
1107  if (!strcmp("msscmd", var)) {isMSSC = 1; Duplicate(val, RSSCmd); return 0;}
1108  if (!strcmp("rsscmd", var)) {isMSSC = 0; Duplicate(val, RSSCmd); return 0;}
1109 
1110  // No match found, complain.
1111  //
1112  Eroute.Say("Config warning: ignoring unknown directive '",var,"'.");
1113  Config.Echo();
1114  return 0;
1115 }
#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_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 // At this point, creation requests may need to be routed via the stagecmd.
148 // This is done if the file/link do not exist. Otherwise, we drop through.
149 //
150  if (StageCreate && Missing)
151  return XrdOssSS->Stage(tident, path, env, Opts>>8,
152  access_mode, crInfo.pOpts);
153 
154 // The file must not exist if it's declared "new". Otherwise, reuse the space.
155 // SetFattr() alaways closes the provided file descriptor!
156 //
157  if (!Missing)
158  {if (Opts & XRDOSS_new) return -EEXIST;
159  if ((buf.st_mode & S_IFMT) == S_IFDIR) return -EISDIR;
160  do {datfd = open(local_path, Opts>>8, access_mode);}
161  while(datfd < 0 && errno == EINTR);
162  if (datfd < 0) return -errno;
163  if ((retc = SetFattr(crInfo, datfd, buf.st_mtime))) return retc;
164  if (Opts>>8 & O_TRUNC && buf.st_size)
165  {off_t theSize = buf.st_size;
166  if (isLink) {buf.st_mode = (buf.st_mode & ~S_IFMT) | S_IFLNK;
167  XrdOssCache::Adjust(local_path, -theSize, &buf);
168  }
169  }
170  return 0;
171  }
172 
173 // If the path is to be created, make sure the path exists at this point
174 //
175  if ((Opts & XRDOSS_mkpath) && (p = rindex(local_path, '/')))
176  {p++; pc = *p; *p = '\0';
177  XrdOucUtils::makePath(local_path, AMode);
178  *p = pc;
179  }
180 
181 // If this is a staging filesystem then we have lots more work to do.
182 //
183  if (remotefs)
184  {char remote_path[MAXPATHLEN+1];
185 
186  // Generate the remote path for this file
187  //
188  if ((retc = GenRemotePath(path,remote_path))) return retc;
189 
190  // Create the file in remote system unless not wanted so
191  //
192  if (crInfo.pOpts & XRDEXP_RCREATE)
193  {if ((retc = MSS_Create(remote_path, access_mode, env)) < 0)
194  {DEBUG("rc" <<retc <<" mode=" <<Xrd::oct1 <<access_mode
195  <<" remote path=" <<remote_path);
196  return retc;
197  }
198  } else if (!(crInfo.pOpts & XRDEXP_NOCHECK))
199  {if (!(retc = MSS_Stat(remote_path))) return -EEXIST;
200  else if (retc != -ENOENT) return retc;
201  }
202  }
203 
204 // Created file in the extended cache or the local name space
205 //
206  if (XrdOssCache::fsfirst && !(crInfo.pOpts & XRDEXP_INPLACE))
207  retc = Alloc_Cache(crInfo, env);
208  else retc = Alloc_Local(crInfo, env);
209 
210 // If successful then check if xattrs were actually set
211 //
212  if (retc == XrdOssOK && crInfo.cOpts & XRDOSS_setnoxa)
213  {XrdOucPList *plP = RPList.About(path);
214  if (plP) plP->Set(plP->Flag() | XRDEXP_NOXATTR);
215  }
216 
217 // All done.
218 //
219  return retc;
220 }
#define tident
#define Check_RO(act, flags, path, opname)
Definition: XrdOssApi.hh:387
XrdOssSys * XrdOssSS
Definition: XrdOssApi.cc:77
#define XRDOSS_setnoxa
Definition: XrdOss.hh:471
#define XRDOSS_new
Definition: XrdOss.hh:467
#define XRDOSS_mkpath
Definition: XrdOss.hh:466
int lstat(const char *path, struct stat *buf)
static XrdOssCache_FS * fsfirst
Definition: XrdOssCache.hh:269
int GenRemotePath(const char *, char *)
Definition: XrdOssApi.cc:249
virtual int Stage(const char *, const char *, XrdOucEnv &, int, mode_t, unsigned long long)
Definition: XrdOssStage.cc:110
int Alloc_Cache(XrdOssCreateInfo &, XrdOucEnv &)
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 &)
static int makePath(char *path, mode_t mode, bool reset=false)
Definition: XrdOucUtils.cc:917
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, XrdOucPList::Flag(), XrdOssCache::fsfirst, GenLocalPath(), GenRemotePath(), lstat(), XrdOucUtils::makePath(), MSS_Create(), MSS_Stat(), Xrd::oct1, open(), XrdMpx::Opts, OssEroute, XrdOssCreateInfo::pOpts, RPList, XrdOucPList::Set(), SetFattr(), Stage(), StageCreate, stat(), tident, unlink(), XRDEXP_INPLACE, XRDEXP_NOCHECK, XRDEXP_NOXATTR, XRDEXP_RCREATE, 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 166 of file XrdOssApi.hh.

166 {return XRDOSS_HASNAIO;} // Turn async I/O off for disk
#define XRDOSS_HASNAIO
Definition: XrdOss.hh:480

References XRDOSS_HASNAIO.

◆ Find()

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

◆ GenLocalPath()

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

Definition at line 232 of file XrdOssApi.cc.

233 {
234  if (lcl_N2N) return -(lcl_N2N->lfn2pfn(oldp, newp, MAXPATHLEN));
235  if (strlen(oldp) >= MAXPATHLEN) return -ENAMETOOLONG;
236  strcpy(newp, oldp);
237  return 0;
238 }

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 249 of file XrdOssApi.cc.

250 {
251  if (rmt_N2N) return -(rmt_N2N->lfn2rfn(oldp, newp, MAXPATHLEN));
252  if (strlen(oldp) >= MAXPATHLEN) return -ENAMETOOLONG;
253  strcpy(newp, oldp);
254  return 0;
255 }
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 186 of file XrdOssApi.cc.

187 {
188  int retc;
189 
190 // No need to do the herald thing as we are the default storage system
191 //
192  OssEroute.logger(lp);
193 
194 // Initialize the subsystems
195 //
196  XrdOssSS = this;
197  if ( (retc = Configure(configfn, OssEroute, envP)) ) return retc;
198 
199 // All done.
200 //
201  return XrdOssOK;
202 }
XrdSysError OssEroute(0, "oss_")
XrdOssSys * XrdOssSS
Definition: XrdOssApi.cc:77
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 170 of file XrdOssApi.hh.

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

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 171 of file XrdOssApi.hh.

172  {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 208 of file XrdOssApi.cc.

209 {
210  if (lcl_N2N) return -(lcl_N2N->lfn2pfn(oldp, newp, blen));
211  if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
212  strcpy(newp, oldp);
213  return 0;
214 }

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 216 of file XrdOssApi.cc.

217 {
218  if (!lcl_N2N) {rc = 0; return oldp;}
219  if ((rc = -(lcl_N2N->lfn2pfn(oldp, newp, blen)))) return 0;
220  return newp;
221 }

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 2087 of file XrdOssConfig.cc.

2089 {
2090  std::string ss;
2091  const char *rwmode;
2092 
2093  if (flags & XRDEXP_FORCERO) rwmode = " forcero";
2094  else if (flags & XRDEXP_READONLY) rwmode = " r/o";
2095  else rwmode = " r/w";
2096 
2097  if (flags & XRDEXP_INPLACE) ss += " inplace";
2098  if (flags & XRDEXP_LOCAL) ss += " local";
2099  if (flags & XRDEXP_GLBLRO) ss += " globalro";
2100 
2101  if (!(flags & XRDEXP_PFCACHE))
2102  {if (flags & XRDEXP_PFCACHE_X) ss += " nocache";
2103  ss += (flags & XRDEXP_NOCHECK ? " nocheck" : " check");
2104  ss += (flags & XRDEXP_NODREAD ? " nodread" : " dread");
2105  ss += (flags & XRDEXP_MIG ? " mig" : " nomig");
2106  ss += (flags & XRDEXP_PURGE ? " purge" : " nopurge");
2107  ss += (flags & XRDEXP_RCREATE ? " rcreate" : " norcreate");
2108  ss += (flags & XRDEXP_STAGE ? " stage" : " nostage");
2109  } else ss += " cache";
2110 
2111 
2112  if (flags & XRDEXP_MMAP)
2113  {ss += " mmap";
2114  ss += (flags & XRDEXP_MKEEP ? " mkeep" : " nomkeep");
2115  ss += (flags & XRDEXP_MLOK ? " mlock" : " nomlock");
2116  }
2117 
2118  Eroute.Say(pfx, pname, rwmode, ss.c_str());
2119 }
#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_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 306 of file XrdOssApi.cc.

307 {
308  char actual_path[MAXPATHLEN+1], *local_path;
309  int retc;
310 
311 // Make sure we can modify this path
312 //
313  Check_RW(Mkdir, path, "create directory");
314 
315 // Generate local path
316 //
317  if (lcl_N2N)
318  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
319  return retc;
320  else local_path = actual_path;
321  else local_path = (char *)path;
322 
323 // Create the directory or full path only in the loal file system
324 //
325  if (!mkdir(local_path, mode)) return XrdOssOK;
326  if (mkpath && errno == ENOENT){return Mkpath(local_path, mode);}
327  if (errno != EEXIST) return -errno;
328 
329 // Check if this is a duplicate request
330 //
331  struct stat Stat;
332  static const mode_t accBits = (S_IRWXU|S_IRWXG|S_IRWXO);
333 
334  if (!stat(local_path, &Stat) && S_ISDIR(Stat.st_mode)
335  && mode == (Stat.st_mode & accBits)) return XrdOssOK;
336  return -EEXIST;
337 }
#define Check_RW(act, path, opname)
Definition: XrdOssApi.hh:392
int mkdir(const char *path, mode_t mode)
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0)
Definition: XrdOssApi.cc:306
int Mkpath(const char *, mode_t mode)
Definition: XrdOssApi.cc:353

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 353 of file XrdOssApi.cc.

354 {
355  char local_path[MAXPATHLEN+1], *next_path;
356  int i = strlen(path);
357 
358 // Copy the path so we can modify it
359 //
360  strcpy(local_path, path);
361 
362 // Trim off the trailing slashes so we can have predictable behaviour
363 //
364  while(i && local_path[--i] == '/') local_path[i] = '\0';
365  if (!i) return -ENOENT;
366 
367 // Start creating directories starting with the root
368 //
369  next_path = local_path;
370  while((next_path = index(next_path+1, int('/'))))
371  {*next_path = '\0';
372  if (mkdir(local_path, mode) && errno != EEXIST) return -errno;
373  *next_path = '/';
374  }
375 
376 // Create last component and return
377 //
378  if (mkdir(local_path, mode) && errno != EEXIST) return -errno;
379  return XrdOssOK;
380 }

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 210 of file XrdOssApi.hh.

210 {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 156 of file XrdOssApi.hh.

157  {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 158 of file XrdOssApi.hh.

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

References tident.

◆ PathOpts()

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

Definition at line 177 of file XrdOssApi.hh.

177 {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:159
XrdSysError OssEroute
int rename(const char *oldpath, const char *newpath)
static XrdOssCache_FS * Find(const char *Path, int lklen=0)
Definition: XrdOssCache.cc:611
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:469
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 314 of file XrdOssCreate.cc.

315 {
316  class fdCloser
317  {public:
318  const char *Path;
319  int theFD;
320  int Done(int rc) {if (rc) unlink(Path); return rc;}
321  fdCloser(const char *pn, int fd) : Path(pn), theFD(fd) {}
322  ~fdCloser() {close(theFD);}
323  } Act(crInfo.Path, fd);
324 
326  int rc;
327 
328 // Check if we need or can record the create time
329 //
330  if (!(XRDEXP_MIGPRG & crInfo.pOpts)
331  || (crInfo.pOpts & XRDEXP_NOXATTR)) return Act.Done(0);
332 
333 // Set copy time
334 //
335  crX.Attr.cpyTime = static_cast<long long>(mtime);
336  rc = crX.Set(crInfo.Path, fd);
337 
338 // Check if extended attribute were set and indicate whether it is supported
339 //
340  if (rc == -ENOTSUP) {rc = 0; crInfo.cOpts |= XRDOSS_setnoxa;}
341  return Act.Done(rc);
342 }
#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
@ Info
@ 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(), 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:486
#define XRDOSS_updtatm
Definition: XrdOss.hh:487
int IsRemote(const char *path)
Definition: XrdOssApi.hh:171
unsigned long long PathOpts(const char *path)
Definition: XrdOssApi.hh:177

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:773
static const int PF_dNums
Definition: XrdOss.hh:771
static const int PF_dInfo
Definition: XrdOss.hh:770
static const int PF_isLFN
Definition: XrdOss.hh:772

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 396 of file XrdOssApi.cc.

397 {
398  static const char statfmt1[] = "<stats id=\"oss\" v=\"2\">";
399  static const char statfmt2[] = "</stats>";
400  static const int statflen = sizeof(statfmt1) + sizeof(statfmt2);
401  char *bp = buff;
402  int n;
403 
404 // If only size wanted, return what size we need
405 //
406  if (!buff) return statflen + getStats(0,0);
407 
408 // Make sure we have enough space
409 //
410  if (blen < statflen) return 0;
411  strcpy(bp, statfmt1);
412  bp += sizeof(statfmt1)-1; blen -= sizeof(statfmt1)-1;
413 
414 // Generate space statistics
415 //
416  n = getStats(bp, blen);
417  bp += n; blen -= n;
418 
419 // Add trailer
420 //
421  if (blen >= (int)sizeof(statfmt2))
422  {strcpy(bp, statfmt2); bp += (sizeof(statfmt2)-1);}
423  return bp - buff;
424 }
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 442 of file XrdOssApi.cc.

444 {
445  struct stat statbuff;
446  char actual_path[MAXPATHLEN+1], *local_path;
447  long long oldsz;
448  int retc;
449 
450 // Make sure we can modify this path
451 //
452  Check_RW(Truncate, path, "truncate");
453 
454 // Generate local path
455 //
456  if (lcl_N2N)
457  if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
458  return retc;
459  else local_path = actual_path;
460  else local_path = (char *)path;
461 
462 // Get file info to do the correct adjustment
463 //
464  if (lstat(local_path, &statbuff)) return -errno;
465  else if ((statbuff.st_mode & S_IFMT) == S_IFDIR) return -EISDIR;
466  else if ((statbuff.st_mode & S_IFMT) == S_IFLNK)
467  {struct stat buff;
468  if (stat(local_path, &buff)) return -errno;
469  oldsz = buff.st_size;
470  } else oldsz = statbuff.st_size;
471 
472 // Change the file only in the local filesystem and make space adjustemt
473 //
474  if (truncate(local_path, size)) return -errno;
475  XrdOssCache::Adjust(local_path,static_cast<long long>(size)-oldsz,&statbuff);
476  return XrdOssOK;
477 }
int truncate(const char *path, off_t offset)
int Truncate(const char *, unsigned long long Size, XrdOucEnv *eP=0)
Definition: XrdOssApi.cc:442

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:468
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 1137 of file XrdOssConfig.cc.

1138 {
1139  char *val;
1140  long long mina = 0;
1141  int fuzz = 0;
1142  int hdrm = 0;
1143 
1144  if (!(val = Config.GetWord()))
1145  {Eroute.Emsg("Config", "alloc minfree not specified"); return 1;}
1146  if (strcmp(val, "*") &&
1147  XrdOuca2x::a2sz(Eroute, "alloc minfree", val, &mina, 0)) return 1;
1148 
1149  if ((val = Config.GetWord()))
1150  {if (strcmp(val, "*") &&
1151  XrdOuca2x::a2i(Eroute,"alloc headroom",val,&hdrm,0,100)) return 1;
1152 
1153  if ((val = Config.GetWord()))
1154  {if (strcmp(val, "*") &&
1155  XrdOuca2x::a2i(Eroute, "alloc fuzz", val, &fuzz, 0, 100)) return 1;
1156  }
1157  }
1158 
1159  minalloc = mina;
1160  ovhalloc = hdrm;
1161  fuzalloc = fuzz;
1162  return 0;
1163 }
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 1180 of file XrdOssConfig.cc.

1181 {
1182  int rc, isXA = 0;
1183 
1184 // Skip out to process this entry and upon success indicate that it is
1185 // deprecated and "space" should be used instead if an XA-style space defined.
1186 //
1187  if (!(rc = xspace(Config, Eroute, &isXA)))
1188  {if (isXA) Eroute.Say("Config warning: 'oss.cache' is deprecated; "
1189  "use 'oss.space' instead!");
1190  else {Eroute.Say("Config failure: non-xa spaces are no longer "
1191  "supported!");
1192  rc = 1;
1193  }
1194  }
1195  return rc;
1196 }

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 1210 of file XrdOssConfig.cc.

1211 { int cscan = 0;
1212  char *val;
1213 
1214  if (!(val = Config.GetWord()))
1215  {Eroute.Emsg("Config", "cachescan not specified"); return 1;}
1216  if (XrdOuca2x::a2tm(Eroute, "cachescan", val, &cscan, 30)) return 1;
1217  cscanint = cscan;
1218  return 0;
1219 }
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 1235 of file XrdOssConfig.cc.

1236 {
1238  return 0;
1239 }
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 1258 of file XrdOssConfig.cc.

1259 {
1260  char *val;
1261  int fence = 0, FDHalf = FDLimit>>1;
1262 
1263  if (!(val = Config.GetWord()))
1264  {Eroute.Emsg("Config", "fdlimit fence not specified"); return 1;}
1265 
1266  if (!strcmp(val, "*")) FDFence = FDHalf;
1267  else {if (XrdOuca2x::a2i(Eroute,"fdlimit fence",val,&fence,0)) return 1;
1268  FDFence = (fence < FDHalf ? fence : FDHalf);
1269  }
1270 
1271  while(Config.GetWord()) {}
1272 
1273 // Eroute.Say("Config warning: ", "fdlimit directive no longer supported.");
1274 
1275  return 0;
1276 }

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 1291 of file XrdOssConfig.cc.

1292 { long long msz;
1293  char *val;
1294 
1295  if (!(val = Config.GetWord()))
1296  {Eroute.Emsg("Config", "maxsize value not specified"); return 1;}
1297  if (XrdOuca2x::a2sz(Eroute, "maxsize", val, &msz, 1024*1024)) return 1;
1298  MaxSize = msz;
1299  return 0;
1300 }

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 1323 of file XrdOssConfig.cc.

1324 {
1325  char *val;
1326  int i, j, V_check=-1, V_preld = -1, V_on=-1;
1327  long long V_max = 0;
1328 
1329  static struct mmapopts {const char *opname; int otyp;
1330  const char *opmsg;} mmopts[] =
1331  {
1332  {"off", 0, ""},
1333  {"preload", 1, "memfile preload"},
1334  {"check", 2, "memfile check"},
1335  {"max", 3, "memfile max"}};
1336  int numopts = sizeof(mmopts)/sizeof(struct mmapopts);
1337 
1338  if (!(val = Config.GetWord()))
1339  {Eroute.Emsg("Config", "memfile option not specified"); return 1;}
1340 
1341  while (val)
1342  {for (i = 0; i < numopts; i++)
1343  if (!strcmp(val, mmopts[i].opname)) break;
1344  if (i >= numopts)
1345  Eroute.Say("Config warning: ignoring invalid memfile option '",val,"'.");
1346  else {if (mmopts[i].otyp > 1 && !(val = Config.GetWord()))
1347  {Eroute.Emsg("Config","memfile",mmopts[i].opname,
1348  "value not specified");
1349  return 1;
1350  }
1351  switch(mmopts[i].otyp)
1352  {case 1: V_preld = 1;
1353  break;
1354  case 2: if (!strcmp("xattr",val)
1355  || !strcmp("lock", val)
1356  || !strcmp("map", val)
1357  || !strcmp("keep", val)) V_check=1;
1358  else {Eroute.Emsg("Config",
1359  "mmap check argument not xattr");
1360  return 1;
1361  }
1362  break;
1363  case 3: j = strlen(val);
1364  if (val[j-1] == '%')
1365  {val[j-1] = '\0';
1366  if (XrdOuca2x::a2i(Eroute,mmopts[i].opmsg,
1367  val, &j, 1, 1000)) return 1;
1368  V_max = -j;
1369  } else if (XrdOuca2x::a2sz(Eroute,
1370  mmopts[i].opmsg, val, &V_max,
1371  10*1024*1024)) return 1;
1372  break;
1373  default: V_on = 0; break;
1374  }
1375  val = Config.GetWord();
1376  }
1377  }
1378 
1379 // Set the values
1380 //
1381  XrdOssMio::Set(V_on, V_preld, V_check);
1382  XrdOssMio::Set(V_max);
1383  return 0;
1384 }

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 1400 of file XrdOssConfig.cc.

1401 {
1402  char *val, parms[1040];
1403 
1404 // Get the path
1405 //
1406  if (!(val = Config.GetWord()) || !val[0])
1407  {Eroute.Emsg("Config", "namelib not specified"); return 1;}
1408 
1409 // Record the path
1410 //
1411  if (N2N_Lib) free(N2N_Lib);
1412  N2N_Lib = strdup(val);
1413 
1414 // Record any parms
1415 //
1416  if (!Config.GetRest(parms, sizeof(parms)))
1417  {Eroute.Emsg("Config", "namelib parameters too long"); return 1;}
1418  if (N2N_Parms) free(N2N_Parms);
1419  N2N_Parms = (*parms ? strdup(parms) : 0);
1420  return 0;
1421 }

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 1437 of file XrdOssConfig.cc.

1438 {
1439  XrdOucPList *pP;
1440 
1441 // Parse the arguments
1442 //
1444  if (!pP) return 1;
1445 
1446 // If this is an absolute path, we are done
1447 //
1448  if (*(pP->Path()) == '/') return 0;
1449 
1450 // If this is an objectid path then make sure to set the default for these
1451 //
1452  if (*(pP->Path()) == '*')
1453  {RPList.Defstar(pP->Flag());
1454  return 0;
1455  }
1456 
1457 // We do not (yet) support exporting specific object ID's
1458 //
1459  Eroute.Emsg("Config", "Unsupported export -", pP->Path());
1460  return 1;
1461 }
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 1487 of file XrdOssConfig.cc.

1488 {
1489  static const long long m16 = 16777216LL;
1490  char *val;
1491  long long lim = 1048576;
1492  int depth, qeq = 0, qsz = 128;
1493 
1494  if (!(val = Config.GetWord()))
1495  {Eroute.Emsg("Config", "preread depth not specified"); return 1;}
1496 
1497  if (!strcmp(val, "on")) depth = 3;
1498  else if (XrdOuca2x::a2i(Eroute,"preread depth",val,&depth,0, 1024))
1499  return 1;
1500 
1501  while((val = Config.GetWord()))
1502  { if (!strcmp(val, "limit"))
1503  {if (!(val = Config.GetWord()))
1504  {Eroute.Emsg("Config","preread limit not specified");
1505  return 1;
1506  }
1507  if (XrdOuca2x::a2sz(Eroute,"preread limit",val,&lim,0,m16))
1508  return 1;
1509  }
1510  else if (!strcmp(val, "qsize"))
1511  {if (!(val = Config.GetWord()))
1512  {Eroute.Emsg("Config","preread qsize not specified");
1513  return 1;
1514  }
1515  if (XrdOuca2x::a2i(Eroute,"preread qsize",val,&qsz,0,1024))
1516  return 1;
1517  if (qsz < depth)
1518  {Eroute.Emsg("Config","preread qsize must be >= depth");
1519  return 1;
1520  }
1521  }
1522  else {Eroute.Emsg("Config","invalid preread option -",val); return 1;}
1523  }
1524 
1525  if (lim < prPSize || !qsz) depth = 0;
1526  if (!qeq && depth)
1527  {qsz = qsz/(depth/2+1);
1528  if (qsz < depth) qsz = depth;
1529  }
1530 
1531  prDepth = depth;
1532  prQSize = qsz;
1533  prBytes = lim;
1534  return 0;
1535 }

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 1682 of file XrdOssConfig.cc.

1684 {
1685  XrdOucPList *pl;
1686  char *path;
1687 
1688 // Get the path
1689 //
1690  path = Config.GetWord();
1691  if (!path || !path[0])
1692  {Eroute.Emsg("Config", "space path not specified"); return 1;}
1693 
1694 // Create a new path list object and add it to list of paths
1695 //
1696 do{if ((pl = SPList.Match(path))) pl->Set(path, grp);
1697  else {pl = new XrdOucPList(path, grp);
1698  SPList.Insert(pl);
1699  }
1700  pl->Set((isAsgn ? spAssign : 0));
1701  } while((path = Config.GetWord()));
1702 
1703 // All done
1704 //
1705  return 0;
1706 }
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 1555 of file XrdOssConfig.cc.

1556 {
1557  XrdOucString grp, fn, mn;
1558  OssSpaceConfig sInfo(grp, fn, mn);
1559  char *val;
1560  int k;
1561  bool isAsgn, isStar;
1562 
1563 // Get the space name
1564 //
1565  if (!(val = Config.GetWord()))
1566  {Eroute.Emsg("Config", "space name not specified"); return 1;}
1567  if ((int)strlen(val) > XrdOssSpace::maxSNlen)
1568  {Eroute.Emsg("Config","excessively long space name - ",val); return 1;}
1569  grp = val;
1570 
1571 // Get the path to the space
1572 //
1573  if (!(val = Config.GetWord()) || !(*val))
1574  {Eroute.Emsg("Config", "space path not specified"); return 1;}
1575 
1576 // Check if assignment
1577 //
1578  if (((isAsgn = !strcmp("assign",val)) || ! strcmp("default",val)) && !isCD)
1579  return xspace(Config, Eroute, grp.c_str(), isAsgn);
1580 
1581 // Preprocess this path and validate it
1582 //
1583  k = strlen(val)-1;
1584  if ((isStar = val[k] == '*')) val[k--] = 0;
1585  else while(k > 0 && val[k] == '/') val[k--] = 0;
1586 
1587  if (k >= MAXPATHLEN || val[0] != '/' || (k < 2 && !isStar))
1588  {Eroute.Emsg("Config", "invalid space path - ", val); return 1;}
1589  fn = val;
1590 
1591 // Sanitize the path as we are sensitive to proper placement of slashes
1592 //
1593  do {k = fn.replace("/./", "/");} while(k);
1594  do {k = fn.replace("//", "/");} while(k);
1595 
1596 // Additional options (for now) are only available to the old-style cache
1597 // directive. So, ignore any unless we entered via the directive.
1598 //
1599  if (isCD)
1600  {if ((val = Config.GetWord()))
1601  {if (strcmp("xa", val))
1602  {Eroute.Emsg("Config","invalid cache option - ",val); return 1;}
1603  else *isCD = 1;
1604  } else {*isCD = 0; sInfo.isXA = false;}
1605  } else {
1606  if ((val = Config.GetWord()) && !strcmp("chkmount", val))
1607  {if (!(val = Config.GetWord()))
1608  {Eroute.Emsg("Config","chkmount ID not specified"); return 1;}
1609  if ((int)strlen(val) > XrdOssSpace::maxSNlen)
1610  {Eroute.Emsg("Config","excessively long mount name - ",val);
1611  return 1;
1612  }
1613  mn = val;
1614  sInfo.chkMnt = true;
1615  if ((val = Config.GetWord()))
1616  {if (!strcmp("nofail", val)) sInfo.noFail = true;
1617  else {Eroute.Emsg("Config","invalid space option - ",val);
1618  return 1;
1619  }
1620  }
1621  }
1622  }
1623 
1624 // Check if this directory in the parent is only to be used for the space
1625 //
1626  if (!isStar)
1627  {if (!fn.endswith('/')) fn += '/';
1628  return !xspaceBuild(sInfo, Eroute);
1629  }
1630 
1631 // We now need to build a space for each directory in the parent
1632 //
1633  struct dirent *dp;
1634  struct stat Stat;
1635  XrdOucString pfx, basepath(fn);
1636  DIR *dirP;
1637  int dFD, rc, snum = 0;
1638  bool chkPfx, failed = false;
1639 
1640  if (basepath.endswith('/')) chkPfx = false;
1641  else {int pos = basepath.rfind('/');
1642  pfx = &basepath[pos+1];
1643  basepath.keep(0, pos+1);
1644  chkPfx = true;
1645  }
1646 
1647  if ((dFD=open(basepath.c_str(),O_DIRECTORY)) < 0 || !(dirP=fdopendir(dFD)))
1648  {Eroute.Emsg("Config",errno,"open space directory",fn.c_str()); return 1;}
1649 
1650  errno = 0;
1651  while((dp = readdir(dirP)))
1652  {if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")
1653  || (chkPfx && strncmp(dp->d_name,pfx.c_str(),pfx.length()))) continue;
1654 
1655  if (fstatat(dFD, dp->d_name, &Stat, AT_SYMLINK_NOFOLLOW))
1656  {basepath += dp->d_name;
1657  break;
1658  }
1659 
1660  if ((Stat.st_mode & S_IFMT) == S_IFDIR)
1661  {fn = basepath; fn += dp->d_name; fn += '/';
1662  if (!xspaceBuild(sInfo, Eroute)) failed = true;
1663  snum++;
1664  }
1665  errno = 0;
1666  }
1667 
1668 // Make sure we built all space successfully and have at least one space
1669 //
1670  if ((rc = errno))
1671  Eroute.Emsg("Config", errno, "process space directory", fn.c_str());
1672  else if (!snum)
1673  Eroute.Say("Config warning: no space directories found in ",
1674  fn.c_str());
1675 
1676  closedir(dirP);
1677  return rc != 0 || failed;
1678 }
struct dirent * readdir(DIR *dirp)
int closedir(DIR *dirp)
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(), 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 1710 of file XrdOssConfig.cc.

1711 {
1714  int rc = 0;
1715 
1716 // Check if we need to verify the mount. Note: sPath must end with a '/'!
1717 //
1718  if (sInfo.chkMnt)
1719  {XrdOucString mFile(sInfo.mName), mPath(sInfo.sPath);
1720  struct stat Stat;
1721  mPath.erasefromend(1);
1722  mFile += '.';
1723  mFile += rindex(mPath.c_str(), '/')+1;
1724  mPath += '/'; mPath += mFile;
1725  if (stat(mPath.c_str(), &Stat))
1726  {char buff[2048];
1727  snprintf(buff, sizeof(buff), "%s@%s; ",
1728  mFile.c_str(), sInfo.sPath.c_str());
1729  Eroute.Say((sInfo.noFail ? "Config warning:" : "Config failure:"),
1730  " Unable to verify mount point ", buff, XrdSysE2T(errno));
1731  return (sInfo.noFail ? 1 : 0);
1732  }
1733  }
1734 
1735 // Add the space to the configuration
1736 
1737  XrdOssCache_FS *fsp = new XrdOssCache_FS(rc, sInfo.sName.c_str(),
1738  sInfo.sPath.c_str(), fopts);
1739  if (rc)
1740  {char buff[256];
1741  snprintf(buff, sizeof(buff), "create %s space at", sInfo.sName.c_str());
1742  Eroute.Emsg("Config", rc, buff, sInfo.sPath.c_str());
1743  if (fsp) delete fsp;
1744  return 0;
1745  }
1747  return 1;
1748 }
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 1768 of file XrdOssConfig.cc.

1769 {
1770  char *val, buff[2048], *bp = buff;
1771  int vlen, blen = sizeof(buff)-1, isAsync = 0, isCreate = 0;
1772 
1773 // Get the aync or async option
1774 //
1775  if ((val = Config.GetWord()))
1776  if ((isAsync = !strcmp(val, "async")) || !strcmp(val, "sync"))
1777  val = Config.GetWord();
1778 
1779 // Get the create option
1780 //
1781  if (val)
1782  if ((isCreate = !strcmp(val, "creates"))) val = Config.GetWord();
1783 
1784 // Get the command
1785 //
1786  if (!val) {Eroute.Emsg("Config", "stagecmd not specified"); return 1;}
1787 
1788 // Copy the command and all of it's arguments
1789 //
1790  do {if ((vlen = strlen(val)) >= blen)
1791  {Eroute.Emsg("Config", "stagecmd arguments too long"); break;}
1792  *bp = ' '; bp++; strcpy(bp, val); bp += vlen; blen -= vlen;
1793  } while((val = Config.GetWord()));
1794 
1795  if (val) return 1;
1796  *bp = '\0'; val = buff+1;
1797 
1798 // Record the command and operating mode
1799 //
1800  StageAsync = (isAsync ? 1 : 0);
1801  StageCreate= isCreate;
1802  if (StageCmd) free(StageCmd);
1803  StageCmd = strdup(val);
1804  return 0;
1805 }

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 1826 of file XrdOssConfig.cc.

1827 {
1828  char *val, parms[1040];
1829 
1830 // Get the path or preopen option
1831 //
1832  if (!(val = Config.GetWord()) || !val[0])
1833  {Eroute.Emsg("Config", "statlib not specified"); return 1;}
1834 
1835 // Check for options we support the old and new versions here
1836 //
1837  STT_V2 = 0; STT_PreOp = 0; STT_DoN2N = 1; STT_DoARE = 0;
1838 do{ if (!strcmp(val, "-2")) STT_V2 = 1;
1839  else if (!strcmp(val, "arevents") || !strcmp(val, "-arevents")) STT_DoARE=1;
1840  else if (!strcmp(val, "non2n") || !strcmp(val, "-non2n")) STT_DoN2N=0;
1841  else if (!strcmp(val, "preopen") || !strcmp(val, "-preopen")) STT_PreOp=1;
1842  else break;
1843  } while((val = Config.GetWord()) && val[0]);
1844 
1845 // Make sure we have a statlib
1846 //
1847  if (!val || !(*val))
1848  {Eroute.Emsg("Config", "statlib not specified"); return 1;}
1849 
1850 // Record the path
1851 //
1852  if (STT_Lib) free(STT_Lib);
1853  STT_Lib = strdup(val);
1854 
1855 // Record any parms
1856 //
1857  if (!Config.GetRest(parms, sizeof(parms)))
1858  {Eroute.Emsg("Config", "statlib parameters too long"); return 1;}
1859  if (STT_Parms) free(STT_Parms);
1860  STT_Parms = (*parms ? strdup(parms) : 0);
1861  return 0;
1862 }

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 1878 of file XrdOssConfig.cc.

1879 {
1880  char *val;
1881  static struct traceopts {const char *opname; int opval;} tropts[] =
1882  {
1883  {"all", TRACE_ALL},
1884  {"debug", TRACE_Debug},
1885  {"open", TRACE_Open},
1886  {"opendir", TRACE_Opendir}
1887  };
1888  int i, neg, trval = 0, numopts = sizeof(tropts)/sizeof(struct traceopts);
1889 
1890  if (!(val = Config.GetWord()))
1891  {Eroute.Emsg("Config", "trace option not specified"); return 1;}
1892  while (val)
1893  {if (!strcmp(val, "off")) trval = 0;
1894  else {if ((neg = (val[0] == '-' && val[1]))) val++;
1895  for (i = 0; i < numopts; i++)
1896  {if (!strcmp(val, tropts[i].opname))
1897  {if (neg) trval &= ~tropts[i].opval;
1898  else trval |= tropts[i].opval;
1899  break;
1900  }
1901  }
1902  if (i >= numopts)
1903  Eroute.Say("Config warning: ignoring invalid trace option '",val,"'.");
1904  }
1905  val = Config.GetWord();
1906  }
1907  OssTrace.What = trval;
1908  return 0;
1909 }
#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 1930 of file XrdOssConfig.cc.

1931 {
1932  char *val;
1933  int usval;
1934 
1935  if (!(val = Config.GetWord()))
1936  {Eroute.Emsg("Config", "usage option not specified"); return 1;}
1937 
1938  while(val)
1939  { if (!strcmp("nolog", val))
1940  {if (UDir) {free(UDir); UDir = 0;}}
1941  else if (!strcmp("log" , val))
1942  {if (UDir) {free(UDir); UDir = 0;}
1943  if (!(val = Config.GetWord()))
1944  {Eroute.Emsg("Config", "usage log path not specified");
1945  return 1;
1946  }
1947  if (*val != '/')
1948  {Eroute.Emsg("Config", "usage log path not absolute");
1949  return 1;
1950  }
1951  UDir = strdup(val);
1952  if (!(val = Config.GetWord()) || strcmp("sync", val))
1953  continue;
1954  if (!(val = Config.GetWord()))
1955  {Eroute.Emsg("Config", "log sync value not specified");
1956  return 1;
1957  }
1958  if (XrdOuca2x::a2i(Eroute,"sync value",val,&usval,1,32767))
1959  return 1;
1960  USync = usval;
1961  }
1962  else if (!strcmp("noquotafile",val))
1963  {if (QFile) {free(QFile); QFile= 0;}}
1964  else if (!strcmp("quotafile",val))
1965  {if (QFile) {free(QFile); QFile= 0;}
1966  if (!(val = Config.GetWord()))
1967  {Eroute.Emsg("Config", "quota file not specified");
1968  return 1;
1969  }
1970  QFile = strdup(val);
1971  }
1972  else {Eroute.Emsg("Config", "invalid usage option -",val); return 1;}
1973 
1974  val = Config.GetWord();
1975  }
1976  return 0;
1977 }

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 2004 of file XrdOssConfig.cc.

2005 {
2006  static const int maxfdln = 256;
2007  const char *wantParm = 0;
2008  char *val;
2009  int thrds = 1;
2010  long long speed = 9*1024*1024;
2011  int ovhd = 30;
2012  int htime = 3*60*60;
2013  int ktime;
2014  int upon = 0;
2015 
2016  while((val = Config.GetWord())) // deny |fdir | keep | up
2017  { if (!strcmp("deny", val))
2018  {wantParm = "xfr deny";
2019  if ((val = Config.GetWord())) // keep time
2020  {if (XrdOuca2x::a2tm(Eroute,wantParm,val,&htime,0))
2021  return 1;
2022  wantParm=0;
2023  }
2024  }
2025  else if (!strcmp("fdir", val))
2026  {wantParm = "xfr fdir";
2027  if ((val = Config.GetWord())) // fdir path
2028  {if (xfrFdir) free(xfrFdir);
2029  xfrFdln = strlen(val);
2030  if (xfrFdln > maxfdln)
2031  {Eroute.Emsg("Config","xfr fdir path too long");
2032  xfrFdir = 0; xfrFdln = 0; return 1;
2033  }
2034  xfrFdir = strdup(val);
2035  wantParm = 0;
2036  }
2037  }
2038  else if (!strcmp("keep", val))
2039  {wantParm = "xfr keep";
2040  if ((val = Config.GetWord())) // keep time
2041  {if (XrdOuca2x::a2tm(Eroute,wantParm,val,&ktime,0))
2042  return 1;
2043  xfrkeep=ktime; wantParm=0;
2044  }
2045  }
2046  else if (!strcmp("up", val)) {upon = 1; wantParm = 0;}
2047  else break;
2048  };
2049 
2050  xfrhold = htime;
2051  if (upon) OptFlags |= XrdOss_USRPRTY;
2052 
2053  if (!val) {if (!wantParm) return 0;
2054  else {Eroute.Emsg("Config", wantParm, "value not specified");
2055  return 1;
2056  }
2057  }
2058 
2059  if (strcmp(val, "*") && XrdOuca2x::a2i(Eroute,"xfr threads",val,&thrds,1))
2060  return 1;
2061 
2062  if ((val = Config.GetWord())) // <speed>
2063  {if (strcmp(val, "*") &&
2064  XrdOuca2x::a2sz(Eroute,"xfr speed",val,&speed,1024)) return 1;
2065 
2066  if ((val = Config.GetWord())) // <ovhd>
2067  {if (strcmp(val, "*") &&
2068  XrdOuca2x::a2tm(Eroute,"xfr overhead",val,&ovhd,0)) return 1;
2069 
2070  if ((val = Config.GetWord())) // <hold>
2071  if (strcmp(val, "*") &&
2072  XrdOuca2x::a2tm(Eroute,"xfr hold",val,&htime,0)) return 1;
2073  }
2074  }
2075 
2076  xfrhold = htime;
2077  xfrthreads = thrds;
2078  xfrspeed = speed;
2079  xfrovhd = ovhd;
2080  return 0;
2081 }

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 304 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and Stage_In().

◆ chkMmap

char XrdOssSys::chkMmap = 0
static

Definition at line 204 of file XrdOssApi.hh.

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

◆ ConfigFN

char* XrdOssSys::ConfigFN

Definition at line 217 of file XrdOssApi.hh.

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

◆ cscanint

int XrdOssSys::cscanint
protected

Definition at line 293 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 258 of file XrdOssApi.hh.

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

◆ FDFence

int XrdOssSys::FDFence

Definition at line 242 of file XrdOssApi.hh.

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

◆ FDLimit

int XrdOssSys::FDLimit

Definition at line 243 of file XrdOssApi.hh.

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

◆ fuzalloc

int XrdOssSys::fuzalloc
protected

Definition at line 292 of file XrdOssApi.hh.

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

◆ isMSSC

int XrdOssSys::isMSSC

Definition at line 239 of file XrdOssApi.hh.

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

◆ lcl_N2N

◆ lenDP

int XrdOssSys::lenDP

Definition at line 259 of file XrdOssApi.hh.

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

◆ LocalRoot

char* XrdOssSys::LocalRoot

Definition at line 218 of file XrdOssApi.hh.

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

◆ MaxArgs

const int XrdOssSys::MaxArgs = 15
static

Definition at line 215 of file XrdOssApi.hh.

◆ MaxSize

long long XrdOssSys::MaxSize

Definition at line 241 of file XrdOssApi.hh.

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

◆ MaxTwiddle

int XrdOssSys::MaxTwiddle

Definition at line 220 of file XrdOssApi.hh.

Referenced by XrdOssSys().

◆ minalloc

long long XrdOssSys::minalloc
protected

Definition at line 290 of file XrdOssApi.hh.

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

◆ myVersion

XrdVersionInfo* XrdOssSys::myVersion

Definition at line 282 of file XrdOssApi.hh.

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

◆ N2N_Lib

char* XrdOssSys::N2N_Lib

Definition at line 252 of file XrdOssApi.hh.

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

◆ N2N_Parms

char* XrdOssSys::N2N_Parms

Definition at line 253 of file XrdOssApi.hh.

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

◆ numCG

short XrdOssSys::numCG

Definition at line 261 of file XrdOssApi.hh.

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

◆ numDP

short XrdOssSys::numDP

Definition at line 260 of file XrdOssApi.hh.

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

◆ OptFlags

int XrdOssSys::OptFlags

Definition at line 247 of file XrdOssApi.hh.

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

◆ ovhalloc

int XrdOssSys::ovhalloc
protected

Definition at line 291 of file XrdOssApi.hh.

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

◆ pfcMode

bool XrdOssSys::pfcMode
protected

Definition at line 314 of file XrdOssApi.hh.

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

◆ pndbytes

long long XrdOssSys::pndbytes
protected

Definition at line 300 of file XrdOssApi.hh.

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

◆ prActive

int XrdOssSys::prActive

Definition at line 278 of file XrdOssApi.hh.

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

◆ prBytes

int XrdOssSys::prBytes

Definition at line 277 of file XrdOssApi.hh.

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

◆ prDepth

short XrdOssSys::prDepth

Definition at line 279 of file XrdOssApi.hh.

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

◆ prPBits

long long XrdOssSys::prPBits

Definition at line 274 of file XrdOssApi.hh.

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

◆ prPMask

long long XrdOssSys::prPMask

Definition at line 275 of file XrdOssApi.hh.

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

◆ prPSize

int XrdOssSys::prPSize

Definition at line 276 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and xprerd().

◆ prQSize

short XrdOssSys::prQSize

Definition at line 280 of file XrdOssApi.hh.

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

◆ QFile

char* XrdOssSys::QFile
protected

Definition at line 310 of file XrdOssApi.hh.

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

◆ RemoteRoot

char* XrdOssSys::RemoteRoot

Definition at line 219 of file XrdOssApi.hh.

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

◆ rmt_N2N

XrdOucName2Name* XrdOssSys::rmt_N2N

Definition at line 255 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 307 of file XrdOssApi.hh.

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

◆ RSSTout

int XrdOssSys::RSSTout

Definition at line 240 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and MSS_Xeq().

◆ Solitary

int XrdOssSys::Solitary

Definition at line 246 of file XrdOssApi.hh.

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

◆ SPList

XrdOucPListAnchor XrdOssSys::SPList

Definition at line 249 of file XrdOssApi.hh.

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

◆ StageAction

char* XrdOssSys::StageAction

Definition at line 233 of file XrdOssApi.hh.

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

◆ StageActLen

int XrdOssSys::StageActLen

Definition at line 232 of file XrdOssApi.hh.

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

◆ StageAln

int XrdOssSys::StageAln[MaxArgs]

Definition at line 236 of file XrdOssApi.hh.

◆ StageAnum

int XrdOssSys::StageAnum

Definition at line 237 of file XrdOssApi.hh.

◆ StageArg

char* XrdOssSys::StageArg[MaxArgs]

Definition at line 235 of file XrdOssApi.hh.

◆ StageAsync

int XrdOssSys::StageAsync

Definition at line 222 of file XrdOssApi.hh.

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

◆ StageCmd

char* XrdOssSys::StageCmd

Definition at line 225 of file XrdOssApi.hh.

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

◆ StageCreate

int XrdOssSys::StageCreate

Definition at line 223 of file XrdOssApi.hh.

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

◆ StageEvents

char* XrdOssSys::StageEvents

Definition at line 230 of file XrdOssApi.hh.

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

◆ StageEvSize

int XrdOssSys::StageEvSize

Definition at line 231 of file XrdOssApi.hh.

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

◆ StageFormat

int XrdOssSys::StageFormat

Definition at line 224 of file XrdOssApi.hh.

Referenced by ConfigStageC(), and Stage_QT().

◆ StageFrm

XrdFrcProxy* XrdOssSys::StageFrm

Definition at line 228 of file XrdOssApi.hh.

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

◆ StageMsg

char* XrdOssSys::StageMsg

Definition at line 226 of file XrdOssApi.hh.

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

◆ StageProg

XrdOucProg* XrdOssSys::StageProg
protected

Definition at line 306 of file XrdOssApi.hh.

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

◆ StageRealTime

int XrdOssSys::StageRealTime

Definition at line 221 of file XrdOssApi.hh.

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

◆ StageSnd

XrdOucMsubs* XrdOssSys::StageSnd

Definition at line 227 of file XrdOssApi.hh.

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

◆ stgbytes

long long XrdOssSys::stgbytes
protected

Definition at line 301 of file XrdOssApi.hh.

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

◆ STT_DoARE

char XrdOssSys::STT_DoARE

Definition at line 272 of file XrdOssApi.hh.

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

◆ STT_DoN2N

char XrdOssSys::STT_DoN2N

Definition at line 270 of file XrdOssApi.hh.

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

◆ STT_Lib

char* XrdOssSys::STT_Lib

Definition at line 263 of file XrdOssApi.hh.

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

◆ STT_Parms

char* XrdOssSys::STT_Parms

Definition at line 264 of file XrdOssApi.hh.

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

◆ STT_PreOp

int XrdOssSys::STT_PreOp

Definition at line 269 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and xstl().

◆ STT_V2

char XrdOssSys::STT_V2

Definition at line 271 of file XrdOssApi.hh.

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

◆ the_N2N

XrdOucName2Name* XrdOssSys::the_N2N

Definition at line 256 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and ConfigN2N().

◆ totbytes

long long XrdOssSys::totbytes
protected

Definition at line 302 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and Stage_In().

◆ totreqs

int XrdOssSys::totreqs
protected

Definition at line 303 of file XrdOssApi.hh.

Referenced by XrdOssSys(), and Stage_In().

◆ Trace

int XrdOssSys::Trace

Definition at line 245 of file XrdOssApi.hh.

◆ tryMmap

char XrdOssSys::tryMmap = 0
static

Definition at line 203 of file XrdOssApi.hh.

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

◆ UDir

char* XrdOssSys::UDir
protected

Definition at line 309 of file XrdOssApi.hh.

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

◆ USync

short XrdOssSys::USync
protected

Definition at line 313 of file XrdOssApi.hh.

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

◆ xfrFdir

char* XrdOssSys::xfrFdir
protected

Definition at line 311 of file XrdOssApi.hh.

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

◆ xfrFdln

int XrdOssSys::xfrFdln
protected

Definition at line 312 of file XrdOssApi.hh.

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

◆ xfrhold

int XrdOssSys::xfrhold
protected

Definition at line 296 of file XrdOssApi.hh.

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

◆ xfrkeep

int XrdOssSys::xfrkeep
protected

Definition at line 297 of file XrdOssApi.hh.

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

◆ xfrovhd

int XrdOssSys::xfrovhd
protected

Definition at line 295 of file XrdOssApi.hh.

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

◆ xfrspeed

int XrdOssSys::xfrspeed
protected

Definition at line 294 of file XrdOssApi.hh.

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

◆ xfrtcount

int XrdOssSys::xfrtcount
protected

Definition at line 299 of file XrdOssApi.hh.

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

◆ xfrthreads

int XrdOssSys::xfrthreads
protected

Definition at line 298 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: