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