XRootD
XrdPssSys Class Reference

#include <XrdPss.hh>

+ Inheritance diagram for XrdPssSys:
+ Collaboration diagram for XrdPssSys:

Public Types

enum  PolAct {
  PolPath = 0 ,
  PolObj = 1
}
 

Public Member Functions

 XrdPssSys ()
 
virtual ~XrdPssSys ()
 
int Chmod (const char *, mode_t mode, XrdOucEnv *eP=0) override
 
bool ConfigMapID ()
 
virtual void Connect (XrdOucEnv &) override
 
virtual int Create (const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override
 
virtual void Disc (XrdOucEnv &) override
 
void EnvInfo (XrdOucEnv *envP) override
 
uint64_t Features () override
 
int Init (XrdSysLogger *, const char *) override
 
int Init (XrdSysLogger *, const char *, XrdOucEnv *envP) override
 
int Lfn2Pfn (const char *Path, char *buff, int blen) override
 
const char * Lfn2Pfn (const char *Path, char *buff, int blen, int &rc) override
 
int Mkdir (const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override
 
virtual XrdOssDFnewDir (const char *tident) override
 
virtual XrdOssDFnewFile (const char *tident) override
 
int Remdir (const char *, int Opts=0, XrdOucEnv *eP=0) override
 
int Rename (const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override
 
int Stat (const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
 
int Stats (char *bp, int bl) override
 
int Truncate (const char *, unsigned long long, XrdOucEnv *eP=0) override
 
int Unlink (const char *, int Opts=0, XrdOucEnv *eP=0) override
 
- Public Member Functions inherited from XrdOss
 XrdOss ()
 Constructor and Destructor. More...
 
virtual ~XrdOss ()
 
virtual int FSctl (int cmd, int alen, const char *args, char **resp=0)
 
virtual int Reloc (const char *tident, const char *path, const char *cgName, const char *anchor=0)
 
virtual int StatFS (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
 
virtual int StatLS (XrdOucEnv &env, const char *path, char *buff, int &blen)
 
virtual int StatPF (const char *path, struct stat *buff)
 
virtual int StatPF (const char *path, struct stat *buff, int opts)
 
virtual int StatVS (XrdOssVSInfo *vsP, const char *sname=0, int updt=0)
 
virtual int StatXA (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
 
virtual int StatXP (const char *path, unsigned long long &attr, XrdOucEnv *envP=0)
 

Static Public Member Functions

static int Info (int rc)
 
static int P2DST (int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
 
static int P2OUT (char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
 
static int P2URL (char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
 

Static Public Attributes

static const char * ConfigFN
 
static bool dcaCheck = false
 
static int dcaCTime = 0
 
static bool dcaWorld = false
 
static bool deferID = false
 
static char * fileOrgn = 0
 
static const char * hdrData = ""
 
static int hdrLen = 0
 
static XrdOucTListManList = 0
 
static const char * myHost
 
static const char * myName
 
static XrdNetSecurityPolice [PolNum] = {0, 0}
 
static const int PolNum = 2
 
static const char * protName = "root:"
 
static bool reProxy = false
 
static int Streams =512
 
static int Trace = 0
 
static int Workers = 16
 
static bool xLfn2Pfn = false
 
static XrdOucPListAnchor XPList
 
- 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
 

Detailed Description

Definition at line 145 of file XrdPss.hh.

Member Enumeration Documentation

◆ PolAct

Enumerator
PolPath 
PolObj 

Definition at line 178 of file XrdPss.hh.

178 {PolPath = 0, PolObj = 1};
@ PolObj
Definition: XrdPss.hh:178
@ PolPath
Definition: XrdPss.hh:178

Constructor & Destructor Documentation

◆ XrdPssSys()

XrdPssSys::XrdPssSys ( )

Definition at line 164 of file XrdPss.cc.

164  : HostArena(0), LocalRoot(0), theN2N(0), DirFlags(0),
165  myVersion(&XrdVERSIONINFOVAR(XrdOssGetStorageSystem2)),
167  {}
#define XRDOSS_HASPRXY
Definition: XrdOss.hh:477
#define XRDOSS_HASNOSF
Definition: XrdOss.hh:478
#define XRDOSS_HASPGRW
Definition: XrdOss.hh:475
XrdOss * XrdOssGetStorageSystem2(XrdOss *native_oss, XrdSysLogger *Logger, const char *cFN, const char *parms, XrdOucEnv *envp)
Definition: XrdPss.cc:143

◆ ~XrdPssSys()

virtual XrdPssSys::~XrdPssSys ( )
inlinevirtual

Definition at line 211 of file XrdPss.hh.

211 {}

Member Function Documentation

◆ Chmod()

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

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 222 of file XrdPss.cc.

223 {
224 // We currently do not support chmod()
225 //
226  return -ENOTSUP;
227 }

◆ ConfigMapID()

bool XrdPssSys::ConfigMapID ( )

Definition at line 375 of file XrdPssConfig.cc.

376 {
377  XrdSecsssCon *conTracker;
378  bool isOK, Debug = (SysTrace.What & TRACEPSS_Debug) != 0;
379 
380 // If this is a generic static ID mapping, we are done
381 //
382  if (sssMap == XrdSecsssID::idStatic) return true;
383 
384 // For optimzation we also note if we have a cache in he way of the map
385 //
386  deferID = psxConfig->hasCache();
387 
388 // Now that we did the cache thing, currently we don't support client personas
389 // with a cache because aren't able to tell which client will be used.
390 //
391  if (deferID)
392  {eDest.Emsg("Config", "Client personas are not supported for "
393  "caching proxy servers.");
394  return false;
395  }
396 
397 // If this server is only a forwarding proxy server, we can't support client
398 // personas either because we don't control the URL. However, if we have an
399 // origin then simply warn that the client persona applies to the origin.
400 //
401  if (outProxy)
402  {if (!ManList)
403  {eDest.Emsg("Config", "Client personas are not supported for "
404  "strictly forwarding proxy servers.");
405  return false;
406  }
407  eDest.Say("Config warning: client personas only apply to "
408  "the origin server!");
409  }
410 
411 // We need to get a connection tracker object from the posix interface.
412 // However, we only need it if we are actually mapping id's.
413 //
414  if (sssMap == XrdSecsssID::idStaticM) conTracker = 0;
415  else conTracker = XrdPosixConfig::conTracker(Debug);
416 
417 // Get an mapper object
418 //
419  idMapper = new XrdSecsssID(sssMap, 0, conTracker, &isOK);
420  if (!isOK)
421  {eDest.Emsg("Config", "Unable to render persona; persona mapper failed!");
422  return false;
423  }
424 
425 // If ths is a server persona then we don't need the mapper; abandon it.
426 //
427  if (sssMap == XrdSecsssID::idStaticM) idMapper = 0;
428  else XrdPssUrlInfo::setMapID(true);
429 
430 // We are all done
431 //
432  return true;
433 }
static XrdSysError eDest(0,"crypto_")
#define TRACEPSS_Debug
Definition: XrdPssTrace.hh:34
bool Debug
static XrdSecsssCon * conTracker(bool debug=false)
static bool deferID
Definition: XrdPss.hh:207
static XrdOucTList * ManList
Definition: XrdPss.hh:194
static void setMapID(bool onoff)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
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
XrdSysTrace SysTrace("PrepGPI")
bool outProxy
Definition: XrdPss.cc:124

References XrdPosixConfig::conTracker(), Debug, XrdProxy::eDest, XrdSysError::Emsg(), XrdProxy::idMapper, XrdSecsssID::idStatic, XrdSecsssID::idStaticM, XrdProxy::outProxy, XrdSysError::Say(), XrdPssUrlInfo::setMapID(), XrdProxy::SysTrace, TRACEPSS_Debug, and XrdSysTrace::What.

+ Here is the call graph for this function:

◆ Connect()

void XrdPssSys::Connect ( XrdOucEnv env)
overridevirtual

Notify storage system that a client has connected.

Parameters
env- Reference to environmental information.

Reimplemented from XrdOss.

Definition at line 233 of file XrdPss.cc.

234 {
235  EPNAME("Connect");
236  const XrdSecEntity *client = theEnv.secEnv();
237 
238 // If we need to personify the client, set it up
239 //
240  if (idMapper && client)
241  {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
242  char uName[32];
243  snprintf(uName, sizeof(uName), fmt, client->ueid);
244  DEBUG(client->tident,"Registering as ID "<<uName);
245  idMapper->Register(uName, client, deferID);
246  }
247 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
const XrdSecEntity * secEnv() const
Definition: XrdOucEnv.hh:107
const char * tident
Trace identifier always preset.
Definition: XrdSecEntity.hh:81
unsigned int ueid
Unique ID of entity instance.
Definition: XrdSecEntity.hh:79
bool Register(const char *lgnid, const XrdSecEntity *Ident, bool doReplace=false, bool defer=false)
Definition: XrdSecsssID.cc:224
XrdOucEnv theEnv

References DEBUG, deferID, EPNAME, XrdSecsssID::Register(), XrdOucEnv::secEnv(), XrdCms::theEnv, XrdSecEntity::tident, and XrdSecEntity::ueid.

+ Here is the call graph for this function:

◆ Create()

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

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 271 of file XrdPss.cc.

273 {
274 
275  return -ENOTSUP;
276 }

◆ Disc()

void XrdPssSys::Disc ( XrdOucEnv env)
overridevirtual

Notify storage system that a client has disconnected.

Parameters
env- Reference to environmental information.

Reimplemented from XrdOss.

Definition at line 282 of file XrdPss.cc.

283 {
284  EPNAME("Disc");
285  const XrdSecEntity *client = theEnv.secEnv();
286 
287 // If we personified a client, remove that persona.
288 //
289  if (idMapper && client)
290  {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
291  char uName[32];
292  snprintf(uName, sizeof(uName), fmt, client->ueid);
293  DEBUG(client->tident,"Unregistering as ID "<<uName);
294  idMapper->Register(uName, 0);
295  }
296 }

References DEBUG, EPNAME, XrdSecsssID::Register(), XrdOucEnv::secEnv(), XrdCms::theEnv, XrdSecEntity::tident, and XrdSecEntity::ueid.

+ Here is the call graph for this function:

◆ EnvInfo()

void XrdPssSys::EnvInfo ( XrdOucEnv envP)
overridevirtual

Notify storage system of initialization information (deprecated).

Parameters
envP- Pointer to environmental information.

Reimplemented from XrdOss.

Definition at line 302 of file XrdPss.cc.

303 {
304 // We only need to extract the scheduler pointer from the environment. Propogate
305 // the information to the POSIX layer.
306 //
307  if (envP)
308  {schedP = (XrdScheduler *)envP->GetPtr("XrdScheduler*");
310  }
311 }
void * GetPtr(const char *varname)
Definition: XrdOucEnv.cc:263
static void EnvInfo(XrdOucEnv &theEnv)
XrdScheduler * schedP
Definition: XrdPss.cc:104
XrdOucEnv * envP
Definition: XrdPss.cc:108

References XrdPosixConfig::EnvInfo(), XrdProxy::envP, XrdOucEnv::GetPtr(), and XrdProxy::schedP.

+ Here is the call graph for this function:

◆ Features()

uint64_t XrdPssSys::Features ( )
inlineoverridevirtual

Return storage system features.

Returns
Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOss.

Definition at line 162 of file XrdPss.hh.

162 {return myFeatures;}

◆ Info()

int XrdPssSys::Info ( int  rc)
static

Definition at line 1275 of file XrdPss.cc.

1276 {
1278  return -rc;
1279 }
static int QueryError(std::string &emsg, int fd=-1, bool reset=true)
thread_local XrdOucECMsg ecMsg("[pss]")

References XrdProxy::ecMsg(), and XrdPosixXrootd::QueryError().

Referenced by Mkdir().

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

◆ Init() [1/2]

int XrdPssSys::Init ( XrdSysLogger lp,
const char *  cfn 
)
inlineoverridevirtual

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 163 of file XrdPss.hh.

163 {return -ENOTSUP;}

Referenced by XrdOssGetStorageSystem2().

+ Here is the caller graph for this function:

◆ Init() [2/2]

int XrdPssSys::Init ( XrdSysLogger lp,
const char *  cfn,
XrdOucEnv envP 
)
overridevirtual

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 180 of file XrdPss.cc.

181 {
182  int NoGo;
183  const char *tmp;
184 
185 // Do the herald thing
186 //
187  SysTrace.SetLogger(lp);
188  eDest.logger(lp);
189  eDest.Say("Copr. 2019, Stanford University, Pss Version " XrdVSTRING);
190 
191 // Initialize the subsystems
192 //
193  tmp = ((NoGo = Configure(cFN, envP)) ? "failed." : "completed.");
194  eDest.Say("------ Proxy storage system initialization ", tmp);
195 
196 // Extract Pfc control, if it is there.
197 //
198  if (!NoGo)
199  cacheFSctl = (XrdOfsFSctl_PI*)envP->GetPtr("XrdFSCtl_PC*");
200 
201 
202 // All done.
203 //
204  return NoGo;
205 }
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141
void SetLogger(XrdSysLogger *logp)
Definition: XrdSysTrace.cc:65
XrdOfsFSctl_PI * cacheFSctl
Definition: XrdPss.cc:110
XrdSysTrace SysTrace("Pss", 0)
Definition: XrdPssCks.cc:54
XrdSysError eDest(0, "pss_")

References XrdProxy::cacheFSctl, XrdProxy::eDest, XrdProxy::envP, XrdOucEnv::GetPtr(), XrdSysError::logger(), XrdSysError::Say(), XrdSysTrace::SetLogger(), and XrdProxy::SysTrace.

+ Here is the call graph for this function:

◆ Lfn2Pfn() [1/2]

int XrdPssSys::Lfn2Pfn ( const char *  Path,
char *  buff,
int  blen 
)
overridevirtual

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 317 of file XrdPss.cc.

318 {
319  if (theN2N) return -(theN2N->lfn2pfn(oldp, newp, blen));
320  if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
321  strcpy(newp, oldp);
322  return 0;
323 }
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0

References XrdOucName2Name::lfn2pfn().

+ Here is the call graph for this function:

◆ Lfn2Pfn() [2/2]

const char * XrdPssSys::Lfn2Pfn ( const char *  Path,
char *  buff,
int  blen,
int &  rc 
)
overridevirtual

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 325 of file XrdPss.cc.

326 {
327  if (!theN2N) {rc = 0; return oldp;}
328  if ((rc = -(theN2N->lfn2pfn(oldp, newp, blen)))) return 0;
329  return newp;
330 }

References XrdOucName2Name::lfn2pfn().

+ Here is the call graph for this function:

◆ Mkdir()

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

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 349 of file XrdPss.cc.

350 {
351  EPNAME("Mkdir");
352  XrdPssUrlInfo uInfo(eP, path);
353  int rc;
354  char pbuff[PBsz];
355 
356 // Verify we can write here
357 //
358  if (isREADONLY(path)) return -EROFS;
359 
360 // Convert path to URL
361 //
362  if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
363 
364 // Some tracing
365 //
366  DEBUG(uInfo.Tident(),"url="<<pbuff);
367 
368 // Simply return the proxied result here
369 //
370  return (XrdPosixXrootd::Mkdir(pbuff, mode) ? Info(errno) : XrdOssOK);
371 }
#define XrdOssOK
Definition: XrdOss.hh:50
#define isREADONLY(_x_)
Definition: XrdPss.cc:88
static int Mkdir(const char *path, mode_t mode)
Mkdir() conforms to POSIX.1-2001 mkdir()
static int Info(int rc)
Definition: XrdPss.cc:1275
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition: XrdPss.cc:1376
static bool xLfn2Pfn
Definition: XrdPss.hh:204
static const int PBsz
Definition: XrdPss.cc:118

References DEBUG, EPNAME, Info(), isREADONLY, XrdPosixXrootd::Mkdir(), P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::Tident(), xLfn2Pfn, and XrdOssOK.

+ Here is the call graph for this function:

◆ newDir()

virtual XrdOssDF* XrdPssSys::newDir ( const char *  tident)
inlineoverridevirtual

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 148 of file XrdPss.hh.

149  {return (XrdOssDF *)new XrdPssDir(tident);}
#define tident

References tident.

◆ newFile()

virtual XrdOssDF* XrdPssSys::newFile ( const char *  tident)
inlineoverridevirtual

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 150 of file XrdPss.hh.

151  {return (XrdOssDF *)new XrdPssFile(tident);}

References tident.

◆ P2DST()

int XrdPssSys::P2DST ( int &  retc,
char *  hBuff,
int  hBlen,
XrdPssSys::PolAct  pEnt,
const char *  path 
)
static

Definition at line 1285 of file XrdPss.cc.

1287 {
1288  const char *Slash;
1289  int n;
1290 
1291 // Extract out the destination
1292 //
1293  Slash = index(path, '/');
1294  if (!Slash || (n = (Slash - path)) == 0) {retc = -EINVAL; return 0;}
1295  if (n >= hBlen) {retc = -ENAMETOOLONG; return 0;}
1296  strncpy(hBuff, path, n); hBuff[n] = 0;
1297 
1298 // Check if we need to authorize the outgoing connection
1299 //
1300  if (Police[pEnt] && !Police[pEnt]->Authorize(hBuff))
1301  {retc = -EACCES; return 0;}
1302 
1303 // All is well
1304 //
1305  return n;
1306 }
XrdAccAuthorize * Authorize
Definition: XrdAccTest.cc:61
static XrdNetSecurity * Police[PolNum]
Definition: XrdPss.hh:193

References Authorize, and Police.

Referenced by P2OUT().

+ Here is the caller graph for this function:

◆ P2OUT()

int XrdPssSys::P2OUT ( char *  pbuff,
int  pblen,
XrdPssUrlInfo uInfo 
)
static

Definition at line 1312 of file XrdPss.cc.

1313 { const char *theID = uInfo.getID();
1314  const char *pname, *path, *thePath;
1315  char hBuff[288];
1316  int retc, n;
1317 
1318 // Setup the path
1319 //
1320  thePath = path = uInfo.thePath();
1321 
1322 // Make sure the path is valid for an outgoing proxy
1323 //
1324  if (*path == '/') path++;
1325  if ((pname = XrdPssUtils::valProt(path, n, 1))) path += n;
1326  else {if (!hdrLen) return -ENOTSUP;
1327  n = snprintf(pbuff, pblen, hdrData, theID, thePath);
1328  if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1329  return -ENAMETOOLONG;
1330  return 0;
1331  }
1332 
1333 // Objectid must be handled differently as they have not been refalgomized
1334 //
1335  if (*thePath != '/')
1336  {if (*path == '/')
1337  {path++;
1338  if (*path == '/') theID = "";
1339  }
1340  if (Police[PolObj] && !P2DST(retc, hBuff, sizeof(hBuff), PolObj,
1341  path+(*path == '/' ? 1:0))) return 0;
1342  n = snprintf(pbuff, pblen, "%s%s%s", pname, theID, path);
1343  if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1344  return -ENAMETOOLONG;
1345  return 0;
1346  }
1347 
1348 // Extract out the destination. We need to do this because the front end
1349 // will have extracted out double slashes and we need to add them back. We
1350 // also authorize the outgoing connection if we need to in the process.
1351 //
1352  if (!(n = P2DST(retc, hBuff, sizeof(hBuff), PolPath, path))) return 0;
1353  path += n;
1354 
1355 // Create the new path. If the url already contains a userid then use it
1356 // instead or our internally generated one. We may need an option for this
1357 // as it may result in unintended side-effects but for now we do that.
1358 //
1359  if (index(hBuff, '@')) theID= "";
1360  n = snprintf(pbuff,pblen,"%s%s%s/%s",pname,theID,hBuff,path);
1361 
1362 // Make sure the path will fit
1363 //
1364  if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1365  return -ENAMETOOLONG;
1366 
1367 // All done
1368 //
1369  return 0;
1370 }
static int hdrLen
Definition: XrdPss.hh:198
static const char * hdrData
Definition: XrdPss.hh:197
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition: XrdPss.cc:1285
const char * thePath()
const char * getID()
bool addCGI(const char *prot, char *buff, int blen)
static const char * valProt(const char *pname, int &plen, int adj=0)
Definition: XrdPssUtils.cc:82

References XrdPssUrlInfo::addCGI(), XrdPssUrlInfo::getID(), hdrData, hdrLen, P2DST(), Police, PolObj, PolPath, XrdPssUrlInfo::thePath(), and XrdPssUtils::valProt().

Referenced by P2URL().

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

◆ P2URL()

int XrdPssSys::P2URL ( char *  pbuff,
int  pblen,
XrdPssUrlInfo uInfo,
bool  doN2N = true 
)
static

Definition at line 1376 of file XrdPss.cc.

1377 {
1378 
1379 // If this is an outgoing proxy then we need to do someother work
1380 //
1381  if (outProxy) return P2OUT(pbuff, pblen, uInfo);
1382 
1383 // Do url generation for actual known origin
1384 //
1385  const char *path = uInfo.thePath();
1386  int retc, pfxLen;
1387  char Apath[MAXPATHLEN+1];
1388 
1389 // Setup to process url generation
1390 //
1391  path = uInfo.thePath();
1392 
1393 // First, apply the N2N mapping if necessary. If N2N fails then the whole
1394 // mapping fails and ENAMETOOLONG will be returned.
1395 //
1396  if (doN2N && XrdProxySS.theN2N)
1397  {if ((retc = XrdProxySS.theN2N->lfn2pfn(path, Apath, sizeof(Apath))))
1398  {if (retc > 0) return -retc;}
1399  path = Apath;
1400  }
1401 
1402 // Format the header into the buffer and check if we overflowed. Note that we
1403 // defer substitution of the path as we need to know where the path is.
1404 //
1405  if (fileOrgn) pfxLen = snprintf(pbuff, pblen, hdrData, path);
1406  else pfxLen = snprintf(pbuff, pblen, hdrData, uInfo.getID(), path);
1407  if (pfxLen >= pblen) return -ENAMETOOLONG;
1408 
1409 // Add any cgi information
1410 //
1411  if (!fileOrgn && uInfo.hasCGI())
1412  {if (!uInfo.addCGI(pbuff, pbuff+pfxLen, pblen-pfxLen))
1413  return -ENAMETOOLONG;
1414  }
1415 
1416 // All done
1417 //
1418  return 0;
1419 }
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition: XrdPss.cc:1312
static char * fileOrgn
Definition: XrdPss.hh:195
static XrdPssSys XrdProxySS
Definition: XrdPss.cc:100

References XrdPssUrlInfo::addCGI(), fileOrgn, XrdPssUrlInfo::getID(), XrdPssUrlInfo::hasCGI(), hdrData, XrdOucName2Name::lfn2pfn(), XrdProxy::outProxy, P2OUT(), XrdPssUrlInfo::thePath(), and XrdProxy::XrdProxySS.

Referenced by XrdPssCks::Get(), Mkdir(), XrdPssFile::Open(), XrdPssDir::Opendir(), Remdir(), Rename(), Stat(), Truncate(), and Unlink().

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

◆ Remdir()

int XrdPssSys::Remdir ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

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 385 of file XrdPss.cc.

386 {
387  EPNAME("Remdir");
388  const char *Cgi = "";
389  int rc;
390  char pbuff[PBsz];
391 
392 // Verify we can write here
393 //
394  if (isREADONLY(path)) return -EROFS;
395 
396 // Setup any required cgi information
397 //
398  if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
399 
400 // Setup url information
401 //
402  XrdPssUrlInfo uInfo(eP, path, Cgi);
403 
404 // Convert path to URL
405 //
406  if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
407 
408 // Do some tracing
409 //
410  DEBUG(uInfo.Tident(),"url="<<pbuff);
411 
412 // Issue unlink and return result
413 //
414  return (XrdPosixXrootd::Rmdir(pbuff) ? -errno : XrdOssOK);
415 }
#define XRDOSS_Online
Definition: XrdOss.hh:468
static int Rmdir(const char *path)
Rmdir() conforms to POSIX.1-2001 rmdir()
int Opts
Definition: XrdMpxStats.cc:58
static const char * ofslclCGI
Definition: XrdPss.cc:114

References DEBUG, EPNAME, isREADONLY, XrdProxy::ofslclCGI, XrdMpx::Opts, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPosixXrootd::Rmdir(), XrdPssUrlInfo::Tident(), xLfn2Pfn, XRDOSS_Online, and XrdOssOK.

+ Here is the call graph for this function:

◆ Rename()

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

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 431 of file XrdPss.cc.

433 {
434  EPNAME("Rename");
435  int rc;
436  char oldName[PBsz], newName[PBsz];
437 
438 // Verify we can write in the source and target
439 //
440  if (isREADONLY(oldname) || isREADONLY(newname)) return -EROFS;
441 
442 // Setup url info
443 //
444  XrdPssUrlInfo uInfoOld(oldenvP, oldname);
445  XrdPssUrlInfo uInfoNew(newenvP, newname, "", true, false);
446 
447 // Convert path to URL
448 //
449  if ((rc = P2URL(oldName, PBsz, uInfoOld, xLfn2Pfn))
450  || (rc = P2URL(newName, PBsz, uInfoNew, xLfn2Pfn))) return rc;
451 
452 // Do some tracing
453 //
454  DEBUG(uInfoOld.Tident(),"old url="<<oldName <<" new url=" <<newName);
455 
456 // Execute the rename and return result
457 //
458  return (XrdPosixXrootd::Rename(oldName, newName) ? -errno : XrdOssOK);
459 }
static int Rename(const char *oldpath, const char *newpath)
Rename() conforms to POSIX.1-2001 rename()

References DEBUG, EPNAME, isREADONLY, P2URL(), XrdProxy::PBsz, XrdPosixXrootd::Rename(), XrdPssUrlInfo::Tident(), xLfn2Pfn, and XrdOssOK.

+ Here is the call graph for this function:

◆ Stat()

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

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 479 of file XrdPss.cc.

480 {
481  EPNAME("Stat");
482  const char *Cgi = "";
483  int rc;
484  char pbuff[PBsz];
485 
486 // Setup any required special cgi information
487 //
488  if (*path == '/' && !outProxy && ((Opts & XRDOSS_resonly)||isNOSTAGE(path)))
489  Cgi = osslclCGI;
490 
491 // We can now establish the url information to be used
492 //
493  XrdPssUrlInfo uInfo(eP, path, Cgi);
494 
495 // Generate an ID if we need to. We can use the server's identity unless that
496 // has been prohibited because client ID mapping is taking place.
497 //
498  if (idMapAll) uInfo.setID();
499  else if (sidP) uInfo.setID(sidP);
500 
501 // Convert path to URL
502 //
503  if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
504 
505 // Do some tracing
506 //
507  DEBUG(uInfo.Tident(),"url="<<pbuff);
508 
509 // Return proxied stat
510 //
511  return (XrdPosixXrootd::Stat(pbuff, buff) ? -errno : XrdOssOK);
512 }
#define XRDOSS_resonly
Definition: XrdOss.hh:486
#define isNOSTAGE(_x_)
Definition: XrdPss.cc:86
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat()
XrdOucSid * sidP
Definition: XrdPss.cc:106
static const char * osslclCGI
Definition: XrdPss.cc:116
bool idMapAll
Definition: XrdPss.cc:122

References DEBUG, EPNAME, XrdProxy::idMapAll, isNOSTAGE, XrdMpx::Opts, XrdProxy::osslclCGI, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::setID(), XrdProxy::sidP, XrdPosixXrootd::Stat(), XrdPssUrlInfo::Tident(), xLfn2Pfn, XRDOSS_resonly, and XrdOssOK.

Referenced by XrdPssFile::Fstat().

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

◆ Stats()

int XrdPssSys::Stats ( char *  buff,
int  blen 
)
overridevirtual

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 527 of file XrdPss.cc.

528 {
529  return XrdPosixConfig::Stats("pss", bp, bl);
530 }
static int Stats(const char *theID, char *buff, int blen)

References XrdPosixConfig::Stats().

+ Here is the call graph for this function:

◆ Truncate()

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

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 545 of file XrdPss.cc.

547 {
548  EPNAME("Trunc");
549  XrdPssUrlInfo uInfo(envP, path);
550  int rc;
551  char pbuff[PBsz];
552 
553 // Make sure we can write here
554 //
555  if (isREADONLY(path)) return -EROFS;
556 
557 // Convert path to URL
558 //
559  if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
560 
561 // Do some tracing
562 //
563  DEBUG(uInfo.Tident(),"url="<<pbuff);
564 
565 // Return proxied truncate. We only do this on a single machine because the
566 // redirector will forbid the trunc() if multiple copies exist.
567 //
568  return (XrdPosixXrootd::Truncate(pbuff, flen) ? -errno : XrdOssOK);
569 }
static int Truncate(const char *path, off_t offset)
Telldir() conforms to POSIX.1-2001 telldir()

References DEBUG, XrdProxy::envP, EPNAME, isREADONLY, P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::Tident(), XrdPosixXrootd::Truncate(), xLfn2Pfn, and XrdOssOK.

+ Here is the call graph for this function:

◆ Unlink()

int XrdPssSys::Unlink ( const char *  path,
int  Opts = 0,
XrdOucEnv envP = 0 
)
overridevirtual

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 583 of file XrdPss.cc.

584 {
585  EPNAME("Unlink");
586  const char *Cgi = "";
587  int rc;
588  char pbuff[PBsz];
589 
590 // Make sure we can write here
591 //
592  if (isREADONLY(path)) return -EROFS;
593 
594 // Setup any required cgi information
595 //
596  if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
597 
598 // Setup url info
599 //
600  XrdPssUrlInfo uInfo(envP, path, Cgi);
601 
602 // Convert path to URL
603 //
604  if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
605 
606 // Do some tracing
607 //
608  DEBUG(uInfo.Tident(),"url="<<pbuff);
609 
610 // Unlink the file and return result.
611 //
612  return (XrdPosixXrootd::Unlink(pbuff) ? -errno : XrdOssOK);
613 }
static int Unlink(const char *path)
Unlink() conforms to POSIX.1-2001 unlink()

References DEBUG, XrdProxy::envP, EPNAME, isREADONLY, XrdProxy::ofslclCGI, XrdMpx::Opts, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::Tident(), XrdPosixXrootd::Unlink(), xLfn2Pfn, XRDOSS_Online, and XrdOssOK.

+ Here is the call graph for this function:

Member Data Documentation

◆ ConfigFN

const char * XrdPssSys::ConfigFN
static

Definition at line 187 of file XrdPss.hh.

◆ dcaCheck

bool XrdPssSys::dcaCheck = false
static

Definition at line 205 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ dcaCTime

int XrdPssSys::dcaCTime = 0
static

Definition at line 202 of file XrdPss.hh.

◆ dcaWorld

bool XrdPssSys::dcaWorld = false
static

Definition at line 206 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ deferID

bool XrdPssSys::deferID = false
static

Definition at line 207 of file XrdPss.hh.

Referenced by Connect().

◆ fileOrgn

char * XrdPssSys::fileOrgn = 0
static

Definition at line 195 of file XrdPss.hh.

Referenced by XrdPssFile::Open(), and P2URL().

◆ hdrData

const char * XrdPssSys::hdrData = ""
static

Definition at line 197 of file XrdPss.hh.

Referenced by P2OUT(), and P2URL().

◆ hdrLen

int XrdPssSys::hdrLen = 0
static

Definition at line 198 of file XrdPss.hh.

Referenced by P2OUT().

◆ ManList

XrdOucTList * XrdPssSys::ManList = 0
static

Definition at line 194 of file XrdPss.hh.

◆ myHost

const char * XrdPssSys::myHost
static

Definition at line 188 of file XrdPss.hh.

◆ myName

const char * XrdPssSys::myName
static

Definition at line 189 of file XrdPss.hh.

◆ Police

XrdNetSecurity * XrdPssSys::Police = {0, 0}
static

Definition at line 193 of file XrdPss.hh.

Referenced by P2DST(), and P2OUT().

◆ PolNum

const int XrdPssSys::PolNum = 2
static

Definition at line 177 of file XrdPss.hh.

◆ protName

const char * XrdPssSys::protName = "root:"
static

Definition at line 196 of file XrdPss.hh.

◆ reProxy

bool XrdPssSys::reProxy = false
static

Definition at line 208 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ Streams

int XrdPssSys::Streams =512
static

Definition at line 199 of file XrdPss.hh.

◆ Trace

int XrdPssSys::Trace = 0
static

Definition at line 201 of file XrdPss.hh.

◆ Workers

int XrdPssSys::Workers = 16
static

Definition at line 200 of file XrdPss.hh.

◆ xLfn2Pfn

bool XrdPssSys::xLfn2Pfn = false
static

Definition at line 204 of file XrdPss.hh.

Referenced by Mkdir(), XrdPssFile::Open(), XrdPssDir::Opendir(), Remdir(), Rename(), Stat(), Truncate(), and Unlink().

◆ XPList

XrdOucPListAnchor XrdPssSys::XPList
static

Definition at line 191 of file XrdPss.hh.

Referenced by XrdPssFile::Open().


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