Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* cell.h: AFS cell record |
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_CELL_H | |
13 | #define _LINUX_AFS_CELL_H | |
14 | ||
15 | #include "types.h" | |
16 | #include "cache.h" | |
17 | ||
18 | #define AFS_CELL_MAX_ADDRS 15 | |
19 | ||
20 | extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */ | |
21 | ||
22 | /*****************************************************************************/ | |
23 | /* | |
24 | * entry in the cached cell catalogue | |
25 | */ | |
26 | struct afs_cache_cell | |
27 | { | |
28 | char name[64]; /* cell name (padded with NULs) */ | |
29 | struct in_addr vl_servers[15]; /* cached cell VL servers */ | |
30 | }; | |
31 | ||
32 | /*****************************************************************************/ | |
33 | /* | |
34 | * AFS cell record | |
35 | */ | |
36 | struct afs_cell | |
37 | { | |
38 | atomic_t usage; | |
39 | struct list_head link; /* main cell list link */ | |
40 | struct list_head proc_link; /* /proc cell list link */ | |
41 | struct proc_dir_entry *proc_dir; /* /proc dir for this cell */ | |
42 | #ifdef AFS_CACHING_SUPPORT | |
43 | struct cachefs_cookie *cache; /* caching cookie */ | |
44 | #endif | |
45 | ||
46 | /* server record management */ | |
47 | rwlock_t sv_lock; /* active server list lock */ | |
48 | struct list_head sv_list; /* active server list */ | |
49 | struct list_head sv_graveyard; /* inactive server list */ | |
50 | spinlock_t sv_gylock; /* inactive server list lock */ | |
51 | ||
52 | /* volume location record management */ | |
53 | struct rw_semaphore vl_sem; /* volume management serialisation semaphore */ | |
54 | struct list_head vl_list; /* cell's active VL record list */ | |
55 | struct list_head vl_graveyard; /* cell's inactive VL record list */ | |
56 | spinlock_t vl_gylock; /* graveyard lock */ | |
57 | unsigned short vl_naddrs; /* number of VL servers in addr list */ | |
58 | unsigned short vl_curr_svix; /* current server index */ | |
59 | struct in_addr vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */ | |
60 | ||
61 | char name[0]; /* cell name - must go last */ | |
62 | }; | |
63 | ||
64 | extern int afs_cell_init(char *rootcell); | |
65 | ||
66 | extern int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell); | |
67 | ||
68 | extern int afs_cell_lookup(const char *name, unsigned nmsize, struct afs_cell **_cell); | |
69 | ||
70 | #define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0) | |
71 | ||
72 | extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell); | |
73 | ||
74 | extern void afs_put_cell(struct afs_cell *cell); | |
75 | ||
76 | extern void afs_cell_purge(void); | |
77 | ||
78 | #endif /* _LINUX_AFS_CELL_H */ |