XRootD
Loading...
Searching...
No Matches
XrdPss.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d P s s . c c */
4/* */
5/* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* Produced by Andrew Hanushevsky for Stanford University under contract */
7/* DE-AC02-76-SFO0515 with the Deprtment of Energy */
8/* */
9/* This file is part of the XRootD software suite. */
10/* */
11/* XRootD is free software: you can redistribute it and/or modify it under */
12/* the terms of the GNU Lesser General Public License as published by the */
13/* Free Software Foundation, either version 3 of the License, or (at your */
14/* option) any later version. */
15/* */
16/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19/* License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24/* */
25/* The copyright holder's institutional names and contributor's names may not */
26/* be used to endorse or promote products derived from this software without */
27/* specific prior written permission of the institution or contributor. */
28/******************************************************************************/
29
30/******************************************************************************/
31/* I n c l u d e s */
32/******************************************************************************/
33
34#include <unistd.h>
35#include <cerrno>
36#include <fcntl.h>
37#include <signal.h>
38#include <cstdint>
39#include <strings.h>
40#include <cstdio>
41#include <sys/file.h>
42#include <sys/param.h>
43#include <sys/stat.h>
44#include <sys/types.h>
45#ifdef __solaris__
46#include <sys/vnode.h>
47#endif
48#include <vector>
49
50#include "XrdVersion.hh"
51
53#include "XrdPss/XrdPss.hh"
54#include "XrdPss/XrdPssTrace.hh"
56#include "XrdPss/XrdPssUtils.hh"
62
63#include "XrdOss/XrdOssError.hh"
64#include "XrdOuc/XrdOucEnv.hh"
70#include "XrdSys/XrdSysError.hh"
73
74#ifndef O_DIRECT
75#define O_DIRECT 0
76#endif
77
78#ifndef ENOATTR
79#define ENOATTR ENODATA
80#endif
81
82/******************************************************************************/
83/* D e f i n e s */
84/******************************************************************************/
85
86#define isNOSTAGE(_x_) !(XRDEXP_STAGE & XrdPssSys::XPList.Find(_x_))
87
88#define isREADONLY(_x_) (XRDEXP_NOTRW & XrdPssSys::XPList.Find(_x_))
89
90/******************************************************************************/
91/* G l o b a l s */
92/******************************************************************************/
93
94class XrdScheduler;
95
96namespace XrdProxy
97{
98thread_local XrdOucECMsg ecMsg("[pss]");
99
101
102 XrdSysError eDest(0, "pss_");
103
105
107
109
111
112 XrdSecsssID *idMapper = 0; // -> Auth ID mapper
113
114static const char *ofslclCGI = "ofs.lcl=1";
115
116static const char *osslclCGI = "oss.lcl=1";
117
118static const int PBsz = 4096;
119
120 int rpFD = -1;
121
122 bool idMapAll = false;
123
124 bool outProxy = false; // True means outgoing proxy
125
126 bool xrdProxy = false; // True means dest using xroot protocol
127
128 XrdSysTrace SysTrace("Pss",0);
129}
130using namespace XrdProxy;
131
132/******************************************************************************/
133/* XrdOssGetSS (a.k.a. XrdOssGetStorageSystem) */
134/******************************************************************************/
135
137
138// This function is called by the OFS layer to retrieve the Storage System
139// object. We return our proxy storage system object if configuration succeeded.
140//
141extern "C"
142{
145 const char *cFN,
146 const char *parms,
147 XrdOucEnv *envp)
148{
149
150// Ignore the parms (we accept none for now) and call the init routine
151//
152 envP = envp;
153 return (XrdProxySS.Init(Logger, cFN, envP) ? 0 : (XrdOss *)&XrdProxySS);
154}
155}
156
157/******************************************************************************/
158/* o o s s _ S y s M e t h o d s */
159/******************************************************************************/
160/******************************************************************************/
161/* C o n s t r u c t o r */
162/******************************************************************************/
163
164XrdPssSys::XrdPssSys() : LocalRoot(0), theN2N(0), DirFlags(0),
165 myVersion(&XrdVERSIONINFOVAR(XrdOssGetStorageSystem2)),
167 {}
168
169/******************************************************************************/
170/* i n i t */
171/******************************************************************************/
172
173/*
174 Function: Initialize proxy subsystem
175
176 Input: None
177
178 Output: Returns zero upon success otherwise (-errno).
179*/
180int XrdPssSys::Init(XrdSysLogger *lp, const char *cFN, XrdOucEnv *envP)
181{
182 int NoGo;
183 const char *tmp;
184
185// Do the herald thing
186//
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}
206
207/******************************************************************************/
208/* C h m o d */
209/******************************************************************************/
210/*
211 Function: Change file mode.
212
213 Input: path - Is the fully qualified name of the target file.
214 mode - The new mode that the file is to have.
215 envP - Environmental information.
216
217 Output: Returns XrdOssOK upon success and -errno upon failure.
218
219 Notes: This function is currently unsupported.
220*/
221
222int XrdPssSys::Chmod(const char *path, mode_t mode, XrdOucEnv *eP)
223{
224// We currently do not support chmod()
225//
226 return -ENOTSUP;
227}
228
229/******************************************************************************/
230/* C o n n e c t */
231/******************************************************************************/
232
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}
248
249/******************************************************************************/
250/* c r e a t e */
251/******************************************************************************/
252
253/*
254 Function: Create a file named `path' with 'file_mode' access mode bits set.
255
256 Input: path - The fully qualified name of the file to create.
257 access_mode - The Posix access mode bits to be assigned to the file.
258 These bits correspond to the standard Unix permission
259 bits (e.g., 744 == "rwxr--r--").
260 env - Environmental information.
261 opts - Set as follows:
262 XRDOSS_mkpath - create dir path if it does not exist.
263 XRDOSS_new - the file must not already exist.
264 x00000000 - x are standard open flags (<<8)
265
266 Output: Returns XrdOssOK upon success; (-errno) otherwise.
267
268 Notes: We always return ENOTSUP as we really want the create options to be
269 promoted to the subsequent open().
270*/
271int XrdPssSys::Create(const char *tident, const char *path, mode_t Mode,
272 XrdOucEnv &env, int Opts)
273{
274
275 return -ENOTSUP;
276}
277
278/******************************************************************************/
279/* D i s c */
280/******************************************************************************/
281
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}
297
298/******************************************************************************/
299/* E n v I n f o */
300/******************************************************************************/
301
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}
312
313/******************************************************************************/
314/* L f n 2 P f n */
315/******************************************************************************/
316
317int XrdPssSys::Lfn2Pfn(const char *oldp, char *newp, int blen)
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}
324
325const char *XrdPssSys::Lfn2Pfn(const char *oldp, char *newp, int blen, int &rc)
326{
327 if (!theN2N) {rc = 0; return oldp;}
328 if ((rc = -(theN2N->lfn2pfn(oldp, newp, blen)))) return 0;
329 return newp;
330}
331
332/******************************************************************************/
333/* M k d i r */
334/******************************************************************************/
335/*
336 Function: Create a directory
337
338 Input: path - Is the fully qualified name of the new directory.
339 mode - The new mode that the directory is to have.
340 mkpath - If true, makes the full path.
341 envP - Environmental information.
342
343 Output: Returns XrdOssOK upon success and -errno upon failure.
344
345 Notes: Directories are only created in the local disk cache.
346 Currently, we do not propogate the mkpath option.
347*/
348
349int XrdPssSys::Mkdir(const char *path, mode_t mode, int mkpath, XrdOucEnv *eP)
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}
372
373/******************************************************************************/
374/* R e m d i r */
375/******************************************************************************/
376
377/*
378 Function: Removes the directory 'path'
379
380 Input: path - Is the fully qualified name of the directory to remove.
381 envP - Environmental information.
382
383 Output: Returns XrdOssOK upon success and -errno upon failure.
384*/
385int XrdPssSys::Remdir(const char *path, int Opts, XrdOucEnv *eP)
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}
416
417/******************************************************************************/
418/* R e n a m e */
419/******************************************************************************/
420
421/*
422 Function: Renames a file with name 'old_name' to 'new_name'.
423
424 Input: old_name - Is the fully qualified name of the file to be renamed.
425 new_name - Is the fully qualified name that the file is to have.
426 old_envP - Environmental information for old_name.
427 new_envP - Environmental information for new_name.
428
429 Output: Returns XrdOssOK upon success and -errno upon failure.
430*/
431int XrdPssSys::Rename(const char *oldname, const char *newname,
432 XrdOucEnv *oldenvP, XrdOucEnv *newenvP)
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}
460
461/******************************************************************************/
462/* s t a t */
463/******************************************************************************/
464
465/*
466 Function: Determine if file 'path' actually exists.
467
468 Input: path - Is the fully qualified name of the file to be tested.
469 buff - pointer to a 'stat' structure to hold the attributes
470 of the file.
471 Opts - stat() options.
472 envP - Environmental information.
473
474 Output: Returns XrdOssOK upon success and -errno upon failure.
475
476 Notes: The XRDOSS_resonly flag in Opts is not supported.
477*/
478
479int XrdPssSys::Stat(const char *path, struct stat *buff, int Opts, XrdOucEnv *eP)
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}
513
514/******************************************************************************/
515/* S t a t s */
516/******************************************************************************/
517
518/* Function: Return statistics.
519
520 Input: buff - Pointer to buffer for statistics data.
521 blen - The length of the buffer.
522
523 Output: When blen is not zero, null terminated statistics are placed
524 in buff and the length is returned. When blen is zero, the
525 maximum length needed is returned.
526*/
527int XrdPssSys::Stats(char *bp, int bl)
528{
529 return XrdPosixConfig::Stats("pss", bp, bl);
530}
531
532/******************************************************************************/
533/* T r u n c a t e */
534/******************************************************************************/
535/*
536 Function: Truncate a file.
537
538 Input: path - Is the fully qualified name of the target file.
539 flen - The new size that the file is to have.
540 envP - Environmental information.
541
542 Output: Returns XrdOssOK upon success and -errno upon failure.
543*/
544
545int XrdPssSys::Truncate(const char *path, unsigned long long flen,
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}
570
571/******************************************************************************/
572/* U n l i n k */
573/******************************************************************************/
574
575/*
576 Function: Delete a file from the namespace and release it's data storage.
577
578 Input: path - Is the fully qualified name of the file to be removed.
579 envP - Environmental information.
580
581 Output: Returns XrdOssOK upon success and -errno upon failure.
582*/
583int XrdPssSys::Unlink(const char *path, int Opts, XrdOucEnv *envP)
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}
614
615/******************************************************************************/
616/* P s s D i r M e t h o d s */
617/******************************************************************************/
618/******************************************************************************/
619/* o p e n d i r */
620/******************************************************************************/
621
622/*
623 Function: Open the directory `path' and prepare for reading.
624
625 Input: path - The fully qualified name of the directory to open.
626 envP - Environmental information.
627
628 Output: Returns XrdOssOK upon success; (-errno) otherwise.
629*/
630int XrdPssDir::Opendir(const char *dir_path, XrdOucEnv &Env)
631{
632 EPNAME("Opendir");
633 int rc;
634 char pbuff[PBsz];
635
636// Return an error if this object is already open
637//
638 if (myDir) return -XRDOSS_E8001;
639
640// Open directories are not supported for object id's
641//
642 if (*dir_path != '/') return -ENOTSUP;
643
644// Setup url info
645//
646 XrdPssUrlInfo uInfo(&Env, dir_path);
647 uInfo.setID();
648
649// Convert path to URL
650//
651 if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
652 return rc;
653
654// Do some tracing
655//
656 DEBUG(uInfo.Tident(),"url="<<pbuff);
657
658// Open the directory
659//
660 myDir = XrdPosixXrootd::Opendir(pbuff);
661 if (!myDir) return -errno;
662 return XrdOssOK;
663}
664
665/******************************************************************************/
666/* r e a d d i r */
667/******************************************************************************/
668
669/*
670 Function: Read the next entry if directory associated with this object.
671
672 Input: buff - Is the address of the buffer that is to hold the next
673 directory name.
674 blen - Size of the buffer.
675
676 Output: Upon success, places the contents of the next directory entry
677 in buff. When the end of the directory is encountered buff
678 will be set to the null string.
679
680 Upon failure, returns a (-errno).
681
682 Warning: The caller must provide proper serialization.
683*/
684int XrdPssDir::Readdir(char *buff, int blen)
685{
686// Check if we are directly reading the directory
687//
688 if (myDir)
689 {dirent *entP, myEnt;
690 int rc = XrdPosixXrootd::Readdir_r(myDir, &myEnt, &entP);
691 if (rc) return -rc;
692 if (!entP) *buff = 0;
693 else strlcpy(buff, myEnt.d_name, blen);
694 return XrdOssOK;
695 }
696
697// The directory is not open
698//
699 return -XRDOSS_E8002;
700}
701
702/******************************************************************************/
703/* C l o s e */
704/******************************************************************************/
705
706/*
707 Function: Close the directory associated with this object.
708
709 Input: None.
710
711 Output: Returns XrdOssOK upon success and (errno) upon failure.
712*/
713int XrdPssDir::Close(long long *retsz)
714{
715 DIR *theDir;
716
717// Close the directory proper if it exists. POSIX specified that directory
718// stream is no longer available after closedir() regardless if return value.
719//
720 if ((theDir = myDir))
721 {myDir = 0;
722 if (XrdPosixXrootd::Closedir(theDir)) return -errno;
723 return XrdOssOK;
724 }
725
726// Directory is not open
727//
728 return -XRDOSS_E8002;
729}
730
731/******************************************************************************/
732/* o o s s _ F i l e M e t h o d s */
733/******************************************************************************/
734/******************************************************************************/
735/* o p e n */
736/******************************************************************************/
737
738/*
739 Function: Open the file `path' in the mode indicated by `Mode'.
740
741 Input: path - The fully qualified name of the file to open.
742 Oflag - Standard open flags.
743 Mode - Create mode (i.e., rwx).
744 env - Environmental information.
745
746 Output: XrdOssOK upon success; -errno otherwise.
747*/
748int XrdPssFile::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &Env)
749{
750 EPNAME("Open");
751 unsigned long long popts = XrdPssSys::XPList.Find(path);
752 const char *Cgi = "";
753 char pbuff[PBsz];
754 int rc;
755 bool tpcMode = (Oflag & O_NOFOLLOW) != 0;
756 bool rwMode = (Oflag & (O_WRONLY | O_RDWR | O_APPEND)) != 0;
757 bool ucgiOK = true;
758 bool ioCache = (Oflag & O_DIRECT);
759
760// Record the security environment
761//
762 entity = Env.secEnv();
763
764// Turn off direct flag if set (we record it separately
765//
766 if (ioCache) Oflag &= ~O_DIRECT;
767
768// Return an error if the object is already open
769//
770 if (fd >= 0 || tpcPath) return -XRDOSS_E8003;
771
772// If we are opening this in r/w mode make sure we actually can
773//
774 if (rwMode)
775 {if (XrdPssSys::fileOrgn) return -EROFS;
776 if (popts & XRDEXP_NOTRW)
777 {if (popts & XRDEXP_FORCERO && !tpcMode) Oflag = O_RDONLY;
778 else return -EROFS;
779 }
780 }
781
782 // check CGI cache-control paramters
783 if (cacheFSctl)
784 {
785 int elen;
786 char *envcgi = (char *)Env.Env(elen);
787
788 if (envcgi && strstr(envcgi, "only-if-cached"))
789 {
790 XrdOucErrInfo einfo;
791 XrdSfsFSctl myData;
792 myData.Arg1 = "cached";
793 myData.Arg1Len = 1;
794 myData.Arg2Len = 1;
795 const char *myArgs[1];
796 myArgs[0] = path;
797 myData.ArgP = myArgs;
798 int fsctlRes = cacheFSctl->FSctl(SFS_FSCTL_PLUGXC, myData, einfo);
799 if (fsctlRes == SFS_ERROR)
800 return -einfo.getErrInfo();
801 }
802 }
803
804// If this is a third party copy open, then strange rules apply. If this is an
805// outgoing proxy we let everything pass through as this may be a TPC request
806// elsewhere. Otherwise, if it's an open for reading, we open the file but
807// strip off all CGI (technically, we should only remove the "tpc" tokens)
808// because the source might not support direct TPC mode. If we are opening for
809// writing, then we skip the open and mark this as a TPC handle which can only
810// be used for fstat() and close(). Any other actions return an error.
811//
812 if (tpcMode)
813 {Oflag &= ~O_NOFOLLOW;
814 if (!XrdProxy::outProxy || !IS_FWDPATH(path))
815 {if (rwMode)
816 {tpcPath = strdup(path);
818 {const char *rPath = Env.Get("tpc.reproxy");
819 if (!rPath || *rPath != '/') return -ENOATTR;
820 if (!(rPath = rindex(rPath, '/')) || *(rPath+1) == 0)
821 return -EFAULT;
822 rpInfo = new tprInfo(rPath+1);
823 }
824 return XrdOssOK;
825 }
826 ucgiOK = false;
827 }
828 }
829
830// Setup any required cgi information. Don't mess with it if it's an objectid
831// or if the we are an outgoing proxy server.
832//
833 if (!XrdProxy::outProxy && *path == '/' && !(XRDEXP_STAGE & popts))
834 Cgi = osslclCGI;
835
836// Construct the url info
837//
838 XrdPssUrlInfo uInfo(&Env, path, Cgi, ucgiOK);
839 uInfo.setID();
840
841// Convert path to URL
842//
843 if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
844 return rc;
845
846// Do some tracing
847//
848 DEBUG(uInfo.Tident(),"url="<<pbuff);
849
850// Try to open and if we failed, return an error
851//
852 if (!XrdPssSys::dcaCheck || !ioCache)
853 {if ((fd = XrdPosixXrootd::Open(pbuff,Oflag,Mode)) < 0) return -errno;
854 } else {
855 XrdPosixInfo Info;
856 Info.ffReady = XrdPssSys::dcaWorld;
857 if (XrdPosixConfig::OpenFC(pbuff,Oflag,Mode,Info))
858 {Env.Put("FileURL", Info.cacheURL);
859 return -EDESTADDRREQ;
860 }
861 fd = Info.fileFD;
862 if (fd < 0) return -errno;
863 }
864
865// All done
866//
867 return XrdOssOK;
868}
869
870/******************************************************************************/
871/* c l o s e */
872/******************************************************************************/
873
874/*
875 Function: Close the file associated with this object.
876
877 Input: None.
878
879 Output: Returns XrdOssOK upon success aud -errno upon failure.
880*/
881int XrdPssFile::Close(long long *retsz)
882{ int rc;
883
884// We don't support returning the size (we really should fix this)
885//
886 if (retsz) *retsz = 0;
887
888// If the file is not open, then this may be OK if it is a 3rd party copy
889//
890 if (fd < 0)
891 {if (!tpcPath) return -XRDOSS_E8004;
892 free(tpcPath);
893 tpcPath = 0;
894 return XrdOssOK;
895 }
896
897// Close the file
898//
900 fd = -1;
901 return (rc == 0 ? XrdOssOK : -errno);
902}
903
904/******************************************************************************/
905/* p g R e a d */
906/******************************************************************************/
907
908/*
909 Function: Read file pages into a buffer and return corresponding checksums.
910
911 Input: buffer - pointer to buffer where the bytes are to be placed.
912 offset - The offset where the read is to start.
913 rdlen - The number of bytes to read.
914 csvec - A vector to be filled with the corresponding CRC32C
915 checksums for each page or page segment, if available.
916 opts - Options as noted (see inherited class).
917
918 Output: returns Number of bytes that placed in buffer upon success and
919 -errno upon failure.
920*/
921
922ssize_t XrdPssFile::pgRead(void *buffer,
923 off_t offset,
924 size_t rdlen,
925 uint32_t *csvec,
926 uint64_t opts)
927{
928 std::vector<uint32_t> vecCS;
929 uint64_t psxOpts;
930 ssize_t bytes;
931
932// Make sure file is open
933//
934 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
935
936// Set options as needed
937//
938 psxOpts = (csvec ? XrdPosixExtra::forceCS : 0);
939
940// Issue the pgread
941//
942 if ((bytes = XrdPosixExtra::pgRead(fd,buffer,offset,rdlen,vecCS,psxOpts)) < 0)
943 return (ssize_t)-errno;
944
945// Copy out the checksum vector
946//
947 if (vecCS.size() && csvec)
948 memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
949
950// All done
951//
952 return bytes;
953}
954
955/******************************************************************************/
956/* p g W r i t e */
957/******************************************************************************/
958/*
959 Function: Write file pages into a file with corresponding checksums.
960
961 Input: buffer - pointer to buffer containing the bytes to write.
962 offset - The offset where the write is to start.
963 wrlen - The number of bytes to write.
964 be the last write to the file at or above the offset.
965 csvec - A vector which contains the corresponding CRC32 checksum
966 for each page or page segment. If size is 0, then
967 checksums are calculated. If not zero, the size must
968 equal the required number of checksums for offset/wrlen.
969 opts - Options as noted.
970
971 Output: Returns the number of bytes written upon success and -errno
972 upon failure.
973*/
974
975ssize_t XrdPssFile::pgWrite(void *buffer,
976 off_t offset,
977 size_t wrlen,
978 uint32_t *csvec,
979 uint64_t opts)
980{
981 std::vector<uint32_t> vecCS;
982 ssize_t bytes;
983
984// Make sure we have an open file
985//
986 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
987
988// Check if caller wants to verify the checksums before writing
989//
990 if (csvec && (opts & XrdOssDF::Verify))
991 {XrdOucPgrwUtils::dataInfo dInfo((const char*)buffer,csvec,offset,wrlen);
992 off_t bado;
993 int badc;
994 if (!XrdOucPgrwUtils::csVer(dInfo, bado, badc)) return -EDOM;
995 }
996
997// Check if caller want checksum generated and possibly returned
998//
999 if ((opts & XrdOssDF::doCalc) || csvec == 0)
1000 {XrdOucPgrwUtils::csCalc((const char *)buffer, offset, wrlen, vecCS);
1001 if (csvec) memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
1002 } else {
1003 int n = XrdOucPgrwUtils::csNum(offset, wrlen);
1004 vecCS.resize(n);
1005 vecCS.assign(n, 0);
1006 memcpy(vecCS.data(), csvec, n*sizeof(uint32_t));
1007 }
1008
1009// Issue the pgwrite
1010//
1011 bytes = XrdPosixExtra::pgWrite(fd, buffer, offset, wrlen, vecCS);
1012
1013// Return result
1014//
1015 return (bytes < 0 ? (ssize_t)-errno : bytes);
1016}
1017
1018/******************************************************************************/
1019/* r e a d */
1020/******************************************************************************/
1021
1022/*
1023 Function: Preread `blen' bytes from the associated file.
1024
1025 Input: offset - The absolute 64-bit byte offset at which to read.
1026 blen - The size to preread.
1027
1028 Output: Returns zero read upon success and -errno upon failure.
1029*/
1030
1031ssize_t XrdPssFile::Read(off_t offset, size_t blen)
1032{
1033 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1034
1035 return 0; // We haven't implemented this yet!
1036}
1037
1038
1039/******************************************************************************/
1040/* r e a d */
1041/******************************************************************************/
1042
1043/*
1044 Function: Read `blen' bytes from the associated file, placing in 'buff'
1045 the data and returning the actual number of bytes read.
1046
1047 Input: buff - Address of the buffer in which to place the data.
1048 offset - The absolute 64-bit byte offset at which to read.
1049 blen - The size of the buffer. This is the maximum number
1050 of bytes that will be read.
1051
1052 Output: Returns the number bytes read upon success and -errno upon failure.
1053*/
1054
1055ssize_t XrdPssFile::Read(void *buff, off_t offset, size_t blen)
1056{
1057 ssize_t retval;
1058
1059 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1060
1061 return (retval = XrdPosixXrootd::Pread(fd, buff, blen, offset)) < 0
1062 ? (ssize_t)-errno : retval;
1063}
1064
1065/******************************************************************************/
1066/* r e a d v */
1067/******************************************************************************/
1068
1069ssize_t XrdPssFile::ReadV(XrdOucIOVec *readV, // In
1070 int readCount) // In
1071/*
1072 Function: Perform all the reads specified in the readV vector.
1073
1074 Input: readV - A description of the reads to perform; includes the
1075 absolute offset, the size of the read, and the buffer
1076 to place the data into.
1077 readCount - The size of the readV vector.
1078
1079 Output: Returns the number of bytes read upon success and -errno upon failure.
1080 If the number of bytes read is less than requested, it is considered
1081 an error.
1082*/
1083{
1084 ssize_t retval;
1085
1086 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1087
1088 return (retval = XrdPosixXrootd::VRead(fd, readV, readCount)) < 0 ? (ssize_t)-errno : retval;;
1089}
1090
1091/******************************************************************************/
1092/* R e a d R a w */
1093/******************************************************************************/
1094
1095/*
1096 Function: Read `blen' bytes from the associated file, placing in 'buff'
1097 the data and returning the actual number of bytes read.
1098
1099 Input: buff - Address of the buffer in which to place the data.
1100 offset - The absolute 64-bit byte offset at which to read.
1101 blen - The size of the buffer. This is the maximum number
1102 of bytes that will be read.
1103
1104 Output: Returns the number bytes read upon success and -errno upon failure.
1105*/
1106
1107ssize_t XrdPssFile::ReadRaw(void *buff, off_t offset, size_t blen)
1108{
1109 return Read(buff, offset, blen);
1110}
1111
1112/******************************************************************************/
1113/* w r i t e */
1114/******************************************************************************/
1115
1116/*
1117 Function: Write `blen' bytes to the associated file, from 'buff'
1118 and return the actual number of bytes written.
1119
1120 Input: buff - Address of the buffer from which to get the data.
1121 offset - The absolute 64-bit byte offset at which to write.
1122 blen - The number of bytes to write from the buffer.
1123
1124 Output: Returns the number of bytes written upon success and -errno o/w.
1125*/
1126
1127ssize_t XrdPssFile::Write(const void *buff, off_t offset, size_t blen)
1128{
1129 ssize_t retval;
1130
1131 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1132
1133 return (retval = XrdPosixXrootd::Pwrite(fd, buff, blen, offset)) < 0
1134 ? (ssize_t)-errno : retval;
1135}
1136
1137/******************************************************************************/
1138/* f s t a t */
1139/******************************************************************************/
1140
1141/*
1142 Function: Return file status for the associated file.
1143
1144 Input: buff - Pointer to buffer to hold file status.
1145
1146 Output: Returns XrdOssOK upon success and -errno upon failure.
1147*/
1148
1149int XrdPssFile::Fstat(struct stat *buff)
1150{
1151 EPNAME("fstat");
1152
1153// If we have a file descriptor then return a stat for it
1154//
1155 if (fd >= 0) return (XrdPosixXrootd::Fstat(fd, buff) ? -errno : XrdOssOK);
1156
1157// Otherwise, if this is not a tpc of any kind, return an error
1158//
1159 if (!tpcPath) return -XRDOSS_E8004;
1160
1161// If this is a normal tpc then simply issue the stat against the origin
1162//
1163 if (!rpInfo)
1164 {XrdOucEnv fstatEnv(0, 0, entity);
1165 return XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv);
1166 }
1167
1168// This is a reproxy tpc, if we have not yet dertermined the true dest, do so.
1169//
1170 struct stat Stat;
1171
1172 if (rpInfo->dstURL == 0
1173 || !fstatat(rpFD, rpInfo->tprPath, &Stat, AT_SYMLINK_NOFOLLOW))
1174 {char lnkbuff[2048]; int lnklen;
1175 lnklen = readlinkat(rpFD, rpInfo->tprPath, lnkbuff, sizeof(lnkbuff)-1);
1176 if (lnklen <= 0)
1177 {int rc = 0;
1178 if (lnklen < 0) {if (errno != ENOENT) rc = -errno;}
1179 else rc = -EFAULT;
1180 if (rc)
1181 {unlinkat(rpFD, rpInfo->tprPath, 0);
1182 return rc;
1183 }
1184 } else {
1185 unlinkat(rpFD, rpInfo->tprPath, 0);
1186 lnkbuff[lnklen] = 0;
1187 if (rpInfo->dstURL) free(rpInfo->dstURL);
1188 rpInfo->dstURL = strdup(lnkbuff);
1189 rpInfo->fSize = 1;
1190 DEBUG(tident,rpInfo->tprPath<<" maps "<<tpcPath<<" -> "<<lnkbuff);
1191 }
1192 }
1193
1194// At this point we may or may not have the final endpoint. An error here could
1195// be due to write error recovery, so make allowance for that.
1196//
1197 if (rpInfo->dstURL)
1198 {if (!XrdPosixXrootd::Stat(rpInfo->dstURL, buff))
1199 {if (!(rpInfo->fSize = buff->st_size)) rpInfo->fSize = 1;
1200 return XrdOssOK;
1201 }
1202 free(rpInfo->dstURL);
1203 rpInfo->dstURL = 0;
1204 }
1205
1206// We don't have the final endpoint. If we ever had it before, then punt.
1207//
1208 if (rpInfo->fSize)
1209 {memset(buff, 0, sizeof(struct stat));
1210 buff->st_size = rpInfo->fSize;
1211 return XrdOssOK;
1212 }
1213
1214// If we are here then maybe the reproxy option was the wrong config setting.
1215// Give stat a try on the origin we'll retry resolution on the next stat.
1216//
1217 XrdOucEnv fstatEnv(0, 0, entity);
1218
1219 if (XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv))
1220 memset(buff, 0, sizeof(struct stat));
1221 return XrdOssOK;
1222}
1223
1224/******************************************************************************/
1225/* f s y n c */
1226/******************************************************************************/
1227
1228/*
1229 Function: Synchronize associated file.
1230
1231 Input: None.
1232
1233 Output: Returns XrdOssOK upon success and -errno upon failure.
1234*/
1236{
1237 if (fd < 0) return -XRDOSS_E8004;
1238
1239 return (XrdPosixXrootd::Fsync(fd) ? -errno : XrdOssOK);
1240}
1241
1242/******************************************************************************/
1243/* f t r u n c a t e */
1244/******************************************************************************/
1245
1246/*
1247 Function: Set the length of associated file to 'flen'.
1248
1249 Input: flen - The new size of the file.
1250
1251 Output: Returns XrdOssOK upon success and -errno upon failure.
1252
1253 Notes: If 'flen' is smaller than the current size of the file, the file
1254 is made smaller and the data past 'flen' is discarded. If 'flen'
1255 is larger than the current size of the file, a hole is created
1256 (i.e., the file is logically extended by filling the extra bytes
1257 with zeroes).
1258
1259 If compiled w/o large file support, only lower 32 bits are used.
1260 used.
1261
1262 Currently not supported for proxies.
1263*/
1264int XrdPssFile::Ftruncate(unsigned long long flen)
1265{
1266 if (fd < 0) return -XRDOSS_E8004;
1267
1268 return (XrdPosixXrootd::Ftruncate(fd, flen) ? -errno : XrdOssOK);
1269}
1270
1271/******************************************************************************/
1272/* I n t e r n a l M e t h o d s */
1273/******************************************************************************/
1274
1276{
1278 return -rc;
1279}
1280
1281/******************************************************************************/
1282/* P 2 D S T */
1283/******************************************************************************/
1284
1285int XrdPssSys::P2DST(int &retc, char *hBuff, int hBlen, XrdPssSys::PolAct pEnt,
1286 const char *path)
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}
1307
1308/******************************************************************************/
1309/* P 2 O U T */
1310/******************************************************************************/
1311
1312int XrdPssSys::P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
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}
1371
1372/******************************************************************************/
1373/* P 2 U R L */
1374/******************************************************************************/
1375
1376int XrdPssSys::P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N)
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}
#define ENOATTR
XrdAccAuthorize * Authorize
Definition XrdAccTest.cc:61
#define tident
#define DEBUG(x)
#define EPNAME(x)
struct stat Stat
Definition XrdCks.cc:49
#define O_DIRECT
Definition XrdCrc32c.cc:51
static XrdSysLogger Logger
static XrdSysError eDest(0,"crypto_")
#define XRDOSS_E8002
#define XRDOSS_E8003
#define XRDOSS_E8004
#define XRDOSS_E8001
#define XRDOSS_HASPRXY
Definition XrdOss.hh:477
#define XRDOSS_Online
Definition XrdOss.hh:468
#define XrdOssOK
Definition XrdOss.hh:50
#define XRDOSS_HASNOSF
Definition XrdOss.hh:478
#define XRDOSS_HASPGRW
Definition XrdOss.hh:475
#define XRDOSS_resonly
Definition XrdOss.hh:486
#define XRDEXP_NOTRW
#define XRDEXP_FORCERO
#define XRDEXP_STAGE
#define stat(a, b)
Definition XrdPosix.hh:96
#define IS_FWDPATH(x)
XrdOss * XrdOssGetStorageSystem2(XrdOss *native_oss, XrdSysLogger *Logger, const char *cFN, const char *parms, XrdOucEnv *envp)
Definition XrdPss.cc:143
XrdVERSIONINFO(XrdOssGetStorageSystem2, XrdPss)
#define isNOSTAGE(_x_)
Definition XrdPss.cc:86
#define isREADONLY(_x_)
Definition XrdPss.cc:88
int Mode
struct myOpts opts
const char * Arg1
PLUGINO, PLUGION, PLUGXC.
int Arg2Len
Length or -count of args in extension.
#define SFS_ERROR
int Arg1Len
Length.
#define SFS_FSCTL_PLUGXC
< SFS_FSCTL_PLUGIN/PLUGIO/PLUGXC parms
size_t strlcpy(char *dst, const char *src, size_t sz)
virtual int FSctl(const int cmd, int alen, const char *args, XrdSfsFile &file, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)=0
static const uint64_t doCalc
pgw: Calculate checksums
Definition XrdOss.hh:225
const char * tident
Definition XrdOss.hh:453
int fd
Definition XrdOss.hh:455
static const uint64_t Verify
all: Verify checksums
Definition XrdOss.hh:223
char * Env(int &envlen)
Definition XrdOucEnv.hh:48
const XrdSecEntity * secEnv() const
Definition XrdOucEnv.hh:107
char * Get(const char *varname)
Definition XrdOucEnv.hh:69
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
void Put(const char *varname, const char *value)
Definition XrdOucEnv.hh:85
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0
unsigned long long Find(const char *pathname)
static void csCalc(const char *data, off_t offs, size_t count, uint32_t *csval)
static bool csVer(dataInfo &dInfo, off_t &bado, int &badc)
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset & length.
static bool OpenFC(const char *path, int oflag, mode_t mode, XrdPosixInfo &Info)
static int Stats(const char *theID, char *buff, int blen)
static void EnvInfo(XrdOucEnv &theEnv)
static ssize_t pgWrite(int fildes, void *buffer, off_t offset, size_t wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, XrdPosixCallBackIO *cbp=0)
static const uint64_t forceCS
static ssize_t pgRead(int fildes, void *buffer, off_t offset, size_t rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, XrdPosixCallBackIO *cbp=0)
static ssize_t Pread(int fildes, void *buf, size_t nbyte, off_t offset)
Pread() conforms to POSIX.1-2001 pread()
static int Closedir(DIR *dirp)
Closedir() conforms to POSIX.1-2001 closedir()
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat()
static int Mkdir(const char *path, mode_t mode)
Mkdir() conforms to POSIX.1-2001 mkdir()
static int Unlink(const char *path)
Unlink() conforms to POSIX.1-2001 unlink()
static int Rmdir(const char *path)
Rmdir() conforms to POSIX.1-2001 rmdir()
static void VRead(int fildes, const XrdOucIOVec *readV, int n, XrdPosixCallBackIO *cbp)
static int Rename(const char *oldpath, const char *newpath)
Rename() conforms to POSIX.1-2001 rename()
static int Close(int fildes)
Close() conforms to POSIX.1-2001 close()
static int Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
static int QueryError(std::string &emsg, int fd=-1, bool reset=true)
static int Ftruncate(int fildes, off_t offset)
Ftruncate() conforms to POSIX.1-2001 ftruncate()
static DIR * Opendir(const char *path)
Opendir() conforms to POSIX.1-2001 opendir()
static int Fsync(int fildes)
Fsync() conforms to POSIX.1-2001 fsync()
static int Fstat(int fildes, struct stat *buf)
Fstat() conforms to POSIX.1-2001 fstat()
static int Open(const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)
static ssize_t Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
Pwrite() conforms to POSIX.1-2001 pwrite()
static int Truncate(const char *path, off_t offset)
Telldir() conforms to POSIX.1-2001 telldir()
int Close(long long *retsz=0)
Definition XrdPss.cc:713
int Opendir(const char *, XrdOucEnv &)
Definition XrdPss.cc:630
int Readdir(char *buff, int blen)
Definition XrdPss.cc:684
ssize_t ReadRaw(void *, off_t, size_t)
Definition XrdPss.cc:1107
int Fsync()
Definition XrdPss.cc:1235
virtual int Close(long long *retsz=0)
Definition XrdPss.cc:881
virtual int Open(const char *, int, mode_t, XrdOucEnv &)
Definition XrdPss.cc:748
ssize_t Read(off_t, size_t)
Definition XrdPss.cc:1031
int Fstat(struct stat *)
Definition XrdPss.cc:1149
ssize_t Write(const void *, off_t, size_t)
Definition XrdPss.cc:1127
ssize_t ReadV(XrdOucIOVec *readV, int n)
Definition XrdPss.cc:1069
ssize_t pgRead(void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
Definition XrdPss.cc:922
int Ftruncate(unsigned long long)
Definition XrdPss.cc:1264
ssize_t pgWrite(void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
Definition XrdPss.cc:975
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:349
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition XrdPss.cc:1312
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:583
XrdPssSys()
Definition XrdPss.cc:164
virtual void Connect(XrdOucEnv &) override
Definition XrdPss.cc:233
int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0) override
Definition XrdPss.cc:545
int Stats(char *bp, int bl) override
Definition XrdPss.cc:527
static int Info(int rc)
Definition XrdPss.cc:1275
static bool deferID
Definition XrdPss.hh:207
static int hdrLen
Definition XrdPss.hh:198
static const char * hdrData
Definition XrdPss.hh:197
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:479
int Init(XrdSysLogger *, const char *) override
Definition XrdPss.hh:163
static char * fileOrgn
Definition XrdPss.hh:195
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition XrdPss.cc:1285
static bool dcaCheck
Definition XrdPss.hh:205
static bool reProxy
Definition XrdPss.hh:208
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0) override
Definition XrdPss.cc:222
void EnvInfo(XrdOucEnv *envP) override
Definition XrdPss.cc:302
static XrdNetSecurity * Police[PolNum]
Definition XrdPss.hh:101
static XrdOucPListAnchor XPList
Definition XrdPss.hh:191
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1376
int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:385
int Lfn2Pfn(const char *Path, char *buff, int blen) override
Definition XrdPss.cc:317
static bool xLfn2Pfn
Definition XrdPss.hh:204
virtual int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override
Definition XrdPss.cc:271
virtual void Disc(XrdOucEnv &) override
Definition XrdPss.cc:282
int Rename(const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override
Definition XrdPss.cc:431
static bool dcaWorld
Definition XrdPss.hh:206
const char * Tident()
const char * getID()
void setID(const char *tid=0)
const char * thePath()
bool addCGI(const char *prot, char *buff, int blen)
static const char * valProt(const char *pname, int &plen, int adj=0)
const char * tident
Trace identifier always preset.
unsigned int ueid
Unique ID of entity instance.
bool Register(const char *lgnid, const XrdSecEntity *Ident, bool doReplace=false, bool defer=false)
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)
XrdSysLogger * logger(XrdSysLogger *lp=0)
void SetLogger(XrdSysLogger *logp)
XrdSecsssID * idMapper
Definition XrdPss.cc:112
XrdOfsFSctl_PI * cacheFSctl
Definition XrdPss.cc:110
XrdSysTrace SysTrace("Pss", 0)
Definition XrdPssCks.cc:54
XrdScheduler * schedP
Definition XrdPss.cc:104
bool xrdProxy
Definition XrdPss.cc:126
XrdOucSid * sidP
Definition XrdPss.cc:106
static const int PBsz
Definition XrdPss.cc:118
XrdSysError eDest(0, "pss_")
static const char * osslclCGI
Definition XrdPss.cc:116
bool outProxy
Definition XrdPss.cc:124
bool idMapAll
Definition XrdPss.cc:122
thread_local XrdOucECMsg ecMsg("[pss]")
int rpFD
Definition XrdPss.cc:120
static XrdPssSys XrdProxySS
Definition XrdPss.cc:100
static const char * ofslclCGI
Definition XrdPss.cc:114
XrdOucEnv * envP
Definition XrdPss.cc:108