[sheepdog] [PATCH v2] sheep: clean up SD_RES_xxx macros

Liu Yuan namei.unix at gmail.com
Fri Apr 12 09:22:15 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

Currently it is a little bit mix that we put SD_RES_xxx for collie
in sheepdog_proto.h but we put some SD_OP_xxx for collie in internal_proto.h.

Let's take a uniform view that take both inter-sheep and collie-sheep as
internal protocols. In this way, collie and QEMU won't share the same number
space to interfere with each other (QEMU is unaware of collie at all).

So the final number space is:

QEMU - sheep: use 1 to 80(inclusive) of number space
inter-sheep and collie - sheep: above 80 of number space

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 include/internal_proto.h |   10 +++++++++-
 include/sheepdog_proto.h |    8 --------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/internal_proto.h b/include/internal_proto.h
index 3f4abfe..159c0c2 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -31,7 +31,8 @@
 
 /*
  * Operations with opcodes above 0x80 are considered part of the inter-sheep
- * protocol and are versioned using SD_SHEEP_PROTO_VER instead of SD_PROTO_VER.
+ * include sheep-collie protocol and are versioned using SD_SHEEP_PROTO_VER
+ * instead of SD_PROTO_VER.
  *
  * These same applies for the above 0x80 flags and error values below.
  */
@@ -90,6 +91,13 @@
 #define SD_RES_NETWORK_ERROR 0x86 /* Network error between sheep */
 #define SD_RES_NO_CACHE      0x87 /* No cache object found */
 #define SD_RES_BUFFER_SMALL  0x88 /* The buffer is too small */
+#define SD_RES_FORCE_RECOVER    0x89 /* Users should not force recover this cluster */
+#define SD_RES_NO_STORE         0x8A /* No targeted backend store */
+#define SD_RES_NO_SUPPORT       0x8B /* Operation is not supported by backend store */
+#define SD_RES_NODE_IN_RECOVERY 0x8C /*	Targeted node is in recovery */
+#define SD_RES_KILLED           0x8D /* Node is killed */
+#define SD_RES_OID_EXIST        0x8E /* Object ID exists already */
+#define SD_RES_AGAIN            0x8F /* Ask to try again */
 
 #define SD_FLAG_NOHALT       0x0004 /* Serve the IO rquest even lack of nodes */
 #define SD_FLAG_QUORUM       0x0008 /* Serve the IO rquest as long we are quorate */
diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index 94baede..f3d69e1 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -68,14 +68,6 @@
 #define SD_RES_WAIT_FOR_JOIN    0x17 /* Sheepdog is waiting for other nodes joining */
 #define SD_RES_JOIN_FAILED   0x18 /* Target node had failed to join sheepdog */
 #define SD_RES_HALT 0x19 /* Sheepdog is stopped doing IO */
-#define SD_RES_FORCE_RECOVER    0x1A /* Users should not force recover this cluster */
-#define SD_RES_NO_STORE         0x20 /* No targeted backend store */
-#define SD_RES_NO_SUPPORT       0x21 /* Operation is not supported by backend store */
-#define SD_RES_NODE_IN_RECOVERY 0x22 /*	Targeted node is in recovery */
-/* #define SD_RES_OBJ_RECOVERING 0x23  Object is recovering */
-#define SD_RES_KILLED           0x24 /* Node is killed */
-#define SD_RES_OID_EXIST        0x25 /* Object ID exists already */
-#define SD_RES_AGAIN            0x26 /* Ask to try again */
 
 /* errors above 0x80 are sheepdog-internal */
 
-- 
1.7.9.5




More information about the sheepdog mailing list