[Glibc-bsd-commits] r1879 - in trunk: . ufsutils ufsutils/debian ufsutils/debian/patches

Petr Salinger ps-guest at alioth.debian.org
Thu Jan 18 12:19:30 UTC 2007


Author: ps-guest
Date: 2007-01-18 13:19:28 +0100 (Thu, 18 Jan 2007)
New Revision: 1879

Added:
   trunk/ufsutils/
   trunk/ufsutils/debian/
   trunk/ufsutils/debian/TODO
   trunk/ufsutils/debian/changelog
   trunk/ufsutils/debian/compat
   trunk/ufsutils/debian/control
   trunk/ufsutils/debian/copyright
   trunk/ufsutils/debian/libufs2.dirs
   trunk/ufsutils/debian/libufs2.install
   trunk/ufsutils/debian/patch.mk
   trunk/ufsutils/debian/patches/
   trunk/ufsutils/debian/patches/00_libport.patch
   trunk/ufsutils/debian/patches/01_libdisklabel.patch
   trunk/ufsutils/debian/patches/01_libufs.patch
   trunk/ufsutils/debian/patches/02_badsect.ufs.patch
   trunk/ufsutils/debian/patches/02_bsdlabel.ufs.patch
   trunk/ufsutils/debian/patches/02_dump.ufs.patch
   trunk/ufsutils/debian/patches/02_dumpfs.ufs.patch
   trunk/ufsutils/debian/patches/02_ffsinfo.patch
   trunk/ufsutils/debian/patches/02_fsck.ufs.patch
   trunk/ufsutils/debian/patches/02_fsdb.ufs.patch
   trunk/ufsutils/debian/patches/02_growfs.ufs.patch
   trunk/ufsutils/debian/patches/02_mkfs.ufs.patch
   trunk/ufsutils/debian/patches/02_tunefs.ufs.patch
   trunk/ufsutils/debian/patches/03_mkfs.ufs_operator_gid.patch
   trunk/ufsutils/debian/patches/99_makefiles.patch
   trunk/ufsutils/debian/rules
   trunk/ufsutils/debian/ufsutils.dirs
   trunk/ufsutils/debian/ufsutils.install
   trunk/ufsutils/debian/upstream.sh
Log:
* add ufsutils from svn.debian.org/svn/pkg-ufsutils/trunk, revision 36



Added: trunk/ufsutils/debian/TODO
===================================================================
--- trunk/ufsutils/debian/TODO	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/TODO	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,10 @@
+TODO:
+
+- hurd specific support. (4th user mode, author, trans)
+- portable mount(2).
+- portable libdisklabel.
+- portable libblockdevice.
+- userland fs manipulation utils (ala hfsutils).
+- ufs snapshot support.
+- alternative to bsd sysctl.
+

Added: trunk/ufsutils/debian/changelog
===================================================================
--- trunk/ufsutils/debian/changelog	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/changelog	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,99 @@
+ufsutils (0.0+2004.06.26-5) UNRELEASED; urgency=low
+
+  * Fix Subversion repository address.
+  * Added PHONY targets:
+    - debian/patch.mk
+  * Use root gid as a fallback for operator on mkfs.ufs. (Closes: #293411)
+  * Updated upstream tarball creator (debian/upstream.sh).
+  * Now using Standards-Version 3.6.2 (no changes needed).
+  * Upgraded to debhelper compatibility level 5.
+  * Reindent debian/copyright.
+  * Make debian/patch.mk privide an unpatch target. Switch patch to single
+    colong target.
+
+ -- Guillem Jover <guillem at debian.org>  Thu,  3 Feb 2005 08:29:58 +0100
+
+ufsutils (0.0+2004.06.26-4) experimental; urgency=low
+
+  * Fix integer overflow on get_block_device_size on GNU/Linux.
+    - debian/patches/00_libport.patch
+
+ -- Guillem Jover <guillem at debian.org>  Sun,  4 Jul 2004 12:25:17 +0200
+
+ufsutils (0.0+2004.06.26-3) experimental; urgency=low
+
+  * Fix get_block_device_size for real on kFreeBSD, it was returning the
+    whole disk size. And add to it Hurd support.
+    - debian/patches/00_libport.patch
+  * Build with LFS support.
+    - debian/patches/99_makefiles.patch
+
+ -- Guillem Jover <guillem at debian.org>  Wed, 30 Jun 2004 16:02:34 +0200
+
+ufsutils (0.0+2004.06.26-2) experimental; urgency=low
+
+  * Create a portable get_block_device_size to fix mkfs.ufs on all versions
+    of kFreeBSD.
+    - debian/patches/00_port.patch
+    - debian/patches/99_makefiles.patch
+  * Splitted and merged patches, more fine grained:
+    - debian/patches/00_port.patch: Renamed to ...
+    - debian/patches/00_libport.patch: ... this. Moved subdirectory specific
+      patches into their own patch.
+    - debian/patches/99_makefiles.patch: Likewise.
+    - debian/patches/01_libufs.patch: New file. Merge from the two previous
+      patches specific parts.
+    - debian/patches/02_badsect.ufs.patch: Likewise.
+    - debian/patches/02_bsdlabel.ufs.patch: Likewise.
+    - debian/patches/02_dumpfs.ufs.patch: Likewise.
+    - debian/patches/02_dump.ufs.patch: Likewise.
+    - debian/patches/02_ffsinfo.patch: Likewise.
+    - debian/patches/02_fsck.ufs.patch: Likewise.
+    - debian/patches/02_fsdb.ufs.patch: Likewise.
+    - debian/patches/02_growfs.ufs.patch: Likewise.
+    - debian/patches/02_mkfs.ufs.patch: Likewise.
+    - debian/patches/02_tunefs.ufs.patch: Likewise.
+
+ -- Guillem Jover <guillem at debian.org>  Tue, 29 Jun 2004 23:23:53 +0200
+
+ufsutils (0.0+2004.06.26-1) experimental; urgency=low
+
+  * New Upstream Snapshot.
+  * Fix mkfs.ufs not working on block devices, due to being unable to
+    get the device size. (Closes: #256716)
+    - debian/patches/00_port.patch
+  * Added the location of the Subversion repo used for the packages.
+  * Sync patches:
+    - debian/patches/00_port.patch
+  * Enable ffsinfo:
+    - debian/patches/99_makefiles.patch
+
+ -- Guillem Jover <guillem at debian.org>  Tue, 29 Jun 2004 03:27:00 +0200
+
+ufsutils (0.0+2004.05.24-1) experimental; urgency=low
+
+  * New Upstream Snapshot.
+    - Some files switched from BSD four clause license to the three one.
+    - Include upstream files into libport, will be easier to track.
+  * Updated upstream tarball creator (debian/upstream.sh), so it now uses
+    ssh and an european mirror.
+  * Refer to debian/upstream.sh from debian/copyright.
+  * Use new make target "patch":
+    - debian/patch.mk
+    - debian/rules
+  * Move libufs2 to Section libs.
+  * Removed debian/docs file.
+  * Splitted patches:
+    - debian/patches/00_port.patch
+    - debian/patches/01_libdisklabel.patch
+    - debian/patches/99_makefiles.patch
+
+ -- Guillem Jover <guillem at debian.org>  Fri, 21 May 2004 06:29:05 +0200
+
+ufsutils (0.0+2004.05.13-1) experimental; urgency=low
+
+  * Initial Release. (Closes: #240587)
+  * Added fsck.ufs -a support. Thanks to Robert Millan <rmh at debian.org>.
+
+ -- Guillem Jover <guillem at debian.org>  Sun, 16 May 2004 23:37:00 +0200
+

Added: trunk/ufsutils/debian/compat
===================================================================
--- trunk/ufsutils/debian/compat	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/compat	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1 @@
+5

Added: trunk/ufsutils/debian/control
===================================================================
--- trunk/ufsutils/debian/control	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/control	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,37 @@
+Source: ufsutils
+Section: utils
+Priority: optional
+Maintainer: Guillem Jover <guillem at debian.org>
+Build-Depends: debhelper (>= 5), libedit-dev, libncurses5-dev
+Standards-Version: 3.6.2
+
+Package: ufsutils
+Architecture: any
+Section: utils
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: fsck-backend
+Conflicts: hurd
+Description: UFS filesystems utilities
+ Utilities to manage the UFS filesystem, mostly used in BSD or derived
+ operating systems. This include FFS, UFS and UFS2.
+ .
+ The following utilities are provided:
+  - mkfs.ufs
+  - fsck.ufs
+  - fsdb.ufs
+  - dumpfs.ufs
+  - growfs.ufs
+  - tunefs.ufs
+  - badsect.ufs
+  - ffsinfo
+ .
+ WARNING: This is an experimental package, it may damage your filesystem.
+
+Package: libufs2
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: UFS filesystem shared library
+ Shared library to manage the UFS filesystem, mostly used in BSD or derived
+ operating systems. This include FFS, UFS and UFS2.
+

Added: trunk/ufsutils/debian/copyright
===================================================================
--- trunk/ufsutils/debian/copyright	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/copyright	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,35 @@
+This package was debianized by Guillem Jover <guillem at debian.org> on
+Fri, 30 Apr 2004 06:35:50 +0200.
+
+The debian packages are maintained through Subversion on:
+
+    <svn://svn.debian.org/pkg-ufsutils/>
+
+The upstream source was downloaded and packaged from the FreeBSD CVS.
+Take a look at the debian/upstream.sh script.
+
+Upstream Authors:
+
+    The FreeBSD Project
+    Ported by Guillem Jover <guillem at debian.org>
+
+License:
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted under the terms of the BSD License.
+
+    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+    ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+    SUCH DAMAGE.
+
+On Debian systems, the complete text of the BSD License can be
+found in `/usr/share/common-licenses/BSD'.
+

Added: trunk/ufsutils/debian/libufs2.dirs
===================================================================
--- trunk/ufsutils/debian/libufs2.dirs	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/libufs2.dirs	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1 @@
+lib

Added: trunk/ufsutils/debian/libufs2.install
===================================================================
--- trunk/ufsutils/debian/libufs2.install	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/libufs2.install	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1 @@
+lib/lib*.so.*

Added: trunk/ufsutils/debian/patch.mk
===================================================================
--- trunk/ufsutils/debian/patch.mk	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patch.mk	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,95 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2002,2003 Colin Walters <walters at debian.org>
+#
+# Modified by Guillem Jover <guillem at debian.org>:
+#  Standalone system
+#  Honour DPATCHLEVEL
+#  Exit when trying to revert patches but no stamp-patch exists
+#  Provide a patch target
+#
+# Description: A sample patch system which uses separate files in debian/patches
+#  Patch names must end in .patch, currently.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+DEB_SRCDIR ?= .
+DEB_PATCHDIRS = debian/patches
+DEB_PATCHES = $(foreach dir,$(DEB_PATCHDIRS),$(shell LC_COLLATE=C echo $(wildcard $(dir)/*.patch) $(wildcard $(dir)/*.diff)))
+
+patch: apply-patches
+
+unpatch: reverse-patches
+	rm -f debian/stamp-patch*
+	rm -f debian/patches/*.log
+
+# The patch subsystem
+apply-patches: debian/stamp-patched
+debian/stamp-patched: $(DEB_PATCHES)
+debian/stamp-patched reverse-patches:
+	@echo "patches: $(DEB_PATCHES)"
+	@set -e ; reverse=""; patches="$(DEB_PATCHES)"; \
+	  if [ "$@" = "reverse-patches" ]; then \
+	    if [ ! -e debian/stamp-patched ]; then \
+	      echo "Not reversing not applied patches."; \
+	      exit 0; \
+	    fi; \
+	    reverse="-R"; \
+	    for patch in $$patches; do reversepatches="$$patch $$reversepatches"; done; \
+	    patches="$$reversepatches"; \
+	  fi; \
+	  for patch in $$patches; do \
+	  level=$$(head $$patch | egrep '^#DPATCHLEVEL=' | cut -f 2 -d '='); \
+	  reverse=""; \
+	  if [ "$@" = "reverse-patches" ]; then reverse="-R"; fi; \
+	  success=""; \
+	  if [ -z "$$level" ]; then \
+	    echo -n "Trying "; if test -n "$$reverse"; then echo -n "reversed "; fi; echo -n "patch $$patch at level "; \
+	    for level in 0 1 2; do \
+	      if test -z "$$success"; then \
+	        echo -n "$$level..."; \
+	        if cat $$patch | patch -d $(DEB_SRCDIR) $$reverse -E --dry-run -p$$level 1>$$patch.level-$$level.log 2>&1; then \
+	          if cat $$patch | patch -d $(DEB_SRCDIR) $$reverse -E --no-backup-if-mismatch -V never -p$$level 1>$$patch.level-$$level.log 2>&1; then \
+	            success=yes; \
+	            touch debian/stamp-patch-$$(basename $$patch); \
+	            echo "success."; \
+                  fi; \
+	        fi; \
+	      fi; \
+            done; \
+	    if test -z "$$success"; then \
+	      if test -z "$$reverse"; then \
+	        echo "failure."; \
+	        exit 1; \
+	       else \
+	         echo "failure (ignored)."; \
+               fi \
+	    fi; \
+	  else \
+	    echo -n "Trying patch $$patch at level $$level..."; \
+	    if cat $$patch | patch -d $(DEB_SRCDIR) $$reverse -E --no-backup-if-mismatch -V never -p$$level 1>$$patch.log 2>&1; then \
+              touch debian/stamp-patch-$$(basename $$patch); \
+	      echo "success."; \
+	    else \
+	      echo "failure:"; \
+	      cat $$patch.log; \
+	      if test -z "$$reverse"; then exit 1; fi; \
+            fi; \
+	  fi; \
+	done
+	if [ "$@" = "debian/stamp-patched" ]; then touch debian/stamp-patched; fi
+
+.PHONY: patch unpatch apply-patches reverse-patches
+

Added: trunk/ufsutils/debian/patches/00_libport.patch
===================================================================
--- trunk/ufsutils/debian/patches/00_libport.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/00_libport.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,811 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/include/port/port.h ufsutils.new/include/port/port.h
+--- ufsutils.orig/include/port/port.h	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/include/port/port.h	2004-05-16 21:34:09.000000000 +0200
+@@ -0,0 +1,11 @@
++#ifndef LIBPORT_H
++#define LIBPORT_H
++
++#define setproctitle(fmt, args...)
++
++#define __dead2
++#define __printflike(x,y)
++#define __FBSDID(x)
++
++#endif
++
+diff -Naur ufsutils.orig/include/port/random.h ufsutils.new/include/port/random.h
+--- ufsutils.orig/include/port/random.h	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/include/port/random.h	2004-05-16 21:41:03.000000000 +0200
+@@ -0,0 +1,11 @@
++#ifndef LIBPORT_RANDOM_H
++#define LIBPORT_RANDOM_H
++
++#include <sys/types.h>
++
++void arc4random_stir();
++void arc4random_addrandom(u_char *dat, int datlen);
++u_int32_t arc4random();
++
++#endif
++
+diff -Naur ufsutils.orig/include/port/string.h ufsutils.new/include/port/string.h
+--- ufsutils.orig/include/port/string.h	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/include/port/string.h	2004-05-16 21:29:54.000000000 +0200
+@@ -0,0 +1,10 @@
++#ifndef LIBPORT_STRING_H
++#define LIBPORT_STRING_H
++
++#include <string.h>
++
++size_t strlcat(char *dst, const char *src, size_t siz);
++size_t strlcpy(char *dst, const char *src, size_t siz);
++
++#endif
++
+diff -Naur ufsutils.orig/include/sys/disklabel.h ufsutils.new/include/sys/disklabel.h
+--- ufsutils.orig/include/sys/disklabel.h	2004-04-30 05:41:43.000000000 +0200
++++ ufsutils.new/include/sys/disklabel.h	2004-05-21 05:12:28.000000000 +0200
+@@ -33,10 +33,11 @@
+ #ifndef _SYS_DISKLABEL_H_
+ #define	_SYS_DISKLABEL_H_
+ 
++#include <stddef.h>
+ #ifndef _KERNEL
+ #include <sys/types.h>
+ #endif
+-#include <sys/ioccom.h>
++//#include <sys/ioccom.h>
+ 
+ /*
+  * Disk description table, see disktab(5)
+diff -Naur ufsutils.orig/include/sys/mount.h ufsutils.new/include/sys/mount.h
+--- ufsutils.orig/include/sys/mount.h	2004-06-19 06:07:57.000000000 +0200
++++ ufsutils.new/include/sys/mount.h	2004-06-28 23:40:16.000000000 +0200
+@@ -34,14 +34,10 @@
+ #define _SYS_MOUNT_H_
+ 
+ #include <sys/ucred.h>
+-#include <sys/queue.h>
+-#ifdef _KERNEL
+-#include <sys/lockmgr.h>
+-#include <sys/_lock.h>
+-#include <sys/_mutex.h>
+-#endif
++#include <stdint.h>
++#include <sys/types.h>
++#include <sys/socket.h>
+ 
+-typedef struct fsid { int32_t val[2]; } fsid_t;	/* filesystem id type */
+ 
+ /*
+  * File identifier.
+@@ -60,116 +56,6 @@
+  */
+ #define	MFSNAMELEN	16		/* length of type name including null */
+ #define	MNAMELEN	88		/* size of on/from name bufs */
+-#define	STATFS_VERSION	0x20030518	/* current version number */
+-struct statfs {
+-	uint32_t f_version;		/* structure version number */
+-	uint32_t f_type;		/* type of filesystem */
+-	uint64_t f_flags;		/* copy of mount exported flags */
+-	uint64_t f_bsize;		/* filesystem fragment size */
+-	uint64_t f_iosize;		/* optimal transfer block size */
+-	uint64_t f_blocks;		/* total data blocks in filesystem */
+-	uint64_t f_bfree;		/* free blocks in filesystem */
+-	int64_t	 f_bavail;		/* free blocks avail to non-superuser */
+-	uint64_t f_files;		/* total file nodes in filesystem */
+-	int64_t	 f_ffree;		/* free nodes avail to non-superuser */
+-	uint64_t f_syncwrites;		/* count of sync writes since mount */
+-	uint64_t f_asyncwrites;		/* count of async writes since mount */
+-	uint64_t f_syncreads;		/* count of sync reads since mount */
+-	uint64_t f_asyncreads;		/* count of async reads since mount */
+-	uint64_t f_spare[10];		/* unused spare */
+-	uint32_t f_namemax;		/* maximum filename length */
+-	uid_t	  f_owner;		/* user that mounted the filesystem */
+-	fsid_t	  f_fsid;		/* filesystem id */
+-	char	  f_charspare[80];	    /* spare string space */
+-	char	  f_fstypename[MFSNAMELEN]; /* filesystem type name */
+-	char	  f_mntfromname[MNAMELEN];  /* mounted filesystem */
+-	char	  f_mntonname[MNAMELEN];    /* directory on which mounted */
+-};
+-
+-#ifdef _KERNEL
+-#define	OMFSNAMELEN	16	/* length of fs type name, including null */
+-#define	OMNAMELEN	(88 - 2 * sizeof(long))	/* size of on/from name bufs */
+-
+-/* XXX getfsstat.2 is out of date with write and read counter changes here. */
+-/* XXX statfs.2 is out of date with read counter changes here. */
+-struct ostatfs {
+-	long	f_spare2;		/* placeholder */
+-	long	f_bsize;		/* fundamental filesystem block size */
+-	long	f_iosize;		/* optimal transfer block size */
+-	long	f_blocks;		/* total data blocks in filesystem */
+-	long	f_bfree;		/* free blocks in fs */
+-	long	f_bavail;		/* free blocks avail to non-superuser */
+-	long	f_files;		/* total file nodes in filesystem */
+-	long	f_ffree;		/* free file nodes in fs */
+-	fsid_t	f_fsid;			/* filesystem id */
+-	uid_t	f_owner;		/* user that mounted the filesystem */
+-	int	f_type;			/* type of filesystem */
+-	int	f_flags;		/* copy of mount exported flags */
+-	long	f_syncwrites;		/* count of sync writes since mount */
+-	long	f_asyncwrites;		/* count of async writes since mount */
+-	char	f_fstypename[OMFSNAMELEN]; /* fs type name */
+-	char	f_mntonname[OMNAMELEN];	/* directory on which mounted */
+-	long	f_syncreads;		/* count of sync reads since mount */
+-	long	f_asyncreads;		/* count of async reads since mount */
+-	short	f_spares1;		/* unused spare */
+-	char	f_mntfromname[OMNAMELEN];/* mounted filesystem */
+-	short	f_spares2;		/* unused spare */
+-	/*
+-	 * XXX on machines where longs are aligned to 8-byte boundaries, there
+-	 * is an unnamed int32_t here.  This spare was after the apparent end
+-	 * of the struct until we bit off the read counters from f_mntonname.
+-	 */
+-	long	f_spare[2];		/* unused spare */
+-};
+-
+-#define	MMAXOPTIONLEN	65536		/* maximum length of a mount option */
+-
+-TAILQ_HEAD(vnodelst, vnode);
+-TAILQ_HEAD(vfsoptlist, vfsopt);
+-struct vfsopt {
+-	TAILQ_ENTRY(vfsopt) link;
+-	char	*name;
+-	void	*value;
+-	int	len;
+-};
+-
+-/*
+- * Structure per mounted filesystem.  Each mounted filesystem has an
+- * array of operations and an instance record.  The filesystems are
+- * put on a doubly linked list.
+- *
+- */
+-struct mount {
+-	TAILQ_ENTRY(mount) mnt_list;		/* mount list */
+-	struct vfsops	*mnt_op;		/* operations on fs */
+-	struct vfsconf	*mnt_vfc;		/* configuration info */
+-	struct vnode	*mnt_vnodecovered;	/* vnode we mounted on */
+-	struct vnode	*mnt_syncer;		/* syncer vnode */
+-	struct vnodelst	mnt_nvnodelist;		/* list of vnodes this mount */
+-	struct lock	mnt_lock;		/* mount structure lock */
+-	struct mtx	mnt_mtx;		/* mount structure interlock */
+-	int		mnt_writeopcount;	/* write syscalls in progress */
+-	int		mnt_flag;		/* flags shared with user */
+-	struct vfsoptlist *mnt_opt;		/* current mount options */
+-	struct vfsoptlist *mnt_optnew;		/* new options passed to fs */
+-	int		mnt_kern_flag;		/* kernel only flags */
+-	int		mnt_maxsymlinklen;	/* max size of short symlink */
+-	struct statfs	mnt_stat;		/* cache of filesystem stats */
+-	struct ucred	*mnt_cred;		/* credentials of mounter */
+-	qaddr_t		mnt_data;		/* private data */
+-	time_t		mnt_time;		/* last time written*/
+-	int		mnt_iosize_max;		/* max size for clusters, etc */
+-	struct netexport *mnt_export;		/* export list */
+-	struct label	*mnt_mntlabel;		/* MAC label for the mount */
+-	struct label	*mnt_fslabel;		/* MAC label for the fs */
+-	int		mnt_nvnodelistsize;	/* # of vnodes on this mount */
+-};
+-
+-
+-#define	MNT_ILOCK(mp)	mtx_lock(&(mp)->mnt_mtx)
+-#define	MNT_IUNLOCK(mp)	mtx_unlock(&(mp)->mnt_mtx)
+-
+-#endif /* _KERNEL */
+ 
+ /*
+  * User specifiable flags.
+@@ -374,190 +260,4 @@
+ #define	VFCF_LOOPBACK	0x00100000	/* aliases some other mounted FS */
+ #define	VFCF_UNICODE	0x00200000	/* stores file names as Unicode*/
+ 
+-struct iovec;
+-struct uio;
+-
+-#ifdef _KERNEL
+-
+-#ifdef MALLOC_DECLARE
+-MALLOC_DECLARE(M_MOUNT);
+-#endif
+-extern int maxvfsconf;		/* highest defined filesystem type */
+-extern int nfs_mount_type;	/* vfc_typenum for nfs, or -1 */
+-extern struct vfsconf *vfsconf;	/* head of list of filesystem types */
+-
+-/*
+- * Operations supported on mounted filesystem.
+- */
+-struct mount_args;
+-struct nameidata;
+-
+-typedef int vfs_mount_t(struct mount *mp, char *path, caddr_t data,
+-			struct nameidata *ndp, struct thread *td);
+-typedef int vfs_start_t(struct mount *mp, int flags, struct thread *td);
+-typedef int vfs_unmount_t(struct mount *mp, int mntflags, struct thread *td);
+-typedef int vfs_root_t(struct mount *mp, struct vnode **vpp);
+-typedef	int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid,
+-		    caddr_t arg, struct thread *td);
+-typedef	int vfs_statfs_t(struct mount *mp, struct statfs *sbp,
+-		    struct thread *td);
+-typedef	int vfs_sync_t(struct mount *mp, int waitfor, struct ucred *cred,
+-		    struct thread *td);
+-typedef	int vfs_vget_t(struct mount *mp, ino_t ino, int flags,
+-		    struct vnode **vpp);
+-typedef	int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp);
+-typedef	int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,
+-		    int *extflagsp, struct ucred **credanonp);
+-typedef	int vfs_vptofh_t(struct vnode *vp, struct fid *fhp);
+-typedef	int vfs_init_t(struct vfsconf *);
+-typedef	int vfs_uninit_t(struct vfsconf *);
+-typedef	int vfs_extattrctl_t(struct mount *mp, int cmd,
+-		    struct vnode *filename_vp, int attrnamespace,
+-		    const char *attrname, struct thread *td);
+-typedef	int vfs_nmount_t(struct mount *mp, struct nameidata *ndp,
+-		    struct thread *td);
+-
+-struct vfsops {
+-	vfs_mount_t		*vfs_mount;
+-	vfs_start_t		*vfs_start;
+-	vfs_unmount_t		*vfs_unmount;
+-	vfs_root_t		*vfs_root;
+-	vfs_quotactl_t		*vfs_quotactl;
+-	vfs_statfs_t		*vfs_statfs;
+-	vfs_sync_t		*vfs_sync;
+-	vfs_vget_t		*vfs_vget;
+-	vfs_fhtovp_t		*vfs_fhtovp;
+-	vfs_checkexp_t		*vfs_checkexp;
+-	vfs_vptofh_t		*vfs_vptofh;
+-	vfs_init_t		*vfs_init;
+-	vfs_uninit_t		*vfs_uninit;
+-	vfs_extattrctl_t	*vfs_extattrctl;
+-	/* Additions below are not binary compatible with 5.0 and below. */
+-	vfs_nmount_t		*vfs_nmount;
+-};
+-
+-#define VFS_NMOUNT(MP, NDP, P)    (*(MP)->mnt_op->vfs_nmount)(MP, NDP, P)
+-#define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
+-	(*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
+-#define VFS_START(MP, FLAGS, P)	  (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
+-#define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
+-#define VFS_ROOT(MP, VPP)	  (*(MP)->mnt_op->vfs_root)(MP, VPP)
+-#define VFS_QUOTACTL(MP,C,U,A,P)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
+-#define VFS_STATFS(MP, SBP, P)	  (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
+-#define VFS_SYNC(MP, WAIT, C, P)  (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
+-#define VFS_VGET(MP, INO, FLAGS, VPP) \
+-	(*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP)
+-#define VFS_FHTOVP(MP, FIDP, VPP) \
+-	(*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
+-#define	VFS_VPTOFH(VP, FIDP)	  (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
+-#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \
+-	(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
+-#define VFS_EXTATTRCTL(MP, C, FN, NS, N, P) \
+-	(*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N, P)
+-
+-#include <sys/module.h>
+-
+-#define VFS_SET(vfsops, fsname, flags) \
+-	static struct vfsconf fsname ## _vfsconf = {		\
+-		&vfsops,					\
+-		#fsname,					\
+-		-1,						\
+-		0,						\
+-		flags						\
+-	};							\
+-	static moduledata_t fsname ## _mod = {			\
+-		#fsname,					\
+-		vfs_modevent,					\
+-		& fsname ## _vfsconf				\
+-	};							\
+-	DECLARE_MODULE(fsname, fsname ## _mod, SI_SUB_VFS, SI_ORDER_MIDDLE)
+-
+-extern	char *mountrootfsname;
+-
+-/*
+- * exported vnode operations
+- */
+-int	dounmount(struct mount *, int, struct thread *);
+-int	kernel_mount(struct iovec *, u_int, int);
+-int	kernel_vmount(int flags, ...);
+-int	vfs_getopt(struct vfsoptlist *, const char *, void **, int *);
+-int	vfs_copyopt(struct vfsoptlist *, const char *, void *, int);
+-int	vfs_mount(struct thread *, const char *, char *, int, void *);
+-int	vfs_nmount(struct thread *, int, struct uio *);
+-int	vfs_setpublicfs			    /* set publicly exported fs */
+-	    (struct mount *, struct netexport *, struct export_args *);
+-int	vfs_lock(struct mount *);         /* lock a vfs */
+-void	vfs_msync(struct mount *, int);
+-void	vfs_unlock(struct mount *);       /* unlock a vfs */
+-int	vfs_busy(struct mount *, int, struct mtx *, struct thread *);
+-int	vfs_export			 /* process mount export info */
+-	    (struct mount *, struct export_args *);
+-struct	netcred *vfs_export_lookup	    /* lookup host in fs export list */
+-	    (struct mount *, struct sockaddr *);
+-int	vfs_allocate_syncvnode(struct mount *);
+-void	vfs_getnewfsid(struct mount *);
+-struct cdev *vfs_getrootfsid(struct mount *);
+-struct	mount *vfs_getvfs(fsid_t *);      /* return vfs given fsid */
+-int	vfs_modevent(module_t, int, void *);
+-int	vfs_mountedon(struct vnode *);    /* is a vfs mounted on vp */
+-void	vfs_mountroot(void);			/* mount our root filesystem */
+-int	vfs_rootmountalloc(char *, char *, struct mount **);
+-void	vfs_mount_destroy(struct mount *, struct thread *);
+-void	vfs_unbusy(struct mount *, struct thread *);
+-void	vfs_unmountall(void);
+-int	vfs_register(struct vfsconf *);
+-int	vfs_unregister(struct vfsconf *);
+-extern	TAILQ_HEAD(mntlist, mount) mountlist;	/* mounted filesystem list */
+-extern	struct mtx mountlist_mtx;
+-extern	struct nfs_public nfs_pub;
+-
+-/*
+- * Declarations for these vfs default operations are located in
+- * kern/vfs_default.c, they should be used instead of making "dummy"
+- * functions or casting entries in the VFS op table to "enopnotsupp()".
+- */
+-vfs_start_t		vfs_stdstart;
+-vfs_root_t		vfs_stdroot;
+-vfs_quotactl_t		vfs_stdquotactl;
+-vfs_statfs_t		vfs_stdstatfs;
+-vfs_sync_t		vfs_stdsync;
+-vfs_sync_t		vfs_stdnosync;
+-vfs_vget_t		vfs_stdvget;
+-vfs_fhtovp_t		vfs_stdfhtovp;
+-vfs_checkexp_t		vfs_stdcheckexp;
+-vfs_vptofh_t		vfs_stdvptofh;
+-vfs_init_t		vfs_stdinit;
+-vfs_uninit_t		vfs_stduninit;
+-vfs_extattrctl_t	vfs_stdextattrctl;
+-
+-/* XXX - these should be indirect functions!!! */
+-int	softdep_fsync(struct vnode *);
+-int	softdep_process_worklist(struct mount *);
+-
+-#else /* !_KERNEL */
+-
+-#include <sys/cdefs.h>
+-
+-struct stat;
+-
+-__BEGIN_DECLS
+-int	fhopen(const struct fhandle *, int);
+-int	fhstat(const struct fhandle *, struct stat *);
+-int	fhstatfs(const struct fhandle *, struct statfs *);
+-int	fstatfs(int, struct statfs *);
+-int	getfh(const char *, fhandle_t *);
+-int	getfsstat(struct statfs *, long, int);
+-int	getmntinfo(struct statfs **, int);
+-int	lgetfh(const char *, fhandle_t *);
+-int	mount(const char *, const char *, int, void *);
+-int	nmount(struct iovec *, unsigned int, int);
+-int	statfs(const char *, struct statfs *);
+-int	unmount(const char *, int);
+-
+-/* C library stuff */
+-int	getvfsbyname(const char *, struct xvfsconf *);
+-__END_DECLS
+-
+-#endif /* _KERNEL */
+-
+ #endif /* !_SYS_MOUNT_H_ */
+diff -Naur ufsutils.orig/include/sys/param.h ufsutils.new/include/sys/param.h
+--- ufsutils.orig/include/sys/param.h	2004-06-26 04:21:20.000000000 +0200
++++ ufsutils.new/include/sys/param.h	2004-06-28 23:39:30.000000000 +0200
+@@ -38,29 +38,6 @@
+ #ifndef _SYS_PARAM_H_
+ #define _SYS_PARAM_H_
+ 
+-#include <sys/_null.h>
+-
+-#define	BSD	199506		/* System version (year & month). */
+-#define BSD4_3	1
+-#define BSD4_4	1
+-
+-/* 
+- * __FreeBSD_version numbers are documented in the Porter's Handbook.
+- * If you bump the version for any reason, you should update the documentation
+- * there.
+- * Currently this lives here:
+- *
+- *	doc/en_US.ISO8859-1/books/porters-handbook/book.sgml
+- *
+- * scheme is:  <major><two digit minor><0 if release branch, otherwise 1>xx
+- */
+-#undef __FreeBSD_version
+-#define __FreeBSD_version 502119	/* Master, propagated to newvers */
+-
+-#ifndef LOCORE
+-#include <sys/types.h>
+-#endif
+-
+ /*
+  * Machine-independent constants (some used in following include files).
+  * Redefined constants are from POSIX 1003.1 limits file.
+@@ -68,7 +45,7 @@
+  * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
+  * MAXLOGNAME should be == UT_NAMESIZE+1 (see <utmp.h>)
+  */
+-#include <sys/syslimits.h>
++#include <limits.h>
+ 
+ #define	MAXCOMLEN	19		/* max command name remembered */
+ #define	MAXINTERP	32		/* max interpreter file name length */
+@@ -81,79 +58,14 @@
+ #define MAXHOSTNAMELEN	256		/* max hostname size */
+ #define SPECNAMELEN	63		/* max length of devicename */
+ 
+-/* More types and definitions used throughout the kernel. */
+-#ifdef _KERNEL
+-#if (defined(BURN_BRIDGES) || __FreeBSD_version >= 600000) \
+-	&& defined(OBSOLETE_IN_6)
+-#error "This file contains obsolete code to be removed in 6.0-current"
+-#endif
+-#include <sys/cdefs.h>
+-#include <sys/errno.h>
+-#include <sys/time.h>
+-#include <sys/priority.h>
+-
+-#define	FALSE	0
+-#define	TRUE	1
+-#endif
+-
+-#ifndef _KERNEL
+-/* Signals. */
+-#include <sys/signal.h>
+-#endif
+-
+-/* Machine type dependent parameters. */
+-#include <machine/param.h>
+-#ifndef _KERNEL
+-#include <sys/limits.h>
+-#endif
+-
+-#ifndef _NO_NAMESPACE_POLLUTION
+-
+ #ifndef DEV_BSHIFT
+ #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
+ #endif
+ #define	DEV_BSIZE	(1<<DEV_BSHIFT)
+ 
+-#ifndef BLKDEV_IOSIZE
+-#define BLKDEV_IOSIZE  PAGE_SIZE	/* default block device I/O size */
+-#endif
+-#ifndef DFLTPHYS
+-#define DFLTPHYS	(64 * 1024)	/* default max raw I/O transfer size */
+-#endif
+ #ifndef MAXPHYS
+ #define MAXPHYS		(128 * 1024)	/* max raw I/O transfer size */
+ #endif
+-#ifndef MAXDUMPPGS
+-#define MAXDUMPPGS	(DFLTPHYS/PAGE_SIZE)
+-#endif
+-
+-/*
+- * Constants related to network buffer management.
+- * MCLBYTES must be no larger than PAGE_SIZE.
+- */
+-#ifndef	MSIZE
+-#define MSIZE		256		/* size of an mbuf */
+-#endif	/* MSIZE */
+-
+-#ifndef	MCLSHIFT
+-#define MCLSHIFT	11		/* convert bytes to mbuf clusters */
+-#endif	/* MCLSHIFT */
+-
+-#define MCLBYTES	(1 << MCLSHIFT)	/* size of an mbuf cluster */
+-
+-/*
+- * Some macros for units conversion
+- */
+-
+-/* clicks to bytes */
+-#ifndef ctob
+-#define ctob(x)	((x)<<PAGE_SHIFT)
+-#endif
+-
+-/* bytes to clicks */
+-#ifndef btoc
+-#define btoc(x)	(((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT)
+-#endif
+ 
+ /*
+  * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We
+@@ -168,32 +80,11 @@
+ 	 : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+ #endif
+ 
+-#ifndef dbtob
+-#define dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
+-	((off_t)(db) << DEV_BSHIFT)
+-#endif
+-
+-#endif /* _NO_NAMESPACE_POLLUTION */
+-
+-#define	PRIMASK	0x0ff
+-#define	PCATCH	0x100		/* OR'd with pri for tsleep to check signals */
+-#define	PDROP	0x200	/* OR'd with pri to stop re-entry of interlock mutex */
+-
+-#define	NZERO	0		/* default "nice" */
+-
+ #define	NBBY	8		/* number of bits in a byte */
+ #define	NBPW	sizeof(int)	/* number of bytes per word (integer) */
+ 
+-#define	CMASK	022		/* default file mask: S_IWGRP|S_IWOTH */
+-
+ #define	NODEV	(dev_t)(-1)	/* non-existent device */
+ 
+-#define	CBLOCK	128		/* Clist block size, must be a power of 2. */
+-#define CBQSIZE	(CBLOCK/NBBY)	/* Quote bytes/cblock - can do better. */
+-				/* Data chars/clist. */
+-#define	CBSIZE	(CBLOCK - sizeof(struct cblock *) - CBQSIZE)
+-#define	CROUND	(CBLOCK - 1)	/* Clist rounding. */
+-
+ /*
+  * File system parameters and macros.
+  *
+@@ -252,71 +143,4 @@
+ #define	MIN(a,b) (((a)<(b))?(a):(b))
+ #define	MAX(a,b) (((a)>(b))?(a):(b))
+ 
+-#ifdef _KERNEL
+-/*
+- * Basic byte order function prototypes for non-inline functions.
+- */
+-#ifndef _BYTEORDER_PROTOTYPED
+-#define	_BYTEORDER_PROTOTYPED
+-__BEGIN_DECLS
+-__uint32_t	 htonl(__uint32_t);
+-__uint16_t	 htons(__uint16_t);
+-__uint32_t	 ntohl(__uint32_t);
+-__uint16_t	 ntohs(__uint16_t);
+-__END_DECLS
+-#endif
+-
+-#ifndef lint
+-#ifndef _BYTEORDER_FUNC_DEFINED
+-#define	_BYTEORDER_FUNC_DEFINED
+-#define	htonl(x)	__htonl(x)
+-#define	htons(x)	__htons(x)
+-#define	ntohl(x)	__ntohl(x)
+-#define	ntohs(x)	__ntohs(x)
+-#endif /* !_BYTEORDER_FUNC_DEFINED */
+-#endif /* lint */
+-#endif /* _KERNEL */
+-
+-/*
+- * Constants for setting the parameters of the kernel memory allocator.
+- *
+- * 2 ** MINBUCKET is the smallest unit of memory that will be
+- * allocated. It must be at least large enough to hold a pointer.
+- *
+- * Units of memory less or equal to MAXALLOCSAVE will permanently
+- * allocate physical memory; requests for these size pieces of
+- * memory are quite fast. Allocations greater than MAXALLOCSAVE must
+- * always allocate and free physical memory; requests for these
+- * size allocations should be done infrequently as they will be slow.
+- *
+- * Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
+- * MAXALLOCSIZE must be a power of two.
+- */
+-#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__)
+-#define MINBUCKET	5		/* 5 => min allocation of 32 bytes */
+-#else
+-#define MINBUCKET	4		/* 4 => min allocation of 16 bytes */
+-#endif
+-#define MAXALLOCSAVE	(2 * PAGE_SIZE)
+-
+-/*
+- * Scale factor for scaled integers used to count %cpu time and load avgs.
+- *
+- * The number of CPU `tick's that map to a unique `%age' can be expressed
+- * by the formula (1 / (2 ^ (FSHIFT - 11))).  The maximum load average that
+- * can be calculated (assuming 32 bits) can be closely approximated using
+- * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
+- *
+- * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
+- * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
+- */
+-#define	FSHIFT	11		/* bits to right of fixed binary point */
+-#define FSCALE	(1<<FSHIFT)
+-
+-#define dbtoc(db)			/* calculates devblks to pages */ \
+-	((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
+- 
+-#define ctodb(db)			/* calculates pages to devblks */ \
+-	((db) << (PAGE_SHIFT - DEV_BSHIFT))
+-
+ #endif	/* _SYS_PARAM_H_ */
+diff -Naur ufsutils.orig/include/sys/ucred.h ufsutils.new/include/sys/ucred.h
+--- ufsutils.orig/include/sys/ucred.h	2004-04-30 05:41:53.000000000 +0200
++++ ufsutils.new/include/sys/ucred.h	2004-05-20 22:56:03.000000000 +0200
+@@ -33,6 +33,8 @@
+ #ifndef _SYS_UCRED_H_
+ #define	_SYS_UCRED_H_
+ 
++#include <sys/types.h>
++
+ /*
+  * Credentials.
+  *
+diff -Naur ufsutils.orig/libport/arc4random.c ufsutils.new/libport/arc4random.c
+--- ufsutils.orig/libport/arc4random.c	2004-04-30 05:28:37.000000000 +0200
++++ ufsutils.new/libport/arc4random.c	2004-05-20 22:49:03.000000000 +0200
+@@ -26,16 +26,11 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.10 2004/03/24 14:44:57 green Exp $");
+ 
+-#include "namespace.h"
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+-#include <pthread.h>
+-
+-#include "libc_private.h"
+-#include "un-namespace.h"
+ 
+ struct arc4_stream {
+ 	u_int8_t i;
+@@ -43,20 +38,9 @@
+ 	u_int8_t s[256];
+ };
+ 
+-static pthread_mutex_t	arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
+-
+ #define	RANDOMDEV	"/dev/urandom"
+-#define	THREAD_LOCK()						\
+-	do {							\
+-		if (__isthreaded)				\
+-			_pthread_mutex_lock(&arc4random_mtx);	\
+-	} while (0)
+-
+-#define	THREAD_UNLOCK()						\
+-	do {							\
+-		if (__isthreaded)				\
+-			_pthread_mutex_unlock(&arc4random_mtx);	\
+-	} while (0)
++#define	THREAD_LOCK()
++#define	THREAD_UNLOCK()
+ 
+ static struct arc4_stream rs;
+ static int rs_initialized;
+@@ -109,10 +93,10 @@
+ 
+ 	gettimeofday(&rdat.tv, NULL);
+ 	rdat.pid = getpid();
+-	fd = _open(RANDOMDEV, O_RDONLY, 0);
++	fd = open(RANDOMDEV, O_RDONLY, 0);
+ 	if (fd >= 0) {
+-		(void) _read(fd, rdat.rnd, sizeof(rdat.rnd));
+-		_close(fd);
++		(void) read(fd, rdat.rnd, sizeof(rdat.rnd));
++		close(fd);
+ 	} 
+ 	/* fd < 0?  Ah, what the heck. We'll just take whatever was on the
+ 	 * stack... */
+diff -Naur ufsutils.orig/libport/blockdev.c ufsutils.new/libport/blockdev.c
+--- ufsutils.orig/libport/blockdev.c	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/libport/blockdev.c	2004-06-30 15:58:31.000000000 +0200
+@@ -0,0 +1,91 @@
++/*
++ * Copyright (C) 2004 Guillem Jover <guillem at debian.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ *    derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
++ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
++ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
++ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
++ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
++ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include <sys/types.h>
++#include <sys/ioctl.h>
++#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
++#if defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version >= 500000
++#include <sys/disk.h>
++#endif
++#include <sys/disklabel.h>
++#ifndef DIOCGMEDIASIZE
++#define DIOCGMEDIASIZE _IOR('d', 129, off_t)
++#endif
++#elif defined(__linux__)
++#ifndef BLKGETSIZE
++#define BLKGETSIZE _IO(0x12,96)
++#endif
++#endif
++#include <sys/stat.h>
++#include <unistd.h>
++#include <port/blockdev.h>
++
++static const int sector_size = 512;
++
++off_t
++get_block_device_size(int fd)
++{
++	off_t device_size = 0;
++	struct stat st;
++
++#if defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__)
++	{
++		struct disklabel disklabel;
++
++		if (!ioctl(fd, DIOCGMEDIASIZE, &device_size))
++			return device_size;
++
++		if (!ioctl(fd, DIOCGDINFO, &disklabel)) {
++			device_size = (off_t)disklabel.d_secperunit * sector_size;
++			return device_size;
++		}
++	}
++#elif defined(__linux__)
++	{
++		long int device_sectors;
++
++		if (!ioctl(fd, BLKGETSIZE, &device_sectors)) {
++			device_size = (off_t)device_sectors * sector_size;
++			return device_size;
++		}
++	}
++#else
++	/* XXX: Implement a generic seek binary test for targets currently
++	 *      not supported.
++	 */
++#error "Do not know how to get block device size"
++#endif
++
++	/* Regular files or devices under the Hurd.  */
++	if (fstat(fd, &st) == 0) {
++		return st.st_size;
++	}
++
++	return device_size;
++}
++
+diff -Naur ufsutils.orig/include/port/blockdev.h ufsutils.new/include/port/blockdev.h
+--- ufsutils.orig/include/port/blockdev.h	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/include/port/blockdev.h	2004-06-29 22:17:29.000000000 +0200
+@@ -0,0 +1,9 @@
++#ifndef LIBPORT_BLOCKDEV_H
++#define LIBPORT_BLOCKDEV_H
++
++#include <sys/types.h>
++
++off_t get_block_device_size(int fd);
++
++#endif
++
+diff -Naur ufsutils.orig/libport/Makefile ufsutils.new/libport/Makefile
+--- ufsutils.orig/libport/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/libport/Makefile	2004-06-29 22:54:03.000000000 +0200
+@@ -0,0 +1,13 @@
++LIB = port
++LIB_type = static
++LIBSRCS = arc4random.c strlcpy.c strlcat.c blockdev.c
++
++ALL_CFLAGS = -D_LIBPORT
++ifdef LIBPORT_DEBUG
++ALL_CFLAGS += -D_LIBPORT_DEBUGGING
++endif
++
++INCLUDES =
++
++include ../Makefile.common
++

Added: trunk/ufsutils/debian/patches/01_libdisklabel.patch
===================================================================
--- trunk/ufsutils/debian/patches/01_libdisklabel.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/01_libdisklabel.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,27 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/libdisklabel/Makefile ufsutils.new/libdisklabel/Makefile
+--- ufsutils.orig/libdisklabel/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/libdisklabel/Makefile	2004-05-16 21:38:08.000000000 +0200
+@@ -0,0 +1,10 @@
++LIB = disklabel
++LIB_type = static
++LIBSRCS = getdisklabel.c
++
++ALL_CFLAGS = -D_LIBDISKLABEL
++
++INCLUDES =
++
++include ../Makefile.common
++
+diff -Naur ufsutils.orig/libdisklabel/getdisklabel.c ufsutils.new/libdisklabel/getdisklabel.c
+--- ufsutils.orig/libdisklabel/getdisklabel.c	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/libdisklabel/getdisklabel.c	2004-05-03 12:33:48.000000000 +0200
+@@ -0,0 +1,8 @@
++#include <stdlib.h>
++#include <sys/disklabel.h>
++
++struct disklabel *getdiskbyname(const char *name)
++{
++	return NULL;
++}
++

Added: trunk/ufsutils/debian/patches/01_libufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/01_libufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/01_libufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,88 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/libufs/block.c ufsutils.new/libufs/block.c
+--- ufsutils.orig/libufs/block.c	2003-10-07 09:12:22.000000000 +0200
++++ ufsutils.new/libufs/block.c	2004-05-13 07:56:42.000000000 +0200
+@@ -25,6 +25,9 @@
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
++#define _BSD_SOURCE
++#define _XOPEN_SOURCE 500
++
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libufs/block.c,v 1.10 2003/10/07 07:12:22 phk Exp $");
+ 
+diff -Naur ufsutils.orig/include/ufs/ffs/fs.h ufsutils.new/include/ufs/ffs/fs.h
+--- ufsutils.orig/include/ufs/ffs/fs.h	2004-04-07 05:47:20.000000000 +0200
++++ ufsutils.new/include/ufs/ffs/fs.h	2004-05-13 08:43:33.000000000 +0200
+@@ -33,6 +33,9 @@
+ #ifndef _UFS_FFS_FS_H_
+ #define _UFS_FFS_FS_H_
+ 
++#include <sys/types.h>
++#include <stdint.h>
++
+ /*
+  * Each disk drive contains some number of filesystems.
+  * A filesystem consists of a number of cylinder groups.
+diff -Naur ufsutils.orig/include/ufs/ufs/dinode.h ufsutils.new/include/ufs/ufs/dinode.h
+--- ufsutils.orig/include/ufs/ufs/dinode.h	2002-07-17 00:36:00.000000000 +0200
++++ ufsutils.new/include/ufs/ufs/dinode.h	2004-05-13 08:15:51.000000000 +0200
+@@ -47,6 +47,8 @@
+ #ifndef _UFS_UFS_DINODE_H_
+ #define	_UFS_UFS_DINODE_H_
+ 
++#include <sys/types.h>
++
+ /*
+  * The root inode is the root of the filesystem.  Inode 0 can't be used for
+  * normal purposes and historically bad blocks were linked to inode 1, thus
+diff -Naur ufsutils.orig/include/ufs/ufs/dir.h ufsutils.new/include/ufs/ufs/dir.h
+--- ufsutils.orig/include/ufs/ufs/dir.h	2004-04-07 05:47:20.000000000 +0200
++++ ufsutils.new/include/ufs/ufs/dir.h	2004-05-13 08:16:08.000000000 +0200
+@@ -38,6 +38,8 @@
+ #ifndef _UFS_UFS_DIR_H_
+ #define	_UFS_UFS_DIR_H_
+ 
++#include <sys/types.h>
++
+ /*
+  * Theoretically, directories can be more than 2Gb in length, however, in
+  * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+diff -Naur ufsutils.orig/libufs/Makefile ufsutils.new/libufs/Makefile
+--- ufsutils.orig/libufs/Makefile	2003-08-18 17:25:39.000000000 +0200
++++ ufsutils.new/libufs/Makefile	2004-05-16 21:38:38.000000000 +0200
+@@ -1,20 +1,16 @@
+ # $FreeBSD: src/lib/libufs/Makefile,v 1.10 2003/08/18 15:25:39 obrien Exp $
+ 
+-LIB=	ufs
+-SHLIBDIR?= /lib
+-SRCS=	block.c cgroup.c inode.c sblock.c type.c
+-INCS=	libufs.h
+-MAN=	bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
+-MLINKS+= bread.3 bwrite.3
+-MLINKS+= cgread.3 cgread1.3
+-MLINKS+= sbread.3 sbwrite.3
+-MLINKS+= ufs_disk_close.3 ufs_disk_fillout.3
+-MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3
+-MLINKS+= ufs_disk_close.3 ufs_disk_write.3
+-CFLAGS+= -I${.CURDIR} -D_LIBUFS
+-.if defined(LIBUFS_DEBUG)
+-CFLAGS+= -D_LIBUFS_DEBUGGING
+-.endif
+-WARNS?=	2
++LIB = ufs
++SHLIB_MAJOR = 2
++LIBSRCS = block.c cgroup.c inode.c sblock.c type.c
++INCS = libufs.h
++
++ALL_CFLAGS = -D_LIBUFS
++ifdef LIBUFS_DEBUG
++ALL_CFLAGS += -D_LIBUFS_DEBUGGING
++endif
++
++INCLUDES = -I.
++
++include ../Makefile.common
+ 
+-.include <bsd.lib.mk>

Added: trunk/ufsutils/debian/patches/02_badsect.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_badsect.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_badsect.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,23 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/badsect.ufs/Makefile ufsutils.new/badsect.ufs/Makefile
+--- ufsutils.orig/badsect.ufs/Makefile	2003-02-22 22:33:42.000000000 +0100
++++ ufsutils.new/badsect.ufs/Makefile	2004-05-16 21:36:51.000000000 +0200
+@@ -1,9 +1,13 @@
+ #	@(#)Makefile	8.1 (Berkeley) 6/5/93
+ # $FreeBSD: src/sbin/badsect/Makefile,v 1.8 2003/02/22 21:33:42 johan Exp $
+ 
+-PROG=	badsect
+-DPADD=	${LIBUFS}
+-LDADD=	-lufs
+-MAN=	badsect.8
++PROG = badsect.ufs
++SRCS = badsect.c
++WARNS = 0
++MAN = badsect.8:badsect.ufs.8
++
++INCLUDES = -I../libufs
++LDADD = -L../libufs -lufs
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>

Added: trunk/ufsutils/debian/patches/02_bsdlabel.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_bsdlabel.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_bsdlabel.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,137 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/bsdlabel/bsdlabel.c ufsutils.new/bsdlabel/bsdlabel.c
+--- ufsutils.orig/bsdlabel/bsdlabel.c	2004-03-31 01:15:03.000000000 +0200
++++ ufsutils.new/bsdlabel/bsdlabel.c	2004-05-21 05:18:50.000000000 +0200
+@@ -40,6 +40,8 @@
+  *	from: $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk $
+  */
+ 
++#define _GNU_SOURCE
++
+ #if 0
+ #ifndef lint
+ static const char copyright[] =
+@@ -60,7 +62,9 @@
+ #include <sys/file.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
++#if HAVE_BSD_DISKLABEL
+ #include <sys/disk.h>
++#endif
+ #define DKTYPENAMES
+ #define FSTYPENAMES
+ #include <sys/disklabel.h>
+@@ -68,7 +72,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <stdio.h>
+-#include <libgeom.h>
++//#include <libgeom.h>
+ #include <stdlib.h>
+ #include <signal.h>
+ #include <stdarg.h>
+@@ -473,8 +477,12 @@
+ 		err(1, specname);
+ 	if (is_file)
+ 		get_file_parms(f);
++#if HAVE_BSD_DISKLABEL
+ 	else if ((ioctl(f, DIOCGMEDIASIZE, &mediasize) != 0) ||
+ 	    (ioctl(f, DIOCGSECTORSIZE, &secsize) != 0)) {
++#else
++	else {
++#endif
+ 		err(4, "cannot get disk geometry");
+ 	}
+ 	(void)lseek(f, (off_t)0, SEEK_SET);
+@@ -659,10 +667,12 @@
+ 
+ 	omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
+ 	while ((pid = fork()) < 0) {
++#if HAVE_BSD_ERRNO
+ 		if (errno == EPROCLIM) {
+ 			warnx("you have too many processes");
+ 			return(0);
+ 		}
++#endif
+ 		if (errno != EAGAIN) {
+ 			warn("fork");
+ 			return(0);
+@@ -1357,8 +1367,12 @@
+ 
+ 	if (is_file)
+ 		get_file_parms(f);
++#if HAVE_BSD_DISKLABEL
+ 	else if ((ioctl(f, DIOCGMEDIASIZE, &mediasize) != 0) ||
+ 	    (ioctl(f, DIOCGSECTORSIZE, &secsize) != 0)) {
++#else
++	else {
++#endif
+ 		close (f);
+ 		return (NULL);
+ 	}
+@@ -1374,13 +1388,18 @@
+ 	 * to get any good ideas from the device, construct something
+ 	 * which is IBM-PC friendly.
+ 	 */
++#if HAVE_BSD_DISKLABEL
+ 	if (ioctl(f, DIOCGFWSECTORS, &u) == 0)
+ 		loclab.d_nsectors = u;
+ 	else
++#endif
+ 		loclab.d_nsectors = 63;
++#if HAVE_BSD_DISKLABEL
+ 	if (ioctl(f, DIOCGFWHEADS, &u) == 0)
+ 		loclab.d_ntracks = u;
+-	else if (loclab.d_secperunit <= 63*1*1024)
++	else
++#endif
++	if (loclab.d_secperunit <= 63*1*1024)
+ 		loclab.d_ntracks = 1;
+ 	else if (loclab.d_secperunit <= 63*16*1024)
+ 		loclab.d_ntracks = 16;
+diff -Naur ufsutils.orig/bsdlabel/Makefile ufsutils.new/bsdlabel/Makefile
+--- ufsutils.orig/bsdlabel/Makefile	2004-01-11 10:11:10.000000000 +0100
++++ ufsutils.new/bsdlabel/Makefile	2004-05-21 05:10:36.000000000 +0200
+@@ -1,26 +1,25 @@
+ #	@(#)Makefile	8.2 (Berkeley) 3/17/94
+ # $FreeBSD: src/sbin/bsdlabel/Makefile,v 1.19 2004/01/11 09:11:10 nyan Exp $
+ 
+-.PATH: ${.CURDIR}/../../sys/geom
+ 
+-PROG=	bsdlabel
+-SRCS=	bsdlabel.c geom_bsd_enc.c
+-#MAN=	bsdlabel.5
+-MAN+=	bsdlabel.8
+-
+-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "alpha" || \
+-    ${MACHINE_ARCH} == "amd64"
+-LINKS=	${BINDIR}/bsdlabel ${BINDIR}/disklabel
+-MLINKS=	bsdlabel.8 disklabel.8
+-.endif
++PROG = bsdlabel
++SRCS = bsdlabel.c ../libdisklabel/geom_bsd_enc.c
++MAN = bsdlabel.8:bsdlabel.8
++
++#if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "alpha" || \
++#    ${MACHINE_ARCH} == "amd64"
++#LINKS = ${BINDIR}/bsdlabel ${BINDIR}/disklabel
++#MLINKS = bsdlabel.8 disklabel.8
++#endif
+ 
+-DPADD=	${LIBGEOM}
+-LDADD=	-lgeom
+-
+-.include <bsd.prog.mk>
++DPADD = ${LIBGEOM}
++LDADD = -lgeom
+ 
+ test: ${PROG}
+-	sh ${.CURDIR}/runtest.sh
++	sh ${CURDIR}/runtest.sh
+ 
+ testx: ${PROG}
+-	sh -x ${.CURDIR}/runtest.sh
++	sh -x ${CURDIR}/runtest.sh
++
++include ../Makefile.common
++

Added: trunk/ufsutils/debian/patches/02_dump.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_dump.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_dump.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,22 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/dump.ufs/Makefile ufsutils.new/dump.ufs/Makefile
+--- ufsutils.orig/dump.ufs/Makefile	2003-11-14 14:07:38.000000000 +0100
++++ ufsutils.new/dump.ufs/Makefile	2004-05-13 07:17:48.000000000 +0200
+@@ -15,9 +15,14 @@
+ 
+ PROG=	dump
+ LINKS=	${BINDIR}/dump ${BINDIR}/rdump
+-CFLAGS+=-DRDUMP
+ SRCS=	itime.c main.c optr.c dumprmt.c tape.c traverse.c unctime.c cache.c
+ MAN=	dump.8
+-MLINKS=	dump.8 rdump.8
++MLINKS+=dump.8 rdump.8
++
++ALL_CFLAGS = -DRDUMP
++
++LDADD = -L../libufs -lufs -L../libport -lport
++INCLUDES = -I../include -I${CURDIR}/../../libexec/rlogind
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>

Added: trunk/ufsutils/debian/patches/02_dumpfs.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_dumpfs.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_dumpfs.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,34 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/dumpfs.ufs/dumpfs.c ufsutils.new/dumpfs.ufs/dumpfs.c
+--- ufsutils.orig/dumpfs.ufs/dumpfs.c	2004-04-09 21:58:27.000000000 +0200
++++ ufsutils.new/dumpfs.ufs/dumpfs.c	2004-05-13 08:22:40.000000000 +0200
+@@ -62,6 +62,7 @@
+ #include <fcntl.h>
+ #include <fstab.h>
+ #include <libufs.h>
++#include <time.h>
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff -Naur ufsutils.orig/dumpfs.ufs/Makefile ufsutils.new/dumpfs.ufs/Makefile
+--- ufsutils.orig/dumpfs.ufs/Makefile	2003-11-14 14:13:23.000000000 +0100
++++ ufsutils.new/dumpfs.ufs/Makefile	2004-05-16 21:37:03.000000000 +0200
+@@ -1,9 +1,13 @@
+ #	@(#)Makefile	8.1 (Berkeley) 6/5/93
+ # $FreeBSD: src/sbin/dumpfs/Makefile,v 1.9 2003/11/14 13:13:23 johan Exp $
+ 
+-PROG=	dumpfs
+-DPADD=	${LIBUFS}
+-LDADD=	-lufs
+-MAN=	dumpfs.8
++PROG = dumpfs.ufs
++SRCS = dumpfs.c
++WARNS = 0
++MAN = dumpfs.8:dumpfs.ufs.8
++
++LDADD = -L../libufs/ -lufs
++INCLUDES = -I../libufs
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>

Added: trunk/ufsutils/debian/patches/02_ffsinfo.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_ffsinfo.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_ffsinfo.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,28 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/bsdlabel/Makefile ufsutils.new/bsdlabel/Makefile
+--- ufsutils.orig/ffsinfo/Makefile	2004-04-01 22:31:48.000000000 +0200
++++ ufsutils.new/ffsinfo/Makefile	2004-05-25 10:20:01.000000000 +0200
+@@ -4,16 +4,12 @@
+ # $FreeBSD: src/sbin/ffsinfo/Makefile,v 1.7 2004/04/01 20:31:48 johan Exp $
+ #
+ 
+-GROWFS= ${.CURDIR}/../growfs
+-.PATH: ${GROWFS}
++PROG = ffsinfo
++SRCS = ffsinfo.c ../growfs.ufs/debug.c
++MAN = ffsinfo.8:ffsinfo.8
+ 
+-PROG=	ffsinfo
+-SRCS=	ffsinfo.c debug.c
+-MAN=	ffsinfo.8
++ALL_CFLAGS = -DFS_DEBUG -I../growfs.ufs -I../libufs
++LDADD = -L../libufs -lufs
++
++include ../Makefile.common
+ 
+-WARNS?=	0
+-CFLAGS+=-DFS_DEBUG -I${GROWFS}
+-DPADD=	${LIBUFS}
+-LDADD=	-lufs
+- 
+-.include <bsd.prog.mk>               

Added: trunk/ufsutils/debian/patches/02_fsck.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_fsck.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_fsck.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,876 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/fsck.ufs/dir.c ufsutils.new/fsck.ufs/dir.c
+--- ufsutils.orig/fsck.ufs/dir.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/dir.c	2004-05-16 22:51:52.000000000 +0200
+@@ -324,7 +324,7 @@
+ 		}
+ 		if (preen || reply("ADJUST") == 1) {
+ 			if (bkgrdflag == 0) {
+-				DIP(dp, di_nlink) -= lcnt;
++				DIP_add(dp, di_nlink, -lcnt);
+ 				inodirty();
+ 			} else {
+ 				cmd.value = idesc->id_number;
+@@ -474,7 +474,7 @@
+ 		    parentdir != (ino_t)-1)
+ 			(void)makeentry(orphan, lfdir, "..");
+ 		dp = ginode(lfdir);
+-		DIP(dp, di_nlink)++;
++		DIP_add(dp, di_nlink, 1);
+ 		inodirty();
+ 		inoinfo(lfdir)->ino_linkcnt++;
+ 		pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan);
+@@ -535,7 +535,7 @@
+ 	idesc.id_name = strdup(name);
+ 	dp = ginode(parent);
+ 	if (DIP(dp, di_size) % DIRBLKSIZ) {
+-		DIP(dp, di_size) = roundup(DIP(dp, di_size), DIRBLKSIZ);
++		DIP_set(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ));
+ 		inodirty();
+ 	}
+ 	if ((ckinode(dp, &idesc) & ALTERED) != 0)
+@@ -563,10 +563,10 @@
+ 		return (0);
+ 	if ((newblk = allocblk(sblock.fs_frag)) == 0)
+ 		return (0);
+-	DIP(dp, di_db[lastbn + 1]) = DIP(dp, di_db[lastbn]);
+-	DIP(dp, di_db[lastbn]) = newblk;
+-	DIP(dp, di_size) += sblock.fs_bsize;
+-	DIP(dp, di_blocks) += btodb(sblock.fs_bsize);
++	DIP_set(dp, di_db[lastbn + 1], DIP(dp, di_db[lastbn]));
++	DIP_set(dp, di_db[lastbn], newblk);
++	DIP_add(dp, di_size, sblock.fs_bsize);
++	DIP_add(dp, di_blocks, btodb(sblock.fs_bsize));
+ 	bp = getdirblk(DIP(dp, di_db[lastbn + 1]),
+ 		sblksize(&sblock, DIP(dp, di_size), lastbn + 1));
+ 	if (bp->b_errs)
+@@ -595,10 +595,10 @@
+ 	inodirty();
+ 	return (1);
+ bad:
+-	DIP(dp, di_db[lastbn]) = DIP(dp, di_db[lastbn + 1]);
+-	DIP(dp, di_db[lastbn + 1]) = 0;
+-	DIP(dp, di_size) -= sblock.fs_bsize;
+-	DIP(dp, di_blocks) -= btodb(sblock.fs_bsize);
++	DIP_set(dp, di_db[lastbn], DIP(dp, di_db[lastbn + 1]));
++	DIP_set(dp, di_db[lastbn + 1], 0);
++	DIP_add(dp, di_size, -sblock.fs_bsize);
++	DIP_add(dp, di_blocks, -btodb(sblock.fs_bsize));
+ 	freeblk(newblk, sblock.fs_frag);
+ 	return (0);
+ }
+@@ -632,7 +632,7 @@
+ 	     cp += DIRBLKSIZ)
+ 		memmove(cp, &emptydir, sizeof emptydir);
+ 	dirty(bp);
+-	DIP(dp, di_nlink) = 2;
++	DIP_set(dp, di_nlink, 2);
+ 	inodirty();
+ 	if (ino == ROOTINO) {
+ 		inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink);
+@@ -654,7 +654,7 @@
+ 		inoinfo(parent)->ino_linkcnt++;
+ 	}
+ 	dp = ginode(parent);
+-	DIP(dp, di_nlink)++;
++	DIP_add(dp, di_nlink, 1);
+ 	inodirty();
+ 	return (ino);
+ }
+@@ -669,7 +669,7 @@
+ 
+ 	if (ino != parent) {
+ 		dp = ginode(parent);
+-		DIP(dp, di_nlink)--;
++		DIP_add(dp, di_nlink, -1);
+ 		inodirty();
+ 	}
+ 	freeino(ino);
+diff -Naur ufsutils.orig/fsck.ufs/ea.c ufsutils.new/fsck.ufs/ea.c
+--- ufsutils.orig/fsck.ufs/ea.c	2003-05-03 20:41:57.000000000 +0200
++++ ufsutils.new/fsck.ufs/ea.c	2004-05-13 08:18:09.000000000 +0200
+@@ -38,7 +38,7 @@
+ 
+ #include <sys/param.h>
+ #include <sys/time.h>
+-#include <sys/stdint.h>
++#include <stdint.h>
+ 
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ufs/dir.h>
+diff -Naur ufsutils.orig/fsck.ufs/fsck_ffs.8 ufsutils.new/fsck.ufs/fsck_ffs.8
+--- ufsutils.orig/fsck.ufs/fsck_ffs.8	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/fsck_ffs.8	2004-05-16 23:19:18.000000000 +0200
+@@ -30,11 +30,11 @@
+ .\" $FreeBSD: src/sbin/fsck_ffs/fsck_ffs.8,v 1.30 2004/04/09 19:58:28 markm Exp $
+ .\"
+ .Dd April 24, 2001
+-.Dt FSCK_FFS 8
++.Dt FSCK.UFS 8
+ .Os
+ .Sh NAME
+-.Nm fsck_ffs ,
+-.Nm fsck_ufs
++.Nm fsck.ffs ,
++.Nm fsck.ufs
+ .Nd file system consistency check and interactive repair
+ .Sh SYNOPSIS
+ .Nm
+@@ -311,5 +311,4 @@
+ .Xr fstab 5 ,
+ .Xr fsck 8 ,
+ .Xr fsdb 8 ,
+-.Xr newfs 8 ,
+ .Xr reboot 8
+diff -Naur ufsutils.orig/fsck.ufs/fsck.h ufsutils.new/fsck.ufs/fsck.h
+--- ufsutils.orig/fsck.ufs/fsck.h	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/fsck.h	2004-05-16 23:21:44.000000000 +0200
+@@ -55,6 +55,18 @@
+ #define	DIP(dp, field) \
+ 	((sblock.fs_magic == FS_UFS1_MAGIC) ? \
+ 	(dp)->dp1.field : (dp)->dp2.field)
++#define	DIP_set(dp, field, value) \
++	{if (sblock.fs_magic == FS_UFS1_MAGIC) \
++	(dp)->dp1.field = (value); else (dp)->dp2.field = (value);}
++#define	DIP_add(dp, field, value) \
++	{if (sblock.fs_magic == FS_UFS1_MAGIC) \
++	(dp)->dp1.field += (value); else (dp)->dp2.field += (value);}
++#define	DIP_and(dp, field, value) \
++	{if (sblock.fs_magic == FS_UFS1_MAGIC) \
++	(dp)->dp1.field &= (value); else (dp)->dp2.field &= (value);}
++#define	DIP_or(dp, field, value) \
++	{if (sblock.fs_magic == FS_UFS1_MAGIC) \
++	(dp)->dp1.field |= (value); else (dp)->dp2.field |= (value);}
+ 
+ /*
+  * Each inode on the file system is described by the following structure.
+@@ -110,6 +122,10 @@
+ #define	IBLK(bp, i) \
+ 	((sblock.fs_magic == FS_UFS1_MAGIC) ? \
+ 	(bp)->b_un.b_indir1[i] : (bp)->b_un.b_indir2[i])
++#define	IBLK_set(bp, i, value) \
++	{if (sblock.fs_magic == FS_UFS1_MAGIC) \
++	(bp)->b_un.b_indir1[i] = (value); \
++	else (bp)->b_un.b_indir2[i] = (value);}
+ 
+ #define	B_INUSE 1
+ 
+diff -Naur ufsutils.orig/fsck.ufs/fsutil.c ufsutils.new/fsck.ufs/fsutil.c
+--- ufsutils.orig/fsck.ufs/fsutil.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/fsutil.c	2004-05-16 20:37:54.000000000 +0200
+@@ -38,7 +38,9 @@
+ #include <sys/param.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
++#if HAVE_BSD_SYSCTL
+ #include <sys/sysctl.h>
++#endif
+ #include <sys/disklabel.h>
+ #include <sys/stat.h>
+ #include <sys/disklabel.h>
+@@ -55,6 +57,7 @@
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <signal.h>
+ #include <unistd.h>
+ 
+ #include "fsck.h"
+@@ -136,7 +139,7 @@
+ 	int iloff;
+ 
+ 	if (inum > maxino)
+-		errx(EEXIT, "inoinfo: inumber %d out of range", inum);
++		errx(EEXIT, "inoinfo: inumber %ld out of range", inum);
+ 	ilp = &inostathead[inum / sblock.fs_ipg];
+ 	iloff = inum % sblock.fs_ipg;
+ 	if (iloff >= ilp->il_numalloced)
+@@ -277,11 +280,13 @@
+ 	if (bkgrdflag) {
+ 		unlink(snapname);
+ 		if ((!(sblock.fs_flags & FS_UNCLEAN)) != markclean) {
++#ifdef HAVE_BSD_SYSCTL
+ 			cmd.value = FS_UNCLEAN;
+ 			cmd.size = markclean ? -1 : 1;
+ 			if (sysctlbyname("vfs.ffs.setflags", 0, 0,
+ 			    &cmd, sizeof cmd) == -1)
+ 				rwerror("SET FILE SYSTEM FLAGS", FS_UNCLEAN);
++#endif
+ 			if (!preen) {
+ 				printf("\n***** FILE SYSTEM MARKED %s *****\n",
+ 				    markclean ? "CLEAN" : "DIRTY");
+@@ -567,7 +572,7 @@
+ }
+ 
+ void
+-catch(int sig __unused)
++catch(int sig)
+ {
+ 
+ 	ckfini(0);
+@@ -580,7 +585,7 @@
+  * so that reboot sequence may be interrupted.
+  */
+ void
+-catchquit(int sig __unused)
++catchquit(int sig)
+ {
+ 	printf("returning to single-user after file system check\n");
+ 	returntosingle = 1;
+@@ -649,11 +654,13 @@
+ 		 * Force foreground fsck to clean up inconsistency.
+ 		 */
+ 		if (bkgrdflag) {
++#if HAVE_BSD_SYSCTL
+ 			cmd.value = FS_NEEDSFSCK;
+ 			cmd.size = 1;
+ 			if (sysctlbyname("vfs.ffs.setflags", 0, 0,
+ 			    &cmd, sizeof cmd) == -1)
+ 				pwarn("CANNOT SET FS_NEEDSFSCK FLAG\n");
++#endif
+ 			fprintf(stdout, "CANNOT RUN IN BACKGROUND\n");
+ 			ckfini(0);
+ 			exit(EEXIT);
+@@ -670,6 +677,7 @@
+ 	/*
+ 	 * Force foreground fsck to clean up inconsistency.
+ 	 */
++#if HAVE_BSD_SYSCTL
+ 	if (bkgrdflag) {
+ 		cmd.value = FS_NEEDSFSCK;
+ 		cmd.size = 1;
+@@ -677,6 +685,7 @@
+ 		    &cmd, sizeof cmd) == -1)
+ 			pwarn("CANNOT SET FS_NEEDSFSCK FLAG\n");
+ 	}
++#endif
+ 	ckfini(0);
+ 	exit(EEXIT);
+ }
+diff -Naur ufsutils.orig/fsck.ufs/inode.c ufsutils.new/fsck.ufs/inode.c
+--- ufsutils.orig/fsck.ufs/inode.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/inode.c	2004-05-16 23:22:10.000000000 +0200
+@@ -36,7 +36,7 @@
+ __FBSDID("$FreeBSD: src/sbin/fsck_ffs/inode.c,v 1.35 2004/04/09 19:58:28 markm Exp $");
+ 
+ #include <sys/param.h>
+-#include <sys/stdint.h>
++#include <stdint.h>
+ #include <sys/time.h>
+ #include <sys/sysctl.h>
+ 
+@@ -47,6 +47,7 @@
+ #include <err.h>
+ #include <pwd.h>
+ #include <string.h>
++#include <time.h>
+ 
+ #include "fsck.h"
+ 
+@@ -95,7 +96,8 @@
+ 					pathbuf);
+                         	if (reply("ADJUST LENGTH") == 1) {
+ 					dp = ginode(idesc->id_number);
+-                                	DIP(dp, di_size) = i * sblock.fs_bsize;
++					DIP_set(dp, di_size,
++						i * sblock.fs_bsize);
+ 					printf(
+ 					    "YOU MUST RERUN FSCK AFTERWARDS\n");
+ 					rerun = 1;
+@@ -133,7 +135,7 @@
+ 					pathbuf);
+                         	if (reply("ADJUST LENGTH") == 1) {
+ 					dp = ginode(idesc->id_number);
+-                                	DIP(dp, di_size) -= remsize;
++					DIP_add(dp, di_size, -remsize);
+ 					remsize = 0;
+ 					printf(
+ 					    "YOU MUST RERUN FSCK AFTERWARDS\n");
+@@ -183,7 +185,7 @@
+ 			if (preen) {
+ 				pfatal("%s", buf);
+ 			} else if (dofix(idesc, buf)) {
+-				IBLK(bp, i) = 0;
++				IBLK_set(bp, i, 0);
+ 				dirty(bp);
+ 			}
+ 		}
+@@ -211,7 +213,7 @@
+ 					pathbuf);
+                         	if (reply("ADJUST LENGTH") == 1) {
+ 					dp = ginode(idesc->id_number);
+-                                	DIP(dp, di_size) -= isize;
++					DIP_add(dp, di_size, -isize);
+ 					isize = 0;
+ 					printf(
+ 					    "YOU MUST RERUN FSCK AFTERWARDS\n");
+@@ -282,7 +284,7 @@
+ 	ufs2_daddr_t iblk;
+ 
+ 	if (inumber < ROOTINO || inumber > maxino)
+-		errx(EEXIT, "bad inode number %d to ginode", inumber);
++		errx(EEXIT, "bad inode number %ld to ginode", inumber);
+ 	if (startinum == 0 ||
+ 	    inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
+ 		iblk = ino_to_fsba(&sblock, inumber);
+@@ -314,7 +316,7 @@
+ 	static caddr_t nextinop;
+ 
+ 	if (inumber != nextino++ || inumber > lastvalidinum)
+-		errx(EEXIT, "bad inode number %d to nextinode", inumber);
++		errx(EEXIT, "bad inode number %ld to nextinode", inumber);
+ 	if (inumber >= lastinum) {
+ 		readcnt++;
+ 		dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
+@@ -345,7 +347,7 @@
+ {
+ 
+ 	if (inum % sblock.fs_ipg != 0)
+-		errx(EEXIT, "bad inode number %d to setinodebuf", inum);
++		errx(EEXIT, "bad inode number %ld to setinodebuf", inum);
+ 	lastvalidinum = inum + sblock.fs_ipg - 1;
+ 	startinum = 0;
+ 	nextino = inum;
+@@ -436,7 +438,7 @@
+ 			continue;
+ 		return (inp);
+ 	}
+-	errx(EEXIT, "cannot find inode %d", inumber);
++	errx(EEXIT, "cannot find inode %ld", inumber);
+ 	return ((struct inoinfo *)0);
+ }
+ 
+@@ -630,20 +632,21 @@
+ 	}
+ 	cgdirty();
+ 	dp = ginode(ino);
+-	DIP(dp, di_db[0]) = allocblk((long)1);
++	DIP_set(dp, di_db[0], allocblk((long)1));
+ 	if (DIP(dp, di_db[0]) == 0) {
+ 		inoinfo(ino)->ino_state = USTATE;
+ 		return (0);
+ 	}
+-	DIP(dp, di_mode) = type;
+-	DIP(dp, di_flags) = 0;
+-	DIP(dp, di_atime) = time(NULL);
+-	DIP(dp, di_mtime) = DIP(dp, di_ctime) = DIP(dp, di_atime);
+-	DIP(dp, di_mtimensec) = 0;
+-	DIP(dp, di_ctimensec) = 0;
+-	DIP(dp, di_atimensec) = 0;
+-	DIP(dp, di_size) = sblock.fs_fsize;
+-	DIP(dp, di_blocks) = btodb(sblock.fs_fsize);
++	DIP_set(dp, di_mode, type);
++	DIP_set(dp, di_flags, 0);
++	DIP_set(dp, di_atime, time(NULL));
++	DIP_set(dp, di_mtime, DIP(dp, di_atime));
++	DIP_set(dp, di_ctime, DIP(dp, di_atime));
++	DIP_set(dp, di_mtimensec, 0);
++	DIP_set(dp, di_ctimensec, 0);
++	DIP_set(dp, di_atimensec, 0);
++	DIP_set(dp, di_size, sblock.fs_fsize);
++	DIP_set(dp, di_blocks, btodb(sblock.fs_fsize));
+ 	n_files++;
+ 	inodirty();
+ 	inoinfo(ino)->ino_type = IFTODT(type);
+diff -Naur ufsutils.orig/fsck.ufs/main.c ufsutils.new/fsck.ufs/main.c
+--- ufsutils.orig/fsck.ufs/main.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/main.c	2004-05-16 23:15:12.000000000 +0200
+@@ -45,13 +45,22 @@
+ #include <sys/stat.h>
+ #include <sys/file.h>
+ #include <sys/time.h>
++#ifdef HAVE_BSD_STATFS
+ #include <sys/mount.h>
++#else
++#include <sys/statvfs.h>
++#define statfs statvfs
++#endif
+ #include <sys/resource.h>
++#ifdef HAVE_BSD_SYSCTL
+ #include <sys/sysctl.h>
++#endif
+ #include <sys/disklabel.h>
+ 
+ #include <ufs/ufs/dinode.h>
++#ifdef HAVE_BSD_MOUNT
+ #include <ufs/ufs/ufsmount.h>
++#endif
+ #include <ufs/ffs/fs.h>
+ 
+ #include <err.h>
+@@ -59,15 +68,19 @@
+ #include <fstab.h>
+ #include <grp.h>
+ #include <paths.h>
++#include <time.h>
+ #include <stdint.h>
+ #include <string.h>
++#include <signal.h>
+ 
+ #include "fsck.h"
+ 
+-static void usage(void) __dead2;
++static void usage(char *progname) __dead2;
+ static int argtoi(int flag, const char *req, const char *str, int base);
+ static int checkfilesys(char *filesys);
++#ifdef HAVE_BSD_STATFS
+ static struct statfs *getmntpt(const char *);
++#endif
+ 
+ int
+ main(int argc, char *argv[])
+@@ -76,10 +89,11 @@
+ 	struct rlimit rlimit;
+ 	struct itimerval itimerval;
+ 	int ret = 0;
++	char *progname = argv[0];
+ 
+ 	sync();
+ 	skipclean = 1;
+-	while ((ch = getopt(argc, argv, "b:Bc:dfFm:npy")) != -1) {
++	while ((ch = getopt(argc, argv, "ab:Bc:dfFm:npy")) != -1) {
+ 		switch (ch) {
+ 		case 'b':
+ 			skipclean = 0;
+@@ -123,6 +137,7 @@
+ 			yflag = 0;
+ 			break;
+ 
++		case 'a':
+ 		case 'p':
+ 			preen++;
+ 			break;
+@@ -133,20 +148,22 @@
+ 			break;
+ 
+ 		default:
+-			usage();
++			usage(progname);
+ 		}
+ 	}
+ 	argc -= optind;
+ 	argv += optind;
+ 
+ 	if (!argc)
+-		usage();
++		usage(progname);
+ 
+ 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ 		(void)signal(SIGINT, catch);
+ 	if (preen)
+ 		(void)signal(SIGQUIT, catchquit);
++#ifdef HAVE_BSD_SIGNALS
+ 	signal(SIGINFO, infohandler);
++#endif
+ 	if (bkgrdflag) {
+ 		signal(SIGALRM, alarmhandler);
+ 		itimerval.it_interval.tv_sec = 5;
+@@ -191,14 +208,18 @@
+ checkfilesys(char *filesys)
+ {
+ 	ufs2_daddr_t n_ffree, n_bfree;
++#if HAVE_BSD_MOUNT
+ 	struct ufs_args args;
++#endif
+ 	struct dups *dp;
+ 	struct statfs *mntp;
+ 	struct zlncnt *zlnp;
++#if HAVE_UFS_SNAPSHOT && HAVE_BSD_STATFS
+ 	struct stat snapdir;
+ 	struct group *grp;
++#endif
+ 	ufs2_daddr_t blks;
+-	int cylno, ret;
++	int cylno;
+ 	ino_t files;
+ 	size_t size;
+ 
+@@ -210,10 +231,12 @@
+ 	 * if it is listed among the mounted file systems. Failing that
+ 	 * check to see if it is listed in /etc/fstab.
+ 	 */
++#if HAVE_BSD_STATFS
+ 	mntp = getmntpt(filesys);
+ 	if (mntp != NULL)
+ 		filesys = mntp->f_mntfromname;
+ 	else
++#endif
+ 		filesys = blockcheck(filesys);
+ 	/*
+ 	 * If -F flag specified, check to see whether a background check
+@@ -231,8 +254,10 @@
+ 		if ((sblock.fs_flags & FS_DOSOFTDEP) == 0)
+ 			exit(5);	/* Not running soft updates */
+ 		size = MIBSIZE;
++#if HAVE_BSD_SYSCTL
+ 		if (sysctlnametomib("vfs.ffs.adjrefcnt", adjrefcnt, &size) < 0)
+ 			exit(6);	/* Lacks kernel support */
++#endif
+ 		if ((mntp == NULL && sblock.fs_clean == 1) ||
+ 		    (mntp != NULL && (sblock.fs_flags & FS_UNCLEAN) == 0))
+ 			exit(7);	/* Filesystem clean, report it now */
+@@ -245,6 +270,7 @@
+ 	 *	return created snapshot file
+ 	 *	if not found, clear bkgrdflag and proceed with normal fsck
+ 	 */
++#if HAVE_UFS_SNAPSHOT && HAVE_BSD_STATFS
+ 	if (bkgrdflag) {
+ 		if (mntp == NULL) {
+ 			bkgrdflag = 0;
+@@ -320,6 +346,7 @@
+ 				filesys = snapname;
+ 		}
+ 	}
++#endif
+ 
+ 	switch (setup(filesys)) {
+ 	case 0:
+@@ -327,7 +354,9 @@
+ 			pfatal("CAN'T CHECK FILE SYSTEM.");
+ 		return (0);
+ 	case -1:
++#if HAVE_UFS_SNAPSHOT && HAVE_BSD_STATFS
+ 	clean:
++#endif
+ 		pwarn("clean, %ld free ", (long)(sblock.fs_cstotal.cs_nffree +
+ 		    sblock.fs_frag * sblock.fs_cstotal.cs_nbfree));
+ 		printf("(%lld frags, %lld blocks, %.1f%% fragmentation)\n",
+@@ -347,8 +376,10 @@
+ 	 */
+ 	if (preen == 0) {
+ 		printf("** Last Mounted on %s\n", sblock.fs_fsmnt);
++#if HAVE_BSD_STATFS
+ 		if (mntp != NULL && mntp->f_flags & MNT_ROOTFS)
+ 			printf("** Root file system\n");
++#endif
+ 		printf("** Phase 1 - Check Blocks and Sizes\n");
+ 	}
+ 	pass1();
+@@ -415,7 +446,7 @@
+ 	    n_ffree * 100.0 / sblock.fs_dsize);
+ 	if (debug) {
+ 		if (files < 0)
+-			printf("%d inodes missing\n", -files);
++			printf("%ld inodes missing\n", -files);
+ 		if (blks < 0)
+ 			printf("%lld blocks missing\n", -(long long)blks);
+ 		if (duplist != NULL) {
+@@ -427,7 +458,7 @@
+ 		if (zlnhead != NULL) {
+ 			printf("The following zero link count inodes remain:");
+ 			for (zlnp = zlnhead; zlnp; zlnp = zlnp->next)
+-				printf(" %u,", zlnp->zlncnt);
++				printf(" %lu,", zlnp->zlncnt);
+ 			printf("\n");
+ 		}
+ 	}
+@@ -454,8 +485,13 @@
+ 	/*
+ 	 * Check to see if the file system is mounted read-write.
+ 	 */
++#if HAVE_BSD_STATFS
+ 	if (bkgrdflag == 0 && mntp != NULL && (mntp->f_flags & MNT_RDONLY) == 0)
+ 		resolved = 0;
++#else
++	if (bkgrdflag == 0 && mntp != NULL && (mntp->f_flag & ST_RDONLY) == 0)
++		resolved = 0;
++#endif
+ 	ckfini(resolved);
+ 
+ 	for (cylno = 0; cylno < sblock.fs_ncg; cylno++)
+@@ -473,6 +509,9 @@
+ 		 * it unless it is read-write, so we can continue using it
+ 		 * as safely as possible.
+ 		 */
++#if HAVE_BSD_STATFS && HAVE_BSD_MOUNT
++		int ret;
++
+ 		if (mntp->f_flags & MNT_RDONLY) {
+ 			args.fspec = 0;
+ 			args.export.ex_flags = 0;
+@@ -484,6 +523,20 @@
+ 			pwarn("mount reload of '%s' failed: %s\n\n",
+ 			    mntp->f_mntonname, strerror(errno));
+ 		}
++//#else
++#warning "FIXME: use linux mount call"
++		if (mntp->f_flag & ST_RDONLY) {
++			args.fspec = 0;
++			args.export.ex_flags = 0;
++			args.export.ex_root = 0;
++			ret = mount("ufs", mntp->f_mntonname,
++			    mntp->f_flag | MNT_UPDATE | MNT_RELOAD, &args);
++			if (ret == 0)
++				return (0);
++			pwarn("mount reload of '%s' failed: %s\n\n",
++			    mntp->f_mntonname, strerror(errno));
++		}
++#endif
+ 		if (!fsmodified)
+ 			return (0);
+ 		if (!preen)
+@@ -494,6 +547,7 @@
+ 	return (0);
+ }
+ 
++#if HAVE_BSD_STATFS
+ /*
+  * Get the mount point information for name.
+  */
+@@ -533,13 +587,14 @@
+ 	statfsp = NULL;
+ 	return (statfsp);
+ }
++#endif
+ 
+ static void
+-usage(void)
++usage(char *progname)
+ {
+         (void) fprintf(stderr,
+             "usage: %s [-BFpfny] [-b block] [-c level] [-m mode] "
+                         "file system ...\n",
+-            getprogname());
++            progname);
+         exit(1);
+ }
+diff -Naur ufsutils.orig/fsck.ufs/pass1.c ufsutils.new/fsck.ufs/pass1.c
+--- ufsutils.orig/fsck.ufs/pass1.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/pass1.c	2004-05-16 23:02:25.000000000 +0200
+@@ -236,8 +236,8 @@
+ 	}
+ 	if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
+ 		dp = ginode(inumber);
+-		DIP(dp, di_size) = sblock.fs_fsize;
+-		DIP(dp, di_mode) = IFREG|0600;
++		DIP_set(dp, di_size, sblock.fs_fsize);
++		DIP_set(dp, di_mode, IFREG|0600);
+ 		inodirty();
+ 	}
+ 	if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
+@@ -328,9 +328,11 @@
+ 	inoinfo(inumber)->ino_type = IFTODT(mode);
+ 	badblk = dupblk = 0;
+ 	idesc->id_number = inumber;
++#if HAVE_UFS_SNAPSHOTS
+ 	if (DIP(dp, di_flags) & SF_SNAPSHOT)
+ 		idesc->id_type = SNAP;
+ 	else
++#endif
+ 		idesc->id_type = ADDR;
+ 	(void)ckinode(dp, idesc);
+ 	if (sblock.fs_magic == FS_UFS2_MAGIC && dp->dp2.di_extsize > 0) {
+@@ -364,7 +366,7 @@
+ 			return;
+ 		if (bkgrdflag == 0) {
+ 			dp = ginode(inumber);
+-			DIP(dp, di_blocks) = idesc->id_entryno;
++			DIP_set(dp, di_blocks, idesc->id_entryno);
+ 			inodirty();
+ 		} else {
+ 			cmd.value = idesc->id_number;
+diff -Naur ufsutils.orig/fsck.ufs/pass2.c ufsutils.new/fsck.ufs/pass2.c
+--- ufsutils.orig/fsck.ufs/pass2.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/pass2.c	2004-05-16 23:03:36.000000000 +0200
+@@ -103,8 +103,8 @@
+ 			exit(EEXIT);
+ 		}
+ 		dp = ginode(ROOTINO);
+-		DIP(dp, di_mode) &= ~IFMT;
+-		DIP(dp, di_mode) |= IFDIR;
++		DIP_and(dp, di_mode, ~IFMT);
++		DIP_or(dp, di_mode, IFDIR);
+ 		inodirty();
+ 		break;
+ 
+@@ -149,7 +149,7 @@
+ 			inp->i_isize = roundup(MINDIRSIZE, DIRBLKSIZ);
+ 			if (reply("FIX") == 1) {
+ 				dp = ginode(inp->i_number);
+-				DIP(dp, di_size) = inp->i_isize;
++				DIP_set(dp, di_size, inp->i_isize);
+ 				inodirty();
+ 			}
+ 		} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
+@@ -167,22 +167,22 @@
+ 			inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
+ 			if (preen || reply("ADJUST") == 1) {
+ 				dp = ginode(inp->i_number);
+-				DIP(dp, di_size) =
+-				    roundup(inp->i_isize, DIRBLKSIZ);
++				DIP_set(dp, di_size,
++				    roundup(inp->i_isize, DIRBLKSIZ));
+ 				inodirty();
+ 			}
+ 		}
+ 		dp = &dino;
+ 		memset(dp, 0, sizeof(struct ufs2_dinode));
+-		DIP(dp, di_mode) = IFDIR;
+-		DIP(dp, di_size) = inp->i_isize;
++		DIP_set(dp, di_mode, IFDIR);
++		DIP_set(dp, di_size, inp->i_isize);
+ 		for (i = 0;
+ 		     i < (inp->i_numblks<NDADDR ? inp->i_numblks : NDADDR);
+ 		     i++)
+-			DIP(dp, di_db[i]) = inp->i_blks[i];
++			DIP_set(dp, di_db[i], inp->i_blks[i]);
+ 		if (inp->i_numblks > NDADDR)
+ 			for (i = 0; i < NIADDR; i++)
+-				DIP(dp, di_ib[i]) = inp->i_blks[NDADDR + i];
++				DIP_set(dp, di_ib[i], inp->i_blks[NDADDR + i]);
+ 		curino.id_number = inp->i_number;
+ 		curino.id_parent = inp->i_parent;
+ 		(void)ckinode(dp, &curino);
+diff -Naur ufsutils.orig/fsck.ufs/pass4.c ufsutils.new/fsck.ufs/pass4.c
+--- ufsutils.orig/fsck.ufs/pass4.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/pass4.c	2004-05-13 08:22:35.000000000 +0200
+@@ -114,7 +114,7 @@
+ 				break;
+ 
+ 			default:
+-				errx(EEXIT, "BAD STATE %d FOR INODE I=%d",
++				errx(EEXIT, "BAD STATE %d FOR INODE I=%ld",
+ 				    inoinfo(inumber)->ino_state, inumber);
+ 			}
+ 		}
+diff -Naur ufsutils.orig/fsck.ufs/setup.c ufsutils.new/fsck.ufs/setup.c
+--- ufsutils.orig/fsck.ufs/setup.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/setup.c	2004-05-13 08:04:18.000000000 +0200
+@@ -36,11 +36,14 @@
+ __FBSDID("$FreeBSD: src/sbin/fsck_ffs/setup.c,v 1.47 2004/04/09 19:58:28 markm Exp $");
+ 
+ #include <sys/param.h>
++#include <sys/types.h>
+ #include <sys/stat.h>
+ #define FSTYPENAMES
+ #include <sys/disklabel.h>
+ #include <sys/file.h>
++#if HAVE_BSD_SYSCTL
+ #include <sys/sysctl.h>
++#endif
+ 
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+@@ -51,6 +54,7 @@
+ #include <limits.h>
+ #include <stdint.h>
+ #include <string.h>
++#include <unistd.h>
+ 
+ #include "fsck.h"
+ 
+@@ -87,6 +91,7 @@
+ 		}
+ 		return (0);
+ 	}
++#if HAVE_UFS_SNAPSHOTS
+ 	if ((statb.st_mode & S_IFMT) != S_IFCHR &&
+ 	    (statb.st_mode & S_IFMT) != S_IFBLK) {
+ 		if (bkgrdflag != 0 && (statb.st_flags & SF_SNAPSHOT) == 0) {
+@@ -121,6 +126,7 @@
+ 			}
+ 		}
+ 	}
++#endif
+ 	if ((fsreadfd = open(dev, O_RDONLY)) < 0) {
+ 		if (bkgrdflag) {
+ 			unlink(snapname);
+@@ -131,6 +137,7 @@
+ 	}
+ 	if (bkgrdflag) {
+ 		unlink(snapname);
++#if HAVE_BSD_SYSCTL
+ 		size = MIBSIZE;
+ 		if (sysctlnametomib("vfs.ffs.adjrefcnt", adjrefcnt, &size) < 0||
+ 		    sysctlnametomib("vfs.ffs.adjblkcnt", adjblkcnt, &size) < 0||
+@@ -142,6 +149,7 @@
+ 		}
+ 		cmd.version = FFS_CMD_VERSION;
+ 		cmd.handle = fsreadfd;
++#endif
+ 		fswritefd = -1;
+ 	}
+ 	if (preen == 0)
+@@ -453,6 +461,8 @@
+ 		return (0);
+ 	}
+ 	lp = getdisklabel(dev, devfd);
++	if (!lp)
++		return (0);
+ 	if (isdigit(*cp))
+ 		pp = &lp->d_partitions[0];
+ 	else
+@@ -503,13 +513,17 @@
+ static struct disklabel *
+ getdisklabel(char *s, int fd)
+ {
++#ifdef HAVE_BSD_DISKLABELS
+ 	static struct disklabel lab;
+ 
+ 	if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ 		if (s == NULL)
++#endif
+ 			return ((struct disklabel *)NULL);
++#ifdef HAVE_BSD_DISKLABELS
+ 		pwarn("ioctl (GCINFO): %s\n", strerror(errno));
+ 		errx(EEXIT, "%s: can't read disk label", s);
+ 	}
+ 	return (&lab);
++#endif
+ }
+diff -Naur ufsutils.orig/fsck.ufs/utilities.c ufsutils.new/fsck.ufs/utilities.c
+--- ufsutils.orig/fsck.ufs/utilities.c	2004-04-09 21:58:28.000000000 +0200
++++ ufsutils.new/fsck.ufs/utilities.c	2004-05-16 20:38:02.000000000 +0200
+@@ -108,14 +108,16 @@
+ 	return (origname);
+ }
+ 
++#ifdef HAVE_BSD_SIGNALS
+ void
+-infohandler(int sig __unused)
++infohandler(int sig)
+ {
+ 	got_siginfo = 1;
+ }
++#endif
+ 
+ void
+-alarmhandler(int sig __unused)
++alarmhandler(int sig)
+ {
+ 	got_sigalarm = 1;
+ }
+diff -Naur ufsutils.orig/fsck.ufs/Makefile ufsutilsi.new/fsck.ufs/Makefile
+--- ufsutils.orig/fsck.ufs/Makefile	2004-02-23 21:13:51.000000000 +0100
++++ ufsutils.new/fsck.ufs/Makefile	2004-05-24 02:34:48.000000000 +0200
+@@ -1,16 +1,19 @@
+ # $FreeBSD: src/sbin/fsck_ffs/Makefile,v 1.14 2004/02/23 20:13:51 johan Exp $
+ #	@(#)Makefile	8.2 (Berkeley) 4/27/95
+ 
+-PROG=	fsck_ffs
+-LINKS+=	${BINDIR}/fsck_ffs ${BINDIR}/fsck_ufs
+-LINKS+=	${BINDIR}/fsck_ffs ${BINDIR}/fsck_4.2bsd
+-MAN=	fsck_ffs.8
+-MLINKS=	fsck_ffs.8 fsck_ufs.8 fsck_ffs.8 fsck_4.2bsd.8
+-SRCS=	dir.c ea.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c \
+-	pass4.c pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c
+-WARNS?=	2
+-CFLAGS+= -I${.CURDIR}
++PROG = fsck.ufs
++LIB = $(PROG)
++LIB_type = static
++SRCS = main.c
++MAN = fsck_ffs.8:fsck.ufs.8
++UFS_SRCS = ../include/ufs/ffs/ffs_subr.c ../include/ufs/ffs/ffs_tables.c
++LIBSRCS = \
++	dir.c ea.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
++	pass5.c setup.c utilities.c $(UFS_SRCS)
++WARNS = 2
+ 
+-.PATH:	${.CURDIR}/../../sys/ufs/ffs
++LDADD = -L../libport -lport -L. -l$(LIB) -L../libufs -lufs
++INCLUDES = -I.
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>

Added: trunk/ufsutils/debian/patches/02_fsdb.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_fsdb.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_fsdb.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,308 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/fsdb.ufs/fsdb.8 ufsutils.new/fsdb.ufs/fsdb.8
+--- ufsutils.orig/fsdb.ufs/fsdb.8	2003-08-30 09:49:42.000000000 +0200
++++ ufsutils.new/fsdb.ufs/fsdb.8	2004-05-13 08:22:41.000000000 +0200
+@@ -242,7 +242,7 @@
+ ported it to
+ .Fx .
+ .Sh WARNING
+-Use this tool with extreme caution--you can damage an FFS file system
++Use this tool with extreme caution\-\-you can damage an FFS file system
+ beyond what
+ .Xr fsck 8
+ can repair.
+diff -Naur ufsutils.orig/fsdb.ufs/fsdb.c ufsutils.new/fsdb.ufs/fsdb.c
+--- ufsutils.orig/fsdb.ufs/fsdb.c	2003-11-13 20:08:43.000000000 +0100
++++ ufsutils.new/fsdb.ufs/fsdb.c	2004-05-16 23:07:42.000000000 +0200
+@@ -35,13 +35,13 @@
+ 
+ #include <sys/param.h>
+ #include <sys/time.h>
++#include <time.h>
+ #include <ctype.h>
+ #include <err.h>
+ #include <grp.h>
+ #include <histedit.h>
+ #include <pwd.h>
+ #include <string.h>
+-#include <timeconv.h>
+ 
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ufs/dir.h>
+@@ -200,7 +200,7 @@
+ prompt(EditLine *el)
+ {
+     static char pstring[64];
+-    snprintf(pstring, sizeof(pstring), "fsdb (inum: %d)> ", curinum);
++    snprintf(pstring, sizeof(pstring), "fsdb (inum: %ld)> ", curinum);
+     return pstring;
+ }
+ 
+@@ -223,7 +223,9 @@
+     printactive(0);
+ 
+     hist = history_init();
++#if HAVE_BSD_LIBEDIT_H_EVENT
+     history(hist, &he, H_EVENT, 100);	/* 100 elt history buffer */
++#endif
+ 
+     elptr = el_init("fsdb", stdin, stdout, stderr);
+     el_set(elptr, EL_EDITOR, "emacs");
+@@ -286,7 +288,7 @@
+ 
+ #define GETINUM(ac,inum)    inum = strtoul(argv[ac], &cp, 0); \
+     if (inum < ROOTINO || inum > maxino || cp == argv[ac] || *cp != '\0' ) { \
+-	printf("inode %d out of range; range is [%d,%d]\n", \
++	printf("inode %ld out of range; range is [%ld,%ld]\n", \
+ 	       inum, ROOTINO, maxino); \
+ 	return 1; \
+     }
+@@ -351,8 +353,8 @@
+ {
+     if (!checkactive())
+ 	return 1;
+-    DIP(curinode, di_nlink) += 1;
+-    printf("inode %d link count now %d\n", curinum, DIP(curinode, di_nlink));
++    DIP_add(curinode, di_nlink, 1);
++    printf("inode %ld link count now %d\n", curinum, DIP(curinode, di_nlink));
+     inodirty();
+     return 0;
+ }
+@@ -361,8 +363,8 @@
+ {
+     if (!checkactive())
+ 	return 1;
+-    DIP(curinode, di_nlink) -= 1;
+-    printf("inode %d link count now %d\n", curinum, DIP(curinode, di_nlink));
++    DIP_add(curinode, di_nlink, -1);
++    printf("inode %ld link count now %d\n", curinum, DIP(curinode, di_nlink));
+     inodirty();
+     return 0;
+ }
+@@ -482,7 +484,7 @@
+ 	return 1;
+     rval = makeentry(curinum, inum, argv[2]);
+     if (rval)
+-	printf("Ino %d entered as `%s'\n", inum, argv[2]);
++	printf("Ino %ld entered as `%s'\n", inum, argv[2]);
+     else
+ 	printf("could not enter name? weird.\n");
+     curinode = ginode(curinum);
+@@ -635,8 +637,8 @@
+ 	warnx("try one of `file', `dir', `socket', `fifo'");
+ 	return 1;
+     }
+-    DIP(curinode, di_mode) &= ~IFMT;
+-    DIP(curinode, di_mode) |= type;
++    DIP_and(curinode, di_mode, ~IFMT);
++    DIP_or(curinode, di_mode, type);
+     inodirty();
+     printactive(0);
+     return 0;
+@@ -657,7 +659,7 @@
+ 	return 1;
+     }
+     
+-    DIP(curinode, di_size) = len;
++    DIP_set(curinode, di_size, len);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -678,8 +680,8 @@
+ 	return 1;
+     }
+     
+-    DIP(curinode, di_mode) &= ~07777;
+-    DIP(curinode, di_mode) |= modebits;
++    DIP_and(curinode, di_mode, ~07777);
++    DIP_or(curinode, di_mode, modebits);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -704,7 +706,7 @@
+ 	warnx("flags set beyond 32-bit range of field (%lx)\n", flags);
+ 	return(1);
+     }
+-    DIP(curinode, di_flags) = flags;
++    DIP_set(curinode, di_flags, flags);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -729,7 +731,7 @@
+ 	warnx("gen set beyond 32-bit range of field (%lx)\n", gen);
+ 	return(1);
+     }
+-    DIP(curinode, di_gen) = gen;
++    DIP_set(curinode, di_gen, gen);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -754,7 +756,7 @@
+ 	return 1;
+     }
+     
+-    DIP(curinode, di_nlink) = lcnt;
++    DIP_set(curinode, di_nlink, lcnt);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -781,7 +783,7 @@
+ 	}
+     }
+     
+-    DIP(curinode, di_uid) = uid;
++    DIP_set(curinode, di_uid, uid);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -807,7 +809,7 @@
+ 	}
+     }
+     
+-    DIP(curinode, di_gid) = gid;
++    DIP_set(curinode, di_gid, gid);
+     inodirty();
+     printactive(0);
+     return rval;
+@@ -874,10 +876,10 @@
+     if (dotime(argv[1], &secs, &nsecs))
+ 	return 1;
+     if (sblock.fs_magic == FS_UFS1_MAGIC)
+-	curinode->dp1.di_mtime = _time_to_time32(secs);
++	curinode->dp1.di_mtime = (int32_t)secs;
+     else
+-	curinode->dp2.di_mtime = _time_to_time64(secs);
+-    DIP(curinode, di_mtimensec) = nsecs;
++	curinode->dp2.di_mtime = (int64_t)secs;
++    DIP_set(curinode, di_mtimensec, nsecs);
+     inodirty();
+     printactive(0);
+     return 0;
+@@ -891,10 +893,10 @@
+     if (dotime(argv[1], &secs, &nsecs))
+ 	return 1;
+     if (sblock.fs_magic == FS_UFS1_MAGIC)
+-	curinode->dp1.di_atime = _time_to_time32(secs);
++	curinode->dp1.di_atime = (int32_t)secs;
+     else
+-	curinode->dp2.di_atime = _time_to_time64(secs);
+-    DIP(curinode, di_atimensec) = nsecs;
++	curinode->dp2.di_atime = (int64_t)secs;
++    DIP_set(curinode, di_atimensec, nsecs);
+     inodirty();
+     printactive(0);
+     return 0;
+@@ -908,10 +910,10 @@
+     if (dotime(argv[1], &secs, &nsecs))
+ 	return 1;
+     if (sblock.fs_magic == FS_UFS1_MAGIC)
+-	curinode->dp1.di_ctime = _time_to_time32(secs);
++	curinode->dp1.di_ctime = (int32_t)secs;
+     else
+-	curinode->dp2.di_ctime = _time_to_time64(secs);
+-    DIP(curinode, di_ctimensec) = nsecs;
++	curinode->dp2.di_ctime = (int64_t)secs;
++    DIP_set(curinode, di_ctimensec, nsecs);
+     inodirty();
+     printactive(0);
+     return 0;
+diff -Naur ufsutils.orig/fsdb.ufs/fsdbutil.c ufsutils.new/fsdb.ufs/fsdbutil.c
+--- ufsutils.orig/fsdb.ufs/fsdbutil.c	2003-11-13 20:08:43.000000000 +0100
++++ ufsutils.new/fsdb.ufs/fsdbutil.c	2004-05-16 20:39:43.000000000 +0200
+@@ -41,7 +41,6 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <time.h>
+-#include <timeconv.h>
+ 
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+@@ -157,23 +156,23 @@
+     printf("I=%lu MODE=%o SIZE=%ju", (u_long)inum, DIP(dp, di_mode),
+ 	(uintmax_t)DIP(dp, di_size));
+     if (sblock.fs_magic == FS_UFS1_MAGIC)
+-	t = _time32_to_time(dp->dp1.di_mtime);
++	t = (time_t)dp->dp1.di_mtime;
+     else
+-	t = _time64_to_time(dp->dp2.di_mtime);
++	t = (time_t)dp->dp2.di_mtime;
+     p = ctime(&t);
+     printf("\n\tMTIME=%15.15s %4.4s [%d nsec]", &p[4], &p[20],
+ 	   DIP(dp, di_mtimensec));
+     if (sblock.fs_magic == FS_UFS1_MAGIC)
+-	t = _time32_to_time(dp->dp1.di_ctime);
++	t = (time_t)dp->dp1.di_ctime;
+     else
+-	t = _time64_to_time(dp->dp2.di_ctime);
++	t = (time_t)dp->dp2.di_ctime;
+     p = ctime(&t);
+     printf("\n\tCTIME=%15.15s %4.4s [%d nsec]", &p[4], &p[20],
+ 	   DIP(dp, di_ctimensec));
+     if (sblock.fs_magic == FS_UFS1_MAGIC)
+-	t = _time32_to_time(dp->dp1.di_atime);
++	t = (time_t)dp->dp1.di_atime;
+     else
+-	t = _time64_to_time(dp->dp2.di_atime);
++	t = (time_t)dp->dp2.di_atime;
+     p = ctime(&t);
+     printf("\n\tATIME=%15.15s %4.4s [%d nsec]\n", &p[4], &p[20],
+ 	   DIP(dp, di_atimensec));
+@@ -285,7 +284,7 @@
+     long ndb, offset;
+     ufs2_daddr_t blkno;
+ 
+-    printf("Blocks for inode %d:\n", inum);
++    printf("Blocks for inode %ld:\n", inum);
+     printf("Direct blocks:\n");
+     ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
+     for (i = 0; i < NDADDR; i++) {
+@@ -335,7 +334,7 @@
+ 	return 0;
+     }
+     if ((DIP(curinode, di_mode) & IFMT) != IFDIR) {
+-	warnx("inode %d not a directory", curinum);
++	warnx("inode %ld not a directory", curinum);
+ 	return 0;
+     }
+     return 1;
+@@ -360,10 +359,10 @@
+ 	    printstat("current inode", curinum, curinode);
+ 	break;
+     case 0:
+-	printf("current inode %d: unallocated inode\n", curinum);
++	printf("current inode %ld: unallocated inode\n", curinum);
+ 	break;
+     default:
+-	printf("current inode %d: screwy itype 0%o (mode 0%o)?\n",
++	printf("current inode %ld: screwy itype 0%o (mode 0%o)?\n",
+ 	       curinum, DIP(curinode, di_mode) & IFMT, DIP(curinode, di_mode));
+ 	break;
+     }
+diff -Naur ufsutils.orig/fsdb.ufs/Makefile ufsutils.new/fsdb.ufs/Makefile
+--- ufsutils.orig/fsdb.ufs/Makefile	2004-02-05 23:44:23.000000000 +0100
++++ ufsutils.new/fsdb.ufs/Makefile	2004-05-16 21:37:50.000000000 +0200
+@@ -2,14 +2,14 @@
+ #	@(#)Makefile	8.1 (Berkeley) 6/5/93
+ # $FreeBSD: src/sbin/fsdb/Makefile,v 1.17 2004/02/05 22:44:23 ru Exp $
+ 
+-PROG=	fsdb
+-MAN=	fsdb.8
+-SRCS=	fsdb.c fsdbutil.c \
+-	dir.c ea.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
+-	pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c
+-CFLAGS+= -I${.CURDIR}/../fsck_ffs
+-LDADD=	-ledit -ltermcap
+-DPADD=	${LIBEDIT} ${LIBTERMCAP}
+-.PATH:	${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs
++PROG = fsdb.ufs
++MAN = fsdb.8:fsdb.ufs.8
++SRCS = fsdb.c fsdbutil.c
++WARNS = 0
++
++LDADD += -ledit -ltermcap -L../libufs -lufs -L../fsck.ufs -lfsck.ufs
++DPADD += ${LIBEDIT} ${LIBTERMCAP}
++INCLUDES = -I../fsck.ufs
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>

Added: trunk/ufsutils/debian/patches/02_growfs.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_growfs.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_growfs.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,121 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/growfs.ufs/growfs.c ufsutils.new/growfs.ufs/growfs.c
+--- ufsutils.orig/growfs.ufs/growfs.c	2004-04-04 06:17:07.000000000 +0200
++++ ufsutils.new/growfs.ufs/growfs.c	2004-05-16 22:45:14.000000000 +0200
+@@ -56,7 +56,6 @@
+ #include <sys/disklabel.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+-#include <sys/disk.h>
+ 
+ #include <stdio.h>
+ #include <paths.h>
+@@ -110,6 +109,10 @@
+ #define	DIP(dp, field) \
+ 	((sblock.fs_magic == FS_UFS1_MAGIC) ? \
+ 	(uint32_t)(dp)->dp1.field : (dp)->dp2.field)
++#define	DIP_set(dp, field, value) \
++	{if (sblock.fs_magic == FS_UFS1_MAGIC) \
++		(dp)->dp1.field = (uint32_t)(value); \
++	 else (dp)->dp2.field = (value);}
+ static ufs2_daddr_t 	inoblk;			/* inode block address */
+ static char		inobuf[MAXBSIZE];	/* inode block */
+ ino_t			maxino;			/* last valid inode */
+@@ -1846,7 +1849,7 @@
+ 		return NULL;
+ 	}
+ 	if (inumber < ROOTINO || inumber > maxino)
+-		errx(8, "bad inode number %d to ginode", inumber);
++		errx(8, "bad inode number %ld to ginode", inumber);
+ 	if (startinum == 0 ||
+ 	    inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
+ 		inoblk = fsbtodb(&sblock, ino_to_fsba(&sblock, inumber));
+@@ -1903,10 +1906,12 @@
+    int sectorsize;
+    off_t mediasize;
+ 
++#ifdef HAVE_BSD_DISKLABEL
+    if (ioctl(fd, DIOCGSECTORSIZE, &sectorsize) == -1)
+         err(1,"DIOCGSECTORSIZE");
+    if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) == -1)
+         err(1,"DIOCGMEDIASIZE");
++#endif
+ 
+    if (sectorsize <= 0)
+        errx(1, "bogus sectorsize: %d", sectorsize);
+@@ -2262,9 +2267,11 @@
+ 		}
+ 		lp->d_checksum=sum;
+ 
++#if HAVE_BSD_DISKLABEL
+ 		if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0) {
+ 			errx(1, "DIOCWDINFO failed");
+ 		}
++#endif
+ 	}
+ 	free(lp);
+ 
+@@ -2288,8 +2295,10 @@
+ 	if (!lab)
+ 		errx(1, "malloc failed");
+ 
++#ifdef HAVE_BSD_DISKLABEL
+     if (!ioctl(fd, DIOCGDINFO, (char *)lab))
+         return (lab);
++#endif
+ 
+     unlabeled++;
+ 
+@@ -2420,7 +2429,7 @@
+ 		if (iptr == 0)
+ 			continue;
+ 		if (cond_bl_upd(&iptr, bp, fsi, fso, Nflag)) {
+-			DIP(ino, di_db[i]) = iptr;
++			DIP_set(ino, di_db[i], iptr);
+ 			inodeupdated++;
+ 		}
+ 	}
+@@ -2434,7 +2443,7 @@
+ 		if (iptr == 0)
+ 			continue;
+ 		if (cond_bl_upd(&iptr, bp, fsi, fso, Nflag)) {
+-			DIP(ino, di_ib[i]) = iptr;
++			DIP_set(ino, di_ib[i], iptr);
+ 			inodeupdated++;
+ 		}
+ 		indirchk(blksperindir, lbn, iptr, numblks, bp, fsi, fso, Nflag);
+diff -Naur ufsutils.orig/growfs.ufs/Makefile ufsutils.new/growfs.ufs/Makefile
+--- ufsutils.orig/growfs.ufs/Makefile	2004-04-04 01:56:24.000000000 +0200
++++ ufsutils.new/growfs.ufs/Makefile	2004-05-16 21:37:56.000000000 +0200
+@@ -4,17 +4,21 @@
+ # $FreeBSD: src/sbin/growfs/Makefile,v 1.9 2004/04/03 23:56:24 mux Exp $
+ #
+ 
+-#GFSDBG=YES  
++MAINTAINER=	tomsoft at FreeBSD.ORG, chm at FreeBSD.ORG
+ 
+-PROG=   growfs
+-SRCS=   growfs.c
+-MAN=	growfs.8
++PROG = growfs.ufs
++MAN = growfs.8:growfs.ufs.8
++SRCS = growfs.c
+ 
+-WARNS?=	6
++ifdef GFSDBG
++SRCS +=  debug.c
++ALL_CFLAGS = -DFS_DEBUG
++endif
+ 
+-.if defined(GFSDBG)
+-SRCS+=  debug.c
+-CFLAGS+=-DFS_DEBUG
+-.endif  
++WARNS = 6
++
++LDADD = -L../libufs -lufs
++INCLUDES =
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>      

Added: trunk/ufsutils/debian/patches/02_mkfs.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_mkfs.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_mkfs.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,149 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/mkfs.ufs/mkfs.c ufsutils.new/mkfs.ufs/mkfs.c
+--- ufsutils.orig/mkfs.ufs/mkfs.c	2004-04-09 21:58:33.000000000 +0200
++++ ufsutils.new/mkfs.ufs/mkfs.c	2004-05-13 08:22:41.000000000 +0200
+@@ -53,6 +53,7 @@
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <unistd.h>
++#include <time.h>
+ #include <sys/param.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
+@@ -902,7 +903,7 @@
+ 	sblock.fs_cstotal.cs_nifree--;
+ 	fscs[0].cs_nifree--;
+ 	if (ino >= (unsigned long)sblock.fs_ipg * sblock.fs_ncg) {
+-		printf("fsinit: inode value out of range (%d).\n", ino);
++		printf("fsinit: inode value out of range (%ld).\n", ino);
+ 		exit(32);
+ 	}
+ 	d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino));
+diff -Naur ufsutils.orig/mkfs.ufs/newfs.c ufsutils.new/mkfs.ufs/newfs.c
+--- ufsutils.orig/mkfs.ufs/newfs.c	2004-04-09 21:58:34.000000000 +0200
++++ ufsutils.new/mkfs.ufs/newfs.c	2004-06-29 22:43:50.000000000 +0200
+@@ -55,7 +55,6 @@
+  */
+ #include <sys/param.h>
+ #include <sys/stat.h>
+-#include <sys/disk.h>
+ #include <sys/disklabel.h>
+ #include <sys/file.h>
+ #include <sys/mount.h>
+@@ -137,6 +136,7 @@
+ static char	device[MAXPATHLEN];
+ static char	*disktype;
+ static int	unlabeled;
++static char	*progname;
+ 
+ static struct disklabel *getdisklabel(char *s);
+ static void rewritelabel(char *s, struct disklabel *lp);
+@@ -153,6 +153,8 @@
+ 	int ch, i;
+ 	off_t mediasize;
+ 
++	progname = argv[0];
++
+ 	while ((ch = getopt(argc, argv,
+ 	    "EL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:o:s:")) != -1)
+ 		switch (ch) {
+@@ -286,12 +288,19 @@
+ 	}
+ 	if (fstat(disk.d_fd, &st) < 0)
+ 		err(1, "%s", special);
++/*
+ 	if ((st.st_mode & S_IFMT) != S_IFCHR)
+ 		errx(1, "%s: not a character-special device", special);
++*/
+ 
++#ifdef HAVE_BSD_DISKLABEL
+ 	if (sectorsize == 0)
+ 		ioctl(disk.d_fd, DIOCGSECTORSIZE, &sectorsize);
+-	if (sectorsize && !ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize)) {
++#else
++	sectorsize = 512;
++#endif
++	mediasize = get_block_device_size(disk.d_fd);
++	if (sectorsize && mediasize) {
+ 		if (fssize == 0)
+ 			fssize = mediasize / sectorsize;
+ 		else if (fssize > mediasize / sectorsize)
+@@ -364,7 +373,7 @@
+ 			pp->p_size *= secperblk;
+ 	}
+ 	mkfs(pp, special);
+-	if (!unlabeled) {
++	if (!unlabeled && pp != NULL) {
+ 		if (realsectorsize != DEV_BSIZE)
+ 			pp->p_size /= realsectorsize / DEV_BSIZE;
+ 		if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition)))
+@@ -377,6 +386,7 @@
+ struct disklabel *
+ getdisklabel(char *s)
+ {
++#if HAVE_BSD_DISKLABEL
+ 	static struct disklabel lab;
+ 	struct disklabel *lp;
+ 
+@@ -388,6 +398,7 @@
+ 		if (lp != NULL)
+ 			return (lp);
+ 	}
++#endif
+ 	return (NULL);
+ }
+ 
+@@ -398,8 +409,10 @@
+ 		return;
+ 	lp->d_checksum = 0;
+ 	lp->d_checksum = dkcksum(lp);
++#if HAVE_BSD_DISKLABEL
+ 	if (ioctl(disk.d_fd, DIOCWDINFO, (char *)lp) < 0)
+ 		warn("ioctl (WDINFO): %s: can't rewrite disk label", s);
++#endif
+ }
+ 
+ static void
+@@ -407,7 +420,7 @@
+ {
+ 	fprintf(stderr,
+ 	    "usage: %s [ -fsoptions ] special-device%s\n",
+-	    getprogname(),
++	    progname,
+ 	    " [device-type]");
+ 	fprintf(stderr, "where fsoptions are:\n");
+ 	fprintf(stderr, "\t-L volume label to add to superblock\n");
+diff -Naur ufsutils.orig/mkfs.ufs/Makefile ufsutils.new/mkfs.ufs/Makefile
+--- ufsutils.orig/mkfs.ufs/Makefile	2003-02-11 04:06:45.000000000 +0100
++++ ufsutils.new/mkfs.ufs/Makefile	2004-06-29 22:56:48.000000000 +0200
+@@ -1,17 +1,20 @@
+ #	@(#)Makefile	8.2 (Berkeley) 3/27/94
+ # $FreeBSD: src/sbin/newfs/Makefile,v 1.22 2003/02/11 03:06:45 jmallett Exp $
+ 
+-PROG=	newfs
+-DPADD=	${LIBUFS}
+-LDADD=	-lufs
+-SRCS=	newfs.c mkfs.c
+-WARNS?=	2
+-MAN=	newfs.8
++PROG = mkfs.ufs
++SRCS = newfs.c mkfs.c
++WARNS ?= 2
++MAN = newfs.8:mkfs.ufs.8
+ 
+-.include <bsd.prog.mk>
++LDADD = -L../libufs -lufs -L../libdisklabel -ldisklabel -L../libport -lport
++INCLUDES = -I../libufs -include port/string.h -include port/random.h \
++           -include port/blockdev.h
++
++include ../Makefile.common
+ 
+ test:	${PROG}
+-	sh ${.CURDIR}/runtest01.sh 
+-	sh ${.CURDIR}/runtest00.sh | tee _.test
+-	diff --ignore-matching-lines=FreeBSD _.test ${.CURDIR}/ref.test
++	sh ${CURDIR}/runtest01.sh
++	sh ${CURDIR}/runtest00.sh | tee _.test
++	diff --ignore-matching-lines=FreeBSD _.test ${CURDIR}/ref.test
+ 	echo All Tests Passed
++

Added: trunk/ufsutils/debian/patches/02_tunefs.ufs.patch
===================================================================
--- trunk/ufsutils/debian/patches/02_tunefs.ufs.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/02_tunefs.ufs.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,82 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/tunefs.ufs/tunefs.c ufsutils.new/tunefs.ufs/tunefs.c
+--- ufsutils.orig/tunefs.ufs/tunefs.c	2004-04-09 21:58:40.000000000 +0200
++++ ufsutils.new/tunefs.ufs/tunefs.c	2004-05-16 23:15:29.000000000 +0200
+@@ -48,8 +48,15 @@
+ #include <sys/mount.h>
+ #include <sys/disklabel.h>
+ #include <sys/stat.h>
++#ifndef HAVE_BSD_STATFS
++#include <sys/statvfs.h>
++#define statfs statvfs
++#define f_flags f_flag
++#endif
+ 
++#if HAVE_BSD_MOUNT
+ #include <ufs/ufs/ufsmount.h>
++#endif
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+ 
+@@ -84,8 +91,12 @@
+ 	int mflag, mvalue, nflag, oflag, ovalue, pflag, sflag, svalue;
+ 	int ch, found_arg, i;
+ 	const char *chg[2];
++#ifdef HAVE_BSD_MOUNT
+ 	struct ufs_args args;
++#endif
++#ifdef HAVE_BSD_STATFS
+ 	struct statfs stfs;
++#endif
+ 
+ 	if (argc < 3)
+ 		usage();
+@@ -228,9 +239,11 @@
+ 		goto err;
+ 	if (disk.d_name != special) {
+ 		special = disk.d_name;
++#ifdef HAVE_BSD_STATFS
+ 		if (statfs(special, &stfs) == 0 &&
+ 		    strcmp(special, stfs.f_mntonname) == 0)
+ 			active = 1;
++#endif
+ 	}
+ 
+ 	if (pflag) {
+@@ -369,6 +382,7 @@
+ 	if (sbwrite(&disk, Aflag) == -1)
+ 		goto err;
+ 	ufs_disk_close(&disk);
++#if HAVE_BSD_MOUNT && HAVE_BSD_STATFS
+ 	if (active) {
+ 		bzero(&args, sizeof(args));
+ 		if (mount("ufs", on,
+@@ -376,6 +390,7 @@
+ 			err(9, "%s: reload", special);
+ 		warnx("file system reloaded");
+ 	}
++#endif
+ 	exit(0);
+ err:
+ 	if (disk.d_error != NULL)
+diff -Naur ufsutils.orig/tunefs.ufs/Makefile ufsutils.new/tunefs.ufs/Makefile
+--- ufsutils.orig/tunefs.ufs/Makefile	2003-01-23 09:15:05.000000000 +0100
++++ ufsutils.new/tunefs.ufs/Makefile	2004-05-16 21:39:19.000000000 +0200
+@@ -1,9 +1,12 @@
+ #	@(#)Makefile	8.1 (Berkeley) 6/5/93
+ # $FreeBSD: src/sbin/tunefs/Makefile,v 1.8 2003/01/23 08:15:05 ru Exp $
+ 
+-PROG=	tunefs
+-DPADD=	${LIBUFS}
+-LDADD=	-lufs
+-MAN=	tunefs.8
++PROG = tunefs.ufs
++SRCS = tunefs.c
++MAN = tunefs.8:tunefs.ufs.8
++
++LDADD = -L../libufs -lufs -L../libport -lport
++INCLUDES = -I../libufs -include port/string.h
++
++include ../Makefile.common
+ 
+-.include <bsd.prog.mk>

Added: trunk/ufsutils/debian/patches/03_mkfs.ufs_operator_gid.patch
===================================================================
--- trunk/ufsutils/debian/patches/03_mkfs.ufs_operator_gid.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/03_mkfs.ufs_operator_gid.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,15 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils-0.0+2004.06.26.orig/mkfs.ufs/mkfs.c ufsutils-0.0+2004.06.26/mkfs.ufs/mkfs.c
+--- ufsutils-0.0+2004.06.26.orig/mkfs.ufs/mkfs.c	2005-02-03 08:34:18.000000000 +0100
++++ ufsutils-0.0+2004.06.26/mkfs.ufs/mkfs.c	2005-02-03 08:36:07.000000000 +0100
+@@ -737,7 +737,9 @@
+ 
+ 	memset(&node, 0, sizeof node);
+ 	if ((grp = getgrnam("operator")) == NULL)
+-		errx(35, "Cannot retrieve operator gid");
++		grp = getgrnam("root")
++	if (grp == NULL)
++		errx(35, "Cannot retrieve operator nor root gid");
+ 	if (sblock.fs_magic == FS_UFS1_MAGIC) {
+ 		/*
+ 		 * initialize the node

Added: trunk/ufsutils/debian/patches/99_makefiles.patch
===================================================================
--- trunk/ufsutils/debian/patches/99_makefiles.patch	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/patches/99_makefiles.patch	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,127 @@
+#DPATCHLEVEL=1
+diff -Naur ufsutils.orig/Makefile ufsutils.new/Makefile
+--- ufsutils.orig/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/Makefile	2004-05-03 12:38:33.000000000 +0200
+@@ -0,0 +1,28 @@
++#
++# ufsutils Makefile
++#
++
++#SUBDIRS = dump.ufs
++SUBDIRS = libport libdisklabel libufs badsect.ufs dumpfs.ufs fsck.ufs \
++	  fsdb.ufs growfs.ufs mkfs.ufs tunefs.ufs ffsinfo
++
++clean_targets = $(addsuffix -clean,$(SUBDIRS))
++install_targets = $(addsuffix -install,$(SUBDIRS))
++
++all: $(SUBDIRS)
++
++$(SUBDIRS):
++	$(MAKE) -C $@
++
++clean: $(clean_targets)
++
++$(clean_targets):
++	$(MAKE) -C $(subst -clean,,$@) clean
++
++install: $(install_targets)
++
++$(install_targets):
++	$(MAKE) -C $(subst -install,,$@) install
++
++.PHONY: all clean install $(SUBDIRS) $(clean_targets) $(install_targets)
++
+diff -Naur ufsutils.orig/Makefile.common ufsutils.new/Makefile.common
+--- ufsutils.orig/Makefile.common	1970-01-01 01:00:00.000000000 +0100
++++ ufsutils.new/Makefile.common	2004-05-16 23:17:22.000000000 +0200
+@@ -0,0 +1,90 @@
++#
++# $Id: Makefile.common 45 2004-05-03 11:07:29Z guillem $
++#
++
++prefix = /usr/local
++exec_prefix = $(prefix)
++sbindir = $(exec_prefix)/sbin
++libdir = $(exec_prefix)/lib
++datadir = $(prefix)/share
++mandir = $(datadir)/man
++man8dir = $(mandir)/man8
++
++CFLAGS = -Wall -g
++ALL_CFLAGS += -I../include -include port/port.h -D_FILE_OFFSET_BITS=64
++
++INSTALL = install
++INSTALL_PROG = $(INSTALL)
++INSTALL_DATA = $(INSTALL) -m 644
++
++ifdef PROG
++OBJS = $(SRCS:.c=.o)
++endif
++
++ifdef LIB
++LIBSOBJS = $(LIBSRCS:.c=.lo)
++LIBOBJS = $(LIBSRCS:.c=.o)
++
++ifndef LIB_type
++LIB_type = static shared
++endif
++
++SHLIB_MAJOR ?= 0
++SHLIB_SONAME = lib$(LIB).so.$(SHLIB_MAJOR)
++endif
++
++# General rules
++
++%.lo: %.c
++	$(CC) -o $@ $(ALL_CFLAGS) $(CFLAGS) $(INCLUDES) -DPIC -fPIC -c $<
++
++%.o: %.c
++	$(CC) -o $@ $(ALL_CFLAGS) $(CFLAGS) $(INCLUDES) -c $<
++
++# Objectives
++
++all:: libs $(PROG)
++
++$(PROG):: $(OBJS)
++	$(CC) -o $@ $(ALL_CFLAGS) $(CFLAGS) $^ $(LDADD)
++
++ifneq (,$(findstring static,$(LIB_type)))
++LIB_targets += lib$(LIB).a
++endif
++ifneq (,$(findstring shared,$(LIB_type)))
++LIB_targets += lib$(LIB).so
++endif
++
++libs:: $(LIB_targets)
++
++lib$(LIB).so:: $(SHLIB_SONAME)
++	ln -fs $^ $@
++
++$(SHLIB_SONAME):: $(LIBSOBJS)
++	gcc -shared -Wl,-soname -Wl,$(SHLIB_SONAME) -o $@ $^ $(LDADD)
++
++lib$(LIB).a:: $(LIBOBJS)
++	ar rcs $@ $^
++
++# General targets
++
++clean::
++	rm -f $(OBJS) $(PROG)
++	rm -f $(LIBSOBJS) $(LIBOBJS)
++	rm -f $(SHLIB_SONAME) lib$(LIB).so lib$(LIB).a
++
++install::
++ifdef PROG
++	$(INSTALL_PROG) $(PROG) $(DESTDIR)$(sbindir)
++endif
++ifdef MAN
++	$(INSTALL_DATA) $(subst :, $(DESTDIR)$(man8dir)/,$(MAN))
++endif
++ifneq (,$(findstring static,$(LIB_type)))
++	$(INSTALL_DATA) lib$(LIB).a $(DESTDIR)$(libdir)/lib$(LIB).a
++endif
++ifneq (,$(findstring shared,$(LIB_type)))
++	$(INSTALL_DATA) lib$(LIB).so $(DESTDIR)$(libdir)/lib$(LIB).so
++	$(INSTALL_DATA) $(SHLIB_SONAME) $(DESTDIR)$(libdir)/$(SHLIB_SONAME)
++endif
++

Added: trunk/ufsutils/debian/rules
===================================================================
--- trunk/ufsutils/debian/rules	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/rules	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,95 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+ufsutils = ufsutils
+libufs = libufs2
+
+DESTDIR = $(CURDIR)/debian/tmp
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+include debian/patch.mk
+
+build: build-stamp
+build-stamp: patch
+	dh_testdir
+	
+	$(MAKE)
+	
+	touch build-stamp
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+	
+	-$(MAKE) clean
+	
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+	
+	mkdir -p $(DESTDIR)/lib
+	mkdir -p $(DESTDIR)/sbin
+	mkdir -p $(DESTDIR)/usr/share/man/man8
+	
+	$(MAKE) install DESTDIR=$(DESTDIR) prefix=/usr exec_prefix=/
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+	# Nothing to do.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+#	dh_installexamples
+	dh_install --sourcedir=debian/tmp
+#	dh_installmenu
+#	dh_installdebconf
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_python
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps -ldebian/$(libufs)/usr/lib -L$(libufs)
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+
+.PHONY: build clean binary-indep binary-arch binary install
+


Property changes on: trunk/ufsutils/debian/rules
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/ufsutils/debian/ufsutils.dirs
===================================================================
--- trunk/ufsutils/debian/ufsutils.dirs	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/ufsutils.dirs	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,2 @@
+sbin
+usr/share/man/man8

Added: trunk/ufsutils/debian/ufsutils.install
===================================================================
--- trunk/ufsutils/debian/ufsutils.install	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/ufsutils.install	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,2 @@
+sbin
+usr/share/man/man8

Added: trunk/ufsutils/debian/upstream.sh
===================================================================
--- trunk/ufsutils/debian/upstream.sh	2007-01-17 09:40:37 UTC (rev 1878)
+++ trunk/ufsutils/debian/upstream.sh	2007-01-18 12:19:28 UTC (rev 1879)
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+cvsroot=":ext:anoncvs at anoncvs.fr.freebsd.org:/home/ncvs"
+
+srcs=" \
+	src/sbin/badsect:badsect.ufs \
+	src/sbin/dump:dump.ufs \
+	src/sbin/dumpfs:dumpfs.ufs \
+	src/sbin/fsck_ffs:fsck.ufs \
+	src/sbin/fsdb:fsdb.ufs \
+	src/sbin/growfs:growfs.ufs \
+	src/sbin/newfs:mkfs.ufs \
+	src/sbin/tunefs:tunefs.ufs \
+	src/sbin/bsdlabel:bsdlabel \
+	src/sbin/sunlabel:sunlable \
+	src/sbin/ffsinfo:ffsinfo \
+	src/lib/libufs:libufs \
+	src/sys/ufs:include"
+
+include_files=" \
+	src/sys/sys/disklabel.h:include/sys \
+	src/sys/sys/mount.h:include/sys \
+	src/sys/sys/param.h:include/sys \
+	src/sys/sys/ucred.h:include/sys"
+
+move_repo()
+{
+  local list=$@
+
+  for src in $list
+  do
+    repo=${src//:*/}
+    dest=${src//*:/}
+    echo " -> moving $repo to $dest"
+    if [ ! -d $repo ]; then
+      mkdir -p $dest
+    fi
+    mv $repo $dest
+  done
+}
+
+get_cvs_list()
+{
+  local list=$@
+
+  for src in $list
+  do
+    orig="$orig ${src//:*/}"
+  done
+  echo $orig
+}
+
+echo "-> Downloading upstream sources ..."
+repos=`get_cvs_list $srcs`
+# Note: Does not use co -d because freebsd cvs server has
+#       a fascist connection limit (2)
+cvs -z3 -d$cvsroot co $repos
+
+mkdir include
+
+echo "-> Moving upstream sources to the proper place ..."
+move_repo $srcs
+
+echo "-> Downloading upstream includes ..."
+cvs_includes=`get_cvs_list $include_files`
+cvs -z3 -d$cvsroot co $cvs_includes
+
+echo "-> Moving upstream includes to the proper place ..."
+move_repo $include_files
+
+echo "-> Cleaning the mess ..."
+rm -rf src
+


Property changes on: trunk/ufsutils/debian/upstream.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the Glibc-bsd-commits mailing list