aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-16 16:16:39 -0400
committerAlex Elder <elder@dreamhost.com>2012-05-17 09:18:13 -0400
commita3530df33eb91d787d08c7383a0a9982690e42d0 (patch)
tree3022fc82ea661654bfca48fae32a7a1584dba1e8 /fs/ceph/mds_client.c
parenta255651d4cad89f1a606edd36135af892ada4f20 (diff)
ceph: have get_authorizer methods return pointers
Have the get_authorizer auth_client method return a ceph_auth pointer rather than an integer, pointer-encoding any returned error value. This is to pave the way for making use of the returned value in an upcoming patch. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 462281742ae..67938a9d049 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -3395,15 +3395,20 @@ out:
3395/* 3395/*
3396 * authentication 3396 * authentication
3397 */ 3397 */
3398static int get_authorizer(struct ceph_connection *con, 3398
3399 void **buf, int *len, int *proto, 3399/*
3400 void **reply_buf, int *reply_len, int force_new) 3400 * Note: returned pointer is the address of a structure that's
3401 * managed separately. Caller must *not* attempt to free it.
3402 */
3403static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con,
3404 void **buf, int *len, int *proto,
3405 void **reply_buf, int *reply_len,
3406 int force_new)
3401{ 3407{
3402 struct ceph_mds_session *s = con->private; 3408 struct ceph_mds_session *s = con->private;
3403 struct ceph_mds_client *mdsc = s->s_mdsc; 3409 struct ceph_mds_client *mdsc = s->s_mdsc;
3404 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; 3410 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
3405 struct ceph_auth_handshake *auth = &s->s_auth; 3411 struct ceph_auth_handshake *auth = &s->s_auth;
3406 int ret = 0;
3407 3412
3408 if (force_new && auth->authorizer) { 3413 if (force_new && auth->authorizer) {
3409 if (ac->ops && ac->ops->destroy_authorizer) 3414 if (ac->ops && ac->ops->destroy_authorizer)
@@ -3411,9 +3416,10 @@ static int get_authorizer(struct ceph_connection *con,
3411 auth->authorizer = NULL; 3416 auth->authorizer = NULL;
3412 } 3417 }
3413 if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) { 3418 if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) {
3414 ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS, auth); 3419 int ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS,
3420 auth);
3415 if (ret) 3421 if (ret)
3416 return ret; 3422 return ERR_PTR(ret);
3417 } 3423 }
3418 3424
3419 *proto = ac->protocol; 3425 *proto = ac->protocol;
@@ -3422,7 +3428,7 @@ static int get_authorizer(struct ceph_connection *con,
3422 *reply_buf = auth->authorizer_reply_buf; 3428 *reply_buf = auth->authorizer_reply_buf;
3423 *reply_len = auth->authorizer_reply_buf_len; 3429 *reply_len = auth->authorizer_reply_buf_len;
3424 3430
3425 return 0; 3431 return auth;
3426} 3432}
3427 3433
3428 3434