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/ioctl.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/XrdOucCloneSeg.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 170 of file XrdOssApi.cc.

173{
174 return XrdOssGetSS(logger, cfg_fn, 0, 0, 0, urVer);
175}
XrdOss * XrdOssGetSS(XrdSysLogger *Logger, const char *config_fn, const char *OssLib, const char *OssParms, XrdOucEnv *envP, XrdVersionInfo &urVer)
Definition XrdOssApi.cc:103

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 103 of file XrdOssApi.cc.

106{
107 static XrdOssSys myOssSys;
108 extern XrdSysError OssEroute;
109 XrdOucPinLoader *myLib;
110 XrdOss *ossP;
111
112// Verify that versions are compatible.
113//
114 if (urVer.vNum != myOssSys.myVersion->vNum
115 && !XrdSysPlugin::VerCmp(urVer, *(myOssSys.myVersion))) return 0;
116
117// Set logger for tracing and errors
118//
119 OssTrace.SetLogger(Logger);
120 OssEroute.logger(Logger);
121
122// If no library has been specified, return the default object
123//
124 if (!OssLib) {if (myOssSys.Init(Logger, config_fn, envP)) return 0;
125 else return (XrdOss *)&myOssSys;
126 }
127
128// Create a plugin object. Take into account the proxy library. Eventually,
129// we will need to support other core libraries. But, for now, this will do.
130//
131 if (!(myLib = new XrdOucPinLoader(&OssEroute, myOssSys.myVersion,
132 "osslib", OssLib))) return 0;
133// Declare the interface versions
134//
136 const char *epName1 = "XrdOssGetStorageSystem";
138 const char *epName2 ="?XrdOssGetStorageSystem2";
139
140// First try finding version 2 of the initializer. If that fails try version 1.
141// In the process, we will get an oss object if we succeed at all.
142//
143 getOSS2 = (XrdOssGetStorageSystem2_t)myLib->Resolve(epName2);
144 if (getOSS2) ossP = getOSS2((XrdOss *)&myOssSys, Logger, config_fn,
145 OssParms, envP);
146 else {getOSS1 = (XrdOssGetStorageSystem_t)myLib->Resolve(epName1);
147 if (!getOSS1) return 0;
148 ossP = getOSS1((XrdOss *)&myOssSys, Logger, config_fn, OssParms);
149 }
150
151// Call the legacy EnvInfo() method and set what library we are using if it
152// differs from what we wre passed.
153//
154 if (ossP && envP)
155 {ossP->EnvInfo(envP);
156 if (envP && strcmp(OssLib, myLib->Path()))
157 envP->Put("oss.lib", myLib->Path());
158 }
159
160// All done
161//
162 delete myLib;
163 return ossP;
164}
static XrdSysLogger Logger
XrdSysTrace OssTrace
XrdSysError OssEroute
XrdOss *(* XrdOssGetStorageSystem2_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
Definition XrdOss.hh:1020
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:1015
int Init(XrdSysLogger *, const char *, XrdOucEnv *envP)
Definition XrdOssApi.cc:191
XrdVersionInfo * myVersion
Definition XrdOssApi.hh:289
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()
static bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false)
XrdOucEnv * envP
Definition XrdPss.cc:110

References XrdOss::EnvInfo(), XrdOssSys::Init(), Logger, XrdOssSys::myVersion, OssEroute, OssTrace, XrdOucPinLoader::Path(), XrdOucEnv::Put(), XrdOucPinLoader::Resolve(), 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_") ( 0 ,
"oss_"  )

◆ OssTrace

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

◆ XrdOssSS