[sheepdog] [PATCH] util: rename set_trimmed_sectors as untrim_zero_sectors

Liu Yuan namei.unix at gmail.com
Tue Jan 22 09:22:29 CET 2013


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

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 collie/common.c |    2 +-
 collie/vdi.c    |    4 ++--
 include/util.h  |    2 +-
 lib/util.c      |    4 ++--
 sheep/gateway.c |    2 +-
 sheep/ops.c     |    2 +-
 sheep/store.c   |    2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/collie/common.c b/collie/common.c
index e709964..29f7dae 100644
--- a/collie/common.c
+++ b/collie/common.c
@@ -77,7 +77,7 @@ int sd_read_object(uint64_t oid, void *data, unsigned int datalen,
 		return rsp->result;
 	}
 
-	set_trimmed_sectors(data, rsp->obj.offset, rsp->data_length, datalen);
+	untrim_zero_sectors(data, rsp->obj.offset, rsp->data_length, datalen);
 
 	return SD_RES_SUCCESS;
 }
diff --git a/collie/vdi.c b/collie/vdi.c
index 2547bd7..b5af7a9 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -327,7 +327,7 @@ static void parse_objs(uint64_t oid, obj_parser_func_t func, void *data, unsigne
 		if (ret)
 			fprintf(stderr, "Failed to connect to %s\n", name);
 		else {
-			set_trimmed_sectors(buf, rsp->obj.offset,
+			untrim_zero_sectors(buf, rsp->obj.offset,
 					    rsp->data_length, size);
 			cb_ret = func(name, oid, rsp, buf, data);
 			if (cb_ret)
@@ -1401,7 +1401,7 @@ static void *read_object_from(const struct sd_vnode *vnode, uint64_t oid)
 
 	switch (rsp->result)  {
 	case SD_RES_SUCCESS:
-		set_trimmed_sectors(buf, rsp->obj.offset, rsp->data_length,
+		untrim_zero_sectors(buf, rsp->obj.offset, rsp->data_length,
 				    SD_DATA_OBJ_SIZE);
 		break;
 	case SD_RES_NO_OBJ:
diff --git a/include/util.h b/include/util.h
index bebef6a..01de542 100644
--- a/include/util.h
+++ b/include/util.h
@@ -85,7 +85,7 @@ extern int rmdir_r(char *dir_path);
 extern bool is_numeric(const char *p);
 
 void trim_zero_sectors(void *buf, uint64_t *offset, uint32_t *len);
-void set_trimmed_sectors(void *buf, uint64_t offset, uint32_t len,
+void untrim_zero_sectors(void *buf, uint64_t offset, uint32_t len,
 			 uint32_t requested_len);
 
 #ifdef assert
diff --git a/lib/util.c b/lib/util.c
index 0fc888f..c79ee46 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -316,8 +316,8 @@ void trim_zero_sectors(void *buf, uint64_t *offset, uint32_t *len)
 	}
 }
 
-/* Set trimmed zero sectors to the beginning and end of buffer */
-void set_trimmed_sectors(void *buf, uint64_t offset, uint32_t len,
+/* Untrim zero sectors to the beginning and end of buffer */
+void untrim_zero_sectors(void *buf, uint64_t offset, uint32_t len,
 			 uint32_t requested_len)
 {
 	uint8_t *p = buf;
diff --git a/sheep/gateway.c b/sheep/gateway.c
index 33fad42..3bca273 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -87,7 +87,7 @@ out:
 	if (ret == SD_RES_SUCCESS &&
 	    req->rq.proto_ver < SD_PROTO_VER_TRIM_ZERO_SECTORS) {
 		/* the client doesn't support trimming zero bytes */
-		set_trimmed_sectors(req->data, req->rp.obj.offset,
+		untrim_zero_sectors(req->data, req->rp.obj.offset,
 				    req->rp.data_length, req->rq.data_length);
 		req->rp.data_length = req->rq.data_length;
 		req->rp.obj.offset = 0;
diff --git a/sheep/ops.c b/sheep/ops.c
index 3cdadfb..c4bd41c 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -761,7 +761,7 @@ static int read_copy_from_replica(struct request *req, uint32_t epoch,
 	ret = gateway_read_obj(&read_req);
 
 	if (ret == SD_RES_SUCCESS)
-		set_trimmed_sectors(buf, rsp->obj.offset, rsp->data_length,
+		untrim_zero_sectors(buf, rsp->obj.offset, rsp->data_length,
 				    SD_DATA_OBJ_SIZE);
 
 	return ret;
diff --git a/sheep/store.c b/sheep/store.c
index 6a1e010..b0dc7e7 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -453,7 +453,7 @@ int read_backend_object(uint64_t oid, char *data, unsigned int datalen,
 	if (ret != SD_RES_SUCCESS)
 		eprintf("failed to read object %" PRIx64 ", %x\n", oid, ret);
 
-	set_trimmed_sectors(data, rsp->obj.offset, rsp->data_length, datalen);
+	untrim_zero_sectors(data, rsp->obj.offset, rsp->data_length, datalen);
 
 	return ret;
 }
-- 
1.7.9.5




More information about the sheepdog mailing list