Linux 2.6.14.1
[linux/fpc-iii.git] / fs / afs / cell.h
blob48349108fb00ef7f170a00d62e98f92bcbdc61fb
1 /* cell.h: AFS cell record
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
12 #ifndef _LINUX_AFS_CELL_H
13 #define _LINUX_AFS_CELL_H
15 #include "types.h"
16 #include "cache.h"
18 #define AFS_CELL_MAX_ADDRS 15
20 extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */
22 /*****************************************************************************/
24 * entry in the cached cell catalogue
26 struct afs_cache_cell
28 char name[64]; /* cell name (padded with NULs) */
29 struct in_addr vl_servers[15]; /* cached cell VL servers */
32 /*****************************************************************************/
34 * AFS cell record
36 struct afs_cell
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
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 */
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 */
61 char name[0]; /* cell name - must go last */
64 extern int afs_cell_init(char *rootcell);
66 extern int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell);
68 extern int afs_cell_lookup(const char *name, unsigned nmsize, struct afs_cell **_cell);
70 #define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
72 extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell);
74 extern void afs_put_cell(struct afs_cell *cell);
76 extern void afs_cell_purge(void);
78 #endif /* _LINUX_AFS_CELL_H */