Loading...
Searching...
No Matches
XrdOssSIgpfsT.cc File Reference
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <unistd.h>`
`#include <strings.h>`
`#include <cstring>`
`#include <cstdlib>`
`#include "XrdVersion.hh"`
`#include "XrdOss/XrdOss.hh"`
`#include "XrdOss/XrdOssStatInfo.hh"`
`#include "XrdOuc/XrdOucEnv.hh"`
`#include "XrdSys/XrdSysError.hh"`
Include dependency graph for XrdOssSIgpfsT.cc:

Go to the source code of this file.

## Functions

int | XrdOssStatInfo (const char *path, struct stat *buff, int opts, XrdOucEnv *envP)
XrdOssStatInfo_t | XrdOssStatInfoInit (XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms)
int | XrdOssStatInfoParm (XrdSysError &eDest, const char *var, const char *val)
| XrdVERSIONINFO (XrdOssStatInfoInit, Stat-GPFS+TAPE)

## Variables

int | XrdOssStatInfoResOnly = ENOENT

## Function Documentation

## XrdOssStatInfo()

int XrdOssStatInfo | ( | const char * | path,
|  | struct stat * | buff,
|  | int | opts,
|  | XrdOucEnv * | envP )

Definition at line 84 of file XrdOssSIgpfsT.cc.

{
// Do a regular stat and if it fails return immediately
//
if (stat(path, buff)) return -1;
// Check if this is an online file, return success
//
if (buff->st_size == 0 || buff->st_blocks) return 0;
// If caller only wants resident files, then return ENOENT. If we are
// restricting the caller to residdent only files, return the proper errno.
// Otherwise, we indicate the file actually exists.
//
if (opts & XRDOSS_resonly) errno = ENOENT;
else errno = XrdOssStatInfoResOnly;
return (errno ? -1 : 0);
}
XrdOssStatInfoResOnly
int XrdOssStatInfoResOnly
Definition XrdOssSIgpfsT.cc:78
XRDOSS_resonly
#define XRDOSS_resonly
Definition XrdOss.hh:486
stat
#define stat(a, b)
Definition XrdPosix.hh:101
opts
struct myOpts opts

References opts, stat, XRDOSS_resonly, and XrdOssStatInfoResOnly.

Referenced by XrdOssStatInfoInit().

Here is the caller graph for this function:

## XrdOssStatInfoInit()

XrdOssStatInfo_t XrdOssStatInfoInit | ( | XrdOss * | native_oss,
|  | XrdSysLogger * | Logger,
|  | const char * | config_fn,
|  | const char * | parms )

The following function is invoked by the plugin manager to obtain the function that is to be used for stat() calls. Valid parameters are:

<pgm> := cmsd | frm_xfrd | frm_purged | xrootd <role> := manager | peer | proxy | server | supervisor <token> := stat[.<pgm>[.<role>]]={online|all}[&<token>]

Definition at line 132 of file XrdOssSIgpfsT.cc.

{
const char *myProg = getenv("XRDPROG");
const char *myRole = getenv("XRDROLE");
const char *xWhat = " only online ";
XrdSysError Say(Logger, "");
XrdOucEnv myEnv(parms);
char zRole[16], vChk[512], *val;
int offLine = 0;
// Readjust the role to be backwards compatible
//
if (myRole)
{ if (!strncmp("proxy", myRole, 5))
{strcpy(zRole, "proxy"); myRole = zRole;}
else if (!strncmp("meta", myRole, 4))
{strcpy(zRole, "manager"); myRole = zRole;}
}
// Check for global parms first
//
strcpy(vChk, "stat");
if ((val = myEnv.Get(vChk))
&& (offLine = XrdOssStatInfoParm(Say, vChk, val)) < 0) return 0;
// Check for program specific variable
//
if (myProg)
{strcat(vChk, "."); strcat(vChk, myProg);
if ((val = myEnv.Get(vChk))
&& (offLine = XrdOssStatInfoParm(Say, vChk, val)) < 0) return 0;
}
// Check for role specific variable
//
if (myProg && myRole)
{strcat(vChk, "."); strcat(vChk, myRole);
if ((val = myEnv.Get(vChk))
&& (offLine = XrdOssStatInfoParm(Say, vChk, val)) < 0) return 0;
}
// Now set the global variable indicate whether we will only allow online
// files or all files (i.e. online and offline).
//
XrdOssStatInfoResOnly = offLine;
// Record in the log what stat will stat
//
if (myProg) strncpy(vChk, " for ", 6);
else *vChk = 0;
if (!XrdOssStatInfoResOnly) xWhat = " all ";
Say.Say("Config", " stat() allows", xWhat, "files", vChk);
// Return the stat function
//
return (XrdOssStatInfo_t)XrdOssStatInfo;
}
Say
XrdOucPup XrdCmsParser::Pup & Say
Definition XrdCmsParser.cc:124
Logger
static XrdSysLogger Logger
Definition XrdCryptoAux.cc:37
XrdOssStatInfoParm
int XrdOssStatInfoParm(XrdSysError &eDest, const char *var, const char *val)
Definition XrdOssSIgpfsT.cc:109
XrdOssStatInfo
int XrdOssStatInfo(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)
Definition XrdOssSIgpfsT.cc:84
XrdOssStatInfo_t
int(* XrdOssStatInfo_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)
Definition XrdOssStatInfo.hh:90
XrdOucEnv
Definition XrdOucEnv.hh:42
XrdSysError
Definition XrdSysError.hh:90

References XrdOucEnv::Get(), Logger, Say, XrdOssStatInfo(), XrdOssStatInfoParm(), and XrdOssStatInfoResOnly.

Referenced by XrdVERSIONINFO(), and XrdVERSIONINFO().

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

## XrdOssStatInfoParm()

int XrdOssStatInfoParm | ( | XrdSysError & | eDest,
|  | const char * | var,
|  | const char * | val )

Definition at line 109 of file XrdOssSIgpfsT.cc.

{
if (!strcmp(val, "all")) return 0;
else if (!strcmp(val, "online")) return ENOENT;
else if (!strcmp(val, "online:eperm")) return EPERM;
eDest.Say("Config", " Invalid statlib parameter, '",var,"=",val,"'.");
return -1;
}
eDest
static XrdSysError eDest(0,"crypto_")

References eDest.

Referenced by XrdOssStatInfoInit().

Here is the caller graph for this function:

## XrdVERSIONINFO()

XrdVERSIONINFO | ( | XrdOssStatInfoInit | ,
|  | Stat-GPFS+ | TAPE )

References Stat, and XrdOssStatInfoInit().

Here is the call graph for this function:

## Variable Documentation

## XrdOssStatInfoResOnly

int XrdOssStatInfoResOnly = ENOENT

This file defines a default plug-in that can be used to handle stat() calls for GPFS backed with a tape system. Valid parameters that can be passed to XrdOssStatInfoInit are:

<prog> := cmsd | frm_xfrd | frm_purged | xrootd <role> := manager | peer | proxy | server | supervisor <token> := stat[.<prog>[.<role>]]={all | online[:eperm]}[&<token>]

where: <prog> applies the specification only to programs named <prog>. If <prog> is not specified, the parametr applies to all programs. <role> applies the specification only to programs named <prog> running with the role <role>. If <role> is not specified, the parameter applies to all <prog>'s regardless of their role. In all cases, the most restrictive specification applies. all allows stat() to return info for online and offline files. online allows stat() to return info for online files only. When when stat() encounters an offline file it returns ENOENT. However, specifying "online:eperm" return EPERM instead.

This global variable is set by XrdOssStatInfoInit to indicate whether we will allow access to all files or only disk resident files. By default, only disk resident files are allowed to be handled via stat(). The value is the errno to be returned when we trip over a non-resident file.

Definition at line 78 of file XrdOssSIgpfsT.cc.

Referenced by XrdOssStatInfo(), and XrdOssStatInfoInit().