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