diff options
author | Sage Weil <sage@inktank.com> | 2013-03-25 18:26:14 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 06:17:14 +0200 |
commit | 27859f9773e4a0b2042435b13400ee2c891a61f4 (patch) | |
tree | 28b8e7133959c88f4de89cc98eee2016874b1ca6 /net/ceph/auth.c | |
parent | libceph: add update_authorizer auth method (diff) | |
download | linux-27859f9773e4a0b2042435b13400ee2c891a61f4.tar.xz linux-27859f9773e4a0b2042435b13400ee2c891a61f4.zip |
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) return 0; return ac->ops->is_authenticated(ac); } +EXPORT_SYMBOL(ceph_auth_is_authenticated); + +int ceph_auth_create_authorizer(struct ceph_auth_client *ac, + int peer_type, + struct ceph_auth_handshake *auth) +{ + if (ac->ops && ac->ops->create_authorizer) + return ac->ops->create_authorizer(ac, peer_type, auth); + return 0; +} +EXPORT_SYMBOL(ceph_auth_create_authorizer); + +void ceph_auth_destroy_authorizer(struct ceph_auth_client *ac, + struct ceph_authorizer *a) +{ + if (ac->ops && ac->ops->destroy_authorizer) + ac->ops->destroy_authorizer(ac, a); +} +EXPORT_SYMBOL(ceph_auth_destroy_authorizer); + +int ceph_auth_update_authorizer(struct ceph_auth_client *ac, + int peer_type, + struct ceph_auth_handshake *a) +{ + int ret = 0; + + if (ac->ops && ac->ops->update_authorizer) + ret = ac->ops->update_authorizer(ac, peer_type, a); + return ret; +} +EXPORT_SYMBOL(ceph_auth_update_authorizer); + +int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, + struct ceph_authorizer *a, size_t len) +{ + if (ac->ops && ac->ops->verify_authorizer_reply) + return ac->ops->verify_authorizer_reply(ac, a, len); + return 0; +} +EXPORT_SYMBOL(ceph_auth_verify_authorizer_reply); + +void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, int peer_type) +{ + if (ac->ops && ac->ops->invalidate_authorizer) + ac->ops->invalidate_authorizer(ac, peer_type); +} +EXPORT_SYMBOL(ceph_auth_invalidate_authorizer); |