diff options
Diffstat (limited to 'include/linux/sunrpc/auth.h')
-rw-r--r-- | include/linux/sunrpc/auth.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 534cdc7be58d..7a69ca3bebaf 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/sunrpc/xdr.h> | 16 | #include <linux/sunrpc/xdr.h> |
17 | 17 | ||
18 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
19 | #include <linux/rcupdate.h> | ||
19 | 20 | ||
20 | /* size of the nodename buffer */ | 21 | /* size of the nodename buffer */ |
21 | #define UNX_MAXNODENAME 32 | 22 | #define UNX_MAXNODENAME 32 |
@@ -30,22 +31,28 @@ struct auth_cred { | |||
30 | /* | 31 | /* |
31 | * Client user credentials | 32 | * Client user credentials |
32 | */ | 33 | */ |
34 | struct rpc_auth; | ||
35 | struct rpc_credops; | ||
33 | struct rpc_cred { | 36 | struct rpc_cred { |
34 | struct hlist_node cr_hash; /* hash chain */ | 37 | struct hlist_node cr_hash; /* hash chain */ |
35 | struct rpc_credops * cr_ops; | 38 | struct list_head cr_lru; /* lru garbage collection */ |
36 | unsigned long cr_expire; /* when to gc */ | 39 | struct rcu_head cr_rcu; |
37 | atomic_t cr_count; /* ref count */ | 40 | struct rpc_auth * cr_auth; |
38 | unsigned short cr_flags; /* various flags */ | 41 | const struct rpc_credops *cr_ops; |
39 | #ifdef RPC_DEBUG | 42 | #ifdef RPC_DEBUG |
40 | unsigned long cr_magic; /* 0x0f4aa4f0 */ | 43 | unsigned long cr_magic; /* 0x0f4aa4f0 */ |
41 | #endif | 44 | #endif |
45 | unsigned long cr_expire; /* when to gc */ | ||
46 | unsigned long cr_flags; /* various flags */ | ||
47 | atomic_t cr_count; /* ref count */ | ||
42 | 48 | ||
43 | uid_t cr_uid; | 49 | uid_t cr_uid; |
44 | 50 | ||
45 | /* per-flavor data */ | 51 | /* per-flavor data */ |
46 | }; | 52 | }; |
47 | #define RPCAUTH_CRED_NEW 0x0001 | 53 | #define RPCAUTH_CRED_NEW 0 |
48 | #define RPCAUTH_CRED_UPTODATE 0x0002 | 54 | #define RPCAUTH_CRED_UPTODATE 1 |
55 | #define RPCAUTH_CRED_HASHED 2 | ||
49 | 56 | ||
50 | #define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 | 57 | #define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 |
51 | 58 | ||
@@ -56,10 +63,10 @@ struct rpc_cred { | |||
56 | #define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1) | 63 | #define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1) |
57 | struct rpc_cred_cache { | 64 | struct rpc_cred_cache { |
58 | struct hlist_head hashtable[RPC_CREDCACHE_NR]; | 65 | struct hlist_head hashtable[RPC_CREDCACHE_NR]; |
59 | unsigned long nextgc; /* next garbage collection */ | 66 | spinlock_t lock; |
60 | unsigned long expire; /* cache expiry interval */ | ||
61 | }; | 67 | }; |
62 | 68 | ||
69 | struct rpc_authops; | ||
63 | struct rpc_auth { | 70 | struct rpc_auth { |
64 | unsigned int au_cslack; /* call cred size estimate */ | 71 | unsigned int au_cslack; /* call cred size estimate */ |
65 | /* guess at number of u32's auth adds before | 72 | /* guess at number of u32's auth adds before |
@@ -69,7 +76,7 @@ struct rpc_auth { | |||
69 | unsigned int au_verfsize; | 76 | unsigned int au_verfsize; |
70 | 77 | ||
71 | unsigned int au_flags; /* various flags */ | 78 | unsigned int au_flags; /* various flags */ |
72 | struct rpc_authops * au_ops; /* operations */ | 79 | const struct rpc_authops *au_ops; /* operations */ |
73 | rpc_authflavor_t au_flavor; /* pseudoflavor (note may | 80 | rpc_authflavor_t au_flavor; /* pseudoflavor (note may |
74 | * differ from the flavor in | 81 | * differ from the flavor in |
75 | * au_ops->au_flavor in gss | 82 | * au_ops->au_flavor in gss |
@@ -115,17 +122,19 @@ struct rpc_credops { | |||
115 | void *, __be32 *, void *); | 122 | void *, __be32 *, void *); |
116 | }; | 123 | }; |
117 | 124 | ||
118 | extern struct rpc_authops authunix_ops; | 125 | extern const struct rpc_authops authunix_ops; |
119 | extern struct rpc_authops authnull_ops; | 126 | extern const struct rpc_authops authnull_ops; |
120 | #ifdef CONFIG_SUNRPC_SECURE | 127 | |
121 | extern struct rpc_authops authdes_ops; | 128 | void __init rpc_init_authunix(void); |
122 | #endif | 129 | void __init rpcauth_init_module(void); |
130 | void __exit rpcauth_remove_module(void); | ||
123 | 131 | ||
124 | int rpcauth_register(struct rpc_authops *); | 132 | int rpcauth_register(const struct rpc_authops *); |
125 | int rpcauth_unregister(struct rpc_authops *); | 133 | int rpcauth_unregister(const struct rpc_authops *); |
126 | struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); | 134 | struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); |
127 | void rpcauth_destroy(struct rpc_auth *); | 135 | void rpcauth_release(struct rpc_auth *); |
128 | struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); | 136 | struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); |
137 | void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); | ||
129 | struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); | 138 | struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); |
130 | struct rpc_cred * rpcauth_bindcred(struct rpc_task *); | 139 | struct rpc_cred * rpcauth_bindcred(struct rpc_task *); |
131 | void rpcauth_holdcred(struct rpc_task *); | 140 | void rpcauth_holdcred(struct rpc_task *); |
@@ -138,8 +147,9 @@ int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, | |||
138 | int rpcauth_refreshcred(struct rpc_task *); | 147 | int rpcauth_refreshcred(struct rpc_task *); |
139 | void rpcauth_invalcred(struct rpc_task *); | 148 | void rpcauth_invalcred(struct rpc_task *); |
140 | int rpcauth_uptodatecred(struct rpc_task *); | 149 | int rpcauth_uptodatecred(struct rpc_task *); |
141 | int rpcauth_init_credcache(struct rpc_auth *, unsigned long); | 150 | int rpcauth_init_credcache(struct rpc_auth *); |
142 | void rpcauth_free_credcache(struct rpc_auth *); | 151 | void rpcauth_destroy_credcache(struct rpc_auth *); |
152 | void rpcauth_clear_credcache(struct rpc_cred_cache *); | ||
143 | 153 | ||
144 | static inline | 154 | static inline |
145 | struct rpc_cred * get_rpccred(struct rpc_cred *cred) | 155 | struct rpc_cred * get_rpccred(struct rpc_cred *cred) |