XRootD
XrdSsiStat.cc File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstdlib>
#include "XrdVersion.hh"
#include "XrdOss/XrdOss.hh"
#include "XrdOss/XrdOssStatInfo.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucPList.hh"
#include "XrdSsi/XrdSsiProvider.hh"
#include "XrdSsi/XrdSsiSfsConfig.hh"
#include "XrdSsi/XrdSsiService.hh"
#include "XrdSys/XrdSysError.hh"
+ Include dependency graph for XrdSsiStat.cc:

Go to the source code of this file.

Namespaces

 XrdSsi
 

Functions

XrdOssStatInfo2_t XrdOssStatInfoInit2 (XrdOss *native_oss, XrdSysLogger *Logger, const char *config_fn, const char *parms, XrdOucEnv *envP)
 
int XrdSsiStatInfo (const char *path, struct stat *buff, int opts, XrdOucEnv *envP, const char *lfn)
 
 XrdVERSIONINFO (XrdOssStatInfoInit, XrdSsiStat)
 
 XrdVERSIONINFO (XrdOssStatInfoInit2, XrdSsiStat2)
 

Function Documentation

◆ XrdOssStatInfoInit2()

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

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

Definition at line 119 of file XrdSsiStat.cc.

124 {
125  XrdSsiSfsConfig Config(true);
126 
127 // Setup the logger
128 //
129  Log.logger(Logger);
130 
131 // Process the configuration file so that we get the service provider object
132 //
133  if (!Config.Configure(config_fn, envP)) return 0;
134 
135 // Return the stat function
136 //
138 }
int(* XrdOssStatInfo2_t)(const char *path, struct stat *buff, int opts, XrdOucEnv *envP, const char *lfn)
int XrdSsiStatInfo(const char *path, struct stat *buff, int opts, XrdOucEnv *envP, const char *lfn)
Definition: XrdSsiStat.cc:75
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141
XrdCmsConfig Config
XrdSysError Log
Definition: XrdConfig.cc:112
XrdSysLogger Logger
Definition: XrdGlobals.cc:47
XrdOucEnv * envP
Definition: XrdPss.cc:109

References XrdCms::Config, XrdProxy::envP, XrdSsi::Log, XrdSsi::Logger, XrdSysError::logger(), and XrdSsiStatInfo().

+ Here is the call graph for this function:

◆ XrdSsiStatInfo()

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

Definition at line 75 of file XrdSsiStat.cc.

77 {
78  static const int regFile = S_IFREG | S_IRUSR | S_IWUSR;
80 
81 // Check for stat changes
82 //
83  if (!buff)
84  {if (!Provider || (fsChk && FSPath.Find(lfn))) return 0;
87  else Provider->ResourceAdded(lfn);
88  return 0;
89  }
90 
91 // Check if this should be issued to the file system
92 //
93  if (fsChk && FSPath.Find(lfn)) return stat(path, buff);
94 
95 // Check resource availability
96 //
97  if (Provider && (rStat = Provider->QueryResource(path)))
98  {memset(buff, 0, sizeof(struct stat));
99  buff->st_mode = regFile;
100  if (rStat == XrdSsiProvider::isPresent) return 0;
101  if (!(opts & XRDOSS_resonly)) {buff->st_mode |= S_IFBLK; return 0;}
102  }
103 
104 // Resource is not available
105 //
106  errno = ENOENT;
107  return -1;
108 }
#define XRDOSS_resonly
Definition: XrdOss.hh:486
int stat(const char *path, struct stat *buf)
struct myOpts opts
unsigned long long Find(const char *pathname)
Definition: XrdOucPList.hh:112
virtual rStat QueryResource(const char *rName, const char *contact=0)=0
virtual void ResourceAdded(const char *rName)
virtual void ResourceRemoved(const char *rName)
static const int FileRemoved
Path has been removed.
bool fsChk
Definition: XrdSsiFile.cc:56
XrdSsiProvider * Provider
XrdOucPListAnchor FSPath
Definition: XrdSsiFile.cc:55

References XrdOssStatEvent::FileRemoved, XrdOucPListAnchor::Find(), XrdSsi::fsChk, XrdSsi::FSPath, XrdSsiProvider::isPresent, opts, XrdSsi::Provider, XrdSsiProvider::QueryResource(), XrdSsiProvider::ResourceAdded(), XrdSsiProvider::ResourceRemoved(), stat(), and XRDOSS_resonly.

Referenced by XrdOssStatInfoInit2().

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

◆ XrdVERSIONINFO() [1/2]

XrdVERSIONINFO ( XrdOssStatInfoInit  ,
XrdSsiStat   
)

◆ XrdVERSIONINFO() [2/2]

XrdVERSIONINFO ( XrdOssStatInfoInit2  ,
XrdSsiStat2   
)