diff options
author | Sage Weil <sage@inktank.com> | 2013-03-25 13:26:14 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:17:14 -0400 |
commit | 27859f9773e4a0b2042435b13400ee2c891a61f4 (patch) | |
tree | 28b8e7133959c88f4de89cc98eee2016874b1ca6 /net/ceph/auth.c | |
parent | 0bed9b5c523d577378b6f83eab5835fe30c27208 (diff) |
libceph: wrap auth ops in wrapper functions
Use wrapper functions that check whether the auth op exists so that callers
do not need a bunch of conditional checks. Simplifies the external
interface.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'net/ceph/auth.c')
-rw-r--r-- | net/ceph/auth.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/net/ceph/auth.c b/net/ceph/auth.c index b4bf4ac090f1..a22de543cedb 100644 --- a/net/ceph/auth.c +++ b/net/ceph/auth.c | |||
@@ -257,3 +257,50 @@ int ceph_auth_is_authenticated(struct ceph_auth_client *ac) | |||
257 | return 0; | 257 | return 0; |
258 | return ac->ops->is_authenticated(ac); | 258 | return ac->ops->is_authenticated(ac); |
259 | } | 259 | } |
260 | EXPORT_SYMBOL(ceph_auth_is_authenticated); | ||
261 | |||
262 | int ceph_auth_create_authorizer(struct ceph_auth_client *ac, | ||
263 | int peer_type, | ||
264 | struct ceph_auth_handshake *auth) | ||
265 | { | ||
266 | if (ac->ops && ac->ops->create_authorizer) | ||
267 | return ac->ops->create_authorizer(ac, peer_type, auth); | ||
268 | return 0; | ||
269 | } | ||
270 | EXPORT_SYMBOL(ceph_auth_create_authorizer); | ||
271 | |||
272 | void ceph_auth_destroy_authorizer(struct ceph_auth_client *ac, | ||
273 | struct ceph_authorizer *a) | ||
274 | { | ||
275 | if (ac->ops && ac->ops->destroy_authorizer) | ||
276 | ac->ops->destroy_authorizer(ac, a); | ||
277 | } | ||
278 | EXPORT_SYMBOL(ceph_auth_destroy_authorizer); | ||
279 | |||
280 | int ceph_auth_update_authorizer(struct ceph_auth_client *ac, | ||
281 | int peer_type, | ||
282 | struct ceph_auth_handshake *a) | ||
283 | { | ||
284 | int ret = 0; | ||
285 | |||
286 | if (ac->ops && ac->ops->update_authorizer) | ||
287 | ret = ac->ops->update_authorizer(ac, peer_type, a); | ||
288 | return ret; | ||
289 | } | ||
290 | EXPORT_SYMBOL(ceph_auth_update_authorizer); | ||
291 | |||
292 | int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, | ||
293 | struct ceph_authorizer *a, size_t len) | ||
294 | { | ||
295 | if (ac->ops && ac->ops->verify_authorizer_reply) | ||
296 | return ac->ops->verify_authorizer_reply(ac, a, len); | ||
297 | return 0; | ||
298 | } | ||
299 | EXPORT_SYMBOL(ceph_auth_verify_authorizer_reply); | ||
300 | |||
301 | void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, int peer_type) | ||
302 | { | ||
303 | if (ac->ops && ac->ops->invalidate_authorizer) | ||
304 | ac->ops->invalidate_authorizer(ac, peer_type); | ||
305 | } | ||
306 | EXPORT_SYMBOL(ceph_auth_invalidate_authorizer); | ||