[Sheepdog] [PATCH 2/5] support snapshot id

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Tue Jan 26 05:32:07 CET 2010


We use 0 for current. Note that qemu doesn't use zero as a snapshot
id.

Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 block/sheepdog.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index b6e5299..1ef970e 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -88,6 +88,8 @@
 
 #define SD_INODE_SIZE (sizeof(struct sd_inode))
 
+#define CURRENT_VDI_ID 0
+
 #undef eprintf
 #define eprintf(fmt, args...)						\
 do {									\
@@ -990,7 +992,7 @@ static int parse_vdiname(const char *filename, char *vdi, int vdi_len,
 		*p++ = '\0';
 		*tag = strtol(p, NULL, 16);
 	} else
-		*tag = -1; /* search current vdi */
+		*tag = CURRENT_VDI_ID; /* search current vdi */
 
 	free(q);
 
@@ -1323,7 +1325,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options)
 			return -1;
 
 		/* cannot clone from a current inode */
-		if (tag == -1)
+		if (tag == CURRENT_VDI_ID)
 			return -1;
 
 		ret = find_vdi_name(bs.opaque, vdi, tag, &oid, 1, NULL, &dummy);
@@ -1363,7 +1365,7 @@ static int sd_claim(BlockDriverState *bs)
 	hdr.opcode = SD_OP_LOCK_VDI;
 	wlen = strlen(s->name) + 1;
 	hdr.data_length = wlen;
-	hdr.tag = -1;
+	hdr.tag = CURRENT_VDI_ID;
 	hdr.flags = SD_FLAG_CMD_WRITE;
 	hdr.epoch = s_epoch;
 
-- 
1.5.6.5




More information about the sheepdog mailing list