Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / linux / nfs_fs_sb.h
1 #ifndef _NFS_FS_SB
2 #define _NFS_FS_SB
3
4 #include <linux/list.h>
5 #include <linux/backing-dev.h>
6 #include <linux/fscache.h>
7
8 struct nfs_iostats;
9
10 /*
11  * The nfs_client identifies our client state to the server.
12  */
13 struct nfs_client {
14         atomic_t                cl_count;
15         int                     cl_cons_state;  /* current construction state (-ve: init error) */
16 #define NFS_CS_READY            0               /* ready to be used */
17 #define NFS_CS_INITING          1               /* busy initialising */
18         int                     cl_nfsversion;  /* NFS protocol version */
19         unsigned long           cl_res_state;   /* NFS resources state */
20 #define NFS_CS_RPCIOD           0               /* - rpciod started */
21 #define NFS_CS_CALLBACK         1               /* - callback started */
22 #define NFS_CS_IDMAP            2               /* - idmap started */
23 #define NFS_CS_RENEWD           3               /* - renewd started */
24         struct sockaddr_in      cl_addr;        /* server identifier */
25         char *                  cl_hostname;    /* hostname of server */
26         struct list_head        cl_share_link;  /* link in global client list */
27         struct list_head        cl_superblocks; /* List of nfs_server structs */
28
29         struct rpc_clnt *       cl_rpcclient;
30         const struct nfs_rpc_ops *rpc_ops;      /* NFS protocol vector */
31         unsigned long           retrans_timeo;  /* retransmit timeout */
32         unsigned int            retrans_count;  /* number of retransmit tries */
33
34 #ifdef CONFIG_NFS_V4
35         u64                     cl_clientid;    /* constant */
36         nfs4_verifier           cl_confirm;
37         unsigned long           cl_state;
38
39         u32                     cl_lockowner_id;
40
41         /*
42          * The following rwsem ensures exclusive access to the server
43          * while we recover the state following a lease expiration.
44          */
45         struct rw_semaphore     cl_sem;
46
47         struct list_head        cl_delegations;
48         struct list_head        cl_state_owners;
49         struct list_head        cl_unused;
50         int                     cl_nunused;
51         spinlock_t              cl_lock;
52
53         unsigned long           cl_lease_time;
54         unsigned long           cl_last_renewal;
55         struct work_struct      cl_renewd;
56
57         struct rpc_wait_queue   cl_rpcwaitq;
58
59         /* used for the setclientid verifier */
60         struct timespec         cl_boot_time;
61
62         /* idmapper */
63         struct idmap *          cl_idmap;
64
65         /* Our own IP address, as a null-terminated string.
66          * This is used to generate the clientid, and the callback address.
67          */
68         char                    cl_ipaddr[16];
69         unsigned char           cl_id_uniquifier;
70 #endif
71
72 #ifdef CONFIG_NFS_FSCACHE
73         struct fscache_cookie   *fscache;       /* client index cache cookie */
74 #endif
75 };
76
77 /*
78  * NFS client parameters stored in the superblock.
79  */
80 struct nfs_server {
81         struct nfs_client *     nfs_client;     /* shared client and NFS4 state */
82         struct list_head        client_link;    /* List of other nfs_server structs
83                                                  * that share the same client
84                                                  */
85         struct list_head        master_link;    /* link in master servers list */
86         struct rpc_clnt *       client;         /* RPC client handle */
87         struct rpc_clnt *       client_acl;     /* ACL RPC client handle */
88         struct nfs_iostats *    io_stats;       /* I/O statistics */
89         struct backing_dev_info backing_dev_info;
90         int                     flags;          /* various flags */
91         unsigned int            caps;           /* server capabilities */
92         unsigned int            rsize;          /* read size */
93         unsigned int            rpages;         /* read size (in pages) */
94         unsigned int            wsize;          /* write size */
95         unsigned int            wpages;         /* write size (in pages) */
96         unsigned int            wtmult;         /* server disk block size */
97         unsigned int            dtsize;         /* readdir size */
98         unsigned int            bsize;          /* server block size */
99         unsigned int            acregmin;       /* attr cache timeouts */
100         unsigned int            acregmax;
101         unsigned int            acdirmin;
102         unsigned int            acdirmax;
103         unsigned int            namelen;
104
105         struct nfs_fsid         fsid;
106         __u64                   maxfilesize;    /* maximum file size */
107         unsigned long           mount_time;     /* when this fs was mounted */
108         dev_t                   s_dev;          /* superblock dev numbers */
109
110 #ifdef CONFIG_NFS_V4
111         u32                     attr_bitmask[2];/* V4 bitmask representing the set
112                                                    of attributes supported on this
113                                                    filesystem */
114         u32                     acl_bitmask;    /* V4 bitmask representing the ACEs
115                                                    that are supported on this
116                                                    filesystem */
117 #endif
118         void (*destroy)(struct nfs_server *);
119 };
120
121 /* Server capabilities */
122 #define NFS_CAP_READDIRPLUS     (1U << 0)
123 #define NFS_CAP_HARDLINKS       (1U << 1)
124 #define NFS_CAP_SYMLINKS        (1U << 2)
125 #define NFS_CAP_ACLS            (1U << 3)
126 #define NFS_CAP_ATOMIC_OPEN     (1U << 4)
127
128 #endif