Hello community,
here is the log from the commit of package nbd for openSUSE:Factory
checked in at Mon May 4 18:30:32 CEST 2009.
--------
--- nbd/nbd.changes 2008-08-20 08:17:40.000000000 +0200
+++ /mounts/work_src_done/STABLE/nbd/nbd.changes 2009-05-04 13:38:00.000000000 +0200
@@ -1,0 +2,12 @@
+Mon May 4 10:40:15 CEST 2009 - ms@suse.de
+
+- Update to nbd-2.9.12:
+ * use atoll instead of atol ... so that multi-terabyte exports work, too
+ * Change meaning of -swap option: rather than trying to use a kernel patch
+ which has been effectively dead since sometime around 2.1.something, do an
+ mlockall() so that the kernel won't throw us out. The MCL_CURRENT | MCL_FUTURE
+ bit might prove to be problematic, but if so, we'll deal with it when
+ we get there
+ * Use right printf() format string
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
nbd-2.9.11.tar.bz2
nbd-2.9.5-doc.diff
nbd-2.9.5-warn.diff
New:
----
nbd-2.9.12-doc.diff
nbd-2.9.12.tar.bz2
nbd-2.9.12-warn.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nbd.spec ++++++
--- /var/tmp/diff_new_pack.gU4751/_old 2009-05-04 18:29:36.000000000 +0200
+++ /var/tmp/diff_new_pack.gU4751/_new 2009-05-04 18:29:36.000000000 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package nbd (Version 2.9.11)
+# spec file for package nbd (Version 2.9.12)
#
-# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -21,15 +21,15 @@
Name: nbd
BuildRequires: doxygen glib2-devel
PreReq: %insserv_prereq coreutils
-Version: 2.9.11
+Version: 2.9.12
Release: 1
License: GPL v2 or later
Group: Productivity/Networking/Other
AutoReqProv: on
Source: %{name}-%{version}.tar.bz2
Source2: init.nbd-server
-Patch2: nbd-2.9.5-warn.diff
-Patch3: nbd-2.9.5-doc.diff
+Patch2: nbd-2.9.12-warn.diff
+Patch3: nbd-2.9.12-doc.diff
Summary: Network Block Device Server and Client Utilities
Url: http://nbd.sourceforge.net/
Prefix: /usr
@@ -166,8 +166,16 @@
%preun
%{stop_on_removal nbd-server}
-
%changelog
+* Mon May 04 2009 ms@suse.de
+- Update to nbd-2.9.12:
+ * use atoll instead of atol ... so that multi-terabyte exports work, too
+ * Change meaning of -swap option: rather than trying to use a kernel patch
+ which has been effectively dead since sometime around 2.1.something, do an
+ mlockall() so that the kernel won't throw us out. The MCL_CURRENT | MCL_FUTURE
+ bit might prove to be problematic, but if so, we'll deal with it when
+ we get there
+ * Use right printf() format string
* Wed Aug 20 2008 garloff@suse.de
- Update to nbd-2.9.11:
* nbd-client: new option -c to check for connection, -d to
@@ -178,7 +186,7 @@
- Update to nbd-2.9.9:
* Document -C option of nbd-server.
* Fix name of /var/run/ file.
-* Thu Nov 08 2007 garloff@suse.de
+* Wed Nov 07 2007 garloff@suse.de
- Split nbd into nbd and nbd-doc packages.
- Update to nbd-2.9.8:
* nbd-server can now setuid to specified user and group.
@@ -254,7 +262,7 @@
* Tue Dec 20 2005 garloff@suse.de
- Update to nbd-2.8.2:
* Enable LFS by default.
-* Thu Nov 03 2005 dmueller@suse.de
+* Wed Nov 02 2005 dmueller@suse.de
- don't build as root
* Fri Oct 28 2005 garloff@suse.de
- Update to version 2.8.1.
++++++ nbd-2.9.5-doc.diff -> nbd-2.9.12-doc.diff ++++++
++++++ nbd-2.9.11.tar.bz2 -> nbd-2.9.12.tar.bz2 ++++++
++++ 10315 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/cliserv.h new/nbd-2.9.12/cliserv.h
--- old/nbd-2.9.11/cliserv.h 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/cliserv.h 2009-04-30 14:49:38.000000000 +0200
@@ -42,8 +42,13 @@
#include "nbd.h"
#endif
#ifdef NBD_H_LINUX
-#include
-#include
+# ifdef HAVE_LINUX_TYPES_H
+# include
+# else
+# define __be32 u32
+# define __be64 u64
+# endif
+# include
#endif
#if NBD_LFS==1
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/CodingStyle new/nbd-2.9.12/CodingStyle
--- old/nbd-2.9.11/CodingStyle 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/CodingStyle 1970-01-01 01:00:00.000000000 +0100
@@ -1,46 +0,0 @@
-NBD Coding style.
-=================
-
-The following expresses my opinion of what C code should look like. I'm
-not as strict as the Kernel maintainers on this one (NBD isn't even
-remotely as large anyway), but code that does not follow these rules
-needs to be updated so that it does, which is useless time wasted for
-me. Therefore, it's appreciated if you would follow these rules.
-
-Thanks.
-
-* Use a tab width of 8 characters. You may use tab or 8 spaces as you
- please, it doesn't really matter to me.
-* opening curly brackets occur on the same line as whatever they're
- curly brackets for, _in all cases_. This includes function
- definitions, if structures, loops, and so on; every code block appears
- like so:
-
-int foo(int bar) {
- ...
-}
-
-* Variable declarations are separated from the rest of a function block
- by a line of whitespace. It's okay to assign a value to a variable
- when you're declaring it if you can do that on one line of code, but
- it must still be in the block of declarations at the top with a
- whiteline below.
-* Variables are declared one on each line. So no
-
- int foo, bar;
-
- use
-
- int foo;
- int bar;
-
- instead.
-* Try to fit everything in 80 columns. This goes especially for comment
- lines, but may be relaxed for function calls with 79 arguments, or so,
- if that's not feasible.
-* If your function block is more than three or so screenfulls, there's a
- hint that you should break it up.
-
-It is true that not all of the code currently follows these rules; but
-that should not stop you from following them for new code, or from
-cleaning up if you can (i.e., you have commit rights).
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/config.h.in new/nbd-2.9.12/config.h.in
--- old/nbd-2.9.11/config.h.in 2008-05-01 21:09:04.000000000 +0200
+++ new/nbd-2.9.12/config.h.in 2009-04-30 15:06:07.000000000 +0200
@@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
/* Define if you want a debugging version of nbd-server (lots of copious
output) */
#undef DODBG
@@ -25,6 +28,9 @@
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the header file. */
+#undef HAVE_LINUX_TYPES_H
+
/* Define to 1 if you have the `llseek' function. */
#undef HAVE_LLSEEK
@@ -131,14 +137,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
- second argument and the buffer pointer as the third, as on System V before
- release 3. */
-#undef SETVBUF_REVERSED
-
/* The size of `unsigned int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_INT
@@ -160,12 +158,17 @@
/* Define to 1 if you have and want support for the Socket Direct Protocol */
#undef WITH_SDP
-/* Define to 1 if your processor stores words with the most significant byte
- first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/configure.ac new/nbd-2.9.12/configure.ac
--- old/nbd-2.9.11/configure.ac 2008-05-01 21:06:14.000000000 +0200
+++ new/nbd-2.9.12/configure.ac 2009-04-30 15:04:43.000000000 +0200
@@ -1,7 +1,7 @@
dnl Configure script for NBD system
dnl (c) 1998 Martin Mares , (c) 2000 Pavel Machek ,
dnl (c) 2003-2006 Wouter Verhelst
-AC_INIT([nbd],[2.9.11],[wouter@debian.org])
+AC_INIT([nbd],[2.9.12],[wouter@debian.org])
AM_INIT_AUTOMAKE(foreign dist-bzip2)
AM_MAINTAINER_MODE
@@ -82,40 +82,6 @@
]
)
-AC_MSG_CHECKING(for klcc)
-AC_ARG_WITH(
- klcc,
- AC_HELP_STRING(--with-klcc,[Build a version of nbd-client against klibc (for initramfs uses). Specify the path to 'klcc' (default autodetected)]),
- [
- if test "x$withval" != "x"; then
- if test -x "$withval"; then
- KLCC="$withval"
- sbin_PROGRAMS=knbd-client
- AC_MSG_RESULT($KLCC)
- else
- AC_MSG_ERROR("specified klcc is not executable or does not exist.")
- fi
- else
- if test -x /usr/bin/klcc; then
- KLCC=/usr/bin/klcc
- sbin_PROGRAMS=knbd-client
- AC_MSG_RESULT($KLCC)
- else
- AC_MSG_ERROR("klcc not found! Please specify it as a parameter to the --with-klcc option");
- fi
- fi
- ],
- [ if test -x /usr/bin/klcc; then
- sbin_PROGRAMS=knbd-client
- KLCC=/usr/bin/klcc
- AC_MSG_RESULT($KLCC)
- else
- AC_MSG_RESULT(not found)
- fi
- ]
-)
-AC_SUBST(KLCC)
-
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
@@ -194,7 +160,7 @@
AC_CHECK_HEADERS([sys/mount.h],,,
[[#include
]])
-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
@@ -203,6 +169,6 @@
nbd_server_CPPFLAGS=$nbd_server_CPPFLAGS" -DSYSCONFDIR='\"$sysconfdir\"'"
AC_SUBST(nbd_server_CPPFLAGS)
AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([Makefile Doxyfile nbd-server.1 nbd-server.5])
+AC_CONFIG_FILES([Makefile Doxyfile nbd-server.1 nbd-server.5 nbd-client.8])
AC_OUTPUT
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/gznbd/.gitignore new/nbd-2.9.12/gznbd/.gitignore
--- old/nbd-2.9.11/gznbd/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/nbd-2.9.12/gznbd/.gitignore 2009-01-03 13:59:46.000000000 +0100
@@ -0,0 +1 @@
+gznbd
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/Makefile.am new/nbd-2.9.12/Makefile.am
--- old/nbd-2.9.11/Makefile.am 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/Makefile.am 2009-04-30 14:49:38.000000000 +0200
@@ -1,31 +1,30 @@
bin_PROGRAMS = nbd-server
EXTRA_PROGRAMS = nbd-client knbd-client
-TESTS = $(srcdir)/simple_test
+TESTS_ENVIRONMENT=$(srcdir)/simple_test
+TESTS = cmd cfg1 cfgmulti
check_PROGRAMS = nbd-tester-client
knbd_client_SOURCES = nbd-client.c cliserv.h
nbd_client_SOURCES = nbd-client.c cliserv.h
-nbd_server_SOURCES = nbd-server.c cliserv.h
+nbd_server_SOURCES = nbd-server.c cliserv.h lfs.h
nbd_tester_client_SOURCES = nbd-tester-client.c cliserv.h
nbd_server_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
nbd_tester_client_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
nbd_server_LDADD = @GLIB_LIBS@
nbd_tester_client_LDADD = @GLIB_LIBS@
man_MANS = nbd-server.1 nbd-server.5 nbd-client.8
-EXTRA_DIST = nbd-client.8.sgml nbd-server.1.sgml nbd-server.5.sgml gznbd winnbd lfs.h nbd-client.8 CodingStyle simple_test INSTALL
-MAINTAINERCLEANFILES = nbd-client.8 nbd-server.1
-nbd-server.1.in: nbd-server.1.sgml
- docbook2man nbd-server.1.sgml
+EXTRA_DIST = nbd-client.8.sgml nbd-server.1.sgml nbd-server.5.sgml gznbd simple_test
+MAINTAINERCLEANFILES = nbd-client.8 nbd-server.1 nbd-server.5
+nbd-server.1.in: $(srcdir)/nbd-server.1.sgml
+ LC_ALL=C docbook2man nbd-server.1.sgml
mv NBD-SERVER.1 nbd-server.1.in
-nbd-client.8: nbd-client.8.sgml
- docbook2man nbd-client.8.sgml
- mv NBD-CLIENT.8 nbd-client.8
-nbd-server.5.in: nbd-server.5.sgml
- docbook2man nbd-server.5.sgml
+nbd-client.8.in: $(srcdir)/nbd-client.8.sgml
+ LC_ALL=C docbook2man nbd-client.8.sgml
+ mv NBD-CLIENT.8 nbd-client.8.in
+nbd-server.5.in: $(srcdir)/nbd-server.5.sgml
+ LC_ALL=C docbook2man nbd-server.5.sgml
mv NBD-SERVER.5 nbd-server.5.in
dist-hook:
rm -Rf `find $(distdir) -name '.svn' -type d -print`
-knbd_client-nbd-client.o: nbd-client.c
- $(KLCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(knbd_client_CPPFLAGS) $(CPPFLAGS) $(knbd_client_CFLAGS) $(CFLAGS) -c -o knbd_client-nbd-client.o nbd-client.c
-knbd-client$(EXEEXT): knbd_client-nbd-client.o $(knbd_client_DEPENDENCIES)
- @rm -f knbd-client$(EXEEXT)
- $(LINK) $(knbd_client_LDFLAGS) knbd_client-nbd-client.o $(knbd_client_LDADD) $(LIBS)
+cmd:
+cfg1:
+cfgmulti:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-client.8 new/nbd-2.9.12/nbd-client.8
--- old/nbd-2.9.11/nbd-client.8 2008-05-01 21:07:08.000000000 +0200
+++ new/nbd-2.9.12/nbd-client.8 1970-01-01 01:00:00.000000000 +0100
@@ -1,135 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" http://shell.ipoline.com/~elmert/comp/docbook2X/
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng .
-.TH "NBD-CLIENT" "8" "01 mei 2008" "" ""
-
-.SH NAME
-nbd-client \- connect to a server running nbd-server(1), to use its exported block device
-.SH SYNOPSIS
-
-\fBnbd-client\fR [ \fBbs=\fIblocksize\fB\fR ] [ \fBtimeout=\fIseconds\fB\fR ] \fB\fIhost\fB\fR \fB\fIport\fB\fR \fB\fInbd-device\fB\fR [ \fB-sdp\fR ] [ \fB-swap\fR ] [ \fB-persist\fR ]
-
-
-\fBnbd-client\fR \fB-d \fInbd-device\fB\fR
-
-
-\fBnbd-client\fR \fB-c \fInbd-device\fB\fR
-
-.SH "DESCRIPTION"
-.PP
-With \fBnbd-client\fR, you can connect to a
-server running \fBnbd-server\fR, thus using raw
-diskspace from that server as a blockdevice on the local
-client.
-.PP
-To do this, support from the Linux Kernel is necessary, in
-the form of the Network Block Device (NBD). When you have that,
-either in the kernel, or as a module, you can connect to an NBD
-server and use its exported file through a block special file with
-major mode 43.
-.SH "OPTIONS"
-.PP
-The following options are supported:
-.TP
-\fBbs=\fIblocksize\fB\fR
-Use a blocksize of "blocksize". Default is 1024;
-allowed values are either 512, 1024, 2048 or 4096
-.TP
-\fBhost\fR
-The hostname of the machine running
-\fBnbd-server\fR\&.
-.TP
-\fBtimeout=\fIseconds\fB\fR
-Set the connection timeout to "seconds". For this to
-work, you need a kernel with support for the NBD_SET_TIMEOUT
-ioctl; this was introduced into Linus' tree on 2007-10-11,
-and will be part of kernel 2.6.24.
-.TP
-\fBport\fR
-The TCP port on which \fBnbd-server\fR is
-running at the server.
-.TP
-\fBnbd-device\fR
-The block special file this nbd-client should connect
-to.
-.TP
-\fB-c\fR
-Check whether the specified nbd device is
-connected.
-
-If the device is connected, nbd-client will exit
-with an exit state of 0 and print the PID of the nbd-client
-instance that connected it to stdout.
-
-If the device is not
-connected or does not exist (for example because the nbd
-module was not loaded), nbd-client will exit with an exit
-state of 1 and not print anything on stdout.
-
-If an error occurred, nbd-client will exit with an exit
-state of 2, and not print anything on stdout either.
-.TP
-\fB-d\fR
-Disconnect the specified nbd device from the
-server
-.TP
-\fB-persist\fR
-When this option is specified, nbd-client will
-immediately try to reconnect an nbd device if the
-connection ever drops unexpectedly due to a lost
-server or something similar.
-.TP
-\fB-sdp\fR
-Connect to the server using the Socket Direct Protocol
-(SDP), rather than IP. See nbd-server(1) for details.
-.TP
-\fB-swap\fR
-Specifies that this NBD device will be used as
-swapspace. If you intend to do that, please use this
-option to prevent deadlocks. You'll need a special kernel
-patch, available at NBD's homepage:
-http://atrey.karlin.mff.cuni.cz/~pavel
-.SH "EXAMPLES"
-.PP
-Some examples of nbd-client usage:
-.TP 0.2i
-\(bu
-To connect to a server running on port 2000 at host
-"server.domain.com", using the client's block special file
-"/dev/nb0":
-
-\fBnbd-client server.domain.com 2000
-/dev/nb0\fR
-.TP 0.2i
-\(bu
-To connect to a server running on port 2001 at host
-"swapserver.domain.com", using the client's block special
-file "/dev/nb1", for swap purposes:
-
-\fBnbd-client swapserver.domain.com 2001 /dev/nb1
--swap\fR
-.TP 0.2i
-\(bu
-To disconnect the above connection again (after making
-sure the block special file is not in use anymore):
-
-\fBnbd-client -d /dev/nb1\fR
-.SH "SEE ALSO"
-.PP
-nbd-server (1).
-.SH "AUTHOR"
-.PP
-The NBD kernel module and the NBD tools have been written by
-Pavel Macheck (pavel@ucw.cz).
-.PP
-The kernel module is now maintained by Paul Clements
-(Paul.Clements@steeleye.com), while the userland tools are maintained by
-Wouter Verhelst (wouter@debian.org)
-.PP
-This manual page was written by Wouter Verhelst () for
-the Debian GNU/Linux system (but may be used by others). Permission is
-granted to copy, distribute and/or modify this document under the
-terms of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-client.8.in new/nbd-2.9.12/nbd-client.8.in
--- old/nbd-2.9.11/nbd-client.8.in 1970-01-01 01:00:00.000000000 +0100
+++ new/nbd-2.9.12/nbd-client.8.in 2009-04-30 14:52:55.000000000 +0200
@@ -0,0 +1,135 @@
+.\" This manpage has been automatically generated by docbook2man
+.\" from a DocBook document. This tool can be found at:
+.\" http://shell.ipoline.com/~elmert/comp/docbook2X/
+.\" Please send any bug reports, improvements, comments, patches,
+.\" etc. to Steve Cheng .
+.TH "NBD-CLIENT" "8" "30 April 2009" "" ""
+
+.SH NAME
+nbd-client \- connect to a server running nbd-server(1), to use its exported block device
+.SH SYNOPSIS
+
+\fBnbd-client\fR [ \fBbs=\fIblocksize\fB\fR ] [ \fBtimeout=\fIseconds\fB\fR ] \fB\fIhost\fB\fR \fB\fIport\fB\fR \fB\fInbd-device\fB\fR [ \fB-sdp\fR ] [ \fB-swap\fR ] [ \fB-persist\fR ]
+
+
+\fBnbd-client\fR \fB-d \fInbd-device\fB\fR
+
+
+\fBnbd-client\fR \fB-c \fInbd-device\fB\fR
+
+.SH "DESCRIPTION"
+.PP
+With \fBnbd-client\fR, you can connect to a
+server running \fBnbd-server\fR, thus using raw
+diskspace from that server as a blockdevice on the local
+client.
+.PP
+To do this, support from the Linux Kernel is necessary, in
+the form of the Network Block Device (NBD). When you have that,
+either in the kernel, or as a module, you can connect to an NBD
+server and use its exported file through a block special file with
+major mode 43.
+.SH "OPTIONS"
+.PP
+The following options are supported:
+.TP
+\fBbs=\fIblocksize\fB\fR
+Use a blocksize of "blocksize". Default is 1024;
+allowed values are either 512, 1024, 2048 or 4096
+.TP
+\fBhost\fR
+The hostname of the machine running
+\fBnbd-server\fR\&.
+.TP
+\fBtimeout=\fIseconds\fB\fR
+Set the connection timeout to "seconds". For this to
+work, you need a kernel with support for the NBD_SET_TIMEOUT
+ioctl; this was introduced into Linus' tree on 2007-10-11,
+and will be part of kernel 2.6.24.
+.TP
+\fBport\fR
+The TCP port on which \fBnbd-server\fR is
+running at the server.
+.TP
+\fBnbd-device\fR
+The block special file this nbd-client should connect
+to.
+.TP
+\fB-c\fR
+Check whether the specified nbd device is
+connected.
+
+If the device is connected, nbd-client will exit
+with an exit state of 0 and print the PID of the nbd-client
+instance that connected it to stdout.
+
+If the device is not
+connected or does not exist (for example because the nbd
+module was not loaded), nbd-client will exit with an exit
+state of 1 and not print anything on stdout.
+
+If an error occurred, nbd-client will exit with an exit
+state of 2, and not print anything on stdout either.
+.TP
+\fB-d\fR
+Disconnect the specified nbd device from the
+server
+.TP
+\fB-persist\fR
+When this option is specified, nbd-client will
+immediately try to reconnect an nbd device if the
+connection ever drops unexpectedly due to a lost
+server or something similar.
+.TP
+\fB-sdp\fR
+Connect to the server using the Socket Direct Protocol
+(SDP), rather than IP. See nbd-server(1) for details.
+.TP
+\fB-swap\fR
+Specifies that this NBD device will be used as
+swapspace. If you intend to do that, please use this
+option to prevent deadlocks. You'll need a special kernel
+patch, available at NBD's homepage:
+http://atrey.karlin.mff.cuni.cz/~pavel
+.SH "EXAMPLES"
+.PP
+Some examples of nbd-client usage:
+.TP 0.2i
+\(bu
+To connect to a server running on port 2000 at host
+"server.domain.com", using the client's block special file
+"/dev/nb0":
+
+\fBnbd-client server.domain.com 2000
+/dev/nb0\fR
+.TP 0.2i
+\(bu
+To connect to a server running on port 2001 at host
+"swapserver.domain.com", using the client's block special
+file "/dev/nb1", for swap purposes:
+
+\fBnbd-client swapserver.domain.com 2001 /dev/nb1
+-swap\fR
+.TP 0.2i
+\(bu
+To disconnect the above connection again (after making
+sure the block special file is not in use anymore):
+
+\fBnbd-client -d /dev/nb1\fR
+.SH "SEE ALSO"
+.PP
+nbd-server (1).
+.SH "AUTHOR"
+.PP
+The NBD kernel module and the NBD tools have been written by
+Pavel Macheck (pavel@ucw.cz).
+.PP
+The kernel module is now maintained by Paul Clements
+(Paul.Clements@steeleye.com), while the userland tools are maintained by
+Wouter Verhelst (wouter@debian.org)
+.PP
+This manual page was written by Wouter Verhelst () for
+the Debian GNU/Linux system (but may be used by others). Permission is
+granted to copy, distribute and/or modify this document under the
+terms of the GNU General Public License,
+version 2, as published by the Free Software Foundation.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-client.8.sgml new/nbd-2.9.12/nbd-client.8.sgml
--- old/nbd-2.9.11/nbd-client.8.sgml 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/nbd-client.8.sgml 2009-04-30 14:49:38.000000000 +0200
@@ -13,7 +13,7 @@
<!ENTITY dhfirstname "<firstname>Wouter</firstname>">
<!ENTITY dhsurname "<surname>Verhelst</surname>">
<!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>$Date: 2008-03-31 10:18:51 +0200 (ma, 31 mrt 2008) $</date>">
+ <!ENTITY dhdate "<date>$Date$</date>">
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
allowed: see man(7), man(1). -->
<!ENTITY dhsection "<manvolnum>8</manvolnum>">
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-client.c new/nbd-2.9.12/nbd-client.c
--- old/nbd-2.9.11/nbd-client.c 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/nbd-client.c 2009-04-30 14:49:38.000000000 +0200
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#ifndef __GNUC__
@@ -185,6 +186,9 @@
if (ioctl(nbd, NBD_SET_SOCK, sock) < 0)
err("Ioctl NBD_SET_SOCK failed: %m\n");
+/*
+ * If anyone ever forward-patches this patch, I'll happily re-enable
+ * this code. Until then...
#ifndef SO_SWAPPING
if (swap)
err("You have to compile me on machine with swapping patch enabled in order to use it later.");
@@ -193,6 +197,8 @@
if (setsockopt(sock, SOL_SOCKET, SO_SWAPPING, &one, sizeof(int)) < 0)
err("Could not enable swapping: %m");
#endif
+*/
+ mlockall(MCL_CURRENT | MCL_FUTURE);
}
int main(int argc, char *argv[]) {
@@ -222,7 +228,7 @@
}
++argv; --argc; /* skip programname */
-
+
if (strcmp(argv[0], "-d")==0) {
nbd = open(argv[1], O_RDWR);
if (nbd < 0)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-server.1.in new/nbd-2.9.12/nbd-server.1.in
--- old/nbd-2.9.11/nbd-server.1.in 2008-05-01 20:57:19.000000000 +0200
+++ new/nbd-2.9.12/nbd-server.1.in 2009-04-30 14:49:38.000000000 +0200
@@ -3,13 +3,13 @@
.\" http://shell.ipoline.com/~elmert/comp/docbook2X/
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
-.TH "NBD-SERVER" "1" "01 mei 2008" "" ""
+.TH "NBD-SERVER" "1" "03 January 2009" "" ""
.SH NAME
nbd-server \- serve a file as a block device to other computers running the GNU/Linux(tm) or GNU/Hurd Operating System
.SH SYNOPSIS
-\fBnbd-server \fR \fB\fI[ip:]port\fB\fR \fB\fIfilename\fB\fR [ \fB\fIsize\fB\fR ] [ \fB-r\fR ] [ \fB-m\fR ] [ \fB-c\fR ] [ \fB-a \fItimeout\fB\fR ] [ \fB-l \fIhost list\fB\fR ] [ \fB-o \fIsection name\fB\fR ] [ \fB-C \fIconfig file\fB\fR ]
+\fBnbd-server \fR \fB\fI[ip:]port\fB\fR \fB\fIfilename\fB\fR [ \fB\fIsize\fB\fR ] [ \fB-r\fR ] [ \fB-m\fR ] [ \fB-c\fR ] [ \fB-a \fItimeout\fB\fR ] [ \fB-l \fIhost list filename\fB\fR ] [ \fB-o \fIsection name\fB\fR ] [ \fB-C \fIconfig file\fB\fR ]
.SH "DESCRIPTION"
.PP
@@ -106,7 +106,7 @@
avoid stale nbd-server processes staying in memory. Use of
this option is strongly recommended.
.TP
-\fBhost list\fR
+\fBhost list filename\fR
This argument should contain a list of IP-addresses
for hosts that may connect to the server. Wildcards are
\fBnot\fR allowed. If the file does not
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-server.1.sgml new/nbd-2.9.12/nbd-server.1.sgml
--- old/nbd-2.9.11/nbd-server.1.sgml 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/nbd-server.1.sgml 2009-04-30 14:49:38.000000000 +0200
@@ -13,7 +13,7 @@
<!ENTITY dhfirstname "<firstname>Wouter</firstname>">
<!ENTITY dhsurname "<surname>Verhelst</surname>">
<!-- Please adjust the date whenever revising the manpage. -->
- <!ENTITY dhdate "<date>$Date: 2007-10-30 11:35:12 +0100 (di, 30 okt 2007) $</date>">
+ <!ENTITY dhdate "<date>$Date$</date>">
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
allowed: see man(7), man(1). -->
<!ENTITY dhsection "<manvolnum>1</manvolnum>">
@@ -64,7 +64,7 @@
<arg><option>-m</option></arg>
<arg><option>-c</option></arg>
<arg><option>-a <replaceable>timeout</replaceable></option></arg>
- <arg><option>-l <replaceable>host list</replaceable></option></arg>
+ <arg><option>-l <replaceable>host list filename</replaceable></option></arg>
<arg><option>-o <replaceable>section name</replaceable></option></arg>
<arg><option>-C <replaceable>config file</replaceable></option></arg>
</cmdsynopsis>
@@ -196,7 +196,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>host list</option></term>
+ <term><option>host list filename</option></term>
<listitem>
<para>This argument should contain a list of IP-addresses
for hosts that may connect to the server. Wildcards are
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-server.5.in new/nbd-2.9.12/nbd-server.5.in
--- old/nbd-2.9.11/nbd-server.5.in 2008-05-01 20:57:20.000000000 +0200
+++ new/nbd-2.9.12/nbd-server.5.in 2009-04-30 14:49:38.000000000 +0200
@@ -3,7 +3,7 @@
.\" http://shell.ipoline.com/~elmert/comp/docbook2X/
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
-.TH "NBD-SERVER" "5" "01 mei 2008" "" ""
+.TH "NBD-SERVER" "5" "03 January 2009" "" ""
.SH NAME
/etc/nbd-server/config \- configuration file for nbd-server
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/nbd-server.c new/nbd-2.9.12/nbd-server.c
--- old/nbd-2.9.11/nbd-server.c 2008-05-01 21:04:44.000000000 +0200
+++ new/nbd-2.9.12/nbd-server.c 2009-04-30 14:49:38.000000000 +0200
@@ -367,7 +367,7 @@
printf("\tcopyonwrite = true\n");
}
if(serve->expected_size) {
- printf("\tfilesize = %Ld\n", (long long int)serve->expected_size);
+ printf("\tfilesize = %lld\n", (long long int)serve->expected_size);
}
if(serve->authname) {
printf("\tauthfile = %s\n", serve->authname);
@@ -442,7 +442,7 @@
if (suffix == 'k' || suffix == 'K' ||
suffix == 'm' || suffix == 'M')
optarg[last] = '\0';
- es = (off_t)atol(optarg);
+ es = (off_t)atoll(optarg);
switch (suffix) {
case 'm':
case 'M': es <<= 10;
@@ -512,7 +512,9 @@
CFILE_KEY_MISSING, /**< A (required) key is missing */
CFILE_VALUE_INVALID, /**< A value is syntactically invalid */
CFILE_VALUE_UNSUPPORTED,/**< A value is not supported in this build */
- CFILE_PROGERR /**< Programmer error */
+ CFILE_PROGERR, /**< Programmer error */
+ CFILE_NO_EXPORTS /**< A config file was specified that does not
+ define any exports */
} CFILE_ERRORS;
/**
@@ -573,6 +575,7 @@
GArray *retval=NULL;
gchar **groups;
gboolean value;
+ gchar* startgroup;
gint i;
gint j;
@@ -585,7 +588,8 @@
g_key_file_free(cfile);
return retval;
}
- if(strcmp(g_key_file_get_start_group(cfile), "generic")) {
+ startgroup = g_key_file_get_start_group(cfile);
+ if(!startgroup || strcmp(startgroup, "generic")) {
g_set_error(e, errdomain, CFILE_MISSING_GENERIC, "Config file does not contain the [generic] group!");
g_key_file_free(cfile);
return NULL;
@@ -703,6 +707,10 @@
}
#endif
}
+ if(i==1) {
+ g_set_error(e, errdomain, CFILE_NO_EXPORTS, "The config file does not specify any exports");
+ }
+ g_key_file_free(cfile);
return retval;
}
@@ -892,7 +900,7 @@
if(maxbytes && len > maxbytes)
len = maxbytes;
- DEBUG4("(WRITE to fd %d offset %Lu len %u), ", fhandle, foffset, len);
+ DEBUG4("(WRITE to fd %d offset %llu len %u), ", fhandle, foffset, len);
myseek(fhandle, foffset);
return write(fhandle, buf, len);
@@ -934,7 +942,7 @@
if(maxbytes && len > maxbytes)
len = maxbytes;
- DEBUG4("(READ from fd %d offset %Lu len %u), ", fhandle, foffset, len);
+ DEBUG4("(READ from fd %d offset %llu len %u), ", fhandle, foffset, len);
myseek(fhandle, foffset);
return read(fhandle, buf, len);
@@ -971,7 +979,7 @@
if (!(client->server->flags & F_COPYONWRITE))
return(rawexpread_fully(a, buf, len, client));
- DEBUG3("Asked to read %d bytes at %Lu.\n", len, (unsigned long long)a);
+ DEBUG3("Asked to read %d bytes at %llu.\n", len, (unsigned long long)a);
mapl=a/DIFFPAGESIZE; maph=(a+len-1)/DIFFPAGESIZE;
@@ -981,12 +989,12 @@
rdlen=(0difmap[mapcnt]!=(u32)(-1)) { /* the block is already there */
- DEBUG3("Page %Lu is at %lu\n", (unsigned long long)mapcnt,
+ DEBUG3("Page %llu is at %lu\n", (unsigned long long)mapcnt,
(unsigned long)(client->difmap[mapcnt]));
myseek(client->difffile, client->difmap[mapcnt]*DIFFPAGESIZE+offset);
if (read(client->difffile, buf, rdlen) != rdlen) return -1;
} else { /* the block is not there */
- DEBUG2("Page %Lu is not here, we read the original one\n",
+ DEBUG2("Page %llu is not here, we read the original one\n",
(unsigned long long)mapcnt);
if(rawexpread_fully(a, buf, rdlen, client)) return -1;
}
@@ -1015,7 +1023,7 @@
if (!(client->server->flags & F_COPYONWRITE))
return(rawexpwrite_fully(a, buf, len, client));
- DEBUG3("Asked to write %d bytes at %Lu.\n", len, (unsigned long long)a);
+ DEBUG3("Asked to write %d bytes at %llu.\n", len, (unsigned long long)a);
mapl=a/DIFFPAGESIZE ; maph=(a+len-1)/DIFFPAGESIZE ;
@@ -1026,7 +1034,7 @@
len : (size_t)DIFFPAGESIZE-offset;
if (client->difmap[mapcnt]!=(u32)(-1)) { /* the block is already there */
- DEBUG3("Page %Lu is at %lu\n", (unsigned long long)mapcnt,
+ DEBUG3("Page %llu is at %lu\n", (unsigned long long)mapcnt,
(unsigned long)(client->difmap[mapcnt])) ;
myseek(client->difffile,
client->difmap[mapcnt]*DIFFPAGESIZE+offset);
@@ -1034,7 +1042,7 @@
} else { /* the block is not there */
myseek(client->difffile,client->difffilelen*DIFFPAGESIZE) ;
client->difmap[mapcnt]=(client->server->flags&F_SPARSE)?mapcnt:client->difffilelen++;
- DEBUG3("Page %Lu is not here, we put it at %lu\n",
+ DEBUG3("Page %llu is not here, we put it at %lu\n",
(unsigned long long)mapcnt,
(unsigned long)(client->difmap[mapcnt]));
rdlen=DIFFPAGESIZE ;
@@ -1134,7 +1142,7 @@
if (len > BUFSIZE + sizeof(struct nbd_reply))
err("Request too big!");
#ifdef DODBG
- printf("%s from %Lu (%Lu) len %d, ", request.type ? "WRITE" :
+ printf("%s from %llu (%llu) len %d, ", request.type ? "WRITE" :
"READ", (unsigned long long)request.from,
(unsigned long long)request.from / 512, len);
#endif
@@ -1257,7 +1265,7 @@
client->exportsize = client->server->expected_size;
}
- msg3(LOG_INFO, "Size of exported file/device is %Lu", (unsigned long long)client->exportsize);
+ msg3(LOG_INFO, "Size of exported file/device is %llu", (unsigned long long)client->exportsize);
if(multifile) {
msg3(LOG_INFO, "Total number of files: %d", i);
}
@@ -1421,9 +1429,16 @@
for(i=0;i<servers->len;i++) {
serve=&(g_array_index(servers, SERVER, i));
if(FD_ISSET(serve->socket, &rset)) {
+ int sock_flags;
if ((net=accept(serve->socket, (struct sockaddr *) &addrin, &addrinlen)) < 0)
err("accept: %m");
+ if((sock_flags = fcntl(net, F_GETFL, 0))==-1) {
+ err("fcntl F_GETFL");
+ }
+ if(fcntl(net, F_SETFL, sock_flags &~O_NONBLOCK)==-1) {
+ err("fcntl F_SETFL ~O_NONBLOCK");
+ }
client = g_malloc(sizeof(CLIENT));
client->server=serve;
client->exportsize=OFFT_MAX;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/README new/nbd-2.9.12/README
--- old/nbd-2.9.11/README 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/README 2009-04-30 14:49:38.000000000 +0200
@@ -109,13 +109,6 @@
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
@@ -127,6 +120,26 @@
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
+ ' (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'
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/simple_test new/nbd-2.9.12/simple_test
--- old/nbd-2.9.11/simple_test 2008-05-01 20:56:34.000000000 +0200
+++ new/nbd-2.9.12/simple_test 2009-04-30 14:49:38.000000000 +0200
@@ -6,43 +6,83 @@
# Create a one-meg device
dd if=/dev/zero of=$tmpnam bs=1024 count=1024
-./nbd-server -C /dev/null -p `pwd`/nbd-server.pid 11111 $tmpnam &
-# -p only works if nbd-server wasn't compiled with -DNOFORK or -DNODAEMON,
-# which I sometimes do for testing and debugging.
-PID=$!
-sleep 1
-./nbd-tester-client localhost 11111
-retval=$?
-if [ -f nbd-server.pid ]
-then
- kill `cat nbd-server.pid`
-else
- kill $PID
-fi
-rm -f nbd-server.pid
-if [ $retval -ne 0 ]
-then
- rm -f $tmpnam
- exit $retval
-fi
-cat > nbd-server.conf < nbd-server.conf <nbd-server.conf <http://www.vanheusden.com/license.txt
-It is actually the GNU Public License.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/winnbd/nbdsrvr.cpp new/nbd-2.9.12/winnbd/nbdsrvr.cpp
--- old/nbd-2.9.11/winnbd/nbdsrvr.cpp 2007-01-30 14:00:59.000000000 +0100
+++ new/nbd-2.9.12/winnbd/nbdsrvr.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,359 +0,0 @@
-#include
-#include
-
-int portnr;
-char *filename;
-
-int READ(SOCKET sh, UCHAR *whereto, int howmuch)
-{
- int pnt = 0;
-
-#ifdef _DEBUG
- printf("read: %d bytes requested\n", howmuch);
-#endif
-
- while(howmuch > 0)
- {
- int nread = recv(sh, (char *)&whereto[pnt], howmuch, 0);
- if (nread == 0)
- break;
- if (nread == SOCKET_ERROR)
- {
- fprintf(stderr, "Connection dropped. Error: %d\n", WSAGetLastError());
- break;
- }
-
- pnt += nread;
- howmuch -= nread;
- }
-
- return pnt;
-}
-
-int WRITE(SOCKET sh, UCHAR *wherefrom, int howmuch)
-{
- int pnt = 0;
-
- while(howmuch > 0)
- {
- int nwritten = send(sh, (char *)&wherefrom[pnt], howmuch, 0);
- if (nwritten == 0)
- break;
- if (nwritten == SOCKET_ERROR)
- {
- fprintf(stderr, "Connection dropped. Error: %d\n", WSAGetLastError());
- break;
- }
-
- pnt += nwritten;
- howmuch -= nwritten;
- }
-
- return pnt;
-}
-
-BOOL getu32(SOCKET sh, ULONG *val)
-{
- UCHAR buffer[4];
-
- if (READ(sh, buffer, 4) != 4)
- return FALSE;
-
- *val = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3]);
-
- return TRUE;
-}
-
-BOOL putu32(SOCKET sh, ULONG value)
-{
- UCHAR buffer[4];
-
- buffer[0] = (value >> 24) & 255;
- buffer[1] = (value >> 16) & 255;
- buffer[2] = (value >> 8) & 255;
- buffer[3] = (value ) & 255;
-
- if (WRITE(sh, buffer, 4) != 4)
- return FALSE;
- else
- return TRUE;
-}
-
-DWORD WINAPI draad(LPVOID data)
-{
- SOCKET sockh = (SOCKET)data;
- HANDLE fh;
- char neg = 1;
-
- // open file 'filename'
- fh = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fh == INVALID_HANDLE_VALUE)
- {
- fprintf(stderr, "Error opening file %s: %d\n", filename, GetLastError());
- }
-
- for(;fh != INVALID_HANDLE_VALUE;)
- {
- UCHAR handle[9];
- ULONG magic, from, len, type, dummy;
-
- /* negotiating time? */
- if (neg)
- {
- printf("Negotiating...\n");
- if (WRITE(sockh, (unsigned char *)"NBDMAGIC", 8) != 8)
- {
- fprintf(stderr, "Failed to send magic string\n");
- break;
- }
-
- // some other magic value
- unsigned char magic[8];
- magic[0] = 0x00;
- magic[1] = 0x00;
- magic[2] = 0x42;
- magic[3] = 0x02;
- magic[4] = 0x81;
- magic[5] = 0x86;
- magic[6] = 0x12;
- magic[7] = 0x53;
- if (WRITE(sockh, magic, 8) != 8)
- {
- fprintf(stderr, "Failed to send 2nd magic string\n");
- break;
- }
-
- // send size of file
- unsigned char exportsize[8];
- DWORD fsize = GetFileSize(fh, NULL);
- if (fsize == 0xFFFFFFFF)
- {
- fprintf(stderr, "Failed to get filesize. Error: %d\n", GetLastError());
- break;
- }
- exportsize[7] = (fsize ) & 255;
- exportsize[6] = (fsize >> 8) & 255;
- exportsize[5] = (fsize >> 16) & 255;
- exportsize[4] = (fsize >> 24) & 255;
- exportsize[3] = (fsize >> 32) & 255;
- exportsize[2] = (fsize >> 40) & 255;
- exportsize[1] = (fsize >> 48) & 255;
- exportsize[0] = (fsize >> 56) & 255;
-#ifdef _DEBUG
- printf("File is %ld bytes\n", fsize);
-#endif
- if (WRITE(sockh, exportsize, 8) != 8)
- {
- fprintf(stderr, "Failed to send filesize\n");
- break;
- }
-
- // send a couple of zeros */
- unsigned char buffer[128];
- memset(buffer, 0x00, 128);
- if (WRITE(sockh, buffer, 128) != 128)
- {
- fprintf(stderr, "Failed to send a couple of 0x00s\n");
- break;
- }
-
- printf("Started!\n");
- neg = 0;
- }
-
- if (getu32(sockh, &magic) == FALSE || // 0x12560953
- getu32(sockh, &type) == FALSE || // 0=read,1=write
- READ(sockh, handle, 8) != 8 || // handle
- getu32(sockh, &dummy) == FALSE || // ... high word of offset
- getu32(sockh, &from) == FALSE || // offset
- getu32(sockh, &len) == FALSE) // length
- {
- fprintf(stderr, "Failed to read from socket\n");
- break;
- }
-
-#ifdef _DEBUG
- handle[8] = 0x00;
- printf("Magic: %lx\n", magic);
- printf("Offset: %ld\n", from);
- printf("Len: %ld\n", len);
- printf("Handle: %s\n", handle);
- printf("Req.type: %ld (%s)\n\n", type, type?"write":"read");
-#endif
-
- // verify protocol
- if (magic != 0x25609513)
- {
- fprintf(stderr, "Unexpected protocol version! (got: %lx, expected: 0x25609513)\n", magic);
- break;
- }
-
- // seek to 'from'
- if (SetFilePointer(fh, from, NULL, FILE_BEGIN) == 0xFFFFFFFF)
- {
- fprintf(stderr, "Error seeking in file %s to position %d: %d\n", filename, from, GetLastError());
- break;
- }
-
- if (type == 1) // write
- {
- while(len > 0)
- {
- DWORD dummy;
- UCHAR buffer[32768];
- // read from socket
- int nb = recv(sockh, (char *)buffer, min(len, 32768), 0);
- if (nb == 0)
- break;
-
- // write to file;
- if (WriteFile(fh, buffer, nb, &dummy, NULL) == 0)
- {
- fprintf(stderr, "Failed to write to %s: %d\n", filename, GetLastError());
- break;
- }
- if (dummy != nb)
- {
- fprintf(stderr, "Failed to write to %s: %d (written: %d, requested to write: %d)\n", filename, GetLastError(), dummy, nb);
- break;
- }
-
- len -= nb;
- }
- if (len) // connection was closed
- {
- fprintf(stderr, "Connection was dropped while receiving data\n");
- break;
- }
-
- // send 'ack'
- if (putu32(sockh, 0x67446698) == FALSE ||
- putu32(sockh, 0) == FALSE ||
- WRITE(sockh, handle, 8) != 8)
- {
- fprintf(stderr, "Failed to send through socket\n");
- break;
- }
- }
- else if (type == 0)
- {
- // send 'ack'
- if (putu32(sockh, 0x67446698) == FALSE ||
- putu32(sockh, 0) == FALSE ||
- WRITE(sockh, handle, 8) != 8)
- {
- fprintf(stderr, "Failed to send through socket\n");
- break;
- }
-
- while(len > 0)
- {
- DWORD dummy;
- UCHAR buffer[32768];
- int nb = min(len, 32768);
- int pnt = 0;
-
- // read nb to buffer;
- if (ReadFile(fh, buffer, nb, &dummy, NULL) == 0)
- {
- fprintf(stderr, "Failed to read from %s: %d\n", filename, GetLastError());
- break;
- }
- if (dummy != nb)
- {
- fprintf(stderr, "Failed to read from %s: %d\n", filename, GetLastError());
- break;
- }
-
- // send through socket
- if (WRITE(sockh, buffer, nb) != nb) // connection was closed
- {
- fprintf(stderr, "Connection dropped while sending block\n");
- break;
- }
-
- len -= nb;
- }
- if (len) // connection was closed
- break;
- }
- else
- {
- printf("Unexpected commandtype: %d\n", type);
- break;
- }
- }
-
- // close file
- if (CloseHandle(fh) == 0)
- {
- fprintf(stderr, "Failed to close handle: %d\n", GetLastError());
- }
-
- closesocket(sockh);
-
- ExitThread(0);
-
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- SOCKET newconnh;
- WSADATA WSAData;
-
- printf("nbdsrvr v0.1, (C) 2003 by folkert@vanheusden.com\n");
-
- if (argc != 3)
- {
- fprintf(stderr, "Usage: %s file portnr\n", argv[0]);
- return 1;
- }
- filename = argv[1];
- portnr = atoi(argv[2]);
-
- // initialize WinSock library
- (void)WSAStartup(0x101, &WSAData);
-
- // create listener socket
- newconnh= socket(AF_INET, SOCK_STREAM, 0);
- if (newconnh == INVALID_SOCKET)
- return -1;
-
- // bind
- struct sockaddr_in ServerAddr;
- int ServerAddrLen;
- ServerAddrLen = sizeof(ServerAddr);
- memset((char *)&ServerAddr, '\0', ServerAddrLen);
- ServerAddr.sin_family = AF_INET;
- ServerAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- ServerAddr.sin_port = htons(portnr);
- if (bind(newconnh, (struct sockaddr *)&ServerAddr, ServerAddrLen) == -1)
- return -1;
-
- // listen
- if (listen(newconnh, 5) == -1)
- return -1;
-
- for(;;)
- {
- SOCKET clienth;
- struct sockaddr_in clientaddr;
- int clientaddrlen;
-
- clientaddrlen = sizeof(clientaddr);
-
- /* accept a connection */
- clienth = accept(newconnh, (struct sockaddr *)&clientaddr, &clientaddrlen);
-
- if (clienth != INVALID_SOCKET)
- {
- printf("Connection made with %s\n", inet_ntoa(clientaddr.sin_addr));
-
- DWORD tid;
- HANDLE th = CreateThread(NULL, 0, draad, (void *)clienth, 0, &tid);
- }
- }
-
- return 0;
-}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/winnbd/nbdsrvr.dsp new/nbd-2.9.12/winnbd/nbdsrvr.dsp
--- old/nbd-2.9.11/winnbd/nbdsrvr.dsp 2007-01-30 14:00:59.000000000 +0100
+++ new/nbd-2.9.12/winnbd/nbdsrvr.dsp 1970-01-01 01:00:00.000000000 +0100
@@ -1,90 +0,0 @@
-# Microsoft Developer Studio Project File - Name="nbdsrvr" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=nbdsrvr - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "nbdsrvr.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "nbdsrvr.mak" CFG="nbdsrvr - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "nbdsrvr - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "nbdsrvr - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "nbdsrvr - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x413 /d "NDEBUG"
-# ADD RSC /l 0x413 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "nbdsrvr - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x413 /d "_DEBUG"
-# ADD RSC /l 0x413 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "nbdsrvr - Win32 Release"
-# Name "nbdsrvr - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\nbdsrvr.cpp
-# End Source File
-# End Target
-# End Project
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/winnbd/nbdsrvr.dsw new/nbd-2.9.12/winnbd/nbdsrvr.dsw
--- old/nbd-2.9.11/winnbd/nbdsrvr.dsw 2007-01-30 14:00:59.000000000 +0100
+++ new/nbd-2.9.12/winnbd/nbdsrvr.dsw 1970-01-01 01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "nbdsrvr"=.\nbdsrvr.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
Files old/nbd-2.9.11/winnbd/NBDSvrWin2000.zip and new/nbd-2.9.12/winnbd/NBDSvrWin2000.zip differ
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/winnbd/README new/nbd-2.9.12/winnbd/README
--- old/nbd-2.9.11/winnbd/README 2007-01-30 14:00:59.000000000 +0100
+++ new/nbd-2.9.12/winnbd/README 1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-nbd server for windows 2000
-
-This is a runnable version of nbd server for windows 2000.
-The client used for test is nbd-2.0.
-
-usage example:
-if Partition if defined
-mynbdserverwin 3456 \\.\A:
-if not
-mynbdserverwin 3456 c:\testfile
\ No newline at end of file
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nbd-2.9.11/winnbd/readme.txt new/nbd-2.9.12/winnbd/readme.txt
--- old/nbd-2.9.11/winnbd/readme.txt 2007-01-30 14:00:59.000000000 +0100
+++ new/nbd-2.9.12/winnbd/readme.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,31 +0,0 @@
-nbdsrvr is (C) 2003 by folkert@vanheusden.com
-New versions can be obtained from:
-http://www.vanheusden.com/ (browse to the
-"microsoft windows software" section).
-
-Usage:
-
-nbdsrvr filename portnumber
-
-filename must be an image of a filesystem or
-whatever kind of device you whish to use. Can
-also be an empty file.
-For example, create an empty file of 10MB
-called "image.dat"
-Then:
-nbdsrvr image.dat 9000
-On your linux-box:
-nbd-client hostname 9000 /dev/ndX
-hostname is the hostname of your windows-box,
-/dev/ndX is the device you want to couple the
-image to.
-After that, you could create a filesystem on
-this image: on your Linux-box, type:
-mke2fs /dev/ndX
-and then mount it:
-mount /dev/ndX /mnt
-
-Good luck!
-
-
--- Folkert van Heusden, 2003/07/13, 21:59
++++++ nbd-2.9.5-warn.diff -> nbd-2.9.12-warn.diff ++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org