aboutsummaryrefslogtreecommitdiffstats
path: root/net
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:12 -0400
commit74f1869f76d043bad12ec03b4d5f04a8c3d1f157 (patch)
treefcce410d255e2660fc82532c70de1b2f60a956c6 /net
parent6c4a19158b96ea1fb8acbe0c1d5493d9dcd2f147 (diff)
ceph: messenger: reduce args to create_authorizer
Make use of the new ceph_auth_handshake structure in order to reduce the number of arguments passed to the create_authorizor method in ceph_auth_client_ops. Use a local variable of that type as a shorthand in the get_authorizer method definitions. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/auth_none.c15
-rw-r--r--net/ceph/auth_x.c15
-rw-r--r--net/ceph/osd_client.c28
3 files changed, 26 insertions, 32 deletions
diff --git a/net/ceph/auth_none.c b/net/ceph/auth_none.c
index 214c2bb43d62..925ca583c09c 100644
--- a/net/ceph/auth_none.c
+++ b/net/ceph/auth_none.c
@@ -59,9 +59,7 @@ static int handle_reply(struct ceph_auth_client *ac, int result,
59 */ 59 */
60static int ceph_auth_none_create_authorizer( 60static int ceph_auth_none_create_authorizer(
61 struct ceph_auth_client *ac, int peer_type, 61 struct ceph_auth_client *ac, int peer_type,
62 struct ceph_authorizer **a, 62 struct ceph_auth_handshake *auth)
63 void **buf, size_t *len,
64 void **reply_buf, size_t *reply_len)
65{ 63{
66 struct ceph_auth_none_info *ai = ac->private; 64 struct ceph_auth_none_info *ai = ac->private;
67 struct ceph_none_authorizer *au = &ai->au; 65 struct ceph_none_authorizer *au = &ai->au;
@@ -82,11 +80,12 @@ static int ceph_auth_none_create_authorizer(
82 dout("built authorizer len %d\n", au->buf_len); 80 dout("built authorizer len %d\n", au->buf_len);
83 } 81 }
84 82
85 *a = (struct ceph_authorizer *)au; 83 auth->authorizer = (struct ceph_authorizer *) au;
86 *buf = au->buf; 84 auth->authorizer_buf = au->buf;
87 *len = au->buf_len; 85 auth->authorizer_buf_len = au->buf_len;
88 *reply_buf = au->reply_buf; 86 auth->authorizer_reply_buf = au->reply_buf;
89 *reply_len = sizeof(au->reply_buf); 87 auth->authorizer_reply_buf_len = sizeof (au->reply_buf);
88
90 return 0; 89 return 0;
91 90
92bad2: 91bad2:
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index 1587dc6010c6..a16bf14eb027 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -526,9 +526,7 @@ static int ceph_x_handle_reply(struct ceph_auth_client *ac, int result,
526 526
527static int ceph_x_create_authorizer( 527static int ceph_x_create_authorizer(
528 struct ceph_auth_client *ac, int peer_type, 528 struct ceph_auth_client *ac, int peer_type,
529 struct ceph_authorizer **a, 529 struct ceph_auth_handshake *auth)
530 void **buf, size_t *len,
531 void **reply_buf, size_t *reply_len)
532{ 530{
533 struct ceph_x_authorizer *au; 531 struct ceph_x_authorizer *au;
534 struct ceph_x_ticket_handler *th; 532 struct ceph_x_ticket_handler *th;
@@ -548,11 +546,12 @@ static int ceph_x_create_authorizer(
548 return ret; 546 return ret;
549 } 547 }
550 548
551 *a = (struct ceph_authorizer *)au; 549 auth->authorizer = (struct ceph_authorizer *) au;
552 *buf = au->buf->vec.iov_base; 550 auth->authorizer_buf = au->buf->vec.iov_base;
553 *len = au->buf->vec.iov_len; 551 auth->authorizer_buf_len = au->buf->vec.iov_len;
554 *reply_buf = au->reply_buf; 552 auth->authorizer_reply_buf = au->reply_buf;
555 *reply_len = sizeof(au->reply_buf); 553 auth->authorizer_reply_buf_len = sizeof (au->reply_buf);
554
556 return 0; 555 return 0;
557} 556}
558 557
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 66b09d6a1531..2da4b9e97dc1 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -2115,29 +2115,25 @@ static int get_authorizer(struct ceph_connection *con,
2115 struct ceph_osd *o = con->private; 2115 struct ceph_osd *o = con->private;
2116 struct ceph_osd_client *osdc = o->o_osdc; 2116 struct ceph_osd_client *osdc = o->o_osdc;
2117 struct ceph_auth_client *ac = osdc->client->monc.auth; 2117 struct ceph_auth_client *ac = osdc->client->monc.auth;
2118 struct ceph_auth_handshake *auth = &o->o_auth;
2118 int ret = 0; 2119 int ret = 0;
2119 2120
2120 if (force_new && o->o_auth.authorizer) { 2121 if (force_new && auth->authorizer) {
2121 ac->ops->destroy_authorizer(ac, o->o_auth.authorizer); 2122 ac->ops->destroy_authorizer(ac, auth->authorizer);
2122 o->o_auth.authorizer = NULL; 2123 auth->authorizer = NULL;
2123 } 2124 }
2124 if (o->o_auth.authorizer == NULL) { 2125 if (auth->authorizer == NULL) {
2125 ret = ac->ops->create_authorizer( 2126 ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_OSD, auth);
2126 ac, CEPH_ENTITY_TYPE_OSD,
2127 &o->o_auth.authorizer,
2128 &o->o_auth.authorizer_buf,
2129 &o->o_auth.authorizer_buf_len,
2130 &o->o_auth.authorizer_reply_buf,
2131 &o->o_auth.authorizer_reply_buf_len);
2132 if (ret) 2127 if (ret)
2133 return ret; 2128 return ret;
2134 } 2129 }
2135 2130
2136 *proto = ac->protocol; 2131 *proto = ac->protocol;
2137 *buf = o->o_auth.authorizer_buf; 2132 *buf = auth->authorizer_buf;
2138 *len = o->o_auth.authorizer_buf_len; 2133 *len = auth->authorizer_buf_len;
2139 *reply_buf = o->o_auth.authorizer_reply_buf; 2134 *reply_buf = auth->authorizer_reply_buf;
2140 *reply_len = o->o_auth.authorizer_reply_buf_len; 2135 *reply_len = auth->authorizer_reply_buf_len;
2136
2141 return 0; 2137 return 0;
2142} 2138}
2143 2139