^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* AFS Volume Location Service client interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef AFS_VL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define AFS_VL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "afs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define AFS_VL_PORT 7003 /* volume location service port */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define VL_SERVICE 52 /* RxRPC service ID for the Volume Location service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define YFS_VL_SERVICE 2503 /* Service ID for AuriStor upgraded VL service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) enum AFSVL_Operations {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) VLGETENTRYBYID = 503, /* AFS Get VLDB entry by ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) VLGETENTRYBYNAME = 504, /* AFS Get VLDB entry by name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) VLPROBE = 514, /* AFS probe VL service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) VLGETENTRYBYIDU = 526, /* AFS Get VLDB entry by ID (UUID-variant) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) VLGETENTRYBYNAMEU = 527, /* AFS Get VLDB entry by name (UUID-variant) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) VLGETADDRSU = 533, /* AFS Get addrs for fileserver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) YVLGETENDPOINTS = 64002, /* YFS Get endpoints for file/volume server */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) YVLGETCELLNAME = 64014, /* YFS Get actual cell name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) VLGETCAPABILITIES = 65537, /* AFS Get server capabilities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) enum AFSVL_Errors {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) AFSVL_IDEXIST = 363520, /* Volume Id entry exists in vl database */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) AFSVL_IO = 363521, /* I/O related error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) AFSVL_NAMEEXIST = 363522, /* Volume name entry exists in vl database */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) AFSVL_CREATEFAIL = 363523, /* Internal creation failure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) AFSVL_NOENT = 363524, /* No such entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) AFSVL_EMPTY = 363525, /* Vl database is empty */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) AFSVL_ENTDELETED = 363526, /* Entry is deleted (soft delete) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) AFSVL_BADNAME = 363527, /* Volume name is illegal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) AFSVL_BADINDEX = 363528, /* Index is out of range */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) AFSVL_BADVOLTYPE = 363529, /* Bad volume type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) AFSVL_BADSERVER = 363530, /* Illegal server number (out of range) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) AFSVL_BADPARTITION = 363531, /* Bad partition number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) AFSVL_REPSFULL = 363532, /* Run out of space for Replication sites */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) AFSVL_NOREPSERVER = 363533, /* No such Replication server site exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) AFSVL_DUPREPSERVER = 363534, /* Replication site already exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) AFSVL_RWNOTFOUND = 363535, /* Parent R/W entry not found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) AFSVL_BADREFCOUNT = 363536, /* Illegal Reference Count number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) AFSVL_SIZEEXCEEDED = 363537, /* Vl size for attributes exceeded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) AFSVL_BADENTRY = 363538, /* Bad incoming vl entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) AFSVL_BADVOLIDBUMP = 363539, /* Illegal max volid increment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) AFSVL_IDALREADYHASHED = 363540, /* RO/BACK id already hashed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) AFSVL_ENTRYLOCKED = 363541, /* Vl entry is already locked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) AFSVL_BADVOLOPER = 363542, /* Bad volume operation code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) AFSVL_BADRELLOCKTYPE = 363543, /* Bad release lock type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) AFSVL_RERELEASE = 363544, /* Status report: last release was aborted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) AFSVL_BADSERVERFLAG = 363545, /* Invalid replication site server flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) AFSVL_PERM = 363546, /* No permission access */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) AFSVL_NOMEM = 363547, /* malloc/realloc failed to alloc enough memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) YFS_SERVER_INDEX = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) YFS_SERVER_UUID = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) YFS_SERVER_ENDPOINT = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) YFS_ENDPOINT_IPV4 = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) YFS_ENDPOINT_IPV6 = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define YFS_MAXENDPOINTS 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * maps to "struct vldbentry" in vvl-spec.pdf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct afs_vldbentry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) char name[65]; /* name of volume (with NUL char) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) afs_voltype_t type; /* volume type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) unsigned num_servers; /* num servers that hold instances of this vol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) unsigned clone_id; /* cloning ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) unsigned flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define AFS_VLF_RWEXISTS 0x1000 /* R/W volume exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define AFS_VLF_ROEXISTS 0x2000 /* R/O volume exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define AFS_VLF_BACKEXISTS 0x4000 /* backup volume exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) afs_volid_t volume_ids[3]; /* volume IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct in_addr addr; /* server address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) unsigned partition; /* partition ID on this server */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) unsigned flags; /* server specific flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define AFS_VLSF_NEWREPSITE 0x0001 /* Ignore all 'non-new' servers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define AFS_VLSF_ROVOL 0x0002 /* this server holds a R/O instance of the volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define AFS_VLSF_RWVOL 0x0004 /* this server holds a R/W instance of the volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define AFS_VLSF_BACKVOL 0x0008 /* this server holds a backup instance of the volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define AFS_VLSF_UUID 0x0010 /* This server is referred to by its UUID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define AFS_VLSF_DONTUSE 0x0020 /* This server ref should be ignored */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) } servers[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define AFS_VLDB_MAXNAMELEN 65
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct afs_ListAddrByAttributes__xdr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) __be32 Mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define AFS_VLADDR_IPADDR 0x1 /* Match by ->ipaddr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define AFS_VLADDR_INDEX 0x2 /* Match by ->index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define AFS_VLADDR_UUID 0x4 /* Match by ->uuid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) __be32 ipaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __be32 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __be32 spare;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct afs_uuid__xdr uuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct afs_uvldbentry__xdr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __be32 name[AFS_VLDB_MAXNAMELEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) __be32 nServers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct afs_uuid__xdr serverNumber[AFS_NMAXNSERVERS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) __be32 serverUnique[AFS_NMAXNSERVERS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __be32 serverPartition[AFS_NMAXNSERVERS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) __be32 serverFlags[AFS_NMAXNSERVERS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) __be32 volumeId[AFS_MAXTYPES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) __be32 cloneId;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) __be32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) __be32 spares1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) __be32 spares2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) __be32 spares3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) __be32 spares4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) __be32 spares5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) __be32 spares6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) __be32 spares7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) __be32 spares8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) __be32 spares9;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct afs_address_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) refcount_t usage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) unsigned int version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) unsigned int nr_addrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct sockaddr_rxrpc addrs[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) extern void afs_put_address_list(struct afs_address_list *alist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #endif /* AFS_VL_H */