[sheepdog] [PATCH] farm: remove unnecessary casting

Liu Yuan namei.unix at gmail.com
Sat Jun 8 14:36:07 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 collie/farm/farm.c      |    2 +-
 collie/farm/farm.h      |    2 +-
 collie/farm/sha1_file.c |    2 +-
 collie/farm/snap.c      |    4 ++--
 collie/farm/trunk.c     |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/collie/farm/farm.c b/collie/farm/farm.c
index 7f895a7..c08a758 100644
--- a/collie/farm/farm.c
+++ b/collie/farm/farm.c
@@ -302,7 +302,7 @@ int farm_save_snapshot(const char *tag)
 
 	wq = create_work_queue("save snapshot", WQ_ORDERED);
 	if (for_each_object_in_tree(queue_save_snapshot_work,
-				    (void *)&trunk_buf) < 0)
+				    &trunk_buf) < 0)
 		goto out;
 
 	work_queue_wait(wq);
diff --git a/collie/farm/farm.h b/collie/farm/farm.h
index 58f7335..ecd76e4 100644
--- a/collie/farm/farm.h
+++ b/collie/farm/farm.h
@@ -62,7 +62,7 @@ int snap_log_write(uint32_t idx, const char *tag, unsigned char *sha1);
 
 /* sha1_file.c */
 bool sha1_file_exist(const unsigned char *sha1);
-int sha1_file_write(unsigned char *buf, size_t len, unsigned char *sha1);
+int sha1_file_write(void *buf, size_t len, unsigned char *sha1);
 void *sha1_file_read(const unsigned char *sha1, size_t *size);
 int get_sha1_hex(const char *hex, unsigned char *sha1);
 int sha1_file_try_delete(const unsigned char *sha1);
diff --git a/collie/farm/sha1_file.c b/collie/farm/sha1_file.c
index d8727b4..5acb1d8 100644
--- a/collie/farm/sha1_file.c
+++ b/collie/farm/sha1_file.c
@@ -155,7 +155,7 @@ bool sha1_file_exist(const unsigned char *sha1)
 	return (access(sha1_to_path(sha1), R_OK) == 0);
 }
 
-int sha1_file_write(unsigned char *buf, size_t len, unsigned char *outsha1)
+int sha1_file_write(void *buf, size_t len, unsigned char *outsha1)
 {
 	unsigned char sha1[SHA1_LEN];
 
diff --git a/collie/farm/snap.c b/collie/farm/snap.c
index a341cd1..14b8aac 100644
--- a/collie/farm/snap.c
+++ b/collie/farm/snap.c
@@ -112,7 +112,7 @@ out:
 struct snap_file *snap_file_read(unsigned char *sha1)
 {
 	size_t size;
-	return (struct snap_file *)sha1_file_read(sha1, &size);
+	return sha1_file_read(sha1, &size);
 }
 
 int snap_file_write(uint32_t idx, unsigned char *trunk_sha1,
@@ -122,6 +122,6 @@ int snap_file_write(uint32_t idx, unsigned char *trunk_sha1,
 	snap.idx = idx;
 	memcpy(snap.trunk_sha1, trunk_sha1, SHA1_LEN);
 
-	return sha1_file_write((void *)&snap, sizeof(struct snap_file),
+	return sha1_file_write(&snap, sizeof(struct snap_file),
 			       outsha1);
 }
diff --git a/collie/farm/trunk.c b/collie/farm/trunk.c
index 7d30f92..df1813b 100644
--- a/collie/farm/trunk.c
+++ b/collie/farm/trunk.c
@@ -32,7 +32,7 @@ int trunk_file_write(uint64_t nr_entries, struct trunk_entry *entries,
 		     unsigned char *trunk_sha1)
 {
 	size_t size = sizeof(struct trunk_entry) * nr_entries;
-	return sha1_file_write((void *)entries, size, trunk_sha1);
+	return sha1_file_write(entries, size, trunk_sha1);
 }
 
 struct trunk_file *trunk_file_read(unsigned char *sha1)
-- 
1.7.9.5




More information about the sheepdog mailing list