All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Fuller <dfuller@redhat.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH RFC 1/6] Add support for userspace ceph DECODE_START.
Date: Tue, 30 Jun 2015 13:27:56 -0700	[thread overview]
Message-ID: <3f553015bc14a3ed984ba62b5237c05f3f236714.1435695881.git.dfuller@redhat.com> (raw)
In-Reply-To: <cover.1435695881.git.dfuller@redhat.com>
In-Reply-To: <cover.1435695881.git.dfuller@redhat.com>

From: Mike Christie <michaelc@cs.wisc.edu>

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
 include/linux/ceph/decode.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index a6ef9cc..b55c7fd 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -255,5 +255,28 @@ static inline void ceph_encode_string(void **p, void *end,
 		ceph_encode_string(p, end, s, n);		\
 	} while (0)
 
+/**
+ * ceph_start_decoding - start a decoding block
+ * @p: buffer to decode
+ * @end: end of buffer
+ * @curr_ver: current version of the encoding that the code supports/encode
+ * @len: buffer to return len of data in buffer
+ */
+static inline int ceph_start_decoding(void **p, void *end, u8 curr_ver,
+				      u32 *len)
+{
+	u8 struct_ver, struct_compat;
+
+	ceph_decode_8_safe(p, end, struct_ver, fail);
+	ceph_decode_8_safe(p, end, struct_compat, fail);
+
+	if (curr_ver < struct_compat)
+		return -EINVAL;
+
+	ceph_decode_32_safe(p, end, *len, fail);
+	return 0;
+fail:
+	return -ERANGE;
+}
 
 #endif
-- 
1.9.3


  reply	other threads:[~2015-06-30 20:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 20:27 [PATCH RFC 0/6] Support rados locking Douglas Fuller
2015-06-30 20:27 ` Douglas Fuller [this message]
2015-06-30 20:27 ` [PATCH RFC 2/6] ceph: add start/finish encoding helpers Douglas Fuller
2015-06-30 20:27 ` [PATCH RFC 3/6] auth.c: added ceph_entity_name_encode Douglas Fuller
2015-06-30 20:27 ` [PATCH RFC 4/6] osd_client: added single object method call Douglas Fuller
2015-06-30 20:28 ` [PATCH RFC 5/6] cls_lock: add rados locking Douglas Fuller
2015-06-30 20:28 ` [PATCH RFC 6/6] cls_lock: add support for lock_info Douglas Fuller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f553015bc14a3ed984ba62b5237c05f3f236714.1435695881.git.dfuller@redhat.com \
    --to=dfuller@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.