| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* vlclient.h: Volume Location Service client interface | 
|  | 2 | * | 
|  | 3 | * Copyright (C) 2002 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 _LINUX_AFS_VLCLIENT_H | 
|  | 13 | #define _LINUX_AFS_VLCLIENT_H | 
|  | 14 |  | 
|  | 15 | #include "types.h" | 
|  | 16 |  | 
|  | 17 | enum AFSVL_Errors { | 
|  | 18 | AFSVL_IDEXIST 		= 363520,	/* Volume Id entry exists in vl database */ | 
|  | 19 | AFSVL_IO 		= 363521,	/* I/O related error */ | 
|  | 20 | AFSVL_NAMEEXIST 	= 363522,	/* Volume name entry exists in vl database */ | 
|  | 21 | AFSVL_CREATEFAIL 	= 363523,	/* Internal creation failure */ | 
|  | 22 | AFSVL_NOENT 		= 363524,	/* No such entry */ | 
|  | 23 | AFSVL_EMPTY 		= 363525,	/* Vl database is empty */ | 
|  | 24 | AFSVL_ENTDELETED 	= 363526,	/* Entry is deleted (soft delete) */ | 
|  | 25 | AFSVL_BADNAME 		= 363527,	/* Volume name is illegal */ | 
|  | 26 | AFSVL_BADINDEX 		= 363528,	/* Index is out of range */ | 
|  | 27 | AFSVL_BADVOLTYPE 	= 363529,	/* Bad volume type */ | 
|  | 28 | AFSVL_BADSERVER 	= 363530,	/* Illegal server number (out of range) */ | 
|  | 29 | AFSVL_BADPARTITION 	= 363531,	/* Bad partition number */ | 
|  | 30 | AFSVL_REPSFULL 		= 363532,	/* Run out of space for Replication sites */ | 
|  | 31 | AFSVL_NOREPSERVER 	= 363533,	/* No such Replication server site exists */ | 
|  | 32 | AFSVL_DUPREPSERVER 	= 363534,	/* Replication site already exists */ | 
|  | 33 | AFSVL_RWNOTFOUND 	= 363535,	/* Parent R/W entry not found */ | 
|  | 34 | AFSVL_BADREFCOUNT 	= 363536,	/* Illegal Reference Count number */ | 
|  | 35 | AFSVL_SIZEEXCEEDED 	= 363537,	/* Vl size for attributes exceeded */ | 
|  | 36 | AFSVL_BADENTRY 		= 363538,	/* Bad incoming vl entry */ | 
|  | 37 | AFSVL_BADVOLIDBUMP 	= 363539,	/* Illegal max volid increment */ | 
|  | 38 | AFSVL_IDALREADYHASHED 	= 363540,	/* RO/BACK id already hashed */ | 
|  | 39 | AFSVL_ENTRYLOCKED 	= 363541,	/* Vl entry is already locked */ | 
|  | 40 | AFSVL_BADVOLOPER 	= 363542,	/* Bad volume operation code */ | 
|  | 41 | AFSVL_BADRELLOCKTYPE 	= 363543,	/* Bad release lock type */ | 
|  | 42 | AFSVL_RERELEASE 	= 363544,	/* Status report: last release was aborted */ | 
|  | 43 | AFSVL_BADSERVERFLAG 	= 363545,	/* Invalid replication site server °ag */ | 
|  | 44 | AFSVL_PERM 		= 363546,	/* No permission access */ | 
|  | 45 | AFSVL_NOMEM 		= 363547,	/* malloc/realloc failed to alloc enough memory */ | 
|  | 46 | }; | 
|  | 47 |  | 
|  | 48 | /* maps to "struct vldbentry" in vvl-spec.pdf */ | 
|  | 49 | struct afs_vldbentry { | 
|  | 50 | char		name[65];		/* name of volume (including NUL char) */ | 
|  | 51 | afs_voltype_t	type;			/* volume type */ | 
|  | 52 | unsigned	num_servers;		/* num servers that hold instances of this vol */ | 
|  | 53 | unsigned	clone_id;		/* cloning ID */ | 
|  | 54 |  | 
|  | 55 | unsigned	flags; | 
|  | 56 | #define AFS_VLF_RWEXISTS	0x1000		/* R/W volume exists */ | 
|  | 57 | #define AFS_VLF_ROEXISTS	0x2000		/* R/O volume exists */ | 
|  | 58 | #define AFS_VLF_BACKEXISTS	0x4000		/* backup volume exists */ | 
|  | 59 |  | 
|  | 60 | afs_volid_t	volume_ids[3];		/* volume IDs */ | 
|  | 61 |  | 
|  | 62 | struct { | 
|  | 63 | struct in_addr	addr;		/* server address */ | 
|  | 64 | unsigned	partition;	/* partition ID on this server */ | 
|  | 65 | unsigned	flags;		/* server specific flags */ | 
|  | 66 | #define AFS_VLSF_NEWREPSITE	0x0001	/* unused */ | 
|  | 67 | #define AFS_VLSF_ROVOL		0x0002	/* this server holds a R/O instance of the volume */ | 
|  | 68 | #define AFS_VLSF_RWVOL		0x0004	/* this server holds a R/W instance of the volume */ | 
|  | 69 | #define AFS_VLSF_BACKVOL	0x0008	/* this server holds a backup instance of the volume */ | 
|  | 70 | } servers[8]; | 
|  | 71 |  | 
|  | 72 | }; | 
|  | 73 |  | 
|  | 74 | /* look up a volume location database entry by name */ | 
|  | 75 | extern int afs_rxvl_get_entry_by_name(struct afs_server *server, | 
|  | 76 | const char *volname, | 
|  | 77 | unsigned volnamesz, | 
|  | 78 | struct afs_cache_vlocation *entry); | 
|  | 79 |  | 
|  | 80 | /* look up a volume location database entry by ID */ | 
|  | 81 | extern int afs_rxvl_get_entry_by_id(struct afs_server *server, | 
|  | 82 | afs_volid_t	volid, | 
|  | 83 | afs_voltype_t voltype, | 
|  | 84 | struct afs_cache_vlocation *entry); | 
|  | 85 |  | 
|  | 86 | extern int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op, | 
|  | 87 | afs_volid_t volid, | 
|  | 88 | afs_voltype_t voltype); | 
|  | 89 |  | 
|  | 90 | extern int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op, | 
|  | 91 | struct afs_cache_vlocation *entry); | 
|  | 92 |  | 
|  | 93 | #endif /* _LINUX_AFS_VLCLIENT_H */ |