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"
39 
40 /******************************************************************************/
41 /* x r o o t d _ l o a d F i l e s y s t e m */
42 /******************************************************************************/
43 
45  XrdSfsFileSystem *prevFS,
46  const char *fslib,
47  const char *cfn, XrdOucEnv *envP)
48 {
49  static XrdVERSIONINFODEF(myVersion, XrdOfsLoader, XrdVNUMBER, XrdVERSION);
50  XrdOucPinLoader ofsLib(eDest, &myVersion, "fslib", fslib);
53  XrdSfsFileSystem *FS = 0;
54 
55 // Record the library path in the environment
56 //
57  if (!prevFS) XrdOucEnv::Export("XRDOFSLIB", fslib);
58 
59 // Get the file system object creator and the object (we preferntially try
60 // to find the version 2 of the plugin).
61 //
62  if ((ep2 = (XrdSfsFileSystem2_t)ofsLib.Resolve("?XrdSfsGetFileSystem2")))
63  { FS = (*ep2)(prevFS, eDest->logger(), cfn, envP);
64  } else {
65  if ((ep = (XrdSfsFileSystem_t )ofsLib.Resolve("XrdSfsGetFileSystem")))
66  FS = (*ep) (prevFS, eDest->logger(), cfn);
67  }
68 
69 // Issue message if we could not load it
70 //
71  if (!FS) eDest->Emsg("Config", "Unable to load file system via", fslib);
72 
73 // All done
74 //
75  return FS;
76 }
77 
78 /******************************************************************************/
79 /* X r d X r o o t d _ l o a d R e d i r L i b */
80 /******************************************************************************/
81 
83  XrdXrootdRedirPI *prevPI,
84  const char *rdrlib,
85  const char *parms,
86  const char *cfn, XrdOucEnv *envP)
87 {
88  static XrdVERSIONINFODEF(myVersion, XrdRdrLoader, XrdVNUMBER, XrdVERSION);
89  XrdOucPinLoader rdrLib(eDest, &myVersion, "redirlib", rdrlib);
91  XrdXrootdRedirPI *rdrPI = 0;
92 
93 // Get the plugin object creator and the resulting plugin
94 //
95  if ((ep = (XrdXrootdRedirPI_t)rdrLib.Resolve("XrdXrootGetdRedirPI")))
96  rdrPI = (*ep)(prevPI, eDest->logger(), parms, cfn, envP);
97 
98 // Issue message if we could not load it
99 //
100  if (!rdrPI) eDest->Emsg("Config","Unable to load redirect plugin via",rdrlib);
101 
102 // All done
103 //
104  return rdrPI;
105 }
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)
XrdXrootdRedirPI * XrdXrootdloadRedirLib(XrdSysError *eDest, XrdXrootdRedirPI *prevPI, const char *rdrlib, const char *parms, const char *cfn, XrdOucEnv *envP)
XrdSfsFileSystem * XrdXrootdloadFileSystem(XrdSysError *eDest, XrdSfsFileSystem *prevFS, const char *fslib, const char *cfn, XrdOucEnv *envP)
XrdXrootdRedirPI *(* XrdXrootdRedirPI_t)(XrdXrootdRedirPI_Args)
static int Export(const char *Var, const char *Val)
Definition: XrdOucEnv.cc:170
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