XRootD
Loading...
Searching...
No Matches
XrdOssApi.cc File Reference
#include <unistd.h>
#include <cerrno>
#include <fcntl.h>
#include <signal.h>
#include <strings.h>
#include <cstdio>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include "XrdVersion.hh"
#include "XrdFrc/XrdFrcXAttr.hh"
#include "XrdOss/XrdOssApi.hh"
#include "XrdOss/XrdOssCache.hh"
#include "XrdOss/XrdOssConfig.hh"
#include "XrdOss/XrdOssError.hh"
#include "XrdOss/XrdOssMio.hh"
#include "XrdOss/XrdOssTrace.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucName2Name.hh"
#include "XrdOuc/XrdOucPinLoader.hh"
#include "XrdOuc/XrdOucXAttr.hh"
#include "XrdSfs/XrdSfsFlags.hh"
#include "XrdSys/XrdSysAtomics.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysFD.hh"
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysPlugin.hh"
+ Include dependency graph for XrdOssApi.cc:

Go to the source code of this file.

Functions

XrdOssXrdOssDefaultSS (XrdSysLogger *logger, const char *cfg_fn, XrdVersionInfo &urVer)
 
XrdOssXrdOssGetSS (XrdSysLogger *Logger, const char *config_fn, const char *OssLib, const char *OssParms, XrdOucEnv *envP, XrdVersionInfo &urVer)
 

Variables

XrdSysError OssEroute (0, "oss_")
 
XrdSysTrace OssTrace ("oss")
 
XrdOssSysXrdOssSS = 0
 

Function Documentation

◆ XrdOssDefaultSS()

XrdOss * XrdOssDefaultSS ( XrdSysLogger logger,
const char *  cfg_fn,
XrdVersionInfo &  urVer 
)

Get the default Storage System object.

Include this file in your code to declare the external function that obtains a default version of the XrdOss object; then simply invoke it.

Parameters
loggerthe address of the logging object to direct messages.
cfg_fnthe address of the configuration file path.
urVerthe version string associated with your code. This is generated by the XrdVERSIONINFODEF macro and can be found in XrdVersion.hh include file. You must supply a compatible version identification string.
Returns
XrdOss pointer to a default configured storage system object. 0 a storage system object could not be created because of configration problems or your version is incompatible.

Definition at line 165 of file XrdOssApi.cc.

168{
169 return XrdOssGetSS(logger, cfg_fn, 0, 0, 0, urVer);
170}
XrdOss * XrdOssGetSS(XrdSysLogger *Logger, const char *config_fn, const char *OssLib, const char *OssParms, XrdOucEnv *envP, XrdVersionInfo &urVer)
Definition XrdOssApi.cc:98

References XrdOssGetSS().

+ Here is the call graph for this function:

◆ XrdOssGetSS()

XrdOss * XrdOssGetSS ( XrdSysLogger Logger,
const char *  config_fn,
const char *  OssLib,
const char *  OssParms,
XrdOucEnv envP,
XrdVersionInfo &  urVer 
)

Definition at line 98 of file XrdOssApi.cc.

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}
static XrdSysLogger Logger
XrdSysError OssEroute(0, "oss_")
XrdSysTrace OssTrace("oss")
XrdOss *(* XrdOssGetStorageSystem2_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
Definition XrdOss.hh:939
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
int Init(XrdSysLogger *, const char *, XrdOucEnv *envP)
Definition XrdOssApi.cc:186
XrdVersionInfo * myVersion
Definition XrdOssApi.hh:282
virtual void EnvInfo(XrdOucEnv *envP)
Definition XrdOss.cc:54
void Put(const char *varname, const char *value)
Definition XrdOucEnv.hh:85
void * Resolve(const char *symbl, int mcnt=1)
const char * Path()
XrdSysLogger * logger(XrdSysLogger *lp=0)
static bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false)
void SetLogger(XrdSysLogger *logp)
XrdOucEnv * envP
Definition XrdPss.cc:108

References XrdOss::EnvInfo(), XrdOssSys::Init(), Logger, XrdSysError::logger(), XrdOssSys::myVersion, OssEroute, OssTrace, XrdOucPinLoader::Path(), XrdOucEnv::Put(), XrdOucPinLoader::Resolve(), XrdSysTrace::SetLogger(), and XrdSysPlugin::VerCmp().

Referenced by XrdFrmConfig::Configure(), XrdOfsConfigPI::Load(), and XrdOssDefaultSS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ OssEroute

XrdSysError OssEroute(0, "oss_") ( ,
"oss_"   
)

Referenced by XrdOssGetSS().

◆ OssTrace

XrdSysTrace OssTrace("oss") ( "oss"  )

Referenced by XrdOssGetSS().

◆ XrdOssSS