XRootD
XrdOfsFS.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d S f s G e t D e f a u l t F i l e S y s t e m */
4 /* */
5 /* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* All Rights Reserved */
7 /* Produced by Andrew Hanushevsky for Stanford University under contract */
8 /* DE-AC02-76-SFO0515 with the Department of Energy */
9 /* */
10 /* This file is part of the XRootD software suite. */
11 /* */
12 /* XRootD is free software: you can redistribute it and/or modify it under */
13 /* the terms of the GNU Lesser General Public License as published by the */
14 /* Free Software Foundation, either version 3 of the License, or (at your */
15 /* option) any later version. */
16 /* */
17 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20 /* License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25 /* */
26 /* The copyright holder's institutional names and contributor's names may not */
27 /* be used to endorse or promote products derived from this software without */
28 /* specific prior written permission of the institution or contributor. */
29 /******************************************************************************/
30 
31 #include "XrdOfs/XrdOfs.hh"
32 #include "XrdSys/XrdSysError.hh"
33 #include "XrdSys/XrdSysTrace.hh"
34 #include "XrdSys/XrdSysPthread.hh"
35 
36 // If you are replacing the standard definition of the file system interface,
37 // with a derived class to perform additional or enhanced functions, you MUST
38 // define XrdOfsFS to be an instance of your derived class definition. You
39 // would then create a shared library linking against libXrdOfs.a and manually
40 // include your definition of XrdOfsFS (obviously upcast to XrdOfs). This
41 // is how the standard libXrdOfs.so is built.
42 
43 // If additional configuration is needed, over-ride the Config() method. At the
44 // the end of your config, return the result of the XrdOfs::Config().
45 
46 
47 XrdOfs *XrdOfsFS = NULL;
48 
50  XrdSysLogger *lp,
51  const char *configfn,
52  XrdOucEnv *EnvInfo)
53 {
54  extern XrdSysError OfsEroute;
55  extern XrdSysTrace OfsTrace;
56  static XrdSysMutex XrdDefaultOfsMutex;
57  static XrdOfs XrdDefaultOfsFS;
58 
59 // No need to herald this as it's now the default filesystem
60 //
61  OfsEroute.SetPrefix("ofs_");
62  OfsEroute.logger(lp);
63  OfsTrace.SetLogger(lp);
64 
65 // Initialize the subsystems
66 //
67  {
68  XrdSysMutexHelper sentry(XrdDefaultOfsMutex);
69  if (XrdOfsFS == NULL) {
70  XrdOfsFS = &XrdDefaultOfsFS;
71  XrdOfsFS->ConfigFN = (configfn && *configfn ? strdup(configfn) : 0);
72  if ( XrdOfsFS->Configure(OfsEroute, EnvInfo) ) return 0;
73  }
74  }
75 
76 // All done, we can return the callout vector to these routines.
77 //
78  return XrdOfsFS;
79 }
XrdSfsFileSystem * XrdSfsGetDefaultFileSystem(XrdSfsFileSystem *native_fs, XrdSysLogger *lp, const char *configfn, XrdOucEnv *EnvInfo)
Definition: XrdOfsFS.cc:49
XrdOfs * XrdOfsFS
Definition: XrdOfsFS.cc:47
XrdSysError OfsEroute(0)
XrdSysTrace OfsTrace("ofs")
char * ConfigFN
Definition: XrdOfs.hh:420
virtual int Configure(XrdSysError &)
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141
const char * SetPrefix(const char *prefix)
Definition: XrdSysError.hh:160
void SetLogger(XrdSysLogger *logp)
Definition: XrdSysTrace.cc:65