|
|
|||
File indexing completed on 2026-01-08 10:33:37
0001 #ifndef _XRDOSSSTATINFO_H 0002 #define _XRDOSSSTATINFO_H 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d O s s S t a t I n f o . h h */ 0006 /* */ 0007 /* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ 0008 /* All Rights Reserved */ 0009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 0010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 0011 /* */ 0012 /* This file is part of the XRootD software suite. */ 0013 /* */ 0014 /* XRootD is free software: you can redistribute it and/or modify it under */ 0015 /* the terms of the GNU Lesser General Public License as published by the */ 0016 /* Free Software Foundation, either version 3 of the License, or (at your */ 0017 /* option) any later version. */ 0018 /* */ 0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 0021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 0022 /* License for more details. */ 0023 /* */ 0024 /* You should have received a copy of the GNU Lesser General Public License */ 0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 0026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 0027 /* */ 0028 /* The copyright holder's institutional names and contributor's names may not */ 0029 /* be used to endorse or promote products derived from this software without */ 0030 /* specific prior written permission of the institution or contributor. */ 0031 /******************************************************************************/ 0032 0033 class XrdOss; 0034 class XrdOucEnv; 0035 class XrdSysLogger; 0036 struct stat; 0037 0038 namespace XrdOssStatEvent 0039 { 0040 static const int FileAdded = 1; //!< Path has been added 0041 static const int PendAdded = 2; //!< Path has been added in pending mode 0042 static const int FileRemoved = 0; //!< Path has been removed 0043 } 0044 0045 //------------------------------------------------------------------------------ 0046 //! This file defines the alternate stat() function that can be used as a 0047 //! replacement for the normal system stat() call that is used to determine the 0048 //! file attributes, including whether the file exists or not. It is loaded as 0049 //! a plug-in via the XrdOssStatInfoInit() function residing in the shared 0050 //! library pecified by the 'oss.statlib' directive. The returned function is 0051 //! preferentially used by the XrdOssSys::Stat() method. 0052 //------------------------------------------------------------------------------ 0053 0054 //------------------------------------------------------------------------------ 0055 //! Get file information. 0056 //! 0057 //! @param path -> the file path whose stat information is wanted. 0058 //! @param buff -> to the stat structure that is to be filled in with 0059 //! stat information the same way that stat() would have, 0060 //! @param opts A combination of XRDOSS_xxxx options. See XrdOss.hh. 0061 //! @param envP -> environment pointer which includes CGI information. 0062 //! This pointer is nil if no special environment exists. 0063 //! @param lfn -> the corresponding logical file name. This is only 0064 //! passed for version 2 calls (see XrdOssStatInfoInit2). 0065 //! 0066 //! @return Success: zero with the stat structure filled in. 0067 //! @return Failure: a -1 with errno set to the correct err number value. 0068 //------------------------------------------------------------------------------ 0069 0070 //------------------------------------------------------------------------------ 0071 //! Set file information. 0072 //! 0073 //! When the arevents option is specified in the oss.statlib directive and the 0074 //! executable is the cmsd running in server mode, then the StatInfo function is 0075 //! also used to relay add/remove file requests send by the companion xrootd to 0076 //! the cmsd. The parameters then are as follows: 0077 //! 0078 //! @param path -> the file path whose whose stat information changed. 0079 //! @param buff -> Nil; this indicates that stat information is being set. 0080 //! @param opts One of the following options: 0081 //! XrdOssStatEvent::FileAdded, 0082 //! XrdOssStatEvent::PendAdded, 0083 //! XrdOssStatEvent::FileRemoved. 0084 //! @param envP -> Nil 0085 //! @param lfn -> the logical file name whose stat information changed. 0086 //! 0087 //! @return The return value should be zero but is not currently inspected. 0088 //------------------------------------------------------------------------------ 0089 0090 typedef int (*XrdOssStatInfo_t) (const char *path, struct stat *buff, 0091 int opts, XrdOucEnv *envP); 0092 0093 typedef int (*XrdOssStatInfo2_t)(const char *path, struct stat *buff, 0094 int opts, XrdOucEnv *envP, 0095 const char *lfn); 0096 0097 /******************************************************************************/ 0098 /* X r d O s s S t a t I n f o I n s t a n t i a t o r */ 0099 /******************************************************************************/ 0100 0101 //------------------------------------------------------------------------------ 0102 //! Get the address of the appropriate XrdOssStatInfo function. 0103 //! 0104 //! @param native_oss -> object that implements the storage system. 0105 //! @param Logger -> The message routing object to be used in conjunction 0106 //! with an XrdSysError object for error messages. 0107 //! @param config_fn -> The name of the config file. 0108 //! @param parms -> Any parameters specified after the path on the 0109 //! oss.statlib directive. If there are no parameters, the 0110 //! pointer may be zero. 0111 //! 0112 //! @return Success: address of the XrdOssStatInfo function to be used 0113 //! for stat() calls by the underlying storage system. 0114 //! Failure: Null pointer which causes initialization to fail. 0115 //! 0116 //! Additionally, two special envars may be queried to determine the context: 0117 //! 0118 //! getenv("XRDPROG") Indicates which program is loading the library: 0119 //! "cmsd", "frm_purged", "frm_xfrd", or "xrootd" 0120 //! Any other value, inclduing a nil pointer, indicates 0121 //! a non-standard program is doing the load. 0122 //! 0123 //! getenv("XRDROLE") Is the role of the program. The envar is set only when 0124 //! XRDPROG is set to "cmsd" or "xrootd". Valid roles are: 0125 //! "manager", "supervisor", "server", "proxy", or "peer". 0126 //! 0127 //! The function creator must be declared as an extern "C" function in the 0128 //! plug-in shared library as follows: 0129 //------------------------------------------------------------------------------ 0130 /*! @code {.cpp} 0131 extern "C" XrdOssStatInfo_t XrdOssStatInfoInit(XrdOss *native_oss, 0132 XrdSysLogger *Logger, 0133 const char *config_fn, 0134 const char *parms); 0135 @endcode 0136 0137 An alternate entry point may be defined in lieu of the previous entry point. 0138 This normally identified by a version option in the configuration file (e.g. 0139 oss.statlib -2 \<path\>). It differs in that an extra parameter is passed and 0140 if returns a function that accepts an extra parameter. 0141 0142 @param envP - Pointer to the environment containing implementation 0143 specific information. 0144 0145 @code {.cpp} 0146 extern "C" XrdOssStatInfo2_t XrdOssStatInfoInit2(XrdOss *native_oss, 0147 XrdSysLogger *Logger, 0148 const char *config_fn, 0149 const char *parms, 0150 XrdOucEnv *envP); 0151 @endcode 0152 */ 0153 0154 //------------------------------------------------------------------------------ 0155 //! Declare compilation version. 0156 //! 0157 //! Additionally, you *must* declare the xrootd version you used to compile 0158 //! your plug-in. Include the code shown below at file level in your source. 0159 //------------------------------------------------------------------------------ 0160 0161 /*! 0162 #include "XrdVersion.hh" 0163 XrdVERSIONINFO(XrdOssStatInfoInit,<name>); 0164 0165 where \<name\> is a 1- to 15-character unquoted name identifying your plugin. 0166 */ 0167 0168 //------------------------------------------------------------------------------ 0169 //! The typedef that describes the XRdOssStatInfoInit external. 0170 //------------------------------------------------------------------------------ 0171 0172 typedef XrdOssStatInfo_t (*XrdOssStatInfoInit_t)(XrdOss *native_oss, 0173 XrdSysLogger *Logger, 0174 const char *config_fn, 0175 const char *parms); 0176 0177 typedef XrdOssStatInfo2_t (*XrdOssStatInfoInit2_t)(XrdOss *native_oss, 0178 XrdSysLogger *Logger, 0179 const char *config_fn, 0180 const char *parms, 0181 XrdOucEnv *envP); 0182 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|