XRootD
XrdXrootdLoadLib.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d X r o o t d L o a d L i b . c c */
4 /* */
5 /* (c) 2004 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 Department 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 #include <cstdio>
31 
32 #include "XrdVersion.hh"
33 
34 #include "XrdOuc/XrdOucEnv.hh"
37 #include "XrdSys/XrdSysError.hh"
38 
39 /******************************************************************************/
40 /* x r o o t d _ l o a d F i l e s y s t e m */
41 /******************************************************************************/
42 
44  XrdSfsFileSystem *prevFS,
45  const char *fslib,
46  const char *cfn, XrdOucEnv *envP)
47 {
48  static XrdVERSIONINFODEF(myVersion, XrdOfsLoader, XrdVNUMBER, XrdVERSION);
49  XrdOucPinLoader ofsLib(eDest, &myVersion, "fslib", fslib);
52  XrdSfsFileSystem *FS = 0;
53 
54 // Record the library path in the environment
55 //
56  if (!prevFS) XrdOucEnv::Export("XRDOFSLIB", fslib);
57 
58 // Get the file system object creator and the object (we preferntially try
59 // to find the version 2 of the plugin).
60 //
61  if ((ep2 = (XrdSfsFileSystem2_t)ofsLib.Resolve("?XrdSfsGetFileSystem2")))
62  { FS = (*ep2)(prevFS, eDest->logger(), cfn, envP);
63  } else {
64  if ((ep = (XrdSfsFileSystem_t )ofsLib.Resolve("XrdSfsGetFileSystem")))
65  FS = (*ep) (prevFS, eDest->logger(), cfn);
66  }
67 
68 // Issue message if we could not load it
69 //
70  if (!FS) eDest->Emsg("Config", "Unable to load file system via", fslib);
71 
72 // All done
73 //
74  return FS;
75 }
static XrdSysError eDest(0,"crypto_")
XrdSfsFileSystem *(* XrdSfsFileSystem2_t)(XrdSfsFileSystem *nativeFS, XrdSysLogger *Logger, const char *configFn, XrdOucEnv *envP)
XrdSfsFileSystem *(* XrdSfsFileSystem_t)(XrdSfsFileSystem *nativeFS, XrdSysLogger *Logger, const char *configFn)
XrdSfsFileSystem * XrdXrootdloadFileSystem(XrdSysError *eDest, XrdSfsFileSystem *prevFS, const char *fslib, const char *cfn, XrdOucEnv *envP)
static int Export(const char *Var, const char *Val)
Definition: XrdOucEnv.cc:188
void * Resolve(const char *symbl, int mcnt=1)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141
XrdVersionInfo myVersion
XrdVERSIONINFODEF(myVersion, cmsclient, XrdVNUMBER, XrdVERSION)
XrdOucEnv * envP
Definition: XrdPss.cc:109