XrdOssStatInfo.hh File Reference

Go to the source code of this file.


typedef int(* XrdOssStatInfo_t )(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)
typedef int(* XrdOssStatInfo2_t )(const char *path, struct stat *buff, int opts, XrdOucEnv *envP, const char *lfn)
typedef XrdOssStatInfo_t(* XrdOssStatInfoInit_t )(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms)
 The typedef that describes the XRdOssStatInfoInit external. More...
typedef XrdOssStatInfo2_t(* XrdOssStatInfoInit2_t )(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)

Typedef Documentation

typedef int(* XrdOssStatInfo2_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP, const char *lfn)
typedef int(* XrdOssStatInfo_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)

This file defines the alternate stat() function that can be used as a replacement for the normal system stat() call that is used to determine the file attributes, including whether the file exists or not. It is loaded as a plug-in via the XrdOssStatInfoInit() function residing in the shared library pecified by the 'oss.statlib' directive. The returned function is preferentially used by the XrdOssSys::Stat() method. Get file information.

path-> the file path whose stat information is wanted.
buff-> to the stat structure that is to be filled in with stat information the same way that stat() would have,
optsA combination of XRDOSS_xxxx options. See XrdOss.hh.
envP-> environment pointer which includes CGI information. This pointer is nil if no special environment exists.
lfn-> the corresponding logical file name. This is only passed for version 2 calls (see XrdOssStatInfoInit2).
Success: zero with the stat structure filled in.
Failure: a -1 with errno set to the correct err number value.
typedef XrdOssStatInfo2_t(* XrdOssStatInfoInit2_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
typedef XrdOssStatInfo_t(* XrdOssStatInfoInit_t)(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms)

The typedef that describes the XRdOssStatInfoInit external.

Get the address of the appropriate XrdOssStatInfo function.

native_oss-> object that implements the storage system.
Logger-> The message routing object to be used in conjunction with an XrdSysError object for error messages.
config_fn-> The name of the config file.
parms-> Any parameters specified after the path on the oss.statlib directive. If there are no parameters, the pointer may be zero.
Success: address of the XrdOssStatInfo function to be used for stat() calls by the underlying storage system. Failure: Null pointer which causes initialization to fail.

Additionally, two special envars may be queried to determine the context:

getenv("XRDPROG") Indicates which program is loading the library: "cmsd", "frm_purged", "frm_xfrd", or "xrootd" Any other value, inclduing a nil pointer, indicates a non-standard program is doing the load.

getenv("XRDROLE") Is the role of the program. The envar is set only when XRDPROG is set to "cmsd" or "xrootd". Valid roles are: "manager", "supervisor", "server", "proxy", or "peer".

The function creator must be declared as an extern "C" function in the plug-in shared library as follows:

extern "C" XrdOssStatInfo_t XrdOssStatInfoInit(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms);

An alternate entry point may be defined in lieu of the previous entry point. This normally identified by a version option in the configuration file (e.g. oss.statlib -2 <path>). It differs in that an extra parameter is passed and if returns a function that accepts an extra parameter.

envP- Pointer to the environment containing implementation specific information.

extern "C" XrdOssStatInfo2_t XrdOssStatInfoInit2(XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP);Declare compilation version.

Additionally, you must declare the xrootd version you used to compile your plug-in. Include the code shown below at file level in your source.

#include "XrdVersion.hh"

where <name> is a 1- to 15-character unquoted name identifying your plugin.