[PATCH 02/32] libibumad: create sysfs.h instead of using extern declarations in umad.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So that we have the prototypes available in the implementation file
and do get proper type checking for them.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 libibumad/sysfs.c |  1 +
 libibumad/sysfs.h | 10 ++++++++++
 libibumad/umad.c  |  7 +------
 3 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100644 libibumad/sysfs.h

diff --git a/libibumad/sysfs.c b/libibumad/sysfs.c
index 011e411..83f89b4 100644
--- a/libibumad/sysfs.c
+++ b/libibumad/sysfs.c
@@ -44,6 +44,7 @@
 #include <byteswap.h>
 #include <netinet/in.h>
 #include <infiniband/arch.h>
+#include "sysfs.h"
 
 static int ret_code(void)
 {
diff --git a/libibumad/sysfs.h b/libibumad/sysfs.h
new file mode 100644
index 0000000..7f8cbfe
--- /dev/null
+++ b/libibumad/sysfs.h
@@ -0,0 +1,10 @@
+#ifndef _UMAD_SYSFS_H
+#define _UMAD_SYSFS_H
+
+extern int sys_read_string(const char *dir_name, const char *file_name, char *str, int len);
+extern int sys_read_guid(const char *dir_name, const char *file_name, uint64_t * net_guid);
+extern int sys_read_gid(const char *dir_name, const char *file_name, uint8_t * gid);
+extern int sys_read_uint64(const char *dir_name, const char *file_name, uint64_t * u);
+extern int sys_read_uint(const char *dir_name, const char *file_name, unsigned *u);
+
+#endif /* _UMAD_SYSFS_H */
diff --git a/libibumad/umad.c b/libibumad/umad.c
index 0c969f1..8860b99 100644
--- a/libibumad/umad.c
+++ b/libibumad/umad.c
@@ -53,6 +53,7 @@
 #define IB_OPENIB_OUI                 (0x001405)
 
 #include <valgrind/memcheck.h>
+#include "sysfs.h"
 
 typedef struct ib_user_mad_reg_req {
 	uint32_t id;
@@ -77,12 +78,6 @@ struct ib_user_mad_reg_req2 {
 	uint8_t  reserved[3];
 };
 
-extern int sys_read_string(const char *dir_name, const char *file_name, char *str, int len);
-extern int sys_read_guid(const char *dir_name, const char *file_name, uint64_t * net_guid);
-extern int sys_read_gid(const char *dir_name, const char *file_name, uint8_t * gid);
-extern int sys_read_uint64(const char *dir_name, const char *file_name, uint64_t * u);
-extern int sys_read_uint(const char *dir_name, const char *file_name, unsigned *u);
-
 #define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## args)
 
 #define TRACE	if (umaddebug)	IBWARN
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux