Build system fixes and documentation
authorWouter Verhelst <w@uter.be>
Thu, 1 Jan 2009 12:44:46 +0000 (13:44 +0100)
committerWouter Verhelst <w@uter.be>
Thu, 1 Jan 2009 12:44:46 +0000 (13:44 +0100)
Should make compiling on non-Linux operating systems not quite as painful

README
cliserv.h
config.h.in
configure
configure.ac

diff --git a/README b/README
index 3ca8a49..f805105 100644 (file)
--- a/README
+++ b/README
@@ -109,13 +109,6 @@ uClibc's "buildroot" script also seems to have support for NBD.
 If you're packaging NBD for a different operating system that isn't in
 the above list, I'd like to know about it.
 
 If you're packaging NBD for a different operating system that isn't in
 the above list, I'd like to know about it.
 
-Thanks, and have fun,
-
-Wouter Verhelst
-
-
-
-
 [1] When you write something to a block device, the kernel will not
 immediately write that to the physical block device; instead, your
 changes are written to a cache, which is periodically flushed by a
 [1] When you write something to a block device, the kernel will not
 immediately write that to the physical block device; instead, your
 changes are written to a cache, which is periodically flushed by a
@@ -127,6 +120,26 @@ If, while your kblockd is emptying the NBD buffer cache, the kernel
 decides that the cache of the block device your nbd-server is writing to
 needs to be emptied, then you've got a deadlock.
 
 decides that the cache of the block device your nbd-server is writing to
 needs to be emptied, then you've got a deadlock.
 
-A kernel patch exists[2] to create a separate kernel thread for NBD
-writes which woul fix this problem; however, it has not made it into
-mainline yet.
+A kernel patch exists to create a separate kernel thread for NBD writes
+which woul fix this problem; however, it has not made it into mainline
+yet.
+
+BUILDING THE SERVER FOR NON-LINUX OPERATING SYSTEMS
+===================================================
+
+Since the client requires kernel-side support, you can't just compile
+nbd-client on a non-Linux kernel and hope it'll work; you'd have to
+write a kernel-space driver before that would be possible.
+
+However, nbd-server assumes nothing more than POSIX and one headerfile
+from the Linux kernel. Compiling it can be done as follows:
+- Fetch the nbd userland sources, and unpack them. Since you're reading
+  this README file, you have already done this step.
+- Fetch the "nbd.h" file from /usr/include/linux on a Linux system, or
+  from include/linux in the Linux source tree, and store it in the
+  toplevel directory of the nbd userland sources
+- Edit the headerfile, and remove the line that says '#include
+  <linux/types.h>' (on non-Linux systems, the userland source is smart
+  enough to figure out how this works by itself)
+- now it's just a regular './configure && make && sudo make install'
+
index 5685528..cefdad2 100644 (file)
--- a/cliserv.h
+++ b/cliserv.h
@@ -42,8 +42,13 @@ typedef unsigned long long u64;
 #include "nbd.h"
 #endif
 #ifdef NBD_H_LINUX
 #include "nbd.h"
 #endif
 #ifdef NBD_H_LINUX
-#include <linux/types.h>
-#include <linux/nbd.h>
+# ifdef HAVE_LINUX_TYPES_H
+#  include <linux/types.h>
+# else
+#  define __be32 u32
+#  define __be64 u64
+# endif
+# include <linux/nbd.h>
 #endif
 
 #if NBD_LFS==1
 #endif
 
 #if NBD_LFS==1
index 2a51644..7c6bfdb 100644 (file)
@@ -25,6 +25,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the <linux/types.h> header file. */
+#undef HAVE_LINUX_TYPES_H
+
 /* Define to 1 if you have the `llseek' function. */
 #undef HAVE_LLSEEK
 
 /* Define to 1 if you have the `llseek' function. */
 #undef HAVE_LLSEEK
 
index 252b252..0d03fa4 100755 (executable)
--- a/configure
+++ b/configure
@@ -7660,7 +7660,8 @@ done
 
 
 
 
 
 
-for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h
+
+for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h linux/types.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
index 3e5663a..51787db 100644 (file)
@@ -160,7 +160,7 @@ AC_SEARCH_LIBS(daemon, resolv,, AC_MSG_ERROR([Could not find an implementation o
 AC_CHECK_HEADERS([sys/mount.h],,,
 [[#include <sys/param.h>
 ]])
 AC_CHECK_HEADERS([sys/mount.h],,,
 [[#include <sys/param.h>
 ]])
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h syslog.h linux/types.h])
 AM_PATH_GLIB_2_0(2.6.0, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))
 AC_HEADER_SYS_WAIT
 AC_TYPE_OFF_T
 AM_PATH_GLIB_2_0(2.6.0, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]))
 AC_HEADER_SYS_WAIT
 AC_TYPE_OFF_T