Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-08 10:33:37

0001 #ifndef __XRDOFSFSCTL_PI_H__
0002 #define __XRDOFSFSCTL_PI_H__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                     X r d O f s F S c t l _ P I . h h                      */
0006 /*                                                                            */
0007 /* (c) 2020 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 XrdOfsFSctl is used to customize the FSCtl() file system call. It is
0034 //! loaded in response to the ofs.ctllib directive.
0035 
0036 class XrdAccAuthorize;
0037 class XrdCmsClient;
0038 class XrdOss;
0039 class XrdOucEnv;
0040 class XrdOucErrInfo;
0041 class XrdSecEntity;
0042 class XrdSfsFile;
0043 class XrdSfsFileSystem;
0044 struct XrdSfsFSctl;
0045 class XrdSysError;
0046   
0047 /******************************************************************************/
0048 /*                           X r d O f s F S C t l                            */
0049 /******************************************************************************/
0050   
0051 class XrdOfsFSctl_PI
0052 {
0053 public:
0054 friend class XrdOfsConfigPI;
0055 
0056 //-----------------------------------------------------------------------------
0057 //! The Plugins struct is used to pass plugin pointers to configure.
0058 //-----------------------------------------------------------------------------
0059 
0060 struct Plugins
0061       {XrdAccAuthorize  *autPI;    //!< -> Authorization plugin
0062        XrdCmsClient     *cmsPI;    //!< -> Cms client object generator plugin
0063        XrdOss           *ossPI;    //!< -> Oss plugin
0064        XrdSfsFileSystem *sfsPI;    //!< -> Sfs plugin (a.k.a. ofs)
0065       };
0066 
0067 //-----------------------------------------------------------------------------
0068 //! Configure plugin.
0069 //!
0070 //! @param  CfgFN  - Path of the configuration file.
0071 //! @param  Parms  - Any parameters specified on the directive (may be null).
0072 //! @param  envP   - Pointer to environmental information
0073 //! @param  plugs  - Reference to the struct containing plugin pointers.
0074 //!                  Unloaded plugins have a nil pointer.
0075 //!
0076 //! @return True upon success and false otherwise.
0077 //-----------------------------------------------------------------------------
0078 
0079 virtual bool           Configure(const char    *CfgFN,
0080                                  const char    *Parms,
0081                                  XrdOucEnv     *envP,
0082                                  const Plugins &plugs) {return true;}
0083 
0084 //-----------------------------------------------------------------------------
0085 //! Perform a file control operation
0086 //!
0087 //! @param  cmd    - The operation to be performed:
0088 //!                  SFS_FCTL_SPEC1    Return Implementation Dependent Data
0089 //! @param  alen   - The length of args.
0090 //! @param  args   - Arguments specific to cmd.
0091 //!                  SFS_FCTL_SPEC1    Unscreened args string.
0092 //! @param  file   - Reference to the target file object.
0093 //! @param  eInfo  - The object where error info or results are to be returned.
0094 //! @param  client - Client's identify (see common description).
0095 //!
0096 //! @return SFS_OK   a null response is sent.
0097 //!         SFS_DATA error.code    length of the data to be sent.
0098 //!                  error.message contains the data to be sent.
0099 //!         o/w      one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.
0100 //-----------------------------------------------------------------------------
0101 
0102 virtual int            FSctl(const int               cmd,
0103                                    int               alen,
0104                              const char             *args,
0105                                    XrdSfsFile       &file,
0106                                    XrdOucErrInfo    &eInfo,
0107                              const XrdSecEntity     *client = 0) = 0;
0108 
0109 //-----------------------------------------------------------------------------
0110 //! Perform a filesystem control operation (version 2)
0111 //!
0112 //! @param  cmd    - The operation to be performed:
0113 //!                  SFS_FSCTL_PLUGIN  Return Implementation Dependent Data v1
0114 //!                  SFS_FSCTL_PLUGIO  Return Implementation Dependent Data v2
0115 //! @param  args   - Arguments specific to cmd.
0116 //!                  SFS_FSCTL_PLUGIN  path and opaque information, fileP == 0
0117 //!                  SFS_FSCTL_PLUGIO  Unscreened argument string,  fileP == 0
0118 //! @param  eInfo  - The object where error info or results are to be returned.
0119 //! @param  client - Client's identify (see common description).
0120 //!
0121 //! @return SFS_OK   a null response is sent.
0122 //!         SFS_DATA error.code    length of the data to be sent.
0123 //!                  error.message contains the data to be sent.
0124 //!         o/w      one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.
0125 //-----------------------------------------------------------------------------
0126 
0127 virtual int            FSctl(const int               cmd,
0128                                    XrdSfsFSctl      &args,
0129                                    XrdOucErrInfo    &eInfo,
0130                              const XrdSecEntity     *client = 0) = 0;
0131 
0132 //------------------------------------------------------------------------------
0133 //! Constructor
0134 //------------------------------------------------------------------------------
0135 
0136              XrdOfsFSctl_PI() : prvPI(0), eDest(0) {}
0137 
0138 //------------------------------------------------------------------------------
0139 //! Destructor
0140 //------------------------------------------------------------------------------
0141 
0142 virtual     ~XrdOfsFSctl_PI() {}
0143 
0144 protected:
0145 
0146 XrdOfsFSctl_PI  *prvPI; // Stacked CTL plugin behind this one for forwarding
0147                         // If none, then the pointer is zero.
0148 XrdSysError     *eDest; // Message logging object to be used for messages.
0149 };
0150 
0151 /******************************************************************************/
0152 /*                    X r d O f s F S c t l   P l u g i n                     */
0153 /******************************************************************************/
0154   
0155 //------------------------------------------------------------------------------
0156 //! To create a loadable XrdfsFSCtl plugin, simply derive your implementation
0157 //! class from the XrdOfsFSctl_PI class. Then declare an instance of that class
0158 //! at file level with the name XrdOfsFSctl. An example follows.
0159 //------------------------------------------------------------------------------
0160 
0161 /*!  class myFSCtl : public XrdOfsFSctl_PI {. . . .};
0162 
0163      myFSCtl XrdOfsFSctl;
0164 */
0165 
0166 //------------------------------------------------------------------------------
0167 //! Declare compilation version.
0168 //!
0169 //! Additionally, you *should* declare the xrootd version you used to compile
0170 //! your plug-in. While not currently required, it is highly recommended to
0171 //! avoid execution issues should the class definition change. Declare it as:
0172 //------------------------------------------------------------------------------
0173 
0174 /*! #include "XrdVersion.hh"
0175     XrdVERSIONINFO(XrdOfsFSctl,<name>);
0176 
0177     where <name> is a 1- to 15-character unquoted name identifying your plugin.
0178 */
0179 #endif