XRootD
Loading...
Searching...
No Matches
XrdOssApi.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d O s s A p i . c c */
4/* */
5/* (c) 2006 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 <strings.h>
39#include <cstdio>
40#include <sys/file.h>
41#include <sys/stat.h>
42#include <sys/types.h>
43#include <sys/param.h>
44#ifdef __solaris__
45#include <sys/vnode.h>
46#endif
47
48#include "XrdVersion.hh"
49
50#include "XrdFrc/XrdFrcXAttr.hh"
51#include "XrdOss/XrdOssApi.hh"
52#include "XrdOss/XrdOssCache.hh"
54#include "XrdOss/XrdOssError.hh"
55#include "XrdOss/XrdOssMio.hh"
56#include "XrdOss/XrdOssTrace.hh"
57#include "XrdOuc/XrdOucEnv.hh"
60#include "XrdOuc/XrdOucXAttr.hh"
61#include "XrdSfs/XrdSfsFlags.hh"
63#include "XrdSys/XrdSysError.hh"
64#include "XrdSys/XrdSysFD.hh"
68
69#ifdef XRDOSSCX
70#include "oocx_CXFile.h"
71#endif
72
73/******************************************************************************/
74/* E r r o r R o u t i n g O b j e c t */
75/******************************************************************************/
76
78
80
82
83/******************************************************************************/
84/* S t o r a g e S y s t e m I n s t a n t i a t o r */
85/******************************************************************************/
86
87char XrdOssSys::tryMmap = 0;
88char XrdOssSys::chkMmap = 0;
89
90/******************************************************************************/
91/* XrdOssGetSS (a.k.a. XrdOssGetStorageSystem) */
92/******************************************************************************/
93
94// This function is called by the OFS layer to retrieve the Storage System
95// object. If a plugin library has been specified, then this function will
96// return the object provided by XrdOssGetStorageSystem() within the library.
97//
98XrdOss *XrdOssGetSS(XrdSysLogger *Logger, const char *config_fn,
99 const char *OssLib, const char *OssParms,
100 XrdOucEnv *envP, XrdVersionInfo &urVer)
101{
102 static XrdOssSys myOssSys;
103 extern XrdSysError OssEroute;
104 XrdOucPinLoader *myLib;
105 XrdOss *ossP;
106
107// Verify that versions are compatible.
108//
109 if (urVer.vNum != myOssSys.myVersion->vNum
110 && !XrdSysPlugin::VerCmp(urVer, *(myOssSys.myVersion))) return 0;
111
112// Set logger for tracing and errors
113//
116
117// If no library has been specified, return the default object
118//
119 if (!OssLib) {if (myOssSys.Init(Logger, config_fn, envP)) return 0;
120 else return (XrdOss *)&myOssSys;
121 }
122
123// Create a plugin object. Take into account the proxy library. Eventually,
124// we will need to support other core libraries. But, for now, this will do.
125//
126 if (!(myLib = new XrdOucPinLoader(&OssEroute, myOssSys.myVersion,
127 "osslib", OssLib))) return 0;
128// Declare the interface versions
129//
131 const char *epName1 = "XrdOssGetStorageSystem";
133 const char *epName2 ="?XrdOssGetStorageSystem2";
134
135// First try finding version 2 of the initializer. If that fails try version 1.
136// In the process, we will get an oss object if we succeed at all.
137//
138 getOSS2 = (XrdOssGetStorageSystem2_t)myLib->Resolve(epName2);
139 if (getOSS2) ossP = getOSS2((XrdOss *)&myOssSys, Logger, config_fn,
140 OssParms, envP);
141 else {getOSS1 = (XrdOssGetStorageSystem_t)myLib->Resolve(epName1);
142 if (!getOSS1) return 0;
143 ossP = getOSS1((XrdOss *)&myOssSys, Logger, config_fn, OssParms);
144 }
145
146// Call the legacy EnvInfo() method and set what library we are using if it
147// differs from what we wre passed.
148//
149 if (ossP && envP)
150 {ossP->EnvInfo(envP);
151 if (envP && strcmp(OssLib, myLib->Path()))
152 envP->Put("oss.lib", myLib->Path());
153 }
154
155// All done
156//
157 delete myLib;
158 return ossP;
159}
160
161/******************************************************************************/
162/* X r d O s s D e f a u l t S S */
163/******************************************************************************/
164
166 const char *cfg_fn,
167 XrdVersionInfo &urVer)
168{
169 return XrdOssGetSS(logger, cfg_fn, 0, 0, 0, urVer);
170}
171
172/******************************************************************************/
173/* o o s s _ S y s M e t h o d s */
174/******************************************************************************/
175/******************************************************************************/
176/* i n i t */
177/******************************************************************************/
178
179/*
180 Function: Initialize staging subsystem
181
182 Input: None
183
184 Output: Returns zero upon success otherwise (-errno).
185*/
186int XrdOssSys::Init(XrdSysLogger *lp, const char *configfn, XrdOucEnv *envP)
187{
188 int retc;
189
190// No need to do the herald thing as we are the default storage system
191//
192 OssEroute.logger(lp);
193
194// Initialize the subsystems
195//
196 XrdOssSS = this;
197 if ( (retc = Configure(configfn, OssEroute, envP)) ) return retc;
198
199// All done.
200//
201 return XrdOssOK;
202}
203
204/******************************************************************************/
205/* L f n 2 P f n */
206/******************************************************************************/
207
208int XrdOssSys::Lfn2Pfn(const char *oldp, char *newp, int blen)
209{
210 if (lcl_N2N) return -(lcl_N2N->lfn2pfn(oldp, newp, blen));
211 if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
212 strcpy(newp, oldp);
213 return 0;
214}
215
216const char *XrdOssSys::Lfn2Pfn(const char *oldp, char *newp, int blen, int &rc)
217{
218 if (!lcl_N2N) {rc = 0; return oldp;}
219 if ((rc = -(lcl_N2N->lfn2pfn(oldp, newp, blen)))) return 0;
220 return newp;
221}
222
223/******************************************************************************/
224/* G e n L o c a l P a t h */
225/******************************************************************************/
226
227/* GenLocalPath() generates the path that a file will have in the local file
228 system. The decision is made based on the user-given path (typically what
229 the user thinks is the local file system path). The output buffer where the
230 new path is placed must be at least MAXPATHLEN bytes long.
231*/
232int XrdOssSys::GenLocalPath(const char *oldp, char *newp)
233{
234 if (lcl_N2N) return -(lcl_N2N->lfn2pfn(oldp, newp, MAXPATHLEN));
235 if (strlen(oldp) >= MAXPATHLEN) return -ENAMETOOLONG;
236 strcpy(newp, oldp);
237 return 0;
238}
239
240/******************************************************************************/
241/* G e n R e m o t e P a t h */
242/******************************************************************************/
243
244/* GenRemotePath() generates the path that a file will have in the remote file
245 system. The decision is made based on the user-given path (typically what
246 the user thinks is the local file system path). The output buffer where the
247 new path is placed must be at least MAXPATHLEN bytes long.
248*/
249int XrdOssSys::GenRemotePath(const char *oldp, char *newp)
250{
251 if (rmt_N2N) return -(rmt_N2N->lfn2rfn(oldp, newp, MAXPATHLEN));
252 if (strlen(oldp) >= MAXPATHLEN) return -ENAMETOOLONG;
253 strcpy(newp, oldp);
254 return 0;
255}
256
257/******************************************************************************/
258/* C h m o d */
259/******************************************************************************/
260/*
261 Function: Change file mode.
262
263 Input: path - Is the fully qualified name of the target file.
264 mode - The new mode that the file is to have.
265 envP - Environmental information.
266
267 Output: Returns XrdOssOK upon success and -errno upon failure.
268
269 Notes: Files are only changed in the local disk cache.
270*/
271
272int XrdOssSys::Chmod(const char *path, mode_t mode, XrdOucEnv *envP)
273{
274 char actual_path[MAXPATHLEN+1], *local_path;
275 int retc;
276
277// Generate local path
278//
279 if (lcl_N2N)
280 if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
281 return retc;
282 else local_path = actual_path;
283 else local_path = (char *)path;
284
285// Change the file only in the local filesystem.
286//
287 return (chmod(local_path, mode) ? -errno : XrdOssOK);
288}
289
290/******************************************************************************/
291/* M k d i r */
292/******************************************************************************/
293/*
294 Function: Create a directory
295
296 Input: path - Is the fully qualified name of the new directory.
297 mode - The new mode that the directory is to have.
298 mkpath - If true, makes the full path.
299 envP - Environmental information.
300
301 Output: Returns XrdOssOK upon success and -errno upon failure.
302
303 Notes: Directories are only created in the local disk cache.
304*/
305
306int XrdOssSys::Mkdir(const char *path, mode_t mode, int mkpath, XrdOucEnv *envP)
307{
308 char actual_path[MAXPATHLEN+1], *local_path;
309 int retc;
310
311// Make sure we can modify this path
312//
313 Check_RW(Mkdir, path, "create directory");
314
315// Generate local path
316//
317 if (lcl_N2N)
318 if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
319 return retc;
320 else local_path = actual_path;
321 else local_path = (char *)path;
322
323// Create the directory or full path only in the loal file system
324//
325 if (!mkdir(local_path, mode)) return XrdOssOK;
326 if (mkpath && errno == ENOENT){return Mkpath(local_path, mode);}
327 if (errno != EEXIST) return -errno;
328
329// Check if this is a duplicate request
330//
331 struct stat Stat;
332 static const mode_t accBits = (S_IRWXU|S_IRWXG|S_IRWXO);
333
334 if (!stat(local_path, &Stat) && S_ISDIR(Stat.st_mode)
335 && mode == (Stat.st_mode & accBits)) return XrdOssOK;
336 return -EEXIST;
337}
338
339/******************************************************************************/
340/* M k p a t h */
341/******************************************************************************/
342/*
343 Function: Create a directory path
344
345 Input: path - Is the fully qualified *local* name of the new path.
346 mode - The new mode that each new directory is to have.
347
348 Output: Returns XrdOssOK upon success and -errno upon failure.
349
350 Notes: Directories are only created in the local disk cache.
351*/
352
353int XrdOssSys::Mkpath(const char *path, mode_t mode)
354{
355 char local_path[MAXPATHLEN+1], *next_path;
356 int i = strlen(path);
357
358// Copy the path so we can modify it
359//
360 strcpy(local_path, path);
361
362// Trim off the trailing slashes so we can have predictable behaviour
363//
364 while(i && local_path[--i] == '/') local_path[i] = '\0';
365 if (!i) return -ENOENT;
366
367// Start creating directories starting with the root
368//
369 next_path = local_path;
370 while((next_path = index(next_path+1, int('/'))))
371 {*next_path = '\0';
372 if (mkdir(local_path, mode) && errno != EEXIST) return -errno;
373 *next_path = '/';
374 }
375
376// Create last component and return
377//
378 if (mkdir(local_path, mode) && errno != EEXIST) return -errno;
379 return XrdOssOK;
380}
381
382
383/******************************************************************************/
384/* S t a t s */
385/******************************************************************************/
386
387/*
388 Function: Return statistics.
389
390 Input: buff - Buffer where the statistics are to be placed.
391 blen - The length of the buffer.
392
393 Output: Returns number of bytes placed in the buffer less null byte.
394*/
395
396int XrdOssSys::Stats(char *buff, int blen)
397{
398 static const char statfmt1[] = "<stats id=\"oss\" v=\"2\">";
399 static const char statfmt2[] = "</stats>";
400 static const int statflen = sizeof(statfmt1) + sizeof(statfmt2);
401 char *bp = buff;
402 int n;
403
404// If only size wanted, return what size we need
405//
406 if (!buff) return statflen + getStats(0,0);
407
408// Make sure we have enough space
409//
410 if (blen < statflen) return 0;
411 strcpy(bp, statfmt1);
412 bp += sizeof(statfmt1)-1; blen -= sizeof(statfmt1)-1;
413
414// Generate space statistics
415//
416 n = getStats(bp, blen);
417 bp += n; blen -= n;
418
419// Add trailer
420//
421 if (blen >= (int)sizeof(statfmt2))
422 {strcpy(bp, statfmt2); bp += (sizeof(statfmt2)-1);}
423 return bp - buff;
424}
425
426/******************************************************************************/
427/* T r u n c a t e */
428/******************************************************************************/
429
430/*
431 Function: Truncate a file.
432
433 Input: path - Is the fully qualified name of the target file.
434 size - The new size that the file is to have.
435 envP - Environmental information.
436
437 Output: Returns XrdOssOK upon success and -errno upon failure.
438
439 Notes: Files are only changed in the local disk cache.
440*/
441
442int XrdOssSys::Truncate(const char *path, unsigned long long size,
443 XrdOucEnv *envP)
444{
445 struct stat statbuff;
446 char actual_path[MAXPATHLEN+1], *local_path;
447 long long oldsz;
448 int retc;
449
450// Make sure we can modify this path
451//
452 Check_RW(Truncate, path, "truncate");
453
454// Generate local path
455//
456 if (lcl_N2N)
457 if ((retc = lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
458 return retc;
459 else local_path = actual_path;
460 else local_path = (char *)path;
461
462// Get file info to do the correct adjustment
463//
464 if (lstat(local_path, &statbuff)) return -errno;
465 else if ((statbuff.st_mode & S_IFMT) == S_IFDIR) return -EISDIR;
466 else if ((statbuff.st_mode & S_IFMT) == S_IFLNK)
467 {struct stat buff;
468 if (stat(local_path, &buff)) return -errno;
469 oldsz = buff.st_size;
470 } else oldsz = statbuff.st_size;
471
472// Change the file only in the local filesystem and make space adjustemt
473//
474 if (truncate(local_path, size)) return -errno;
475 XrdOssCache::Adjust(local_path,static_cast<long long>(size)-oldsz,&statbuff);
476 return XrdOssOK;
477}
478
479/******************************************************************************/
480/* P r i v a t e M e t h o d s */
481/******************************************************************************/
482/******************************************************************************/
483/* o o s s _ D i r M e t h o d s */
484/******************************************************************************/
485/******************************************************************************/
486/* o p e n d i r */
487/******************************************************************************/
488
489/*
490 Function: Open the directory `path' and prepare for reading.
491
492 Input: path - The fully qualified name of the directory to open.
493 env - Environmental information.
494
495 Output: Returns XrdOssOK upon success; (-errno) otherwise.
496*/
497int XrdOssDir::Opendir(const char *dir_path, XrdOucEnv &Env)
498{
499 EPNAME("Opendir");
500 char actual_path[MAXPATHLEN+1], *local_path, *remote_path;
501 int retc;
502
503// Return an error if this object is already open
504//
505 if (isopen) return -XRDOSS_E8001;
506
507// Get the processing flags for this directory
508//
509 unsigned long long pflags = XrdOssSS->PathOpts(dir_path);
510 if (pflags & XRDEXP_STAGE) dOpts |= isStage;
511 if (pflags & XRDEXP_NODREAD) dOpts |= noDread;
512 if (pflags & XRDEXP_NOCHECK) dOpts |= noCheck;
513 ateof = false;
514
515// Generate local path
516//
517 if (XrdOssSS->lcl_N2N)
518 if ((retc = XrdOssSS->lcl_N2N->lfn2pfn(dir_path, actual_path, sizeof(actual_path))))
519 return retc;
520 else local_path = actual_path;
521 else local_path = (char *)dir_path;
522
523// If this is a local filesystem request, open locally. We also obtian the
524// underlying file descriptor.
525//
526 if (!(dOpts & isStage) || (dOpts & noDread))
527 {TRACE(Opendir, "lcl path " <<local_path <<" (" <<dir_path <<")");
528 if (!(lclfd = XrdSysFD_OpenDir(local_path))) return -errno;
529 fd = dirfd(lclfd);
530 isopen = true;
531 return XrdOssOK;
532 }
533
534// Generate remote path
535//
536 if (XrdOssSS->rmt_N2N)
537 if ((retc = XrdOssSS->rmt_N2N->lfn2rfn(dir_path, actual_path, sizeof(actual_path))))
538 return retc;
539 else remote_path = actual_path;
540 else remote_path = (char *)dir_path;
541
542 TRACE(Opendir, "rmt path " << remote_path <<" (" << dir_path <<")");
543
544// Originally, if MSS directories were not to be read, we ould simply check
545// if the path was a directory and return an error if not. That was superceeded
546// by making NODREAD mean to read the local directory only (which is not always
547// ideal). So, we keep the code below but comment it out for now.
548//
549// if ((dOpts & noDread) && !(dOpts & noCheck))
550// {struct stat fstat;
551// if ((retc = XrdOssSS->MSS_Stat(remote_path,&fstat))) return retc;
552// if (!(S_ISDIR(fstat.st_mode))) return -ENOTDIR;
553// isopen = true;
554// return XrdOssOK;
555// }
556
557// Open the directory at the remote location.
558//
559 if (!(mssfd = XrdOssSS->MSS_Opendir(remote_path, retc))) return retc;
560 isopen = true;
561 return XrdOssOK;
562}
563
564/******************************************************************************/
565/* r e a d d i r */
566/******************************************************************************/
567
568/*
569 Function: Read the next entry if directory associated with this object.
570
571 Input: buff - Is the address of the buffer that is to hold the next
572 directory name.
573 blen - Size of the buffer.
574
575 Output: Upon success, places the contents of the next directory entry
576 in buff. When the end of the directory is encountered buff
577 will be set to the null string.
578
579 Upon failure, returns a (-errno).
580
581 Warning: The caller must provide proper serialization.
582*/
583int XrdOssDir::Readdir(char *buff, int blen)
584{
585 struct dirent *rp;
586
587// Check if this object is actually open
588//
589 if (!isopen) return -XRDOSS_E8002;
590
591// Perform local reads if this is a local directory
592//
593 if (lclfd)
594 {errno = 0;
595 while((rp = readdir(lclfd)))
596 {strlcpy(buff, rp->d_name, blen);
597#ifdef HAVE_FSTATAT
598 if (Stat && fstatat(fd, rp->d_name, Stat, 0))
599 {if (errno != ENOENT) return -errno;
600 errno = 0;
601 continue;
602 }
603#endif
604 return XrdOssOK;
605 }
606 *buff = '\0'; ateof = true;
607 return -errno;
608 }
609
610// Simulate the read operation, if need be.
611//
612 if (dOpts & noDread)
613 {if (ateof) *buff = '\0';
614 else {*buff = '.'; ateof = true;}
615 return XrdOssOK;
616 }
617
618// Perform a remote read
619//
620 return XrdOssSS->MSS_Readdir(mssfd, buff, blen);
621}
622
623/******************************************************************************/
624/* S t a t R e t */
625/******************************************************************************/
626/*
627 Function: Set stat buffer pointerto automatically stat returned entries.
628
629 Input: buff - Pointer to the stat buffer.
630
631 Output: Upon success, return 0.
632
633 Upon failure, returns a (-errno).
634
635 Warning: The caller must provide proper serialization.
636*/
637int XrdOssDir::StatRet(struct stat *buff)
638{
639
640// Check if this object is actually open
641//
642 if (!isopen) return -XRDOSS_E8002;
643
644// We only support autostat for local directories
645//
646 if (!lclfd) return -ENOTSUP;
647
648// We do not support autostat unless we have the fstatat function
649//
650#ifndef HAVE_FSTATAT
651 return -ENOTSUP;
652#endif
653
654// All is well
655//
656 Stat = buff;
657 return 0;
658}
659
660/******************************************************************************/
661/* C l o s e */
662/******************************************************************************/
663
664/*
665 Function: Close the directory associated with this object.
666
667 Input: None.
668
669 Output: Returns XrdOssOK upon success and (errno) upon failure.
670*/
671int XrdOssDir::Close(long long *retsz)
672{
673 int retc;
674
675// We do not support returing a size
676//
677 if (retsz) *retsz = 0;
678
679// Make sure this object is open
680//
681 if (!isopen) return -XRDOSS_E8002;
682
683// Close whichever handle is open
684//
685 if (lclfd)
686 {if (!(retc = closedir(lclfd)))
687 {lclfd = 0;
688 isopen = false;
689 }
690 } else {
691 if (mssfd) { if (!(retc = XrdOssSS->MSS_Closedir(mssfd))) mssfd = 0;}
692 else retc = 0;
693 }
694
695// Indicate whether or not we really closed this object
696//
697 return retc;
698}
699
700/******************************************************************************/
701/* o o s s _ F i l e M e t h o d s */
702/******************************************************************************/
703
704/******************************************************************************/
705/* o p e n */
706/******************************************************************************/
707
708/*
709 Function: Open the file `path' in the mode indicated by `Mode'.
710
711 Input: path - The fully qualified name of the file to open.
712 Oflag - Standard open flags.
713 Mode - Create mode (i.e., rwx).
714 env - Environmental information.
715
716 Output: XrdOssOK upon success; -errno otherwise.
717*/
718int XrdOssFile::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &Env)
719{
720 unsigned long long popts;
721 int retc, mopts;
722 char actual_path[MAXPATHLEN+1], *local_path;
723 struct stat buf;
724
725// Return an error if this object is already open
726//
727 if (fd >= 0) return -XRDOSS_E8003;
728 else cxobj = 0;
729
730// Construct the processing options for this path.
731//
732 popts = XrdOssSS->PathOpts(path);
733 if (popts & XRDEXP_STAGE && Env.Get("oss.lcl")) popts &= ~XRDEXP_STAGE;
734
735// Generate local path
736//
737 if (XrdOssSS->lcl_N2N)
738 if ((retc = XrdOssSS->lcl_N2N->lfn2pfn(path, actual_path, sizeof(actual_path))))
739 return retc;
740 else local_path = actual_path;
741 else local_path = (char *)path;
742
743// Check if this is a read/only filesystem
744//
745 if ((Oflag & (O_WRONLY | O_RDWR)) && (popts & XRDEXP_NOTRW))
746 {if (popts & XRDEXP_FORCERO) Oflag = O_RDONLY;
747 else return OssEroute.Emsg("Open",-XRDOSS_E8005,"open r/w",path);
748 }
749
750// If we can open the local copy. If not found, try to stage it in if possible.
751// Note that stage will regenerate the right local and remote paths.
752//
753 if ( (fd = (int)Open_ufs(local_path, Oflag, Mode, popts)) == -ENOENT
754 && (popts & XRDEXP_REMOTE))
755 {if (!(popts & XRDEXP_STAGE))
756 return OssEroute.Emsg("Open",-XRDOSS_E8006,"open",path);
757 if ((retc = XrdOssSS->Stage(tident, path, Env, Oflag, Mode, popts)))
758 return retc;
759 fd = (int)Open_ufs(local_path, Oflag, Mode, popts & ~XRDEXP_REMOTE);
760 }
761
762// This interface supports only regular files. Complain if this is not one.
763//
764 if (fd >= 0)
765 {do {retc = fstat(fd, &buf);} while(retc && errno == EINTR);
766 if (!retc && !(buf.st_mode & S_IFREG))
767 {close(fd); fd = (buf.st_mode & S_IFDIR ? -EISDIR : -ENOTBLK);}
768 if (Oflag & (O_WRONLY | O_RDWR))
769 {FSize = buf.st_size; cacheP = XrdOssCache::Find(local_path);}
770 else {if (buf.st_mode & XRDSFS_POSCPEND && fd >= 0)
771 {close(fd); fd=-ETXTBSY;}
772 FSize = -1; cacheP = 0;
773 }
774 } else if (fd == -EEXIST)
775 {do {retc = stat(local_path,&buf);} while(retc && errno==EINTR);
776 if (!retc && (buf.st_mode & S_IFDIR)) fd = -EISDIR;
777 }
778
779// See if should memory map this file. For now, extended attributes are only
780// needed when memory mapping is enabled and can apply only to specific files.
781// So, we read them here should we need them.
782//
783 if (fd >= 0 && XrdOssSS->tryMmap)
785 mopts = 0;
786 if (!(popts & XRDEXP_NOXATTR) && XrdOssSS->chkMmap)
787 Info.Get(local_path, fd);
788 if (popts & XRDEXP_MKEEP || Info.Attr.Flags & XrdFrcXAttrMem::memKeep)
789 mopts |= OSSMIO_MPRM;
790 if (popts & XRDEXP_MLOK || Info.Attr.Flags & XrdFrcXAttrMem::memLock)
791 mopts |= OSSMIO_MLOK;
792 if (popts & XRDEXP_MMAP || Info.Attr.Flags & XrdFrcXAttrMem::memMap)
793 mopts |= OSSMIO_MMAP;
794 if (mopts) mmFile = XrdOssMio::Map(local_path, fd, mopts);
795 } else mmFile = 0;
796
797// Return the result of this open
798//
799 return (fd < 0 ? fd : XrdOssOK);
800}
801
802/******************************************************************************/
803/* c l o s e */
804/******************************************************************************/
805
806/*
807 Function: Close the file associated with this object.
808
809 Input: None.
810
811 Output: Returns XrdOssOK upon success and -1 upon failure.
812*/
813int XrdOssFile::Close(long long *retsz)
814{
815 if (fd < 0) return -XRDOSS_E8004;
816 if (retsz || cacheP)
817 {struct stat buf;
818 int retc;
819 do {retc = fstat(fd, &buf);} while(retc && errno == EINTR);
820 if (cacheP && FSize != buf.st_size)
821 XrdOssCache::Adjust(cacheP, buf.st_size - FSize);
822 if (retsz) *retsz = buf.st_size;
823 }
824 if (close(fd)) return -errno;
825 if (mmFile) {XrdOssMio::Recycle(mmFile); mmFile = 0;}
826#ifdef XRDOSSCX
827 if (cxobj) {delete cxobj; cxobj = 0;}
828#endif
829 fd = -1; FSize = -1; cacheP = 0;
830 return XrdOssOK;
831}
832
833/******************************************************************************/
834/* r e a d */
835/******************************************************************************/
836
837/*
838 Function: Preread `blen' bytes from the associated file.
839
840 Input: offset - The absolute 64-bit byte offset at which to read.
841 blen - The size to preread.
842
843 Output: Returns zero read upon success and -errno upon failure.
844*/
845
846ssize_t XrdOssFile::Read(off_t offset, size_t blen)
847{
848
849 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
850
851#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
852 posix_fadvise(fd, offset, blen, POSIX_FADV_WILLNEED);
853#endif
854
855 return 0; // We haven't implemented this yet!
856}
857
858
859/******************************************************************************/
860/* r e a d */
861/******************************************************************************/
862
863/*
864 Function: Read `blen' bytes from the associated file, placing in 'buff'
865 the data and returning the actual number of bytes read.
866
867 Input: buff - Address of the buffer in which to place the data.
868 offset - The absolute 64-bit byte offset at which to read.
869 blen - The size of the buffer. This is the maximum number
870 of bytes that will be read.
871
872 Output: Returns the number bytes read upon success and -errno upon failure.
873*/
874
875ssize_t XrdOssFile::Read(void *buff, off_t offset, size_t blen)
876{
877 ssize_t retval;
878
879 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
880
881#ifdef XRDOSSCX
882 if (cxobj)
883 if (XrdOssSS->DirFlags & XrdOssNOSSDEC) return (ssize_t)-XRDOSS_E8021;
884 else retval = cxobj->Read((char *)buff, blen, offset);
885 else
886#endif
887 do { retval = pread(fd, buff, blen, offset); }
888 while(retval < 0 && errno == EINTR);
889
890 return (retval >= 0 ? retval : (ssize_t)-errno);
891}
892
893/******************************************************************************/
894/* r e a d v */
895/******************************************************************************/
896
897/*
898 Function: Perform all the reads specified in the readV vector.
899
900 Input: readV - A description of the reads to perform; includes the
901 absolute offset, the size of the read, and the buffer
902 to place the data into.
903 readCount - The size of the readV vector.
904
905 Output: Returns the number of bytes read upon success and SFS_ERROR o/w.
906 If the number of bytes read is less than requested, it is considered
907 an error.
908*/
909
910ssize_t XrdOssFile::ReadV(XrdOucIOVec *readV, int n)
911{
912 ssize_t rdsz, totBytes = 0;
913 int i;
914
915// For platforms that support fadvise, pre-advise what we will be reading
916//
917#if (defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))) && defined(HAVE_ATOMICS)
918 EPNAME("ReadV");
919 long long begOff, endOff, begLst = -1, endLst = -1;
920 int nPR = n;
921
922// Indicate we are in preread state and see if we have exceeded the limit
923//
924 if (XrdOssSS->prDepth
925 && AtomicInc((XrdOssSS->prActive)) < XrdOssSS->prQSize && n > 2)
926 {int faBytes = 0;
927 for (nPR=0;nPR < XrdOssSS->prDepth && faBytes < XrdOssSS->prBytes;nPR++)
928 if (readV[nPR].size > 0)
929 {begOff = XrdOssSS->prPMask & readV[nPR].offset;
930 endOff = XrdOssSS->prPBits | (readV[nPR].offset+readV[nPR].size);
931 rdsz = endOff - begOff + 1;
932 if ((begOff > endLst || endOff < begLst)
933 && rdsz < XrdOssSS->prBytes)
934 {posix_fadvise(fd, begOff, rdsz, POSIX_FADV_WILLNEED);
935 TRACE(Debug,"fadvise(" <<fd <<',' <<begOff <<',' <<rdsz <<')');
936 faBytes += rdsz;
937 }
938 begLst = begOff; endLst = endOff;
939 }
940 }
941#endif
942
943// Read in the vector and do a pre-advise if we support that
944//
945 for (i = 0; i < n; i++)
946 {do {rdsz = pread(fd, readV[i].data, readV[i].size, readV[i].offset);}
947 while(rdsz < 0 && errno == EINTR);
948 if (rdsz < 0 || rdsz != readV[i].size)
949 {totBytes = (rdsz < 0 ? -errno : -ESPIPE); break;}
950 totBytes += rdsz;
951#if (defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))) && defined(HAVE_ATOMICS)
952 if (nPR < n && readV[nPR].size > 0)
953 {begOff = XrdOssSS->prPMask & readV[nPR].offset;
954 endOff = XrdOssSS->prPBits | (readV[nPR].offset+readV[nPR].size);
955 rdsz = endOff - begOff + 1;
956 if ((begOff > endLst || endOff < begLst)
957 && rdsz <= XrdOssSS->prBytes)
958 {posix_fadvise(fd, begOff, rdsz, POSIX_FADV_WILLNEED);
959 TRACE(Debug,"fadvise(" <<fd <<',' <<begOff <<',' <<rdsz <<')');
960 }
961 begLst = begOff; endLst = endOff;
962 }
963 nPR++;
964#endif
965 }
966
967// All done, return bytes read.
968//
969#if (defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))) && defined(HAVE_ATOMICS)
971#endif
972 return totBytes;
973}
974
975/******************************************************************************/
976/* R e a d R a w */
977/******************************************************************************/
978
979/*
980 Function: Read `blen' bytes from the associated file, placing in 'buff'
981 the data and returning the actual number of bytes read.
982
983 Input: buff - Address of the buffer in which to place the data.
984 offset - The absolute 64-bit byte offset at which to read.
985 blen - The size of the buffer. This is the maximum number
986 of bytes that will be read.
987
988 Output: Returns the number bytes read upon success and -errno upon failure.
989*/
990
991ssize_t XrdOssFile::ReadRaw(void *buff, off_t offset, size_t blen)
992{
993 ssize_t retval;
994
995 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
996
997#ifdef XRDOSSCX
998 if (cxobj) retval = cxobj->ReadRaw((char *)buff, blen, offset);
999 else
1000#endif
1001 do { retval = pread(fd, buff, blen, offset); }
1002 while(retval < 0 && errno == EINTR);
1003
1004 return (retval >= 0 ? retval : (ssize_t)-errno);
1005}
1006
1007/******************************************************************************/
1008/* w r i t e */
1009/******************************************************************************/
1010
1011/*
1012 Function: Write `blen' bytes to the associated file, from 'buff'
1013 and return the actual number of bytes written.
1014
1015 Input: buff - Address of the buffer from which to get the data.
1016 offset - The absolute 64-bit byte offset at which to write.
1017 blen - The number of bytes to write from the buffer.
1018
1019 Output: Returns the number of bytes written upon success and -errno o/w.
1020*/
1021
1022ssize_t XrdOssFile::Write(const void *buff, off_t offset, size_t blen)
1023{
1024 ssize_t retval;
1025
1026 if (fd < 0) return (ssize_t)-XRDOSS_E8004;
1027
1028 if (XrdOssSS->MaxSize && (long long)(offset+blen) > XrdOssSS->MaxSize)
1029 return (ssize_t)-XRDOSS_E8007;
1030
1031 do { retval = pwrite(fd, buff, blen, offset); }
1032 while(retval < 0 && errno == EINTR);
1033
1034 if (retval < 0) retval = (retval == EBADF && cxobj ? -XRDOSS_E8022 : -errno);
1035 return retval;
1036}
1037
1038/******************************************************************************/
1039/* F c h m o d */
1040/******************************************************************************/
1041
1042/*
1043 Function: Sets mode bits for an open file.
1044
1045 Input: Mode - The mode to set.
1046
1047 Output: Returns XrdOssOK upon success and -errno upon failure.
1048*/
1049
1051{
1052 return (fchmod(fd, Mode) ? -errno : XrdOssOK);
1053}
1054
1055/******************************************************************************/
1056/* F c t l */
1057/******************************************************************************/
1058/*
1059 Function: Perform control operations on a file.
1060
1061 Input: cmd - The command.
1062 alen - length of arguments.
1063 args - Pointer to arguments.
1064 resp - Pointer to where response should be placed.
1065
1066 Output: Returns XrdOssOK upon success and -errno upon failure.
1067*/
1068
1069int XrdOssFile::Fctl(int cmd, int alen, const char *args, char **resp)
1070{
1071 const struct timeval *utArgs;
1072
1073 switch(cmd)
1075 if (alen != sizeof(struct timeval)*2 || !args) return -EINVAL;
1076 utArgs = (const struct timeval *)args;
1077 if (futimes(fd, utArgs)) return -errno;
1078 return XrdOssOK;
1079 break;
1080 default: break;
1081 }
1082 return -ENOTSUP;
1083}
1084
1085/******************************************************************************/
1086/* F l u s h */
1087/******************************************************************************/
1088
1089/*
1090 Function: Flush file pages from the filesyste cache.
1091
1092 Output: Returns XrdOssOK upon success and -errno upon failure.
1093*/
1094
1096{
1097// This actually only works in Linux so we punt otherwise
1098//
1099#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
1100 if (fd>= 0)
1101 {fdatasync(fd);
1102 posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
1103 }
1104#endif
1105}
1106
1107/******************************************************************************/
1108/* F s t a t */
1109/******************************************************************************/
1110
1111/*
1112 Function: Return file status for the associated file.
1113
1114 Input: buff - Pointer to buffer to hold file status.
1115
1116 Output: Returns XrdOssOK upon success and -errno upon failure.
1117*/
1118
1119int XrdOssFile::Fstat(struct stat *buff)
1120{
1121 return (fstat(fd, buff) ? -errno : XrdOssOK);
1122}
1123
1124/******************************************************************************/
1125/* F s y n c */
1126/******************************************************************************/
1127
1128/*
1129 Function: Synchronize associated file.
1130
1131 Input: None.
1132
1133 Output: Returns XrdOssOK upon success and -errno upon failure.
1134*/
1136{
1137 return (fsync(fd) ? -errno : XrdOssOK);
1138}
1139
1140/******************************************************************************/
1141/* g e t M m a p */
1142/******************************************************************************/
1143
1144/*
1145 Function: Indicate whether or not file is memory mapped.
1146
1147 Input: addr - Points to an address which will receive the location
1148 memory where the file is mapped. If the address is
1149 null, true is returned if a mapping exist.
1150
1151 Output: Returns the size of the file if it is memory mapped (see above).
1152 Otherwise, zero is returned and addr is set to zero.
1153*/
1154off_t XrdOssFile::getMmap(void **addr)
1155{
1156 if (mmFile) return (addr ? mmFile->Export(addr) : 1);
1157 if (addr) *addr = 0;
1158 return 0;
1159}
1160
1161/******************************************************************************/
1162/* i s C o m p r e s s e d */
1163/******************************************************************************/
1164
1165/*
1166 Function: Indicate whether or not file is compressed.
1167
1168 Input: cxidp - Points to a four byte buffer to hold the compression
1169 algorithm used if the file is compressed or null.
1170
1171 Output: Returns the regios size which is 0 if the file is not compressed.
1172 If cxidp is not null, the algorithm is returned only if the file
1173 is compressed.
1174*/
1176{
1177 if (cxpgsz)
1178 {cxidp[0] = cxid[0]; cxidp[1] = cxid[1];
1179 cxidp[2] = cxid[2]; cxidp[3] = cxid[3];
1180 }
1181 return cxpgsz;
1182}
1183
1184/******************************************************************************/
1185/* t r u n c a t e */
1186/******************************************************************************/
1187
1188/*
1189 Function: Set the length of associated file to 'flen'.
1190
1191 Input: flen - The new size of the file. Only 32-bit lengths
1192 are supported.
1193
1194 Output: Returns XrdOssOK upon success and -1 upon failure.
1195
1196 Notes: If 'flen' is smaller than the current size of the file, the file
1197 is made smaller and the data past 'flen' is discarded. If 'flen'
1198 is larger than the current size of the file, a hole is created
1199 (i.e., the file is logically extended by filling the extra bytes
1200 with zeroes).
1201
1202 If compiled w/o large file support, only lower 32 bits are used.
1203 used.
1204 in supporting it for any other system.
1205*/
1206int XrdOssFile::Ftruncate(unsigned long long flen) {
1207 off_t newlen = flen;
1208
1209 if (sizeof(newlen) < sizeof(flen) && (flen>>31)) return -XRDOSS_E8008;
1210
1211// Note that space adjustment will occur when the file is closed, not here
1212//
1213 return (ftruncate(fd, newlen) ? -errno : XrdOssOK);
1214 }
1215
1216/******************************************************************************/
1217/* P R I V A T E S E C T I O N */
1218/******************************************************************************/
1219/******************************************************************************/
1220/* o o s s _ O p e n _ u f s */
1221/******************************************************************************/
1222
1223int XrdOssFile::Open_ufs(const char *path, int Oflag, int Mode,
1224 unsigned long long popts)
1225{
1226 EPNAME("Open_ufs")
1227 static const int isWritable = O_WRONLY|O_RDWR;
1228 int myfd, newfd;
1229#ifndef NODEBUG
1230 char *ftype = (char *)" path=";
1231#endif
1232#ifdef XRDOSSCX
1233 int attcx = 0;
1234#endif
1235
1236// If we need to do a stat() prior to the open, do so now
1237//
1238 if (XrdOssSS->STT_PreOp)
1239 {struct stat Stat;
1240 if ((*(XrdOssSS->STT_Func))(path, &Stat, XRDOSS_preop, 0)) return -errno;
1241 }
1242
1243// Now open the actual data file in the appropriate mode.
1244//
1245 do { myfd = XrdSysFD_Open(path, Oflag|O_LARGEFILE, Mode);}
1246 while( myfd < 0 && errno == EINTR);
1247
1248// If the file is marked purgeable or migratable and we may modify this file,
1249// then get a shared lock on the file to keep it from being migrated or purged
1250// while it is open. This is advisory so we can ignore any errors.
1251//
1252 if (myfd >= 0
1253 && (popts & XRDEXP_PURGE || (popts & XRDEXP_MIG && Oflag & isWritable)))
1254 {FLOCK_t lock_args;
1255 bzero(&lock_args, sizeof(lock_args));
1256 lock_args.l_type = F_RDLCK;
1257 fcntl(myfd, F_SETLKW, &lock_args);
1258 }
1259
1260// Chck if file is compressed
1261//
1262 if (myfd < 0) myfd = -errno;
1263#ifdef XRDOSSCX
1264 else if ((popts & XRDEXP_COMPCHK)
1265 && oocx_CXFile::isCompressed(myfd, cxid, &cxpgsz))
1266 if (Oflag != O_RDONLY) {close(myfd); return -XRDOSS_E8022;}
1267 else attcx = 1;
1268#endif
1269
1270// Relocate the file descriptor if need be and make sure file is closed on exec
1271//
1272 if (myfd >= 0)
1273 {if (myfd < XrdOssSS->FDFence)
1274 {if ((newfd = XrdSysFD_Dup1(myfd, XrdOssSS->FDFence)) < 0)
1275 OssEroute.Emsg("Open_ufs",errno,"reloc FD",path);
1276 else {close(myfd); myfd = newfd;}
1277 }
1278#ifdef XRDOSSCX
1279 // If the file is compressed get a CXFile object and attach the FD to it
1280 //
1281 if (attcx) {cxobj = new oocx_CXFile;
1282 ftype = (char *)" CXpath=";
1283 if ((retc = cxobj->Attach(myfd, path)) < 0)
1284 {close(myfd); myfd = retc; delete cxobj; cxobj = 0;}
1285 }
1286#endif
1287 }
1288
1289// Trace the action.
1290//
1291 TRACE(Open, "fd=" <<myfd <<" flags=" <<Xrd::hex1 <<Oflag <<" mode="
1292 <<Xrd::oct1 <<Mode <<ftype <<path);
1293
1294// All done
1295//
1296 return myfd;
1297}
#define EPNAME(x)
struct stat Stat
Definition XrdCks.cc:49
static XrdSysLogger Logger
XrdSysError OssEroute
XrdSysError OssEroute(0, "oss_")
XrdSysTrace OssTrace("oss")
XrdOss * XrdOssGetSS(XrdSysLogger *Logger, const char *config_fn, const char *OssLib, const char *OssParms, XrdOucEnv *envP, XrdVersionInfo &urVer)
Definition XrdOssApi.cc:98
XrdOss * XrdOssDefaultSS(XrdSysLogger *logger, const char *cfg_fn, XrdVersionInfo &urVer)
Definition XrdOssApi.cc:165
XrdOssSys * XrdOssSS
Definition XrdOssApi.cc:77
#define Check_RW(act, path, opname)
Definition XrdOssApi.hh:392
#define XRDOSS_E8002
#define XRDOSS_E8006
#define XRDOSS_E8007
#define XRDOSS_E8003
#define XRDOSS_E8004
#define XRDOSS_E8022
#define XRDOSS_E8008
#define XRDOSS_E8021
#define XRDOSS_E8001
#define XRDOSS_E8005
#define OSSMIO_MMAP
Definition XrdOssMio.hh:41
#define OSSMIO_MLOK
Definition XrdOssMio.hh:40
#define OSSMIO_MPRM
Definition XrdOssMio.hh:42
XrdOss *(* XrdOssGetStorageSystem2_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
Definition XrdOss.hh:939
#define XrdOssOK
Definition XrdOss.hh:50
XrdOss *(* XrdOssGetStorageSystem_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms)
The typedef that describes the XRdOssStatInfoInit external.
Definition XrdOss.hh:934
#define XRDOSS_preop
Definition XrdOss.hh:488
#define XRDEXP_NOTRW
#define XRDEXP_NODREAD
#define XRDEXP_PURGE
#define XRDEXP_MMAP
#define XRDEXP_MKEEP
#define XRDEXP_FORCERO
#define XRDEXP_REMOTE
#define XRDEXP_MLOK
#define XRDEXP_NOCHECK
#define XRDEXP_NOXATTR
#define XRDEXP_STAGE
#define XRDEXP_MIG
int lstat(const char *path, struct stat *buf)
int fcntl(int fd, int cmd,...)
int fdatasync(int fildes)
#define close(a)
Definition XrdPosix.hh:43
#define fsync(a)
Definition XrdPosix.hh:59
#define fstat(a, b)
Definition XrdPosix.hh:57
#define mkdir(a, b)
Definition XrdPosix.hh:69
#define closedir(a)
Definition XrdPosix.hh:45
#define stat(a, b)
Definition XrdPosix.hh:96
#define readdir(a)
Definition XrdPosix.hh:81
#define ftruncate(a, b)
Definition XrdPosix.hh:65
#define truncate(a, b)
Definition XrdPosix.hh:106
#define pwrite(a, b, c, d)
Definition XrdPosix.hh:102
#define pread(a, b, c, d)
Definition XrdPosix.hh:75
int Mode
bool Debug
#define XRDSFS_POSCPEND
#define AtomicInc(x)
#define AtomicDec(x)
#define dirfd(x)
size_t strlcpy(char *dst, const char *src, size_t sz)
#define FLOCK_t
#define TRACE(act, x)
Definition XrdTrace.hh:63
static const char memKeep
static const char memLock
static const char memMap
static XrdOssCache_FS * Find(const char *Path, int lklen=0)
static void Adjust(dev_t devid, off_t size)
const char * tident
Definition XrdOss.hh:453
int fd
Definition XrdOss.hh:455
static const int Fctl_utimes
Definition XrdOss.hh:416
int StatRet(struct stat *buff)
Definition XrdOssApi.cc:637
int Opendir(const char *, XrdOucEnv &)
Definition XrdOssApi.cc:497
int Readdir(char *buff, int blen)
Definition XrdOssApi.cc:583
int Close(long long *retsz=0)
Definition XrdOssApi.cc:671
virtual int Close(long long *retsz=0)
Definition XrdOssApi.cc:813
int Fchmod(mode_t mode)
int isCompressed(char *cxidp=0)
ssize_t Read(off_t, size_t)
Definition XrdOssApi.cc:846
int Fctl(int cmd, int alen, const char *args, char **resp=0)
virtual int Open(const char *, int, mode_t, XrdOucEnv &)
Definition XrdOssApi.cc:718
off_t getMmap(void **addr)
int Fstat(struct stat *)
void Flush()
Flush filesystem cached pages for this file (used for checksums).
ssize_t ReadV(XrdOucIOVec *readV, int)
Definition XrdOssApi.cc:910
int Ftruncate(unsigned long long)
ssize_t Write(const void *, off_t, size_t)
ssize_t ReadRaw(void *, off_t, size_t)
Definition XrdOssApi.cc:991
off_t Export(void **Addr)
static XrdOssMioFile * Map(char *path, int fd, int opts)
Definition XrdOssMio.cc:94
static void Recycle(XrdOssMioFile *mp)
Definition XrdOssMio.cc:294
int GenRemotePath(const char *, char *)
Definition XrdOssApi.cc:249
virtual int Stage(const char *, const char *, XrdOucEnv &, int, mode_t, unsigned long long)
int Configure(const char *, XrdSysError &, XrdOucEnv *envP)
int STT_PreOp
Definition XrdOssApi.hh:269
int MSS_Readdir(void *fd, char *buff, int blen)
Definition XrdOssMSS.cc:140
int Init(XrdSysLogger *, const char *, XrdOucEnv *envP)
Definition XrdOssApi.cc:186
int getStats(char *buff, int blen)
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0)
Definition XrdOssApi.cc:306
short prDepth
Definition XrdOssApi.hh:279
static char chkMmap
Definition XrdOssApi.hh:204
int MSS_Closedir(void *)
Definition XrdOssMSS.cc:185
short prQSize
Definition XrdOssApi.hh:280
long long MaxSize
Definition XrdOssApi.hh:241
unsigned long long PathOpts(const char *path)
Definition XrdOssApi.hh:177
int Mkpath(const char *, mode_t mode)
Definition XrdOssApi.cc:353
int GenLocalPath(const char *, char *)
Definition XrdOssApi.cc:232
XrdOucName2Name * lcl_N2N
Definition XrdOssApi.hh:254
long long prPMask
Definition XrdOssApi.hh:275
long long prPBits
Definition XrdOssApi.hh:274
static char tryMmap
Definition XrdOssApi.hh:203
int Lfn2Pfn(const char *Path, char *buff, int blen)
Definition XrdOssApi.cc:208
XrdVersionInfo * myVersion
Definition XrdOssApi.hh:282
unsigned long long DirFlags
Definition XrdOssApi.hh:244
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0)
Definition XrdOssApi.cc:272
int Stats(char *bp, int bl)
Definition XrdOssApi.cc:396
int Truncate(const char *, unsigned long long Size, XrdOucEnv *eP=0)
Definition XrdOssApi.cc:442
void * MSS_Opendir(const char *, int &rc)
Definition XrdOssMSS.cc:102
XrdOucName2Name * rmt_N2N
Definition XrdOssApi.hh:255
virtual void EnvInfo(XrdOucEnv *envP)
Definition XrdOss.cc:54
char * Get(const char *varname)
Definition XrdOucEnv.hh:69
void Put(const char *varname, const char *value)
Definition XrdOucEnv.hh:85
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0
virtual int lfn2rfn(const char *lfn, char *buff, int blen)=0
void * Resolve(const char *symbl, int mcnt=1)
const char * Path()
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
XrdSysLogger * logger(XrdSysLogger *lp=0)
static bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false)
void SetLogger(XrdSysLogger *logp)
long long offset