xref: /linux/fs/afs/afs_vl.h (revision 0d456bad36d42d16022be045c8a53ddbb59ee478)
1 /* AFS Volume Location Service client interface
2  *
3  * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4  * 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 
12 #ifndef AFS_VL_H
13 #define AFS_VL_H
14 
15 #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 */
19 
20 enum AFSVL_Operations {
21 	VLGETENTRYBYID		= 503,	/* AFS Get Cache Entry By ID operation ID */
22 	VLGETENTRYBYNAME	= 504,	/* AFS Get Cache Entry By Name operation ID */
23 	VLPROBE			= 514,	/* AFS Probe Volume Location Service operation ID */
24 };
25 
26 enum AFSVL_Errors {
27 	AFSVL_IDEXIST 		= 363520,	/* Volume Id entry exists in vl database */
28 	AFSVL_IO 		= 363521,	/* I/O related error */
29 	AFSVL_NAMEEXIST 	= 363522,	/* Volume name entry exists in vl database */
30 	AFSVL_CREATEFAIL 	= 363523,	/* Internal creation failure */
31 	AFSVL_NOENT 		= 363524,	/* No such entry */
32 	AFSVL_EMPTY 		= 363525,	/* Vl database is empty */
33 	AFSVL_ENTDELETED 	= 363526,	/* Entry is deleted (soft delete) */
34 	AFSVL_BADNAME 		= 363527,	/* Volume name is illegal */
35 	AFSVL_BADINDEX 		= 363528,	/* Index is out of range */
36 	AFSVL_BADVOLTYPE 	= 363529,	/* Bad volume type */
37 	AFSVL_BADSERVER 	= 363530,	/* Illegal server number (out of range) */
38 	AFSVL_BADPARTITION 	= 363531,	/* Bad partition number */
39 	AFSVL_REPSFULL 		= 363532,	/* Run out of space for Replication sites */
40 	AFSVL_NOREPSERVER 	= 363533,	/* No such Replication server site exists */
41 	AFSVL_DUPREPSERVER 	= 363534,	/* Replication site already exists */
42 	AFSVL_RWNOTFOUND 	= 363535,	/* Parent R/W entry not found */
43 	AFSVL_BADREFCOUNT 	= 363536,	/* Illegal Reference Count number */
44 	AFSVL_SIZEEXCEEDED 	= 363537,	/* Vl size for attributes exceeded */
45 	AFSVL_BADENTRY 		= 363538,	/* Bad incoming vl entry */
46 	AFSVL_BADVOLIDBUMP 	= 363539,	/* Illegal max volid increment */
47 	AFSVL_IDALREADYHASHED 	= 363540,	/* RO/BACK id already hashed */
48 	AFSVL_ENTRYLOCKED 	= 363541,	/* Vl entry is already locked */
49 	AFSVL_BADVOLOPER 	= 363542,	/* Bad volume operation code */
50 	AFSVL_BADRELLOCKTYPE 	= 363543,	/* Bad release lock type */
51 	AFSVL_RERELEASE 	= 363544,	/* Status report: last release was aborted */
52 	AFSVL_BADSERVERFLAG 	= 363545,	/* Invalid replication site server flag */
53 	AFSVL_PERM 		= 363546,	/* No permission access */
54 	AFSVL_NOMEM 		= 363547,	/* malloc/realloc failed to alloc enough memory */
55 };
56 
57 /*
58  * maps to "struct vldbentry" in vvl-spec.pdf
59  */
60 struct afs_vldbentry {
61 	char		name[65];		/* name of volume (with NUL char) */
62 	afs_voltype_t	type;			/* volume type */
63 	unsigned	num_servers;		/* num servers that hold instances of this vol */
64 	unsigned	clone_id;		/* cloning ID */
65 
66 	unsigned	flags;
67 #define AFS_VLF_RWEXISTS	0x1000		/* R/W volume exists */
68 #define AFS_VLF_ROEXISTS	0x2000		/* R/O volume exists */
69 #define AFS_VLF_BACKEXISTS	0x4000		/* backup volume exists */
70 
71 	afs_volid_t	volume_ids[3];		/* volume IDs */
72 
73 	struct {
74 		struct in_addr	addr;		/* server address */
75 		unsigned	partition;	/* partition ID on this server */
76 		unsigned	flags;		/* server specific flags */
77 #define AFS_VLSF_NEWREPSITE	0x0001	/* unused */
78 #define AFS_VLSF_ROVOL		0x0002	/* this server holds a R/O instance of the volume */
79 #define AFS_VLSF_RWVOL		0x0004	/* this server holds a R/W instance of the volume */
80 #define AFS_VLSF_BACKVOL	0x0008	/* this server holds a backup instance of the volume */
81 	} servers[8];
82 };
83 
84 #endif /* AFS_VL_H */
85