[AF_RXRPC]: Add an interface to the AF_RXRPC module for the AFS filesystem to use
[firefly-linux-kernel-4.4.55.git] / fs / afs / cell.h
1 /* 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 AFS_CELL_H
13 #define 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  * entry in the cached cell catalogue
24  */
25 struct afs_cache_cell {
26         char                    name[64];       /* cell name (padded with NULs) */
27         struct in_addr          vl_servers[15]; /* cached cell VL servers */
28 };
29
30 /*
31  * AFS cell record
32  */
33 struct afs_cell {
34         atomic_t                usage;
35         struct list_head        link;           /* main cell list link */
36         struct list_head        proc_link;      /* /proc cell list link */
37         struct proc_dir_entry   *proc_dir;      /* /proc dir for this cell */
38 #ifdef AFS_CACHING_SUPPORT
39         struct cachefs_cookie   *cache;         /* caching cookie */
40 #endif
41
42         /* server record management */
43         rwlock_t                sv_lock;        /* active server list lock */
44         struct list_head        sv_list;        /* active server list */
45         struct list_head        sv_graveyard;   /* inactive server list */
46         spinlock_t              sv_gylock;      /* inactive server list lock */
47
48         /* volume location record management */
49         struct rw_semaphore     vl_sem;         /* volume management serialisation semaphore */
50         struct list_head        vl_list;        /* cell's active VL record list */
51         struct list_head        vl_graveyard;   /* cell's inactive VL record list */
52         spinlock_t              vl_gylock;      /* graveyard lock */
53         unsigned short          vl_naddrs;      /* number of VL servers in addr list */
54         unsigned short          vl_curr_svix;   /* current server index */
55         struct in_addr          vl_addrs[AFS_CELL_MAX_ADDRS];   /* cell VL server addresses */
56
57         char                    name[0];        /* cell name - must go last */
58 };
59
60 extern int afs_cell_init(char *);
61 extern int afs_cell_create(const char *, char *, struct afs_cell **);
62 extern int afs_cell_lookup(const char *, unsigned, struct afs_cell **);
63
64 #define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
65
66 extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **);
67 extern void afs_put_cell(struct afs_cell *);
68 extern void afs_cell_purge(void);
69
70 #endif /* AFS_CELL_H */