[sheepdog] [PATCH 3/3] shared lib: don't export unnecessary structures to user

Liu Yuan namei.unix at gmail.com
Thu Apr 23 15:12:09 CEST 2015


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

internal.h is dedicated to hold the non-user functions and structures for shared
lib.

Signed-off-by: Liu Yuan <liuyuan at cmss.chinamobile.com>
---
 lib/shared/internal.h | 28 ++++++++++++++++++++++++++++
 lib/shared/sheep.c    |  1 +
 lib/shared/sheepdog.h | 11 -----------
 lib/shared/vdi.c      |  1 +
 4 files changed, 30 insertions(+), 11 deletions(-)
 create mode 100644 lib/shared/internal.h

diff --git a/lib/shared/internal.h b/lib/shared/internal.h
new file mode 100644
index 0000000..dd3647f
--- /dev/null
+++ b/lib/shared/internal.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 China Mobile Inc.
+ *
+ * Liu Yuan <liuyuan at cmss.chinamobile.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version
+ * 2 as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INTERNAL_H_
+#define INTERNAL_H_
+
+struct sd_request {
+	struct list_node list;
+	struct sd_vdi *vdi;
+	void *data;
+	size_t length;
+	off_t offset;
+	bool write;
+	int efd;
+	int ret;
+};
+
+#endif
diff --git a/lib/shared/sheep.c b/lib/shared/sheep.c
index 8568436..933be07 100644
--- a/lib/shared/sheep.c
+++ b/lib/shared/sheep.c
@@ -12,6 +12,7 @@
  */
 
 #include "sheepdog.h"
+#include "internal.h"
 
 #include <unistd.h>
 #include <sys/types.h>
diff --git a/lib/shared/sheepdog.h b/lib/shared/sheepdog.h
index daa16e7..4d620ef 100644
--- a/lib/shared/sheepdog.h
+++ b/lib/shared/sheepdog.h
@@ -44,17 +44,6 @@ struct sd_cluster {
 	struct sd_mutex submit_mutex;
 };
 
-struct sd_request {
-	struct list_node list;
-	struct sd_vdi *vdi;
-	void *data;
-	size_t length;
-	off_t offset;
-	bool write;
-	int efd;
-	int ret;
-};
-
 struct sd_vdi {
 	struct sd_cluster *cluster;
 	struct sd_inode *inode;
diff --git a/lib/shared/vdi.c b/lib/shared/vdi.c
index ce10e35..7375094 100644
--- a/lib/shared/vdi.c
+++ b/lib/shared/vdi.c
@@ -12,6 +12,7 @@
  */
 
 #include "sheepdog.h"
+#include "internal.h"
 
 static int lock_vdi(struct sd_vdi *vdi)
 {
-- 
1.9.1




More information about the sheepdog mailing list