diff mbox

[01/16] libceph: rename ceph_entity_name_encode() -> ceph_auth_entity_name_encode()

Message ID 1472044720-29116-2-git-send-email-idryomov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov Aug. 24, 2016, 1:18 p.m. UTC
Clear up EntityName vs entity_name_t confusion.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 include/linux/ceph/auth.h | 2 +-
 net/ceph/auth.c           | 7 +++++--
 net/ceph/auth_none.c      | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

Comments

Alex Elder Aug. 24, 2016, 6:49 p.m. UTC | #1
On 08/24/2016 08:18 AM, Ilya Dryomov wrote:
> Clear up EntityName vs entity_name_t confusion.

If I understand what your code does, you're using
"auth_entity_name" to represent whatever "EntityName"
is.  (At this point I'm just looking at the code; I
haven't gone to look at what an entity_name_t or
EntitnyName are...)

In any case, this looks good to me.

Reviewed-by: Alex Elder <elder@linaro.org>

> 
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
>  include/linux/ceph/auth.h | 2 +-
>  net/ceph/auth.c           | 7 +++++--
>  net/ceph/auth_none.c      | 2 +-
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
> index 1563265d2097..374bb1c4ef52 100644
> --- a/include/linux/ceph/auth.h
> +++ b/include/linux/ceph/auth.h
> @@ -104,7 +104,7 @@ extern int ceph_auth_build_hello(struct ceph_auth_client *ac,
>  extern int ceph_handle_auth_reply(struct ceph_auth_client *ac,
>  				  void *buf, size_t len,
>  				  void *reply_buf, size_t reply_len);
> -extern int ceph_entity_name_encode(const char *name, void **p, void *end);
> +int ceph_auth_entity_name_encode(const char *name, void **p, void *end);
>  
>  extern int ceph_build_auth(struct ceph_auth_client *ac,
>  		    void *msg_buf, size_t msg_len);
> diff --git a/net/ceph/auth.c b/net/ceph/auth.c
> index 2bc5965fdd1e..78067dda9d3c 100644
> --- a/net/ceph/auth.c
> +++ b/net/ceph/auth.c
> @@ -82,7 +82,10 @@ void ceph_auth_reset(struct ceph_auth_client *ac)
>  	mutex_unlock(&ac->mutex);
>  }
>  
> -int ceph_entity_name_encode(const char *name, void **p, void *end)
> +/*
> + * EntityName, not to be confused with entity_name_t
> + */
> +int ceph_auth_entity_name_encode(const char *name, void **p, void *end)
>  {
>  	int len = strlen(name);
>  
> @@ -124,7 +127,7 @@ int ceph_auth_build_hello(struct ceph_auth_client *ac, void *buf, size_t len)
>  	for (i = 0; i < num; i++)
>  		ceph_encode_32(&p, supported_protocols[i]);
>  
> -	ret = ceph_entity_name_encode(ac->name, &p, end);
> +	ret = ceph_auth_entity_name_encode(ac->name, &p, end);
>  	if (ret < 0)
>  		goto out;
>  	ceph_decode_need(&p, end, sizeof(u64), bad);
> diff --git a/net/ceph/auth_none.c b/net/ceph/auth_none.c
> index 5f836f02ae36..df45e467c81f 100644
> --- a/net/ceph/auth_none.c
> +++ b/net/ceph/auth_none.c
> @@ -46,7 +46,7 @@ static int ceph_auth_none_build_authorizer(struct ceph_auth_client *ac,
>  	int ret;
>  
>  	ceph_encode_8_safe(&p, end, 1, e_range);
> -	ret = ceph_entity_name_encode(ac->name, &p, end);
> +	ret = ceph_auth_entity_name_encode(ac->name, &p, end);
>  	if (ret < 0)
>  		return ret;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ilya Dryomov Aug. 24, 2016, 8:15 p.m. UTC | #2
On Wed, Aug 24, 2016 at 8:49 PM, Alex Elder <elder@ieee.org> wrote:
> On 08/24/2016 08:18 AM, Ilya Dryomov wrote:
>> Clear up EntityName vs entity_name_t confusion.
>
> If I understand what your code does, you're using
> "auth_entity_name" to represent whatever "EntityName"
> is.  (At this point I'm just looking at the code; I
> haven't gone to look at what an entity_name_t or
> EntitnyName are...)

Correct.  Those are two different types: EntityName is integer type
(osd, mds, etc) + string id ("0", "a", etc), while entity_name_t is
integer type + integer id.  One of Doug's patches indicated that he was
confused about the two and it took me a moment to disambiguate so
I went ahead and renamed the function.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index 1563265d2097..374bb1c4ef52 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -104,7 +104,7 @@  extern int ceph_auth_build_hello(struct ceph_auth_client *ac,
 extern int ceph_handle_auth_reply(struct ceph_auth_client *ac,
 				  void *buf, size_t len,
 				  void *reply_buf, size_t reply_len);
-extern int ceph_entity_name_encode(const char *name, void **p, void *end);
+int ceph_auth_entity_name_encode(const char *name, void **p, void *end);
 
 extern int ceph_build_auth(struct ceph_auth_client *ac,
 		    void *msg_buf, size_t msg_len);
diff --git a/net/ceph/auth.c b/net/ceph/auth.c
index 2bc5965fdd1e..78067dda9d3c 100644
--- a/net/ceph/auth.c
+++ b/net/ceph/auth.c
@@ -82,7 +82,10 @@  void ceph_auth_reset(struct ceph_auth_client *ac)
 	mutex_unlock(&ac->mutex);
 }
 
-int ceph_entity_name_encode(const char *name, void **p, void *end)
+/*
+ * EntityName, not to be confused with entity_name_t
+ */
+int ceph_auth_entity_name_encode(const char *name, void **p, void *end)
 {
 	int len = strlen(name);
 
@@ -124,7 +127,7 @@  int ceph_auth_build_hello(struct ceph_auth_client *ac, void *buf, size_t len)
 	for (i = 0; i < num; i++)
 		ceph_encode_32(&p, supported_protocols[i]);
 
-	ret = ceph_entity_name_encode(ac->name, &p, end);
+	ret = ceph_auth_entity_name_encode(ac->name, &p, end);
 	if (ret < 0)
 		goto out;
 	ceph_decode_need(&p, end, sizeof(u64), bad);
diff --git a/net/ceph/auth_none.c b/net/ceph/auth_none.c
index 5f836f02ae36..df45e467c81f 100644
--- a/net/ceph/auth_none.c
+++ b/net/ceph/auth_none.c
@@ -46,7 +46,7 @@  static int ceph_auth_none_build_authorizer(struct ceph_auth_client *ac,
 	int ret;
 
 	ceph_encode_8_safe(&p, end, 1, e_range);
-	ret = ceph_entity_name_encode(ac->name, &p, end);
+	ret = ceph_auth_entity_name_encode(ac->name, &p, end);
 	if (ret < 0)
 		return ret;