XRootD
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.

86{
87
88// Do a regular stat and if it fails return immediately
89//
90 if (stat(path, buff)) return -1;
91
92// Check if this is an online file, return success
93//
94 if (buff->st_size == 0 || buff->st_blocks) return 0;
95
96// If caller only wants resident files, then return ENOENT. If we are
97// restricting the caller to residdent only files, return the proper errno.
98// Otherwise, we indicate the file actually exists.
99//
100 if (opts & XRDOSS_resonly) errno = ENOENT;
101 else errno = XrdOssStatInfoResOnly;
102 return (errno ? -1 : 0);
103}
int XrdOssStatInfoResOnly
#define XRDOSS_resonly
Definition XrdOss.hh:486
#define stat(a, b)
Definition XrdPosix.hh:101
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.

136{
137 const char *myProg = getenv("XRDPROG");
138 const char *myRole = getenv("XRDROLE");
139 const char *xWhat = " only online ";
141 XrdOucEnv myEnv(parms);
142 char zRole[16], vChk[512], *val;
143 int offLine = 0;
144
145// Readjust the role to be backwards compatible
146//
147 if (myRole)
148 { if (!strncmp("proxy", myRole, 5))
149 {strcpy(zRole, "proxy"); myRole = zRole;}
150 else if (!strncmp("meta", myRole, 4))
151 {strcpy(zRole, "manager"); myRole = zRole;}
152 }
153
154// Check for global parms first
155//
156 strcpy(vChk, "stat");
157 if ((val = myEnv.Get(vChk))
158 && (offLine = XrdOssStatInfoParm(Say, vChk, val)) < 0) return 0;
159
160// Check for program specific variable
161//
162 if (myProg)
163 {strcat(vChk, "."); strcat(vChk, myProg);
164 if ((val = myEnv.Get(vChk))
165 && (offLine = XrdOssStatInfoParm(Say, vChk, val)) < 0) return 0;
166 }
167
168// Check for role specific variable
169//
170 if (myProg && myRole)
171 {strcat(vChk, "."); strcat(vChk, myRole);
172 if ((val = myEnv.Get(vChk))
173 && (offLine = XrdOssStatInfoParm(Say, vChk, val)) < 0) return 0;
174 }
175
176// Now set the global variable indicate whether we will only allow online
177// files or all files (i.e. online and offline).
178//
179 XrdOssStatInfoResOnly = offLine;
180
181// Record in the log what stat will stat
182//
183 if (myProg) strncpy(vChk, " for ", 6);
184 else *vChk = 0;
185 if (!XrdOssStatInfoResOnly) xWhat = " all ";
186 Say.Say("Config", " stat() allows", xWhat, "files", vChk);
187
188// Return the stat function
189//
191}
XrdOucPup XrdCmsParser::Pup & Say
static XrdSysLogger Logger
int XrdOssStatInfoParm(XrdSysError &eDest, const char *var, const char *val)
int XrdOssStatInfo(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)
int(* XrdOssStatInfo_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP)

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.

110{
111 if (!strcmp(val, "all")) return 0;
112 else if (!strcmp(val, "online")) return ENOENT;
113 else if (!strcmp(val, "online:eperm")) return EPERM;
114
115 eDest.Say("Config", " Invalid statlib parameter, '",var,"=",val,"'.");
116 return -1;
117}
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().