Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* AFS Volume Location Service client interface
0003  *
0004  * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
0005  * Written by David Howells (dhowells@redhat.com)
0006  */
0007 
0008 #ifndef AFS_VL_H
0009 #define AFS_VL_H
0010 
0011 #include "afs.h"
0012 
0013 #define AFS_VL_PORT     7003    /* volume location service port */
0014 #define VL_SERVICE      52  /* RxRPC service ID for the Volume Location service */
0015 #define YFS_VL_SERVICE      2503    /* Service ID for AuriStor upgraded VL service */
0016 
0017 enum AFSVL_Operations {
0018     VLGETENTRYBYID      = 503,  /* AFS Get VLDB entry by ID */
0019     VLGETENTRYBYNAME    = 504,  /* AFS Get VLDB entry by name */
0020     VLPROBE         = 514,  /* AFS probe VL service */
0021     VLGETENTRYBYIDU     = 526,  /* AFS Get VLDB entry by ID (UUID-variant) */
0022     VLGETENTRYBYNAMEU   = 527,  /* AFS Get VLDB entry by name (UUID-variant) */
0023     VLGETADDRSU     = 533,  /* AFS Get addrs for fileserver */
0024     YVLGETENDPOINTS     = 64002, /* YFS Get endpoints for file/volume server */
0025     YVLGETCELLNAME      = 64014, /* YFS Get actual cell name */
0026     VLGETCAPABILITIES   = 65537, /* AFS Get server capabilities */
0027 };
0028 
0029 enum AFSVL_Errors {
0030     AFSVL_IDEXIST       = 363520,   /* Volume Id entry exists in vl database */
0031     AFSVL_IO        = 363521,   /* I/O related error */
0032     AFSVL_NAMEEXIST     = 363522,   /* Volume name entry exists in vl database */
0033     AFSVL_CREATEFAIL    = 363523,   /* Internal creation failure */
0034     AFSVL_NOENT         = 363524,   /* No such entry */
0035     AFSVL_EMPTY         = 363525,   /* Vl database is empty */
0036     AFSVL_ENTDELETED    = 363526,   /* Entry is deleted (soft delete) */
0037     AFSVL_BADNAME       = 363527,   /* Volume name is illegal */
0038     AFSVL_BADINDEX      = 363528,   /* Index is out of range */
0039     AFSVL_BADVOLTYPE    = 363529,   /* Bad volume type */
0040     AFSVL_BADSERVER     = 363530,   /* Illegal server number (out of range) */
0041     AFSVL_BADPARTITION  = 363531,   /* Bad partition number */
0042     AFSVL_REPSFULL      = 363532,   /* Run out of space for Replication sites */
0043     AFSVL_NOREPSERVER   = 363533,   /* No such Replication server site exists */
0044     AFSVL_DUPREPSERVER  = 363534,   /* Replication site already exists */
0045     AFSVL_RWNOTFOUND    = 363535,   /* Parent R/W entry not found */
0046     AFSVL_BADREFCOUNT   = 363536,   /* Illegal Reference Count number */
0047     AFSVL_SIZEEXCEEDED  = 363537,   /* Vl size for attributes exceeded */
0048     AFSVL_BADENTRY      = 363538,   /* Bad incoming vl entry */
0049     AFSVL_BADVOLIDBUMP  = 363539,   /* Illegal max volid increment */
0050     AFSVL_IDALREADYHASHED   = 363540,   /* RO/BACK id already hashed */
0051     AFSVL_ENTRYLOCKED   = 363541,   /* Vl entry is already locked */
0052     AFSVL_BADVOLOPER    = 363542,   /* Bad volume operation code */
0053     AFSVL_BADRELLOCKTYPE    = 363543,   /* Bad release lock type */
0054     AFSVL_RERELEASE     = 363544,   /* Status report: last release was aborted */
0055     AFSVL_BADSERVERFLAG     = 363545,   /* Invalid replication site server flag */
0056     AFSVL_PERM      = 363546,   /* No permission access */
0057     AFSVL_NOMEM         = 363547,   /* malloc/realloc failed to alloc enough memory */
0058 };
0059 
0060 enum {
0061     YFS_SERVER_INDEX    = 0,
0062     YFS_SERVER_UUID     = 1,
0063     YFS_SERVER_ENDPOINT = 2,
0064 };
0065 
0066 enum {
0067     YFS_ENDPOINT_IPV4   = 0,
0068     YFS_ENDPOINT_IPV6   = 1,
0069 };
0070 
0071 #define YFS_MAXENDPOINTS    16
0072 
0073 /*
0074  * maps to "struct vldbentry" in vvl-spec.pdf
0075  */
0076 struct afs_vldbentry {
0077     char        name[65];       /* name of volume (with NUL char) */
0078     afs_voltype_t   type;           /* volume type */
0079     unsigned    num_servers;        /* num servers that hold instances of this vol */
0080     unsigned    clone_id;       /* cloning ID */
0081 
0082     unsigned    flags;
0083 #define AFS_VLF_RWEXISTS    0x1000      /* R/W volume exists */
0084 #define AFS_VLF_ROEXISTS    0x2000      /* R/O volume exists */
0085 #define AFS_VLF_BACKEXISTS  0x4000      /* backup volume exists */
0086 
0087     afs_volid_t volume_ids[3];      /* volume IDs */
0088 
0089     struct {
0090         struct in_addr  addr;       /* server address */
0091         unsigned    partition;  /* partition ID on this server */
0092         unsigned    flags;      /* server specific flags */
0093 #define AFS_VLSF_NEWREPSITE 0x0001  /* Ignore all 'non-new' servers */
0094 #define AFS_VLSF_ROVOL      0x0002  /* this server holds a R/O instance of the volume */
0095 #define AFS_VLSF_RWVOL      0x0004  /* this server holds a R/W instance of the volume */
0096 #define AFS_VLSF_BACKVOL    0x0008  /* this server holds a backup instance of the volume */
0097 #define AFS_VLSF_UUID       0x0010  /* This server is referred to by its UUID */
0098 #define AFS_VLSF_DONTUSE    0x0020  /* This server ref should be ignored */
0099     } servers[8];
0100 };
0101 
0102 #define AFS_VLDB_MAXNAMELEN 65
0103 
0104 
0105 struct afs_ListAddrByAttributes__xdr {
0106     __be32          Mask;
0107 #define AFS_VLADDR_IPADDR   0x1 /* Match by ->ipaddr */
0108 #define AFS_VLADDR_INDEX    0x2 /* Match by ->index */
0109 #define AFS_VLADDR_UUID     0x4 /* Match by ->uuid */
0110     __be32          ipaddr;
0111     __be32          index;
0112     __be32          spare;
0113     struct afs_uuid__xdr    uuid;
0114 };
0115 
0116 struct afs_uvldbentry__xdr {
0117     __be32          name[AFS_VLDB_MAXNAMELEN];
0118     __be32          nServers;
0119     struct afs_uuid__xdr    serverNumber[AFS_NMAXNSERVERS];
0120     __be32          serverUnique[AFS_NMAXNSERVERS];
0121     __be32          serverPartition[AFS_NMAXNSERVERS];
0122     __be32          serverFlags[AFS_NMAXNSERVERS];
0123     __be32          volumeId[AFS_MAXTYPES];
0124     __be32          cloneId;
0125     __be32          flags;
0126     __be32          spares1;
0127     __be32          spares2;
0128     __be32          spares3;
0129     __be32          spares4;
0130     __be32          spares5;
0131     __be32          spares6;
0132     __be32          spares7;
0133     __be32          spares8;
0134     __be32          spares9;
0135 };
0136 
0137 struct afs_address_list {
0138     refcount_t      usage;
0139     unsigned int        version;
0140     unsigned int        nr_addrs;
0141     struct sockaddr_rxrpc   addrs[];
0142 };
0143 
0144 extern void afs_put_address_list(struct afs_address_list *alist);
0145 
0146 #endif /* AFS_VL_H */