[Sheepdog] [PATCH 3/3] sheepdog: add protocol version to the request header

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon May 10 00:44:28 CEST 2010


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 block/sheepdog.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index e3a94b4..89f1ccb 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -12,6 +12,8 @@
 #include "qemu_socket.h"
 #include "block_int.h"
 
+#define SD_PROTO_VER 0x01
+
 #define SD_DEFAULT_ADDR "localhost:7000"
 
 #define SD_OP_CREATE_AND_WRITE_OBJ  0x01
@@ -47,6 +49,7 @@
 #define SD_RES_SHUTDOWN      0x11 /* Sheepdog is shutting down */
 #define SD_RES_NO_MEM        0x12 /* Cannot allocate memory */
 #define SD_RES_FULL_VDI      0x13 /* we already have the maximum vdis */
+#define SD_RES_VER_MISMATCH  0x14 /* Protocol version mismatch */
 
 /*
  * Object ID rules
@@ -778,6 +781,7 @@ static int find_vdi_name(struct bdrv_sd_state *s, char *filename, uint32_t snapi
 	snprintf(buf, sizeof(buf), "%s", filename);
 	hdr.opcode = SD_OP_GET_VDI_INFO;
 	wlen = SD_MAX_VDI_LEN;
+	hdr.proto_ver = SD_PROTO_VER;
 	hdr.data_length = SD_MAX_VDI_LEN;
 	hdr.snapid = snapid;
 	hdr.flags = SD_FLAG_CMD_WRITE;
@@ -1111,6 +1115,7 @@ static int sd_claim(BlockDriverState *bs)
 	memset(&hdr, 0, sizeof(hdr));
 	hdr.opcode = SD_OP_LOCK_VDI;
 	wlen = SD_MAX_VDI_LEN;
+	hdr.proto_ver = SD_PROTO_VER;
 	hdr.data_length = SD_MAX_VDI_LEN;
 	hdr.snapid = CURRENT_VDI_ID;
 	hdr.flags = SD_FLAG_CMD_WRITE;
-- 
1.5.6.5




More information about the sheepdog mailing list