Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef __SFS_FATTR_H__
0002 #define __SFS_FATTR_H__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                        X r d S f s F A t t r . h h                         */
0006 /*                                                                            */
0007 /*(c) 2018 by the Board of Trustees of the Leland Stanford, Jr., University   */
0008 /*Produced by Andrew Hanushevsky for Stanford University under contract       */
0009 /*           DE-AC02-76-SFO0515 with the Deprtment of Energy                  */
0010 /*                                                                            */
0011 /* This file is part of the XRootD software suite.                            */
0012 /*                                                                            */
0013 /* XRootD is free software: you can redistribute it and/or modify it under    */
0014 /* the terms of the GNU Lesser General Public License as published by the     */
0015 /* Free Software Foundation, either version 3 of the License, or (at your     */
0016 /* option) any later version.                                                 */
0017 /*                                                                            */
0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0021 /* License for more details.                                                  */
0022 /*                                                                            */
0023 /* You should have received a copy of the GNU Lesser General Public License   */
0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0026 /*                                                                            */
0027 /* The copyright holder's institutional names and contributor's names may not */
0028 /* be used to endorse or promote products derived from this software without  */
0029 /* specific prior written permission of the institution or contributor.       */
0030 /******************************************************************************/
0031 
0032 #include <cstdlib>
0033 
0034 //-----------------------------------------------------------------------------
0035 //! This include file defines control strucres used to drive entended file
0036 //! attribute handling via the fsctl() method.
0037 //-----------------------------------------------------------------------------
0038   
0039 /******************************************************************************/
0040 /*                          X r d S f s F A I n f o                           */
0041 /******************************************************************************/
0042   
0043 struct XrdSfsFAInfo
0044 {
0045 char  *Name;   //!< Variable name
0046 char  *Value;  //!< Variable value
0047 int    VLen;   //!< Variable value length (aligned)
0048 short  NLen;   //!< Length of name  not including null byte
0049 int    faRC;   //!< Action return code for this element
0050 
0051        XrdSfsFAInfo() : Value(0), VLen(0), NLen(0), faRC(0) {}
0052       ~XrdSfsFAInfo() {}
0053 };
0054 
0055 /******************************************************************************/
0056 /*                          X r d S f s F A B u f f                           */
0057 /******************************************************************************/
0058 
0059 struct XrdSfsFABuff
0060 {
0061 XrdSfsFABuff *next;
0062 int           dlen;    //!< Data Length in subsequent buffer
0063 char          data[4]; //!< Start of data
0064 };
0065   
0066 /******************************************************************************/
0067 /*                           X r d S f s F A C t l                            */
0068 /******************************************************************************/
0069 
0070 class XrdOucEnv;
0071   
0072 struct XrdSfsFACtl
0073 {
0074 const char      *path;    //!< The file path to act on (logical)
0075 const char      *pcgi;    //!< Opaque information (null if none)
0076 const char      *pfnP;    //!< The file path to act on (physical)
0077 XrdSfsFAInfo    *info;    //!< Pointer to attribute information
0078 XrdOucEnv       *envP;    //!< Optional environmental information
0079 XrdSfsFABuff    *fabP;    //!<  -> Additional memory that was allocated
0080 char             nPfx[2]; //!< The namespace being used
0081 unsigned short   iNum;    //!< Number of info entries
0082 unsigned char    rqst;    //!< Type of file attribute request (see below)
0083 unsigned char    opts;    //!< Request options (see below)
0084 
0085 enum RQST:char {faDel = 0, faGet, faLst, faSet, faFence};
0086 
0087 static const int accChk = 0x01;   //!< Perform access check
0088 static const int newAtr = 0x02;   //!< For set the attribute must not exist
0089 static const int xplode = 0x04;   //!< Construct an info vec from faList
0090 static const int retvsz = 0x0c;   //!< Above plus return size of attr value
0091 static const int retval = 0x1c;   //!< Above plus return actual  attr value
0092 
0093               XrdSfsFACtl(const char *p, const char *opq, int anum)
0094                          : path(p), pcgi(opq), pfnP(0), info(0), envP(0),
0095                            fabP(0), iNum(anum), rqst(255), opts(0)
0096                            {nPfx[0] = 0; nPfx[1] = 0;}
0097 
0098              ~XrdSfsFACtl() {XrdSfsFABuff *dP, *nP = fabP;
0099                              while((dP = nP)) {nP = nP->next; free(dP);}
0100                              if (info) delete [] info;
0101                             }
0102 };
0103 #endif