[sheepdog] [PATCH v2 4/8] move sheep specific headers out of sheepdog_proto.h

Liu Yuan namei.unix at gmail.com
Wed Apr 8 04:19:35 CEST 2015


From: Liu Yuan <liuyuan at cmss.chinamobile.com>

This is preparation patch for shared lib.

Signed-off-by: Liu Yuan <liuyuan at cmss.chinamobile.com>
---
 include/sheep.h          | 13 +++++++++++++
 include/sheepdog_proto.h | 16 +---------------
 lib/sd_inode.c           |  1 +
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/sheep.h b/include/sheep.h
index ebd4143..43f692f 100644
--- a/include/sheep.h
+++ b/include/sheep.h
@@ -337,4 +337,17 @@ static inline bool is_cluster_autovnodes(const struct cluster_info *cinfo)
 	return (cinfo->flags & SD_CLUSTER_FLAG_AUTO_VNODES) > 0;
 }
 
+static inline size_t count_data_objs(const struct sd_inode *inode)
+{
+	return DIV_ROUND_UP(inode->vdi_size,
+			    (1UL << inode->block_size_shift));
+}
+
+static inline __attribute__((used)) void __sd_proto_build_bug_ons(void)
+{
+	/* never called, only for checking BUILD_BUG_ON()s */
+	BUILD_BUG_ON(sizeof(struct sd_req) != SD_REQ_SIZE);
+	BUILD_BUG_ON(sizeof(struct sd_rsp) != SD_RSP_SIZE);
+}
+
 #endif
diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index f1cdcfd..20f3b71 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -18,12 +18,11 @@
 # include <inttypes.h>
 # include <stdint.h>
 # include <string.h>
-# include "compiler.h"
-# include "bitops.h"
 #endif
 
 #include <stdbool.h>
 #include <linux/limits.h>
+#include <stddef.h>
 
 #define SD_PROTO_VER 0x02
 
@@ -485,12 +484,6 @@ static inline bool is_data_obj(uint64_t oid)
 		!is_ledger_object(oid);
 }
 
-static inline size_t count_data_objs(const struct sd_inode *inode)
-{
-	return DIV_ROUND_UP(inode->vdi_size,
-			    (1UL << inode->block_size_shift));
-}
-
 static inline size_t get_objsize(uint64_t oid, uint32_t object_size)
 {
 	if (is_vdi_obj(oid))
@@ -548,13 +541,6 @@ static inline bool vdi_is_snapshot(const struct sd_inode *inode)
 	return !!inode->snap_ctime;
 }
 
-static inline __attribute__((used)) void __sd_proto_build_bug_ons(void)
-{
-	/* never called, only for checking BUILD_BUG_ON()s */
-	BUILD_BUG_ON(sizeof(struct sd_req) != SD_REQ_SIZE);
-	BUILD_BUG_ON(sizeof(struct sd_rsp) != SD_RSP_SIZE);
-}
-
 static inline uint64_t ledger_oid_to_data_oid(uint64_t oid)
 {
 	return ~LEDGER_BIT & oid;
diff --git a/lib/sd_inode.c b/lib/sd_inode.c
index 3e69a1f..94de334 100644
--- a/lib/sd_inode.c
+++ b/lib/sd_inode.c
@@ -82,6 +82,7 @@
 
 #include "util.h"
 #include "internal_proto.h"
+#include "sheep.h"
 
 #define PAYLOAD_SIZE (SD_INODE_DATA_INDEX_SIZE - \
 		sizeof(struct sd_index_header))
-- 
1.9.1




More information about the sheepdog mailing list