xrootd
Loading...
Searching...
No Matches
Namespaces | Typedefs | Variables
XrdOssStatInfo.hh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  XrdOssStatEvent
 

Typedefs

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.
 
typedef XrdOssStatInfo2_t(* XrdOssStatInfoInit2_t) (XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
 

Variables

static const int XrdOssStatEvent::FileAdded = 1
 Path has been added.
 
static const int XrdOssStatEvent::PendAdded = 2
 Path has been added in pending mode.
 
static const int XrdOssStatEvent::FileRemoved = 0
 Path has been removed.
 

Typedef Documentation

◆ XrdOssStatInfo2_t

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

◆ XrdOssStatInfo_t

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.

Parameters
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).
Returns
Success: zero with the stat structure filled in.
Failure: a -1 with errno set to the correct err number value. Set file information.

When the arevents option is specified in the oss.statlib directive and the executable is the cmsd running in server mode, then the StatInfo function is also used to relay add/remove file requests send by the companion xrootd to the cmsd. The parameters then are as follows:

Parameters
path-> the file path whose whose stat information changed.
buff-> Nil; this indicates that stat information is being set.
optsOne of the following options: XrdOssStatEvent::FileAdded, XrdOssStatEvent::PendAdded, XrdOssStatEvent::FileRemoved.
envP-> Nil
lfn-> the logical file name whose stat information changed.
Returns
The return value should be zero but is not currently inspected.

◆ XrdOssStatInfoInit2_t

typedef XrdOssStatInfo2_t(* XrdOssStatInfoInit2_t) (XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)

◆ XrdOssStatInfoInit_t

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.

Parameters
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.
Returns
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);
int(* XrdOssStatInfo_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)
Definition XrdOssStatInfo.hh:90
Definition XrdOss.hh:498
Definition XrdSysLogger.hh:53

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.

Parameters
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);
int(* XrdOssStatInfo2_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP, const char *lfn)
Definition XrdOssStatInfo.hh:93
Definition XrdOucEnv.hh:42

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"
XrdVERSIONINFO(XrdOssStatInfoInit,<name>);

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