[RFC,3/6] auth.c: added ceph_entity_name_encode
diff mbox

Message ID 6a61ab4e809ccaa6aee711abf727ce0cdda26db8.1435695881.git.dfuller@redhat.com
State New
Headers show

Commit Message

Douglas Fuller June 30, 2015, 8:27 p.m. UTC
Signed-off-by: Douglas Fuller <dfuller@redhat.com>
---
 include/linux/ceph/auth.h |  2 ++
 net/ceph/auth.c           | 11 +++++++++++
 2 files changed, 13 insertions(+)

Patch
diff mbox

diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index 260d78b..7687918 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -104,6 +104,8 @@  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);
+extern int ceph_entity_name_decode(struct ceph_entity_name *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 6b923bc..50baee6 100644
--- a/net/ceph/auth.c
+++ b/net/ceph/auth.c
@@ -94,6 +94,17 @@  int ceph_entity_name_encode(const char *name, void **p, void *end)
 	return 0;
 }
 
+int ceph_entity_name_decode(struct ceph_entity_name *name, void **p, void *end)
+{
+	ceph_decode_8_safe(p, end, name->type, bad);
+	ceph_decode_64_safe(p, end, name->num, bad);
+
+	return 0;
+
+bad:
+	return -ERANGE;
+}
+
 /*
  * Initiate protocol negotiation with monitor.  Include entity name
  * and list supported protocols.