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"
71#include "XrdSys/XrdSysError.hh"
74
75#ifndef O_DIRECT
76#define O_DIRECT 0
77#endif
78
79#ifndef ENOATTR
80#define ENOATTR ENODATA
81#endif
82
83/******************************************************************************/
84/* D e f i n e s */
85/******************************************************************************/
86
87#define isNOSTAGE(_x_) !(XRDEXP_STAGE & XrdPssSys::XPList.Find(_x_))
88
89#define isREADONLY(_x_) (XRDEXP_NOTRW & XrdPssSys::XPList.Find(_x_))
90
91/******************************************************************************/
92/* G l o b a l s */
93/******************************************************************************/
94
95class XrdScheduler;
96
97namespace XrdProxy
98{
99thread_local XrdOucECMsg ecMsg("[pss]");
100
102
103 XrdSysError eDest(0, "pss_");
104
106
108
110
112
113 XrdSecsssID *idMapper = 0; // -> Auth ID mapper
114
115static const char *ofslclCGI = "ofs.lcl=1";
116
117static const char *osslclCGI = "oss.lcl=1";
118
119static const int PBsz = 4096;
120
121 int rpFD = -1;
122
123 bool idMapAll = false;
124
125 bool outProxy = false; // True means outgoing proxy
126
127 bool xrdProxy = false; // True means dest using xroot protocol
128
129 XrdSysTrace SysTrace("Pss",0);
130}
131using namespace XrdProxy;
132
133/******************************************************************************/
134/* XrdOssGetSS (a.k.a. XrdOssGetStorageSystem) */
135/******************************************************************************/
136
138
139// This function is called by the OFS layer to retrieve the Storage System
140// object. We return our proxy storage system object if configuration succeeded.
141//
142extern "C"
143{
146 const char *cFN,
147 const char *parms,
148 XrdOucEnv *envp)
149{
150
151// Ignore the parms (we accept none for now) and call the init routine
152//
153 envP = envp;
154 return (XrdProxySS.Init(Logger, cFN, envP) ? 0 : (XrdOss *)&XrdProxySS);
155}
156}
157
158/******************************************************************************/
159/* o o s s _ S y s M e t h o d s */
160/******************************************************************************/
161/******************************************************************************/
162/* C o n s t r u c t o r */
163/******************************************************************************/
164
165XrdPssSys::XrdPssSys() : HostArena(0), LocalRoot(0), theN2N(0), DirFlags(0),
166 myVersion(&XrdVERSIONINFOVAR(XrdOssGetStorageSystem2)),
168 {}
169
170/******************************************************************************/
171/* i n i t */
172/******************************************************************************/
173
174/*
175 Function: Initialize proxy subsystem
176
177 Input: None
178
179 Output: Returns zero upon success otherwise (-errno).
180*/
181int XrdPssSys::Init(XrdSysLogger *lp, const char *cFN, XrdOucEnv *envP)
182{
183 int NoGo;
184 const char *tmp;
185
186// Do the herald thing
187//
189 eDest.logger(lp);
190 eDest.Say("Copr. 2019, Stanford University, Pss Version " XrdVSTRING);
191
192// Initialize the subsystems
193//
194 tmp = ((NoGo = Configure(cFN, envP)) ? "failed." : "completed.");
195 eDest.Say("------ Proxy storage system initialization ", tmp);
196
197// Extract Pfc control, if it is there.
198//
199 if (!NoGo)
200 cacheFSctl = (XrdOfsFSctl_PI*)envP->GetPtr("XrdFSCtl_PC*");
201
202
203// All done.
204//
205 return NoGo;
206}
207
208/******************************************************************************/
209/* C h m o d */
210/******************************************************************************/
211/*
212 Function: Change file mode.
213
214 Input: path - Is the fully qualified name of the target file.
215 mode - The new mode that the file is to have.
216 envP - Environmental information.
217
218 Output: Returns XrdOssOK upon success and -errno upon failure.
219
220 Notes: This function is currently unsupported.
221*/
222
223int XrdPssSys::Chmod(const char *path, mode_t mode, XrdOucEnv *eP)
224{
225// We currently do not support chmod()
226//
227 return -ENOTSUP;
228}
229
230/******************************************************************************/
231/* C o n n e c t */
232/******************************************************************************/
233
235{
236 EPNAME("Connect");
237 const XrdSecEntity *client = theEnv.secEnv();
238
239// If we need to personify the client, set it up
240//
241 if (idMapper && client)
242 {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
243 char uName[32];
244 snprintf(uName, sizeof(uName), fmt, client->ueid);
245 DEBUG(client->tident,"Registering as ID "<<uName);
246 idMapper->Register(uName, client, deferID);
247 }
248}
249
250/******************************************************************************/
251/* c r e a t e */
252/******************************************************************************/
253
254/*
255 Function: Create a file named `path' with 'file_mode' access mode bits set.
256
257 Input: path - The fully qualified name of the file to create.
258 access_mode - The Posix access mode bits to be assigned to the file.
259 These bits correspond to the standard Unix permission
260 bits (e.g., 744 == "rwxr--r--").
261 env - Environmental information.
262 opts - Set as follows:
263 XRDOSS_mkpath - create dir path if it does not exist.
264 XRDOSS_new - the file must not already exist.
265 x00000000 - x are standard open flags (<<8)
266
267 Output: Returns XrdOssOK upon success; (-errno) otherwise.
268
269 Notes: We always return ENOTSUP as we really want the create options to be
270 promoted to the subsequent open().
271*/
272int XrdPssSys::Create(const char *tident, const char *path, mode_t Mode,
273 XrdOucEnv &env, int Opts)
274{
275
276 return -ENOTSUP;
277}
278
279/******************************************************************************/
280/* D i s c */
281/******************************************************************************/
282
284{
285 EPNAME("Disc");
286 const XrdSecEntity *client = theEnv.secEnv();
287
288// If we personified a client, remove that persona.
289//
290 if (idMapper && client)
291 {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
292 char uName[32];
293 snprintf(uName, sizeof(uName), fmt, client->ueid);
294 DEBUG(client->tident,"Unregistering as ID "<<uName);
295 idMapper->Register(uName, 0);
296 }
297}
298
299/******************************************************************************/
300/* E n v I n f o */
301/******************************************************************************/
302
304{
305// We only need to extract the scheduler pointer from the environment. Propogate
306// the information to the POSIX layer.
307//
308 if (envP)
309 {schedP = (XrdScheduler *)envP->GetPtr("XrdScheduler*");
311 }
312}
313
314/******************************************************************************/
315/* L f n 2 P f n */
316/******************************************************************************/
317
318int XrdPssSys::Lfn2Pfn(const char *oldp, char *newp, int blen)
319{
320 if (theN2N) return -(theN2N->lfn2pfn(oldp, newp, blen));
321 if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
322 strcpy(newp, oldp);
323 return 0;
324}
325
326const char *XrdPssSys::Lfn2Pfn(const char *oldp, char *newp, int blen, int &rc)
327{
328 if (!theN2N) {rc = 0; return oldp;}
329 if ((rc = -(theN2N->lfn2pfn(oldp, newp, blen)))) return 0;
330 return newp;
331}
332
333/******************************************************************************/
334/* M k d i r */
335/******************************************************************************/
336/*
337 Function: Create a directory
338
339 Input: path - Is the fully qualified name of the new directory.
340 mode - The new mode that the directory is to have.
341 mkpath - If true, makes the full path.
342 envP - Environmental information.
343
344 Output: Returns XrdOssOK upon success and -errno upon failure.
345
346 Notes: Directories are only created in the local disk cache.
347 Currently, we do not propogate the mkpath option.
348*/
349
350int XrdPssSys::Mkdir(const char *path, mode_t mode, int mkpath, XrdOucEnv *eP)
351{
352 EPNAME("Mkdir");
353 XrdPssUrlInfo uInfo(eP, path);
354 int rc;
355 char pbuff[PBsz];
356
357// Verify we can write here
358//
359 if (isREADONLY(path)) return -EROFS;
360
361// Convert path to URL
362//
363 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
364
365// Some tracing
366//
367 if(DEBUGON) {
368 auto urlObf = obfuscateAuth(pbuff);
369 DEBUG(uInfo.Tident(),"url="<<urlObf);
370 }
371
372// Simply return the proxied result here
373//
374 return (XrdPosixXrootd::Mkdir(pbuff, mode) ? Info(errno) : XrdOssOK);
375}
376
377/******************************************************************************/
378/* R e m d i r */
379/******************************************************************************/
380
381/*
382 Function: Removes the directory 'path'
383
384 Input: path - Is the fully qualified name of the directory to remove.
385 envP - Environmental information.
386
387 Output: Returns XrdOssOK upon success and -errno upon failure.
388*/
389int XrdPssSys::Remdir(const char *path, int Opts, XrdOucEnv *eP)
390{
391 EPNAME("Remdir");
392 const char *Cgi = "";
393 int rc;
394 char pbuff[PBsz];
395
396// Verify we can write here
397//
398 if (isREADONLY(path)) return -EROFS;
399
400// Setup any required cgi information
401//
402 if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
403
404// Setup url information
405//
406 XrdPssUrlInfo uInfo(eP, path, Cgi);
407
408// Convert path to URL
409//
410 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
411
412// Do some tracing
413//
414 if(DEBUGON) {
415 auto urlObf = obfuscateAuth(pbuff);
416 DEBUG(uInfo.Tident(),"url="<<urlObf);
417 }
418// Issue unlink and return result
419//
420 return (XrdPosixXrootd::Rmdir(pbuff) ? -errno : XrdOssOK);
421}
422
423/******************************************************************************/
424/* R e n a m e */
425/******************************************************************************/
426
427/*
428 Function: Renames a file with name 'old_name' to 'new_name'.
429
430 Input: old_name - Is the fully qualified name of the file to be renamed.
431 new_name - Is the fully qualified name that the file is to have.
432 old_envP - Environmental information for old_name.
433 new_envP - Environmental information for new_name.
434
435 Output: Returns XrdOssOK upon success and -errno upon failure.
436*/
437int XrdPssSys::Rename(const char *oldname, const char *newname,
438 XrdOucEnv *oldenvP, XrdOucEnv *newenvP)
439{
440 EPNAME("Rename");
441 int rc;
442 char oldName[PBsz], newName[PBsz];
443
444// Verify we can write in the source and target
445//
446 if (isREADONLY(oldname) || isREADONLY(newname)) return -EROFS;
447
448// Setup url info
449//
450 XrdPssUrlInfo uInfoOld(oldenvP, oldname);
451 XrdPssUrlInfo uInfoNew(newenvP, newname, "", true, false);
452
453// Convert path to URL
454//
455 if ((rc = P2URL(oldName, PBsz, uInfoOld, xLfn2Pfn))
456 || (rc = P2URL(newName, PBsz, uInfoNew, xLfn2Pfn))) return rc;
457
458// Do some tracing
459//
460 if(DEBUGON) {
461 auto oldNameObf = obfuscateAuth(oldName);
462 auto newNameObf = obfuscateAuth(newName);
463 DEBUG(uInfoOld.Tident(),"old url="<<oldNameObf <<" new url=" <<newNameObf);
464 }
465
466
467// Execute the rename and return result
468//
469 return (XrdPosixXrootd::Rename(oldName, newName) ? -errno : XrdOssOK);
470}
471
472/******************************************************************************/
473/* s t a t */
474/******************************************************************************/
475
476/*
477 Function: Determine if file 'path' actually exists.
478
479 Input: path - Is the fully qualified name of the file to be tested.
480 buff - pointer to a 'stat' structure to hold the attributes
481 of the file.
482 Opts - stat() options.
483 envP - Environmental information.
484
485 Output: Returns XrdOssOK upon success and -errno upon failure.
486
487 Notes: The XRDOSS_resonly flag in Opts is not supported.
488*/
489
490int XrdPssSys::Stat(const char *path, struct stat *buff, int Opts, XrdOucEnv *eP)
491{
492 EPNAME("Stat");
493 const char *Cgi = "";
494 int rc;
495 char pbuff[PBsz];
496
497// Setup any required special cgi information
498//
499 if (*path == '/' && !outProxy && ((Opts & XRDOSS_resonly)||isNOSTAGE(path)))
500 Cgi = osslclCGI;
501
502// We can now establish the url information to be used
503//
504 XrdPssUrlInfo uInfo(eP, path, Cgi);
505
506// Generate an ID if we need to. We can use the server's identity unless that
507// has been prohibited because client ID mapping is taking place.
508//
509 if (idMapAll) uInfo.setID();
510 else if (sidP) uInfo.setID(sidP);
511
512// Convert path to URL
513//
514 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
515
516// Do some tracing
517//
518 if(DEBUGON) {
519 auto urlObf = obfuscateAuth(pbuff);
520 DEBUG(uInfo.Tident(),"url="<<urlObf);
521 }
522
523// Return proxied stat
524//
525 return (XrdPosixXrootd::Stat(pbuff, buff) ? -errno : XrdOssOK);
526}
527
528/******************************************************************************/
529/* S t a t s */
530/******************************************************************************/
531
532/* Function: Return statistics.
533
534 Input: buff - Pointer to buffer for statistics data.
535 blen - The length of the buffer.
536
537 Output: When blen is not zero, null terminated statistics are placed
538 in buff and the length is returned. When blen is zero, the
539 maximum length needed is returned.
540*/
541int XrdPssSys::Stats(char *bp, int bl)
542{
543 return XrdPosixConfig::Stats("pss", bp, bl);
544}
545
546/******************************************************************************/
547/* T r u n c a t e */
548/******************************************************************************/
549/*
550 Function: Truncate a file.
551
552 Input: path - Is the fully qualified name of the target file.
553 flen - The new size that the file is to have.
554 envP - Environmental information.
555
556 Output: Returns XrdOssOK upon success and -errno upon failure.
557*/
558
559int XrdPssSys::Truncate(const char *path, unsigned long long flen,
561{
562 EPNAME("Trunc");
563 XrdPssUrlInfo uInfo(envP, path);
564 int rc;
565 char pbuff[PBsz];
566
567// Make sure we can write here
568//
569 if (isREADONLY(path)) return -EROFS;
570
571// Convert path to URL
572//
573 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
574
575// Do some tracing
576//
577 if(DEBUGON) {
578 auto urlObf = obfuscateAuth(pbuff);
579 DEBUG(uInfo.Tident(),"url="<<urlObf);
580 }
581
582// Return proxied truncate. We only do this on a single machine because the
583// redirector will forbid the trunc() if multiple copies exist.
584//
585 return (XrdPosixXrootd::Truncate(pbuff, flen) ? -errno : XrdOssOK);
586}
587
588/******************************************************************************/
589/* U n l i n k */
590/******************************************************************************/
591
592/*
593 Function: Delete a file from the namespace and release it's data storage.
594
595 Input: path - Is the fully qualified name of the file to be removed.
596 envP - Environmental information.
597
598 Output: Returns XrdOssOK upon success and -errno upon failure.
599*/
600int XrdPssSys::Unlink(const char *path, int Opts, XrdOucEnv *envP)
601{
602 EPNAME("Unlink");
603 const char *Cgi = "";
604 int rc;
605 char pbuff[PBsz];
606
607// Make sure we can write here
608//
609 if (isREADONLY(path)) return -EROFS;
610
611// Setup any required cgi information
612//
613 if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
614
615// Setup url info
616//
617 XrdPssUrlInfo uInfo(envP, path, Cgi);
618
619// Convert path to URL
620//
621 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
622
623// Do some tracing
624//
625 if(DEBUGON) {
626 auto urlObf = obfuscateAuth(pbuff);
627 DEBUG(uInfo.Tident(),"url="<<urlObf);
628 }
629
630// Unlink the file and return result.
631//
632 return (XrdPosixXrootd::Unlink(pbuff) ? -errno : XrdOssOK);
633}
634
635/******************************************************************************/
636/* P s s D i r M e t h o d s */
637/******************************************************************************/
638/******************************************************************************/
639/* o p e n d i r */
640/******************************************************************************/
641
642/*
643 Function: Open the directory `path' and prepare for reading.
644
645 Input: path - The fully qualified name of the directory to open.
646 envP - Environmental information.
647
648 Output: Returns XrdOssOK upon success; (-errno) otherwise.
649*/
650int XrdPssDir::Opendir(const char *dir_path, XrdOucEnv &Env)
651{
652 EPNAME("Opendir");
653 int rc;
654 char pbuff[PBsz];
655
656// Return an error if this object is already open
657//
658 if (myDir) return -XRDOSS_E8001;
659
660// Open directories are not supported for object id's
661//
662 if (*dir_path != '/') return -ENOTSUP;
663
664// Setup url info
665//
666 XrdPssUrlInfo uInfo(&Env, dir_path);
667 uInfo.setID();
668
669// Convert path to URL
670//
671 if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
672 return rc;
673
674// Do some tracing
675//
676 if(DEBUGON) {
677 auto urlObf = obfuscateAuth(pbuff);
678 DEBUG(uInfo.Tident(),"url="<<urlObf);
679 }
680
681// Open the directory
682//
683 myDir = XrdPosixXrootd::Opendir(pbuff);
684 if (!myDir) return -errno;
685 return XrdOssOK;
686}
687
688/******************************************************************************/
689/* r e a d d i r */
690/******************************************************************************/
691
692/*
693 Function: Read the next entry if directory associated with this object.
694
695 Input: buff - Is the address of the buffer that is to hold the next
696 directory name.
697 blen - Size of the buffer.
698
699 Output: Upon success, places the contents of the next directory entry
700 in buff. When the end of the directory is encountered buff
701 will be set to the null string.
702
703 Upon failure, returns a (-errno).
704
705 Warning: The caller must provide proper serialization.
706*/
707int XrdPssDir::Readdir(char *buff, int blen)
708{
709// Check if we are directly reading the directory
710//
711 if (myDir)
712 {dirent *entP, myEnt;
713 int rc = XrdPosixXrootd::Readdir_r(myDir, &myEnt, &entP);
714 if (rc) return -rc;
715 if (!entP) *buff = 0;
716 else strlcpy(buff, myEnt.d_name, blen);
717 return XrdOssOK;
718 }
719
720// The directory is not open
721//
722 return -XRDOSS_E8002;
723}
724
725/******************************************************************************/
726/* S t a t R e t */
727/******************************************************************************/
728int XrdPssDir::StatRet(struct stat *buff)
729{
730 if (!myDir) return -XRDOSS_E8002;
731
732 auto rc = XrdPosixXrootd::StatRet(myDir, buff);
733 if (rc) return -rc;
734 return XrdOssOK;
735}
736
737/******************************************************************************/
738/* C l o s e */
739/******************************************************************************/
740
741/*
742 Function: Close the directory associated with this object.
743
744 Input: None.
745
746 Output: Returns XrdOssOK upon success and (errno) upon failure.
747*/
748int XrdPssDir::Close(long long *retsz)
749{
750 DIR *theDir;
751
752// Close the directory proper if it exists. POSIX specified that directory
753// stream is no longer available after closedir() regardless if return value.
754//
755 if ((theDir = myDir))
756 {myDir = 0;
757 if (XrdPosixXrootd::Closedir(theDir)) return -errno;
758 return XrdOssOK;
759 }
760
761// Directory is not open
762//
763 return -XRDOSS_E8002;
764}
765
766/******************************************************************************/
767/* o o s s _ F i l e M e t h o d s */
768/******************************************************************************/
769/******************************************************************************/
770/* o p e n */
771/******************************************************************************/
772
773/*
774 Function: Open the file `path' in the mode indicated by `Mode'.
775
776 Input: path - The fully qualified name of the file to open.
777 Oflag - Standard open flags.
778 Mode - Create mode (i.e., rwx).
779 env - Environmental information.
780
781 Output: XrdOssOK upon success; -errno otherwise.
782*/
783int XrdPssFile::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &Env)
784{
785 EPNAME("Open");
786 unsigned long long popts = XrdPssSys::XPList.Find(path);
787 const char *Cgi = "";
788 char pbuff[PBsz];
789 int rc;
790 bool tpcMode = (Oflag & O_NOFOLLOW) != 0;
791 bool rwMode = (Oflag & O_ACCMODE) != O_RDONLY;
792 bool ucgiOK = true;
793 bool ioCache = (Oflag & O_DIRECT);
794
795// Record the security environment
796//
797 entity = Env.secEnv();
798
799// Turn off direct flag if set (we record it separately
800//
801 if (ioCache) Oflag &= ~O_DIRECT;
802
803// Return an error if the object is already open
804//
805 if (fd >= 0 || tpcPath) return -XRDOSS_E8003;
806
807// If we are opening this in r/w mode make sure we actually can
808//
809 if (rwMode)
810 {if (XrdPssSys::fileOrgn) return -EROFS;
811 if (popts & XRDEXP_NOTRW)
812 {if (popts & XRDEXP_FORCERO && !tpcMode) Oflag = O_RDONLY;
813 else return -EROFS;
814 }
815 }
816
817 // check CGI cache-control paramters
818 if (cacheFSctl)
819 {
820 int elen;
821 char *envcgi = (char *)Env.Env(elen);
822
823 if (envcgi && strstr(envcgi, "only-if-cached"))
824 {
825 XrdOucErrInfo einfo;
826 XrdSfsFSctl myData;
827 myData.Arg1 = "cached";
828 myData.Arg1Len = 1;
829 myData.Arg2Len = 1;
830 const char *myArgs[1];
831 myArgs[0] = path;
832 myData.ArgP = myArgs;
833 int fsctlRes = cacheFSctl->FSctl(SFS_FSCTL_PLUGXC, myData, einfo);
834 if (fsctlRes == SFS_ERROR)
835 return -einfo.getErrInfo();
836 }
837 }
838
839// If this is a third party copy open, then strange rules apply. If this is an
840// outgoing proxy we let everything pass through as this may be a TPC request
841// elsewhere. Otherwise, if it's an open for reading, we open the file but
842// strip off all CGI (technically, we should only remove the "tpc" tokens)
843// because the source might not support direct TPC mode. If we are opening for
844// writing, then we skip the open and mark this as a TPC handle which can only
845// be used for fstat() and close(). Any other actions return an error.
846//
847 if (tpcMode)
848 {Oflag &= ~O_NOFOLLOW;
849 if (!XrdProxy::outProxy || !IS_FWDPATH(path))
850 {if (rwMode)
851 {tpcPath = strdup(path);
853 {const char *rPath = Env.Get("tpc.reproxy");
854 if (!rPath || *rPath != '/') return -ENOATTR;
855 if (!(rPath = rindex(rPath, '/')) || *(rPath+1) == 0)
856 return -EFAULT;
857 rpInfo = new tprInfo(rPath+1);
858 }
859 return XrdOssOK;
860 }
861 ucgiOK = false;
862 }
863 }
864
865// Setup any required cgi information. Don't mess with it if it's an objectid
866// or if the we are an outgoing proxy server.
867//
868 if (!XrdProxy::outProxy && *path == '/' && !(XRDEXP_STAGE & popts))
869 Cgi = osslclCGI;
870
871// Construct the url info
872//
873 XrdPssUrlInfo uInfo(&Env, path, Cgi, ucgiOK);
874 uInfo.setID();
875
876// Convert path to URL
877//
878 if ((rc = XrdPssSys::P2URL(pbuff, PBsz, uInfo, XrdPssSys::xLfn2Pfn)))
879 return rc;
880
881// Do some tracing
882//
883 if(DEBUGON) {
884 auto urlObf = obfuscateAuth(pbuff);
885 DEBUG(uInfo.Tident(),"url="<<urlObf);
886 }
887
888// Try to open and if we failed, return an error
889//
890 if (!XrdPssSys::dcaCheck || !ioCache)
891 {if ((fd = XrdPosixXrootd::Open(pbuff,Oflag,Mode)) < 0) return -errno;
892 } else {
893 XrdPosixInfo Info;
894 Info.ffReady = XrdPssSys::dcaWorld;
895 if (XrdPosixConfig::OpenFC(pbuff,Oflag,Mode,Info))
896 {Env.Put("FileURL", Info.cacheURL);
897 return -EDESTADDRREQ;
898 }
899 fd = Info.fileFD;
900 if (fd < 0) return -errno;
901 }
902
903// All done
904//
905 return XrdOssOK;
906}
907
908/******************************************************************************/
909/* c l o s e */
910/******************************************************************************/
911
912/*
913 Function: Close the file associated with this object.
914
915 Input: None.
916
917 Output: Returns XrdOssOK upon success aud -errno upon failure.
918*/
919int XrdPssFile::Close(long long *retsz)
920{ int rc;
921
922// We don't support returning the size (we really should fix this)
923//
924 if (retsz) *retsz = 0;
925
926// If the file is not open, then this may be OK if it is a 3rd party copy
927//
928 if (fd < 0)
929 {if (!tpcPath) return -XRDOSS_E8004;
930 free(tpcPath);
931 tpcPath = 0;
932 return XrdOssOK;
933 }
934
935// Close the file
936//
938 fd = -1;
939 return (rc == 0 ? XrdOssOK : -errno);
940}
941
942/******************************************************************************/
943/* p g R e a d */
944/******************************************************************************/
945
946/*
947 Function: Read file pages into a buffer and return corresponding checksums.
948
949 Input: buffer - pointer to buffer where the bytes are to be placed.
950 offset - The offset where the read is to start.
951 rdlen - The number of bytes to read.
952 csvec - A vector to be filled with the corresponding CRC32C
953 checksums for each page or page segment, if available.
954 opts - Options as noted (see inherited class).
955
956 Output: returns Number of bytes that placed in buffer upon success and
957 -errno upon failure.
958*/
959
960ssize_t XrdPssFile::pgRead(void *buffer,
961 off_t offset,
962 size_t rdlen,
963 uint32_t *csvec,
964 uint64_t opts)
965{
966 std::vector<uint32_t> vecCS;
967 uint64_t psxOpts;
968 ssize_t bytes;
969
970// Make sure file is open
971//
972 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
973
974// Set options as needed
975//
976 psxOpts = (csvec ? XrdPosixExtra::forceCS : 0);
977
978// Issue the pgread
979//
980 if ((bytes = XrdPosixExtra::pgRead(fd,buffer,offset,rdlen,vecCS,psxOpts)) < 0)
981 return (ssize_t)-errno;
982
983// Copy out the checksum vector
984//
985 if (vecCS.size() && csvec)
986 memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
987
988// All done
989//
990 return bytes;
991}
992
993/******************************************************************************/
994/* p g W r i t e */
995/******************************************************************************/
996/*
997 Function: Write file pages into a file with corresponding checksums.
998
999 Input: buffer - pointer to buffer containing the bytes to write.
1000 offset - The offset where the write is to start.
1001 wrlen - The number of bytes to write.
1002 be the last write to the file at or above the offset.
1003 csvec - A vector which contains the corresponding CRC32 checksum
1004 for each page or page segment. If size is 0, then
1005 checksums are calculated. If not zero, the size must
1006 equal the required number of checksums for offset/wrlen.
1007 opts - Options as noted.
1008
1009 Output: Returns the number of bytes written upon success and -errno
1010 upon failure.
1011*/
1012
1013ssize_t XrdPssFile::pgWrite(void *buffer,
1014 off_t offset,
1015 size_t wrlen,
1016 uint32_t *csvec,
1017 uint64_t opts)
1018{
1019 std::vector<uint32_t> vecCS;
1020 ssize_t bytes;
1021
1022// Make sure we have an open file
1023//
1024 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1025
1026// Check if caller wants to verify the checksums before writing
1027//
1028 if (csvec && (opts & XrdOssDF::Verify))
1029 {XrdOucPgrwUtils::dataInfo dInfo((const char*)buffer,csvec,offset,wrlen);
1030 off_t bado;
1031 int badc;
1032 if (!XrdOucPgrwUtils::csVer(dInfo, bado, badc)) return -EDOM;
1033 }
1034
1035// Check if caller want checksum generated and possibly returned
1036//
1037 if ((opts & XrdOssDF::doCalc) || csvec == 0)
1038 {XrdOucPgrwUtils::csCalc((const char *)buffer, offset, wrlen, vecCS);
1039 if (csvec) memcpy(csvec, vecCS.data(), vecCS.size()*sizeof(uint32_t));
1040 } else {
1041 int n = XrdOucPgrwUtils::csNum(offset, wrlen);
1042 vecCS.resize(n);
1043 vecCS.assign(n, 0);
1044 memcpy(vecCS.data(), csvec, n*sizeof(uint32_t));
1045 }
1046
1047// Issue the pgwrite
1048//
1049 bytes = XrdPosixExtra::pgWrite(fd, buffer, offset, wrlen, vecCS);
1050
1051// Return result
1052//
1053 return (bytes < 0 ? (ssize_t)-errno : bytes);
1054}
1055
1056/******************************************************************************/
1057/* r e a d */
1058/******************************************************************************/
1059
1060/*
1061 Function: Preread `blen' bytes from the associated file.
1062
1063 Input: offset - The absolute 64-bit byte offset at which to read.
1064 blen - The size to preread.
1065
1066 Output: Returns zero read upon success and -errno upon failure.
1067*/
1068
1069ssize_t XrdPssFile::Read(off_t offset, size_t blen)
1070{
1071 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1072
1073 return 0; // We haven't implemented this yet!
1074}
1075
1076
1077/******************************************************************************/
1078/* r e a d */
1079/******************************************************************************/
1080
1081/*
1082 Function: Read `blen' bytes from the associated file, placing in 'buff'
1083 the data and returning the actual number of bytes read.
1084
1085 Input: buff - Address of the buffer in which to place the data.
1086 offset - The absolute 64-bit byte offset at which to read.
1087 blen - The size of the buffer. This is the maximum number
1088 of bytes that will be read.
1089
1090 Output: Returns the number bytes read upon success and -errno upon failure.
1091*/
1092
1093ssize_t XrdPssFile::Read(void *buff, off_t offset, size_t blen)
1094{
1095 ssize_t retval;
1096
1097 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1098
1099 return (retval = XrdPosixXrootd::Pread(fd, buff, blen, offset)) < 0
1100 ? (ssize_t)-errno : retval;
1101}
1102
1103/******************************************************************************/
1104/* r e a d v */
1105/******************************************************************************/
1106
1107ssize_t XrdPssFile::ReadV(XrdOucIOVec *readV, // In
1108 int readCount) // In
1109/*
1110 Function: Perform all the reads specified in the readV vector.
1111
1112 Input: readV - A description of the reads to perform; includes the
1113 absolute offset, the size of the read, and the buffer
1114 to place the data into.
1115 readCount - The size of the readV vector.
1116
1117 Output: Returns the number of bytes read upon success and -errno upon failure.
1118 If the number of bytes read is less than requested, it is considered
1119 an error.
1120*/
1121{
1122 ssize_t retval;
1123
1124 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1125
1126 return (retval = XrdPosixXrootd::VRead(fd, readV, readCount)) < 0 ? (ssize_t)-errno : retval;;
1127}
1128
1129/******************************************************************************/
1130/* R e a d R a w */
1131/******************************************************************************/
1132
1133/*
1134 Function: Read `blen' bytes from the associated file, placing in 'buff'
1135 the data and returning the actual number of bytes read.
1136
1137 Input: buff - Address of the buffer in which to place the data.
1138 offset - The absolute 64-bit byte offset at which to read.
1139 blen - The size of the buffer. This is the maximum number
1140 of bytes that will be read.
1141
1142 Output: Returns the number bytes read upon success and -errno upon failure.
1143*/
1144
1145ssize_t XrdPssFile::ReadRaw(void *buff, off_t offset, size_t blen)
1146{
1147 return Read(buff, offset, blen);
1148}
1149
1150/******************************************************************************/
1151/* w r i t e */
1152/******************************************************************************/
1153
1154/*
1155 Function: Write `blen' bytes to the associated file, from 'buff'
1156 and return the actual number of bytes written.
1157
1158 Input: buff - Address of the buffer from which to get the data.
1159 offset - The absolute 64-bit byte offset at which to write.
1160 blen - The number of bytes to write from the buffer.
1161
1162 Output: Returns the number of bytes written upon success and -errno o/w.
1163*/
1164
1165ssize_t XrdPssFile::Write(const void *buff, off_t offset, size_t blen)
1166{
1167 ssize_t retval;
1168
1169 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1170
1171 return (retval = XrdPosixXrootd::Pwrite(fd, buff, blen, offset)) < 0
1172 ? (ssize_t)-errno : retval;
1173}
1174
1175/******************************************************************************/
1176/* f s t a t */
1177/******************************************************************************/
1178
1179/*
1180 Function: Return file status for the associated file.
1181
1182 Input: buff - Pointer to buffer to hold file status.
1183
1184 Output: Returns XrdOssOK upon success and -errno upon failure.
1185*/
1186
1187int XrdPssFile::Fstat(struct stat *buff)
1188{
1189 EPNAME("fstat");
1190
1191// If we have a file descriptor then return a stat for it
1192//
1193 if (fd >= 0) return (XrdPosixXrootd::Fstat(fd, buff) ? -errno : XrdOssOK);
1194
1195// Otherwise, if this is not a tpc of any kind, return an error
1196//
1197 if (!tpcPath) return -XRDOSS_E8004;
1198
1199// If this is a normal tpc then simply issue the stat against the origin
1200//
1201 if (!rpInfo)
1202 {XrdOucEnv fstatEnv(0, 0, entity);
1203 return XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv);
1204 }
1205
1206// This is a reproxy tpc, if we have not yet dertermined the true dest, do so.
1207//
1208 struct stat Stat;
1209
1210 if (rpInfo->dstURL == 0
1211 || !fstatat(rpFD, rpInfo->tprPath, &Stat, AT_SYMLINK_NOFOLLOW))
1212 {char lnkbuff[2048]; int lnklen;
1213 lnklen = readlinkat(rpFD, rpInfo->tprPath, lnkbuff, sizeof(lnkbuff)-1);
1214 if (lnklen <= 0)
1215 {int rc = 0;
1216 if (lnklen < 0) {if (errno != ENOENT) rc = -errno;}
1217 else rc = -EFAULT;
1218 if (rc)
1219 {unlinkat(rpFD, rpInfo->tprPath, 0);
1220 return rc;
1221 }
1222 } else {
1223 unlinkat(rpFD, rpInfo->tprPath, 0);
1224 lnkbuff[lnklen] = 0;
1225 if (rpInfo->dstURL) free(rpInfo->dstURL);
1226 rpInfo->dstURL = strdup(lnkbuff);
1227 rpInfo->fSize = 1;
1228 DEBUG(tident,rpInfo->tprPath<<" maps "<<tpcPath<<" -> "<<lnkbuff);
1229 }
1230 }
1231
1232// At this point we may or may not have the final endpoint. An error here could
1233// be due to write error recovery, so make allowance for that.
1234//
1235 if (rpInfo->dstURL)
1236 {if (!XrdPosixXrootd::Stat(rpInfo->dstURL, buff))
1237 {if (!(rpInfo->fSize = buff->st_size)) rpInfo->fSize = 1;
1238 return XrdOssOK;
1239 }
1240 free(rpInfo->dstURL);
1241 rpInfo->dstURL = 0;
1242 }
1243
1244// We don't have the final endpoint. If we ever had it before, then punt.
1245//
1246 if (rpInfo->fSize)
1247 {memset(buff, 0, sizeof(struct stat));
1248 buff->st_size = rpInfo->fSize;
1249 return XrdOssOK;
1250 }
1251
1252// If we are here then maybe the reproxy option was the wrong config setting.
1253// Give stat a try on the origin we'll retry resolution on the next stat.
1254//
1255 XrdOucEnv fstatEnv(0, 0, entity);
1256
1257 if (XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv))
1258 memset(buff, 0, sizeof(struct stat));
1259 return XrdOssOK;
1260}
1261
1262/******************************************************************************/
1263/* f s y n c */
1264/******************************************************************************/
1265
1266/*
1267 Function: Synchronize associated file.
1268
1269 Input: None.
1270
1271 Output: Returns XrdOssOK upon success and -errno upon failure.
1272*/
1274{
1275 if (fd < 0) return -XRDOSS_E8004;
1276
1277 return (XrdPosixXrootd::Fsync(fd) ? -errno : XrdOssOK);
1278}
1279
1280/******************************************************************************/
1281/* f t r u n c a t e */
1282/******************************************************************************/
1283
1284/*
1285 Function: Set the length of associated file to 'flen'.
1286
1287 Input: flen - The new size of the file.
1288
1289 Output: Returns XrdOssOK upon success and -errno upon failure.
1290
1291 Notes: If 'flen' is smaller than the current size of the file, the file
1292 is made smaller and the data past 'flen' is discarded. If 'flen'
1293 is larger than the current size of the file, a hole is created
1294 (i.e., the file is logically extended by filling the extra bytes
1295 with zeroes).
1296
1297 If compiled w/o large file support, only lower 32 bits are used.
1298 used.
1299
1300 Currently not supported for proxies.
1301*/
1302int XrdPssFile::Ftruncate(unsigned long long flen)
1303{
1304 if (fd < 0) return -XRDOSS_E8004;
1305
1306 return (XrdPosixXrootd::Ftruncate(fd, flen) ? -errno : XrdOssOK);
1307}
1308
1309/******************************************************************************/
1310/* I n t e r n a l M e t h o d s */
1311/******************************************************************************/
1312
1314{
1315 std::string psxMsg;
1316 int n = XrdPosixXrootd::QueryError(psxMsg);
1317
1318 XrdProxy::ecMsg.Set(n, psxMsg);
1319 return -rc;
1320}
1321
1322/******************************************************************************/
1323/* P 2 D S T */
1324/******************************************************************************/
1325
1326int XrdPssSys::P2DST(int &retc, char *hBuff, int hBlen, XrdPssSys::PolAct pEnt,
1327 const char *path)
1328{
1329 const char *Slash;
1330 int n;
1331
1332// Extract out the destination
1333//
1334 Slash = index(path, '/');
1335 if (!Slash || (n = (Slash - path)) == 0) {retc = -EINVAL; return 0;}
1336 if (n >= hBlen) {retc = -ENAMETOOLONG; return 0;}
1337 strncpy(hBuff, path, n); hBuff[n] = 0;
1338
1339// Check if we need to authorize the outgoing connection
1340//
1341 if (Police[pEnt] && !Police[pEnt]->Authorize(hBuff))
1342 {retc = -EACCES; return 0;}
1343
1344// All is well
1345//
1346 return n;
1347}
1348
1349/******************************************************************************/
1350/* P 2 O U T */
1351/******************************************************************************/
1352
1353int XrdPssSys::P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
1354{ const char *theID = uInfo.getID();
1355 const char *pname, *path, *thePath;
1356 char hBuff[288];
1357 int retc, n;
1358
1359// Setup the path
1360//
1361 thePath = path = uInfo.thePath();
1362
1363// Make sure the path is valid for an outgoing proxy
1364//
1365 if (*path == '/') path++;
1366 if ((pname = XrdPssUtils::valProt(path, n, 1))) path += n;
1367 else {if (!hdrLen) return -ENOTSUP;
1368 n = snprintf(pbuff, pblen, hdrData, theID, thePath);
1369 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1370 return -ENAMETOOLONG;
1371 return 0;
1372 }
1373
1374// Objectid must be handled differently as they have not been refalgomized
1375//
1376 if (*thePath != '/')
1377 {if (*path == '/')
1378 {path++;
1379 if (*path == '/') theID = "";
1380 }
1381 if (Police[PolObj] && !P2DST(retc, hBuff, sizeof(hBuff), PolObj,
1382 path+(*path == '/' ? 1:0))) return 0;
1383 n = snprintf(pbuff, pblen, "%s%s%s", pname, theID, path);
1384 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1385 return -ENAMETOOLONG;
1386 return 0;
1387 }
1388
1389// Extract out the destination. We need to do this because the front end
1390// will have extracted out double slashes and we need to add them back. We
1391// also authorize the outgoing connection if we need to in the process.
1392//
1393 if (!(n = P2DST(retc, hBuff, sizeof(hBuff), PolPath, path))) return 0;
1394 path += n;
1395
1396// Create the new path. If the url already contains a userid then use it
1397// instead or our internally generated one. We may need an option for this
1398// as it may result in unintended side-effects but for now we do that.
1399//
1400 if (index(hBuff, '@')) theID= "";
1401 n = snprintf(pbuff,pblen,"%s%s%s/%s",pname,theID,hBuff,path);
1402
1403// Make sure the path will fit
1404//
1405 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1406 return -ENAMETOOLONG;
1407
1408// All done
1409//
1410 return 0;
1411}
1412
1413/******************************************************************************/
1414/* P 2 U R L */
1415/******************************************************************************/
1416
1417int XrdPssSys::P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N)
1418{
1419
1420// If this is an outgoing proxy then we need to do someother work
1421//
1422 if (outProxy) return P2OUT(pbuff, pblen, uInfo);
1423
1424// Do url generation for actual known origin
1425//
1426 const char *path = uInfo.thePath();
1427 int retc, pfxLen;
1428 char Apath[MAXPATHLEN+1];
1429
1430// Setup to process url generation
1431//
1432 path = uInfo.thePath();
1433
1434// First, apply the N2N mapping if necessary. If N2N fails then the whole
1435// mapping fails and ENAMETOOLONG will be returned.
1436//
1437 if (doN2N && XrdProxySS.theN2N)
1438 {if ((retc = XrdProxySS.theN2N->lfn2pfn(path, Apath, sizeof(Apath))))
1439 {if (retc > 0) return -retc;}
1440 path = Apath;
1441 }
1442
1443// Format the header into the buffer and check if we overflowed. Note that we
1444// defer substitution of the path as we need to know where the path is.
1445//
1446 if (fileOrgn) pfxLen = snprintf(pbuff, pblen, hdrData, path);
1447 else pfxLen = snprintf(pbuff, pblen, hdrData, uInfo.getID(), path);
1448 if (pfxLen >= pblen) return -ENAMETOOLONG;
1449
1450// Add any cgi information
1451//
1452 if (!fileOrgn && uInfo.hasCGI())
1453 {if (!uInfo.addCGI(pbuff, pbuff+pfxLen, pblen-pfxLen))
1454 return -ENAMETOOLONG;
1455 }
1456
1457// All done
1458//
1459 return 0;
1460}
#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
std::string obfuscateAuth(const std::string &input)
#define DEBUGON
#define stat(a, b)
Definition XrdPosix.hh:101
#define IS_FWDPATH(x)
XrdOss * XrdOssGetStorageSystem2(XrdOss *native_oss, XrdSysLogger *Logger, const char *cFN, const char *parms, XrdOucEnv *envp)
Definition XrdPss.cc:144
XrdVERSIONINFO(XrdOssGetStorageSystem2, XrdPss)
#define isNOSTAGE(_x_)
Definition XrdPss.cc:87
#define isREADONLY(_x_)
Definition XrdPss.cc:89
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
void Set(int ecc, const char *ecm="")
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 StatRet(DIR *dirp, struct stat *buf)
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:748
int Opendir(const char *, XrdOucEnv &)
Definition XrdPss.cc:650
int Readdir(char *buff, int blen)
Definition XrdPss.cc:707
int StatRet(struct stat *buf)
Definition XrdPss.cc:728
ssize_t ReadRaw(void *, off_t, size_t)
Definition XrdPss.cc:1145
int Fsync()
Definition XrdPss.cc:1273
virtual int Close(long long *retsz=0)
Definition XrdPss.cc:919
virtual int Open(const char *, int, mode_t, XrdOucEnv &)
Definition XrdPss.cc:783
ssize_t Read(off_t, size_t)
Definition XrdPss.cc:1069
int Fstat(struct stat *)
Definition XrdPss.cc:1187
ssize_t Write(const void *, off_t, size_t)
Definition XrdPss.cc:1165
ssize_t ReadV(XrdOucIOVec *readV, int n)
Definition XrdPss.cc:1107
ssize_t pgRead(void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
Definition XrdPss.cc:960
int Ftruncate(unsigned long long)
Definition XrdPss.cc:1302
ssize_t pgWrite(void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
Definition XrdPss.cc:1013
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:350
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition XrdPss.cc:1353
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:600
XrdPssSys()
Definition XrdPss.cc:165
virtual void Connect(XrdOucEnv &) override
Definition XrdPss.cc:234
int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0) override
Definition XrdPss.cc:559
int Stats(char *bp, int bl) override
Definition XrdPss.cc:541
static int Info(int rc)
Definition XrdPss.cc:1313
static bool deferID
Definition XrdPss.hh:214
static int hdrLen
Definition XrdPss.hh:205
static const char * hdrData
Definition XrdPss.hh:204
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:490
int Init(XrdSysLogger *, const char *) override
Definition XrdPss.hh:170
static char * fileOrgn
Definition XrdPss.hh:202
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition XrdPss.cc:1326
static bool dcaCheck
Definition XrdPss.hh:212
static bool reProxy
Definition XrdPss.hh:215
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0) override
Definition XrdPss.cc:223
void EnvInfo(XrdOucEnv *envP) override
Definition XrdPss.cc:303
static XrdNetSecurity * Police[PolNum]
Definition XrdPss.hh:101
static XrdOucPListAnchor XPList
Definition XrdPss.hh:198
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1417
int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:389
int Lfn2Pfn(const char *Path, char *buff, int blen) override
Definition XrdPss.cc:318
static bool xLfn2Pfn
Definition XrdPss.hh:211
virtual int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override
Definition XrdPss.cc:272
virtual void Disc(XrdOucEnv &) override
Definition XrdPss.cc:283
int Rename(const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override
Definition XrdPss.cc:437
static bool dcaWorld
Definition XrdPss.hh:213
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:113
XrdOfsFSctl_PI * cacheFSctl
Definition XrdPss.cc:111
XrdSysTrace SysTrace("Pss", 0)
Definition XrdPssCks.cc:55
XrdScheduler * schedP
Definition XrdPss.cc:105
bool xrdProxy
Definition XrdPss.cc:127
XrdOucSid * sidP
Definition XrdPss.cc:107
static const int PBsz
Definition XrdPss.cc:119
XrdSysError eDest(0, "pss_")
static const char * osslclCGI
Definition XrdPss.cc:117
bool outProxy
Definition XrdPss.cc:125
bool idMapAll
Definition XrdPss.cc:123
thread_local XrdOucECMsg ecMsg("[pss]")
int rpFD
Definition XrdPss.cc:121
static XrdPssSys XrdProxySS
Definition XrdPss.cc:101
static const char * ofslclCGI
Definition XrdPss.cc:115
XrdOucEnv * envP
Definition XrdPss.cc:109