[stgt] [PATCH 04/11] BSD builds support - #includes reorder

Boaz Harrosh bharrosh at panasas.com
Thu Mar 12 12:01:14 CET 2009


BSD's networking headers are very broken and do
weird stuff when included in the wrong order.
The changes are OK with Linux and enable BSD build.

linux/fs.h definitions need be included specifically
for bsd builds.

Signed-off-by: Boaz Harrosh <bharrosh at panasas.com>
---
 usr/iscsi/iscsi_tcp.c |   15 ++++++++++-----
 usr/iscsi/isns.c      |   12 ++++++++----
 usr/iscsi/target.c    |    2 +-
 usr/libcrc32c.c       |    2 +-
 usr/libssc.c          |    3 +++
 usr/scsi.c            |    2 +-
 usr/target.c          |    2 ++
 usr/tgtadm.c          |    2 ++
 usr/tgtimg.c          |    2 ++
 usr/util.c            |    1 -
 10 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index edc4e86..bee2145 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -20,17 +20,22 @@
  * 02110-1301 USA
  */
 #include <errno.h>
-#include <fcntl.h>
-#include <netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <arpa/inet.h>
+
+#include <netdb.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+
 #include <sys/epoll.h>
-#include <sys/socket.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "iscsid.h"
 #include "tgtd.h"
diff --git a/usr/iscsi/isns.c b/usr/iscsi/isns.c
index 88e5211..ba0058f 100644
--- a/usr/iscsi/isns.c
+++ b/usr/iscsi/isns.c
@@ -20,16 +20,20 @@
  */
 
 #include <errno.h>
-#include <netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+
+#include <netdb.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
-#include <sys/socket.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+
 #include <sys/epoll.h>
-#include <sys/types.h>
 
 #include "iscsid.h"
 #include "parser.h"
diff --git a/usr/iscsi/target.c b/usr/iscsi/target.c
index 43b249f..ae531f1 100644
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -26,9 +26,9 @@
 #include <netdb.h>
 #include <sys/stat.h>
 #include <sys/un.h>
+#include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
-#include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <netinet/ip.h>
 #include <arpa/inet.h>
diff --git a/usr/libcrc32c.c b/usr/libcrc32c.c
index bda0020..66301d5 100644
--- a/usr/libcrc32c.c
+++ b/usr/libcrc32c.c
@@ -31,7 +31,7 @@
  *
  */
 #include "crc32c.h"
-#include <asm/byteorder.h>
+#include "util.h"
 
 /*
  * MODULE_AUTHOR("Clay Haapala <chaapala at cisco.com>");
diff --git a/usr/libssc.c b/usr/libssc.c
index e13a9f6..7cd965e 100644
--- a/usr/libssc.c
+++ b/usr/libssc.c
@@ -23,6 +23,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdio.h>
+
+#include <linux/fs.h>
+
 #include "bs_ssc.h"
 #include "ssc.h"
 #include "be_byteshift.h"
diff --git a/usr/scsi.c b/usr/scsi.c
index daf4aef..54672e8 100644
--- a/usr/scsi.c
+++ b/usr/scsi.c
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
-#include <syscall.h>
+#include <sys/syscall.h>
 #include <unistd.h>
 #include <linux/fs.h>
 
diff --git a/usr/target.c b/usr/target.c
index dc30c87..6266aef 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -28,6 +28,8 @@
 #include <unistd.h>
 #include <sys/socket.h>
 
+#include <linux/fs.h>
+
 #include "list.h"
 #include "util.h"
 #include "tgtd.h"
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 71d7fc5..d928f96 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -36,6 +36,8 @@
 #include <sys/types.h>
 #include <sys/un.h>
 
+#include <linux/fs.h>
+
 #include "scsi.h"
 #include "util.h"
 #include "list.h"
diff --git a/usr/tgtimg.c b/usr/tgtimg.c
index 43b0761..4cbc871 100644
--- a/usr/tgtimg.c
+++ b/usr/tgtimg.c
@@ -32,6 +32,8 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <linux/fs.h>
+
 #include "media.h"
 #include "bs_ssc.h"
 #include "ssc.h"
diff --git a/usr/util.c b/usr/util.c
index e91453d..2f4f488 100644
--- a/usr/util.c
+++ b/usr/util.c
@@ -29,7 +29,6 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <linux/fs.h>
-#include <sys/sysmacros.h>
 
 #include "log.h"
 #include "util.h"
-- 
1.6.0.6

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



More information about the stgt mailing list