commit:     0eb6f9313c116798bffaea22adc49e44806fd3e7
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  3 00:20:20 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  3 00:20:20 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=0eb6f931

sys-fs/e2fsprogs: in tree builds fine against musl

---
 sys-fs/e2fsprogs/e2fsprogs-1.42.7-r99.ebuild       |  151 --
 sys-fs/e2fsprogs/e2fsprogs-1.42.9-r99.ebuild       |  150 --
 sys-fs/e2fsprogs/files/e2fsck.conf                 |    6 -
 sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch   |   11 -
 sys-fs/e2fsprogs/files/e2fsprogs-1.41-mint.patch   | 1947 --------------------
 .../files/e2fsprogs-1.41.12-darwin-makefile.patch  |  113 --
 .../files/e2fsprogs-1.41.12-mint-blkid.patch       |   43 -
 .../files/e2fsprogs-1.41.8-makefile.patch          |   10 -
 ...fsprogs-1.42.7-libext2fs-fix-return-value.patch |   32 -
 .../files/e2fsprogs-1.42.7-use-uint64_t.patch      |   17 -
 sys-fs/e2fsprogs/files/fsck_ext2fs.8               |   96 -
 sys-fs/e2fsprogs/files/fsck_ext2fs.c               |  147 --
 sys-fs/e2fsprogs/metadata.xml                      |    8 -
 13 files changed, 2731 deletions(-)

diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.42.7-r99.ebuild 
b/sys-fs/e2fsprogs/e2fsprogs-1.42.7-r99.ebuild
deleted file mode 100644
index 4b9b86f..0000000
--- a/sys-fs/e2fsprogs/e2fsprogs-1.42.7-r99.ebuild
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/e2fsprogs/e2fsprogs-1.42.7.ebuild,v 
1.15 2014/01/18 05:15:33 vapier Exp $
-
-EAPI=3
-
-case ${PV} in
-*_pre*) UP_PV="${PV%_pre*}-WIP-${PV#*_pre}" ;;
-*)      UP_PV=${PV} ;;
-esac
-
-inherit eutils flag-o-matic multilib toolchain-funcs
-
-DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
-HOMEPAGE="http://e2fsprogs.sourceforge.net/";
-SRC_URI="mirror://sourceforge/e2fsprogs/${PN}-${UP_PV}.tar.gz"
-
-LICENSE="GPL-2 BSD"
-SLOT="0"
-KEYWORDS="amd64 arm ~mips x86"
-IUSE="nls static-libs elibc_FreeBSD"
-
-RDEPEND="~sys-libs/${PN}-libs-${PV}
-       >=sys-apps/util-linux-2.16
-       nls? ( virtual/libintl )"
-DEPEND="${RDEPEND}
-       nls? ( sys-devel/gettext )
-       virtual/pkgconfig
-       sys-apps/texinfo"
-
-S=${WORKDIR}/${P%_pre*}
-
-pkg_setup() {
-       if [[ ! -e ${EROOT}/etc/mtab ]] ; then
-               # add some crap to deal with missing /etc/mtab #217719
-               ewarn "No /etc/mtab file, creating one temporarily"
-               echo "${PN} crap for src_test" > "${EROOT}"/etc/mtab
-       fi
-}
-
-src_prepare() {
-       epatch "${FILESDIR}"/${PN}-1.41.8-makefile.patch
-       epatch "${FILESDIR}"/${PN}-1.40-fbsd.patch
-       epatch "${FILESDIR}"/${PN}-1.41.12-darwin-makefile.patch
-       epatch "${FILESDIR}"/${PN}-1.42.7-libext2fs-fix-return-value.patch 
#467986
-       epatch "${FILESDIR}"/${PN}-1.42.7-use-uint64_t.patch
-       if [[ ${CHOST} == *-mint* ]] ; then
-               epatch "${FILESDIR}"/${PN}-1.41-mint.patch
-               epatch "${FILESDIR}"/${PN}-1.41.12-mint-blkid.patch
-       fi
-       # blargh ... trick e2fsprogs into using e2fsprogs-libs
-       rm -rf doc
-       sed -i -r \
-               -e 's:@LIBINTL@:@LTLIBINTL@:' \
-               -e '/^LIB(COM_ERR|SS)/s:[$][(]LIB[)]/lib([^@]*)@LIB_EXT@:-l\1:' 
\
-               -e '/^DEPLIB(COM_ERR|SS)/s:=.*:=:' \
-               MCONFIG.in || die "muck libs" #122368
-       sed -i -r \
-               -e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
-               Makefile.in || die "remove subdirs"
-
-       # Avoid rebuild
-       touch lib/ss/ss_err.h
-}
-
-src_configure() {
-       # Keep the package from doing silly things #261411
-       export VARTEXFONTS=${T}/fonts
-
-       # needs open64() prototypes and friends
-       append-cppflags -D_GNU_SOURCE
-
-       # We want to use the "bsd" libraries while building on Darwin, but while
-       # building on other Gentoo/*BSD we prefer elf-naming scheme.
-       local libtype
-       case ${CHOST} in
-               *-darwin*) libtype=--enable-bsd-shlibs  ;;
-               *-mint*)   libtype=                     ;;
-               *)         libtype=--enable-elf-shlibs  ;;
-       esac
-
-       ac_cv_path_LDCONFIG=: \
-       econf \
-               --with-root-prefix="${EPREFIX}/" \
-               --enable-symlink-install \
-               ${libtype} \
-               $(tc-has-tls || echo --disable-tls) \
-               --without-included-gettext \
-               $(use_enable nls) \
-               --disable-libblkid \
-               --disable-libuuid \
-               --disable-quota \
-               --disable-fsck \
-               --disable-uuidd
-       if [[ ${CHOST} != *-uclibc ]] && grep -qs 'USE_INCLUDED_LIBINTL.*yes' 
config.{log,status} ; then
-               eerror "INTL sanity check failed, aborting build."
-               eerror "Please post your ${S}/config.log file as an"
-               eerror "attachment to 
http://bugs.gentoo.org/show_bug.cgi?id=81096";
-               die "Preventing included intl cruft from building"
-       fi
-}
-
-src_compile() {
-       emake COMPILE_ET=compile_et MK_CMDS=mk_cmds || die
-
-       # Build the FreeBSD helper
-       if use elibc_FreeBSD ; then
-               cp "${FILESDIR}"/fsck_ext2fs.c .
-               emake fsck_ext2fs || die
-       fi
-}
-
-pkg_preinst() {
-       if [[ -r ${EROOT}/etc/mtab ]] ; then
-               if [[ $(<"${EROOT}"/etc/mtab) == "${PN} crap for src_test" ]] ; 
then
-                       rm -f "${EROOT}"/etc/mtab
-               fi
-       fi
-}
-
-src_install() {
-       # need to set root_libdir= manually as any --libdir options in the
-       # econf above (i.e. multilib) will screw up the default #276465
-       emake \
-               STRIP=: \
-               root_libdir="${EPREFIX}/usr/$(get_libdir)" \
-               DESTDIR="${D}" \
-               install install-libs || die
-       dodoc README RELEASE-NOTES
-
-       insinto /etc
-       doins "${FILESDIR}"/e2fsck.conf || die
-
-       # Move shared libraries to /lib/, install static libraries to
-       # /usr/lib/, and install linker scripts to /usr/lib/.
-       gen_usr_ldscript -a e2p ext2fs
-       # configure doesn't have an option to disable static libs :/
-       use static-libs || find "${D}" -name '*.a' -delete
-
-       if use elibc_FreeBSD ; then
-               # Install helpers for us
-               into /
-               dosbin "${S}"/fsck_ext2fs || die
-               doman "${FILESDIR}"/fsck_ext2fs.8 || die
-
-               # filefrag is linux only
-               rm \
-                       "${ED}"/usr/sbin/filefrag \
-                       "${ED}"/usr/share/man/man8/filefrag.8 || die
-       fi
-}

diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.42.9-r99.ebuild 
b/sys-fs/e2fsprogs/e2fsprogs-1.42.9-r99.ebuild
deleted file mode 100644
index c2993f0..0000000
--- a/sys-fs/e2fsprogs/e2fsprogs-1.42.9-r99.ebuild
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/e2fsprogs/e2fsprogs-1.42.9.ebuild,v 
1.2 2014/01/18 05:15:33 vapier Exp $
-
-EAPI=3
-
-case ${PV} in
-*_pre*) UP_PV="${PV%_pre*}-WIP-${PV#*_pre}" ;;
-*)      UP_PV=${PV} ;;
-esac
-
-inherit eutils flag-o-matic multilib toolchain-funcs
-
-DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
-HOMEPAGE="http://e2fsprogs.sourceforge.net/";
-SRC_URI="mirror://sourceforge/e2fsprogs/${PN}-${UP_PV}.tar.gz"
-
-LICENSE="GPL-2 BSD"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 -x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos 
~x86-macos ~m68k-mint"
-IUSE="nls static-libs elibc_FreeBSD"
-
-RDEPEND="~sys-libs/${PN}-libs-${PV}
-       >=sys-apps/util-linux-2.16
-       nls? ( virtual/libintl )"
-DEPEND="${RDEPEND}
-       nls? ( sys-devel/gettext )
-       virtual/pkgconfig
-       sys-apps/texinfo"
-
-S=${WORKDIR}/${P%_pre*}
-
-pkg_setup() {
-       if [[ ! -e ${EROOT}/etc/mtab ]] ; then
-               # add some crap to deal with missing /etc/mtab #217719
-               ewarn "No /etc/mtab file, creating one temporarily"
-               echo "${PN} crap for src_test" > "${EROOT}"/etc/mtab
-       fi
-}
-
-src_prepare() {
-       epatch "${FILESDIR}"/${PN}-1.41.8-makefile.patch
-       epatch "${FILESDIR}"/${PN}-1.40-fbsd.patch
-       epatch "${FILESDIR}"/${PN}-1.41.12-darwin-makefile.patch
-       epatch "${FILESDIR}"/${PN}-1.42.7-use-uint64_t.patch
-       if [[ ${CHOST} == *-mint* ]] ; then
-               epatch "${FILESDIR}"/${PN}-1.41-mint.patch
-               epatch "${FILESDIR}"/${PN}-1.41.12-mint-blkid.patch
-       fi
-       # blargh ... trick e2fsprogs into using e2fsprogs-libs
-       rm -rf doc
-       sed -i -r \
-               -e 's:@LIBINTL@:@LTLIBINTL@:' \
-               -e '/^LIB(COM_ERR|SS)/s:[$][(]LIB[)]/lib([^@]*)@LIB_EXT@:-l\1:' 
\
-               -e '/^DEPLIB(COM_ERR|SS)/s:=.*:=:' \
-               MCONFIG.in || die "muck libs" #122368
-       sed -i -r \
-               -e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
-               Makefile.in || die "remove subdirs"
-
-       # Avoid rebuild
-       touch lib/ss/ss_err.h
-}
-
-src_configure() {
-       # Keep the package from doing silly things #261411
-       export VARTEXFONTS=${T}/fonts
-
-       # needs open64() prototypes and friends
-       append-cppflags -D_GNU_SOURCE
-
-       # We want to use the "bsd" libraries while building on Darwin, but while
-       # building on other Gentoo/*BSD we prefer elf-naming scheme.
-       local libtype
-       case ${CHOST} in
-               *-darwin*) libtype=--enable-bsd-shlibs  ;;
-               *-mint*)   libtype=                     ;;
-               *)         libtype=--enable-elf-shlibs  ;;
-       esac
-
-       ac_cv_path_LDCONFIG=: \
-       econf \
-               --with-root-prefix="${EPREFIX}/" \
-               --enable-symlink-install \
-               ${libtype} \
-               $(tc-has-tls || echo --disable-tls) \
-               --without-included-gettext \
-               $(use_enable nls) \
-               --disable-libblkid \
-               --disable-libuuid \
-               --disable-quota \
-               --disable-fsck \
-               --disable-uuidd
-       if [[ ${CHOST} != *-uclibc ]] && grep -qs 'USE_INCLUDED_LIBINTL.*yes' 
config.{log,status} ; then
-               eerror "INTL sanity check failed, aborting build."
-               eerror "Please post your ${S}/config.log file as an"
-               eerror "attachment to 
http://bugs.gentoo.org/show_bug.cgi?id=81096";
-               die "Preventing included intl cruft from building"
-       fi
-}
-
-src_compile() {
-       emake COMPILE_ET=compile_et MK_CMDS=mk_cmds || die
-
-       # Build the FreeBSD helper
-       if use elibc_FreeBSD ; then
-               cp "${FILESDIR}"/fsck_ext2fs.c .
-               emake fsck_ext2fs || die
-       fi
-}
-
-pkg_preinst() {
-       if [[ -r ${EROOT}/etc/mtab ]] ; then
-               if [[ $(<"${EROOT}"/etc/mtab) == "${PN} crap for src_test" ]] ; 
then
-                       rm -f "${EROOT}"/etc/mtab
-               fi
-       fi
-}
-
-src_install() {
-       # need to set root_libdir= manually as any --libdir options in the
-       # econf above (i.e. multilib) will screw up the default #276465
-       emake \
-               STRIP=: \
-               root_libdir="${EPREFIX}/usr/$(get_libdir)" \
-               DESTDIR="${D}" \
-               install install-libs || die
-       dodoc README RELEASE-NOTES
-
-       insinto /etc
-       doins "${FILESDIR}"/e2fsck.conf || die
-
-       # Move shared libraries to /lib/, install static libraries to
-       # /usr/lib/, and install linker scripts to /usr/lib/.
-       gen_usr_ldscript -a e2p ext2fs
-       # configure doesn't have an option to disable static libs :/
-       use static-libs || find "${D}" -name '*.a' -delete
-
-       if use elibc_FreeBSD ; then
-               # Install helpers for us
-               into /
-               dosbin "${S}"/fsck_ext2fs || die
-               doman "${FILESDIR}"/fsck_ext2fs.8 || die
-
-               # filefrag is linux only
-               rm \
-                       "${ED}"/usr/sbin/filefrag \
-                       "${ED}"/usr/share/man/man8/filefrag.8 || die
-       fi
-}

diff --git a/sys-fs/e2fsprogs/files/e2fsck.conf 
b/sys-fs/e2fsprogs/files/e2fsck.conf
deleted file mode 100644
index 401cec4..0000000
--- a/sys-fs/e2fsprogs/files/e2fsck.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# See the e2fsck.conf man page for more info
-
-[options]
-
-# allow fsck to run sanely at any point in time #142850
-buggy_init_scripts = yes

diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch
deleted file mode 100644
index 7d09196..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/lib/ext2fs/ext2_fs.h
-+++ b/lib/ext2fs/ext2_fs.h
-@@ -414,7 +414,7 @@
- 
- #define i_size_high   i_dir_acl
- 
--#if defined(__KERNEL__) || defined(__linux__)
-+#if defined(__KERNEL__) || defined(__linux__) || defined(__FreeBSD__)
- #define i_reserved1   osd1.linux1.l_i_reserved1
- #define i_frag                osd2.linux2.l_i_frag
- #define i_fsize               osd2.linux2.l_i_fsize

diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.41-mint.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.41-mint.patch
deleted file mode 100644
index 43ed92d..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.41-mint.patch
+++ /dev/null
@@ -1,1947 +0,0 @@
-http://bugs.gentoo.org/show_bug.cgi?id=256234
-http://sourceforge.net/tracker/?func=detail&aid=2550325&group_id=2406&atid=302406
-
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/Makefile.in 
e2fsprogs-1.41.3-mint/lib/ext2fs/Makefile.in
---- e2fsprogs-1.41.3/lib/ext2fs/Makefile.in    2008-10-07 14:22:39.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/Makefile.in       2009-01-23 
10:48:50.000000000 +0000
-@@ -74,7 +74,9 @@
-       unix_io.o \
-       unlink.o \
-       valid_blk.o \
--      version.o
-+      version.o \
-+      mint_io.o \
-+      xhdi.o
- 
- SRCS= ext2_err.c \
-       $(srcdir)/alloc.c \
-@@ -146,6 +148,8 @@
-       $(srcdir)/unlink.c \
-       $(srcdir)/valid_blk.c \
-       $(srcdir)/version.c \
-+      $(srcdir)/mint_io.c \
-+      $(srcdir)/xhdi.c \
-       $(srcdir)/write_bb_file.c
- 
- HFILES= bitops.h ext2fs.h ext2_io.h ext2_fs.h ext2_ext_attr.h ext3_extents.h \
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/bitops.h 
e2fsprogs-1.41.3-mint/lib/ext2fs/bitops.h
---- e2fsprogs-1.41.3/lib/ext2fs/bitops.h       2008-10-07 14:22:39.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/bitops.h  2009-01-23 10:47:35.000000000 
+0000
-@@ -125,7 +125,7 @@
-  */
- #ifdef NO_INLINE_FUNCS
- #if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
--                         defined(__i586__) || defined(__mc68000__)))
-+                         defined(__i586__) || defined(__mc68020__)))
-       /* This prevents bitops.c from trying to include the C */
-       /* function version of these functions */
- #define _EXT2_HAVE_ASM_BITOPS_
-@@ -246,7 +246,7 @@
- #endif        /* i386 */
- 
- #if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
--     (defined(__mc68000__)))
-+     (defined(__mc68020__)))
- 
- #define _EXT2_HAVE_ASM_BITOPS_
- 
-@@ -280,6 +280,50 @@
-       return retval;
- }
- 
-+#elif  defined(__mc68000__)
-+
-+#define _EXT2_HAVE_ASM_BITOPS_
-+
-+_INLINE_ int
-+ext2fs_set_bit (unsigned int nr, void *addr)
-+{
-+      int mask, retval;
-+      unsigned char *ADDR = (unsigned char *) addr;
-+      
-+      ADDR += nr >> 3;
-+      mask = 1UL << (nr & 0x07);
-+      retval = (mask & *ADDR) != 0;
-+      *ADDR |= mask;
-+      
-+      return retval;
-+}
-+
-+_INLINE_ int
-+ext2fs_clear_bit (unsigned int nr, void *addr)
-+{
-+      int mask, retval;
-+      unsigned char *ADDR = (unsigned char *) addr;
-+      
-+      ADDR += nr >> 3;
-+      mask = 1UL << (nr & 0x07);
-+      retval = (mask & *ADDR) != 0;
-+      *ADDR &= ~mask;
-+      
-+      return retval;
-+}
-+
-+_INLINE_ int
-+ext2fs_test_bit (unsigned int nr, const void *addr)
-+{
-+      int mask;
-+      const unsigned char *ADDR = (const unsigned char *) addr;
-+      
-+      ADDR += nr >> 3;
-+      mask = 1UL << (nr & 0x07);
-+      
-+      return ((mask & *ADDR) != 0);
-+}
-+
- #endif /* __mc68000__ */
- 
- 
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/ext2_fs.h 
e2fsprogs-1.41.3-mint/lib/ext2fs/ext2_fs.h
---- e2fsprogs-1.41.3/lib/ext2fs/ext2_fs.h      2009-01-23 10:01:34.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/ext2_fs.h 2009-01-23 10:49:44.000000000 
+0000
-@@ -307,6 +307,7 @@
- #define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 
0)
- #endif
- 
-+#ifndef __MINT__
- #define EXT2_IOC_GETFLAGS             _IOR('f', 1, long)
- #define EXT2_IOC_SETFLAGS             _IOW('f', 2, long)
- #define EXT2_IOC_GETVERSION           _IOR('v', 1, long)
-@@ -316,6 +317,9 @@
- #define EXT2_IOC_GROUP_EXTEND         _IOW('f', 7, unsigned long)
- #define EXT2_IOC_GROUP_ADD            _IOW('f', 8,struct ext2_new_group_input)
- #define EXT4_IOC_GROUP_ADD            _IOW('f', 8,struct ext4_new_group_input)
-+#else
-+#include <mint/dcntl.h>
-+#endif
- 
- /*
-  * Structure of an inode on the disk
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/getsize.c 
e2fsprogs-1.41.3-mint/lib/ext2fs/getsize.c
---- e2fsprogs-1.41.3/lib/ext2fs/getsize.c      2008-10-07 14:22:39.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/getsize.c 2009-01-23 10:47:35.000000000 
+0000
-@@ -58,6 +58,11 @@
- #define BLKGETSIZE DKIOCGETBLOCKCOUNT32
- #endif /* APPLE_DARWIN */
- 
-+#ifdef __MINT__
-+#include <sys/ioctl.h>
-+#include "mint_io.h"
-+#endif
-+
- #include "ext2_fs.h"
- #include "ext2fs.h"
- 
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/llseek.c 
e2fsprogs-1.41.3-mint/lib/ext2fs/llseek.c
---- e2fsprogs-1.41.3/lib/ext2fs/llseek.c       2008-10-07 14:22:39.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/llseek.c  2009-01-23 10:47:35.000000000 
+0000
-@@ -115,6 +115,8 @@
- 
- #else /* !linux */
- 
-+#ifndef __MINT__
-+
- #ifndef EINVAL
- #define EINVAL EXT2_ET_INVALID_ARGUMENT
- #endif
-@@ -133,6 +135,8 @@
- #endif
- }
- 
-+#endif /* __MINT__ */
-+
- #endif        /* linux */
- 
- 
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/mint_io.c 
e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.c
---- e2fsprogs-1.41.3/lib/ext2fs/mint_io.c      1970-01-01 00:00:00.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.c 2009-01-23 10:49:51.000000000 
+0000
-@@ -0,0 +1,858 @@
-+/*
-+ * $Id: e2fsprogs-1.41-mint.patch,v 1.1 2010/11/19 18:49:02 jlec Exp $
-+ * 
-+ * This file belongs to FreeMiNT. It's not in the original MiNT 1.12
-+ * distribution. See the file CHANGES for a detailed log of changes.
-+ * 
-+ * 
-+ * Copyright 2000 Frank Naumann <[email protected]>
-+ * All rights reserved.
-+ * 
-+ * 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 file 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ * 
-+ * 
-+ * Author: Frank Naumann <[email protected]>
-+ * Started: 200-06-14
-+ * 
-+ * Please send suggestions, patches or bug reports to me or
-+ * the MiNT mailing list.
-+ * 
-+ */
-+
-+# ifdef __MINT__
-+
-+# include <assert.h>
-+# include <ctype.h>
-+# include <errno.h>
-+# include <fcntl.h>
-+# include <limits.h>
-+# include <stdarg.h>
-+# include <stdlib.h>
-+# include <stdio.h>
-+# include <string.h>
-+# include <time.h>
-+# include <unistd.h>
-+
-+# include "et/com_err.h"
-+# include "ext2fs/ext2_io.h"
-+# include <sys/ioctl.h>
-+# include <sys/stat.h>
-+# define loff_t ext2_loff_t
-+# define llseek ext2fs_llseek
-+
-+# include <mintbind.h>
-+# include "mint_io.h"
-+# include "xhdi.h"
-+
-+
-+# if 0
-+# define DEBUG(x)     printf x
-+# else
-+# define DEBUG(x)
-+# endif
-+
-+
-+/* prototypes */
-+
-+int __open_v(const char *_filename, int iomode, va_list argp);
-+
-+int open(__const char *__file, int __oflag, ...) __THROW;
-+int __open(__const char *__file, int __oflag, ...) __THROW;
-+
-+int ioctl(int fd, int cmd, void *arg);
-+int __ioctl(int fd, int cmd, void *arg);
-+
-+int fsync(int __fd) __THROW;
-+int __fsync(int __fd) __THROW;
-+
-+__off_t lseek(int __fd, __off_t __offset, int __whence) __THROW;
-+__off_t __lseek(int __fd, __off_t __offset, int __whence) __THROW;
-+
-+int close(int __fd) __THROW;
-+int __close(int __fd) __THROW;
-+
-+ssize_t read(int __fd, void *__buf, size_t __nbytes) __THROW;
-+ssize_t __read(int __fd, void *__buf, size_t __nbytes) __THROW;
-+
-+ssize_t write(int __fd, __const void *__buf, size_t __n) __THROW;
-+ssize_t __write(int __fd, __const void *__buf, size_t __n) __THROW;
-+
-+int fstat(int __fd, struct stat *__buf) __THROW;
-+int __fstat(int __fd, struct stat *__buf) __THROW;
-+
-+int stat(const char *filename, struct stat *st) __THROW;
-+
-+
-+struct device
-+{
-+      int used;
-+      
-+      int drv;
-+      int open_flags;
-+      
-+      ushort xhdi_maj;
-+      ushort xhdi_min;
-+      ulong xhdi_start;
-+      ulong xhdi_blocks;
-+      ulong xhdi_blocksize;
-+      char xhdi_id[4];
-+      
-+      loff_t pos;
-+};
-+
-+# define DEVS 16
-+static struct device devs[DEVS];
-+
-+static void
-+init_device(struct device *dev)
-+{
-+      dev->used = 0;
-+      
-+      dev->drv = -1;
-+      dev->open_flags = 0;
-+      dev->xhdi_maj = 0;
-+      dev->xhdi_min = 0;
-+      dev->xhdi_start = 0;
-+      dev->xhdi_blocks = 0;
-+      dev->xhdi_blocksize = 0;
-+      
-+      dev->pos = 0;
-+}
-+
-+static inline void
-+init(void)
-+{
-+      static int done = 0;
-+      int i;
-+      
-+      if (done)
-+              return;
-+      
-+      assert(sizeof(loff_t) == sizeof(long long));
-+      
-+      for (i = 0; i < DEVS; i++)
-+              init_device (&devs[i]);
-+      
-+      init_XHDI();
-+      
-+      /* we are now initialized */
-+      done = 1;
-+}
-+
-+static struct device *
-+get_device(int fd)
-+{
-+      struct device *dev;
-+      
-+      if ((fd < 1024) || (fd >= (1024 + DEVS)))
-+              return NULL;
-+      
-+      fd -= 1024;
-+      dev = &devs[fd];
-+      
-+      assert(dev->used);
-+      
-+      return dev;
-+}
-+
-+static int
-+alloc_device(void)
-+{
-+      int i;
-+      
-+      for (i = 0; i < DEVS; i++)
-+      {
-+              struct device *dev = &devs[i];
-+              
-+              if (!dev->used)
-+              {
-+                      dev->used = 1;
-+                      return (i + 1024);
-+              }
-+      }
-+      
-+      __set_errno(ENOMEM);
-+      return -1;
-+}
-+
-+static void
-+free_device(struct device *dev)
-+{
-+      assert(dev->used);
-+      
-+      init_device (dev);
-+}
-+
-+
-+int
-+open(const char *filename, int iomode, ...)
-+{
-+      const char *f = filename;
-+      struct device *mydev = NULL;
-+      int dev = -1;
-+      long ret;
-+      
-+      init();
-+      
-+      if (!filename)
-+      {
-+              __set_errno(EINVAL);
-+              return -1;
-+      }
-+      
-+      if ((f[1] == ':') && (f[2] == '\0'))
-+      {
-+              int c = tolower(f[0]);
-+              
-+              if (c >= 'a' && c <= 'z')
-+                      c = c - 'a';
-+              else if (c >= '1' && c <= '6')
-+                      c = 26 + (c - '1');
-+              
-+              if ((c >= 0) && (c < 32))
-+              {
-+                      dev = alloc_device();
-+                      if (dev != -1)
-+                      {
-+                              mydev = get_device(dev);
-+                              assert(mydev);
-+                              
-+                              mydev->drv = c;
-+                              mydev->open_flags = iomode;
-+                      }
-+              }
-+      }
-+      
-+      if (dev == -1)
-+      {
-+              /* fall through */
-+              
-+              va_list args;
-+              int retval;
-+              
-+              va_start(args, iomode);
-+              retval = __open_v(filename, iomode, args);
-+              va_end(args);
-+              
-+              return retval;
-+      }
-+      
-+      if (mydev->open_flags == O_RDONLY)
-+      {
-+              DEBUG(("readonly mode!\n"));
-+              sync();
-+      }
-+      else if (Dlock(1, mydev->drv))
-+      {
-+              printf("Can't lock partition %c:!\n", mydev->drv+'A');
-+              
-+              if (mydev)
-+                      free_device(mydev);
-+              
-+              __set_errno(EACCES);
-+              return -1;
-+      }
-+      
-+      __set_errno(EERROR);
-+      
-+      ret = XHGetVersion ();
-+      DEBUG(("XHDI version: %lx\n", ret));
-+      
-+      ret = XHInqDev2(mydev->drv,
-+                      &mydev->xhdi_maj, &mydev->xhdi_min,
-+                      &mydev->xhdi_start, NULL,
-+                      &mydev->xhdi_blocks, mydev->xhdi_id);
-+      if (ret)
-+      {
-+              printf("XHInqDev2 [%c] fail (ret = %li, errno = %i)\n",
-+                      mydev->drv+'A', ret, errno);
-+              ret = -1;
-+      }
-+      else
-+      {
-+              ret = XHInqTarget(mydev->xhdi_maj, mydev->xhdi_min,
-+                                &mydev->xhdi_blocksize, NULL, NULL);
-+              if (ret)
-+              {
-+                      printf("XHInqTarget [%i:%i] fail (ret = %li, errno = 
%i)\n",
-+                              mydev->xhdi_maj, mydev->xhdi_min, ret, errno);
-+                      ret = -1;
-+              }
-+              else
-+              {
-+                      char *xhdi_id = mydev->xhdi_id;
-+                      
-+                      if (       0
-+                              || ((xhdi_id[0] == 'G') && (xhdi_id[1] == 'E') 
&& (xhdi_id[2] == 'M')) /* GEM */
-+                              || ((xhdi_id[0] == 'B') && (xhdi_id[1] == 'G') 
&& (xhdi_id[2] == 'M')) /* BGM */
-+                              || ((xhdi_id[0] == 'F') && (xhdi_id[1] == '3') 
&& (xhdi_id[2] == '2')) /* F32 */
-+                              || ((xhdi_id[0] == 'M') && (xhdi_id[1] == 'I') 
&& (xhdi_id[2] == 'X')) /* MIX */
-+                              || ((xhdi_id[0] == 'R') && (xhdi_id[1] == 'A') 
&& (xhdi_id[2] == 'W')) /* RAW */
-+                              || ((xhdi_id[0] == 'L') && (xhdi_id[1] == 'N') 
&& (xhdi_id[2] == 'X')) /* LNX */
-+                              || ((xhdi_id[0] == '\0') && (xhdi_id[1] == 
'D')))                  /* any DOS */
-+                      {
-+                              DEBUG(("Partition ok and accepted!\n"));
-+                              DEBUG(("start = %lu, blocks = %lu, blocksize = 
%lu\n",
-+                                      mydev->xhdi_start, mydev->xhdi_blocks,
-+                                      mydev->xhdi_blocksize));
-+                      }
-+                      else
-+                      {
-+                              xhdi_id [3] = '\0';
-+                              printf("Wrong partition ID [%s]!\n", xhdi_id);
-+                              printf("Only 'RAW', 'LNX' and DOS partitions 
are supported.\n");
-+                              
-+                              __set_errno(EPERM);
-+                              ret = -1;
-+                      }
-+              }
-+      }
-+      
-+      if (ret)
-+      {
-+              if (mydev)
-+                      free_device(mydev);
-+              
-+              dev = -1;
-+      }
-+      
-+      return dev;
-+}
-+
-+int
-+close(int fd)
-+{
-+      struct device *mydev = get_device(fd);
-+      int ret = 0;
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __close(fd);
-+      
-+      if (mydev->open_flags == O_RDONLY)
-+      {
-+              ;
-+      }
-+      else if (Dlock(0, mydev->drv))
-+      {
-+              printf("Can't unlock partition %c:!\n", 'A'+mydev->drv);
-+              
-+              __set_errno(EACCES);
-+              ret = -1;
-+      }
-+      
-+      free_device(mydev);
-+      return ret;
-+}
-+
-+/* simple buffer */
-+static char buffer[1024L * 128];
-+static ulong buf_recno = 0;
-+static long buf_n = 0;
-+
-+static long
-+rwabs_xhdi(struct device *mydev, ushort rw, void *buf, ulong size, ulong 
recno)
-+{
-+      ulong n = size / mydev->xhdi_blocksize;
-+      long r;
-+      
-+      assert((size % mydev->xhdi_blocksize) == 0);
-+      
-+      if (!n || (recno + n) > mydev->xhdi_blocks)
-+      {
-+              printf("rwabs_xhdi: access outside partition (drv = %c:)\n", 
'A'+mydev->drv);
-+              exit(2);
-+      }
-+      
-+      if (n > 65535UL)
-+      {
-+              printf("rwabs_xhdi: n to large (drv = %c)\n", 'A'+mydev->drv);
-+              exit(2);
-+      }
-+      
-+      if (!rw && (buf_recno == recno) && (buf_n == n))
-+      {
-+              bcopy(buffer, buf, buf_n * mydev->xhdi_blocksize);
-+              return 0;
-+      }
-+      
-+      r = XHReadWrite (mydev->xhdi_maj, mydev->xhdi_min, rw, 
mydev->xhdi_start + recno, n, buf);
-+      
-+      if (!r && (n * mydev->xhdi_blocksize) <= sizeof(buffer))
-+      {
-+              bcopy(buf, buffer, n * mydev->xhdi_blocksize);
-+              
-+              buf_recno = recno;
-+              buf_n = n;
-+      }
-+      else
-+              buf_n = 0;
-+      
-+      return r;
-+}
-+
-+# define max(a,b)     (a > b ? a : b)
-+# define min(a,b)     (a > b ? b : a)
-+
-+int
-+read(int fd, void *_buf, size_t size)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __read(fd, _buf, size);
-+              
-+{
-+      char *buf = _buf;
-+      long todo;              /* characters remaining */
-+      long done;              /* characters processed */
-+      
-+      todo = size;
-+      done = 0;
-+      
-+      if (todo == 0)
-+              return 0;
-+      
-+      /* partial block copy
-+       */
-+      if (mydev->pos % mydev->xhdi_blocksize)
-+      {
-+              char tmp[mydev->xhdi_blocksize];
-+              
-+              ulong recno = mydev->pos / mydev->xhdi_blocksize;
-+              ulong offset = mydev->pos % mydev->xhdi_blocksize;
-+              ulong data;
-+              long ret;
-+              
-+              ret = rwabs_xhdi(mydev, 0, tmp, mydev->xhdi_blocksize, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("read: partial part: read failure (r = %li, 
errno = %i)\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              data = mydev->xhdi_blocksize - offset;
-+              data = min (todo, data);
-+              
-+              memcpy(buf, tmp + offset, data);
-+              
-+              buf += data;
-+              todo -= data;
-+              done += data;
-+              mydev->pos += data;
-+      }
-+      
-+      if (todo)
-+      {
-+              assert((todo > 0));
-+              assert((mydev->pos % mydev->xhdi_blocksize) == 0);
-+      }
-+      
-+      
-+      /* full blocks
-+       */
-+      if (todo / mydev->xhdi_blocksize)
-+      {
-+              ulong recno = mydev->pos / mydev->xhdi_blocksize;
-+              ulong data = (todo / mydev->xhdi_blocksize) * 
mydev->xhdi_blocksize;
-+              long ret;
-+              
-+              ret = rwabs_xhdi (mydev, 0, buf, data, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("read: full blocks: read failure (r = %li, errno 
= %i)\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              buf += data;
-+              todo -= data;
-+              done += data;
-+              mydev->pos += data;
-+      }
-+      
-+      if (todo)
-+      {
-+              assert((todo > 0) && (todo < mydev->xhdi_blocksize));
-+              assert((mydev->pos % mydev->xhdi_blocksize) == 0);
-+      }
-+      
-+      /* anything left?
-+       */
-+      if (todo)
-+      {
-+              char tmp[mydev->xhdi_blocksize];
-+              
-+              ulong recno = mydev->pos / mydev->xhdi_blocksize;
-+              long ret;
-+              
-+              ret = rwabs_xhdi (mydev, 0, tmp, mydev->xhdi_blocksize, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("read: left part: read failure (r = %li, errno = 
%i)]\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              memcpy(buf, tmp, todo);
-+              
-+              done += todo;
-+              mydev->pos += todo;
-+      }
-+      
-+      assert(done == size);
-+      
-+out:
-+      return done;
-+}
-+}
-+
-+int
-+write(int fd, const void *_buf, size_t size)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __write(fd, _buf, size);
-+      
-+      if (mydev->open_flags == O_RDONLY)
-+      {
-+              __set_errno(EPERM);
-+              return -1;
-+      }
-+{
-+      const char *buf = _buf;
-+      long todo;              /* characters remaining */
-+      long done;              /* characters processed */
-+      
-+      todo = size;
-+      done = 0;
-+      
-+      if (todo == 0)
-+              return 0;
-+      
-+      /* partial block copy
-+       */
-+      if (mydev->pos % mydev->xhdi_blocksize)
-+      {
-+              char tmp[mydev->xhdi_blocksize];
-+              
-+              ulong recno = mydev->pos / mydev->xhdi_blocksize;
-+              ulong offset = mydev->pos % mydev->xhdi_blocksize;
-+              ulong data;
-+              long ret;
-+              
-+              ret = rwabs_xhdi(mydev, 0, tmp, mydev->xhdi_blocksize, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("write: partial part: read failure (r = %li, 
errno = %i)\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              data = mydev->xhdi_blocksize - offset;
-+              data = min (todo, data);
-+              
-+              memcpy(tmp + offset, buf, data);
-+              
-+              ret = rwabs_xhdi(mydev, 1, tmp, mydev->xhdi_blocksize, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("write: partial part: write failure (r = %li, 
errno = %i)\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              buf += data;
-+              todo -= data;
-+              done += data;
-+              mydev->pos += data;
-+      }
-+      
-+      if (todo)
-+      {
-+              assert((todo > 0));
-+              assert((mydev->pos % mydev->xhdi_blocksize) == 0);
-+      }
-+      
-+      /* full blocks
-+       */
-+      if (todo / mydev->xhdi_blocksize)
-+      {
-+              ulong recno = mydev->pos / mydev->xhdi_blocksize;
-+              ulong data = (todo / mydev->xhdi_blocksize) * 
mydev->xhdi_blocksize;
-+              long ret;
-+              
-+              ret = rwabs_xhdi(mydev, 1, (void *)buf, data, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("write: full blocks: write failure (r = %li, 
errno = %i)\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              buf += data;
-+              todo -= data;
-+              done += data;
-+              mydev->pos += data;
-+      }
-+      
-+      if (todo)
-+      {
-+              assert((todo > 0) && (todo < mydev->xhdi_blocksize));
-+              assert((mydev->pos % mydev->xhdi_blocksize) == 0);
-+      }
-+      
-+      /* anything left?
-+       */
-+      if (todo)
-+      {
-+              char tmp[mydev->xhdi_blocksize];
-+              
-+              ulong recno = mydev->pos / mydev->xhdi_blocksize;
-+              long ret;
-+              
-+              ret = rwabs_xhdi(mydev, 0, tmp, mydev->xhdi_blocksize, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("write: left part: read failure (r = %li, errno 
= %i)]\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              memcpy(tmp, buf, todo);
-+              
-+              ret = rwabs_xhdi(mydev, 1, tmp, mydev->xhdi_blocksize, recno);
-+              if (ret)
-+              {
-+                      DEBUG(("write: partial part: write failure (r = %li, 
errno = %i)\n", ret, errno));
-+                      goto out;
-+              }
-+              
-+              done += todo;
-+              mydev->pos += todo;
-+      }
-+      
-+      assert(done == size);
-+      
-+out:
-+      return done;
-+}
-+}
-+
-+int
-+ioctl(int fd, int cmd, void *arg)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __ioctl(fd, cmd, arg);
-+      
-+      DEBUG(("ioctl: cmd = %i\n", cmd));
-+      
-+      switch (cmd)
-+      {
-+              case BLKGETSIZE:
-+              {
-+                      ulong *size = arg;
-+                      *size = mydev->xhdi_blocks * (mydev->xhdi_blocksize / 
512);
-+                      break;
-+              }
-+              case BLOCKSIZE:
-+              {
-+                      ulong *block_size = arg;
-+                      *block_size = mydev->xhdi_blocksize;
-+                      break;
-+              }
-+              default:
-+                      __set_errno(EINVAL);
-+                      return -1;
-+      }
-+      
-+      return 0;
-+}
-+
-+int
-+fstat(int fd, struct stat *st)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __fstat(fd, st);
-+      
-+      bzero(st, sizeof(*st));
-+      
-+      st->st_dev      = mydev->xhdi_maj;
-+      st->st_ino      = mydev->drv;
-+      st->st_mode     = S_IFBLK | S_IRUSR | S_IWUSR;
-+      st->st_nlink    = 1;
-+      st->st_uid      = 0;
-+      st->st_gid      = 0;
-+      st->st_rdev     = mydev->xhdi_min;
-+      st->st_atime    = time (NULL);
-+      st->st_mtime    = time (NULL);
-+      st->st_ctime    = time (NULL);
-+      st->st_size     = (int64_t) mydev->xhdi_blocks * mydev->xhdi_blocksize;
-+      st->st_blocks   = (int64_t) mydev->xhdi_blocks * mydev->xhdi_blocksize 
/ 512;
-+      st->st_blksize  = mydev->xhdi_blocksize;
-+      st->st_flags    = 0;
-+      st->st_gen      = 0;
-+      
-+      return 0;
-+}
-+
-+int
-+stat(const char *filename, struct stat *st)
-+{
-+      struct device *mydev;
-+      int fd, res;
-+      
-+      fd = open(filename, O_RDONLY);
-+      if (fd == -1)
-+              return -1;
-+
-+      mydev = get_device(fd);
-+      if (!mydev)
-+      {
-+              close(fd);
-+              
-+              /* fall through */
-+              return __stat(filename, st);
-+      }
-+      
-+      res = fstat(fd, st); 
-+      close(fd);
-+      
-+      return res;
-+}
-+
-+int
-+fsync(int fd)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __fsync(fd);
-+      
-+      /* nothing todo */
-+      return 0;
-+}
-+
-+loff_t llseek(int fd, loff_t offset, int origin);
-+
-+loff_t
-+llseek(int fd, loff_t offset, int origin)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __lseek(fd, (off_t) offset, origin);
-+      
-+      
-+      switch (origin)
-+      {
-+              case SEEK_SET:
-+                      break;
-+              case SEEK_CUR:
-+                      offset += mydev->pos;
-+                      break;
-+              case SEEK_END:
-+                      offset += (int64_t) mydev->xhdi_blocks * 
mydev->xhdi_blocksize;
-+                      break;
-+              default:
-+                      return -1;
-+      }
-+      
-+      if (offset > (loff_t) mydev->xhdi_blocks * mydev->xhdi_blocksize)
-+      {
-+              __set_errno(EINVAL);
-+              return -1;
-+      }
-+      
-+      mydev->pos = offset;
-+      return mydev->pos;
-+}
-+
-+loff_t lseek64(int fd, loff_t offset, int origin);
-+
-+loff_t
-+lseek64(int fd, loff_t offset, int origin)
-+{
-+      return llseek(fd, offset, origin);
-+}
-+
-+__off_t
-+lseek(int fd, __off_t offset, int mode)
-+{
-+      struct device *mydev = get_device(fd);
-+      
-+      if (!mydev)
-+              /* fall through */
-+              return __lseek(fd, offset, mode);
-+      
-+{
-+      loff_t _offset = offset;
-+      
-+      switch (mode)
-+      {
-+              case SEEK_SET:
-+                      break;
-+              case SEEK_CUR:
-+                      _offset += mydev->pos;
-+                      break;
-+              case SEEK_END:
-+                      _offset += (loff_t) mydev->xhdi_blocks * 
mydev->xhdi_blocksize;
-+                      break;
-+              default:
-+                      return -1;
-+      }
-+      
-+      if (_offset > LONG_MAX)
-+      {
-+              __set_errno(EINVAL);
-+              return -1;
-+      }
-+      
-+      if (_offset > (loff_t) mydev->xhdi_blocks * mydev->xhdi_blocksize)
-+      {
-+              __set_errno(EINVAL);
-+              return -1;
-+      }
-+      
-+      mydev->pos = _offset;
-+      return (off_t) mydev->pos;
-+}
-+}
-+
-+int gettype(int fd);
-+
-+int
-+gettype(int fd)
-+{
-+      struct device *mydev = get_device(fd);
-+      char *xhdi_id;
-+      
-+      if (!mydev)
-+              return -1;
-+
-+      /* Get filesystem type by XHDI ID */
-+      xhdi_id = mydev->xhdi_id;
-+      if ((xhdi_id[0] == '\0') && (xhdi_id[1] == 'D'))
-+              return 0;   /* DOS (\0D*) */
-+      else
-+              return 1;   /* Atari (GEM/GBM) */
-+}
-+
-+# endif /* __MINT__ */
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/mint_io.h 
e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.h
---- e2fsprogs-1.41.3/lib/ext2fs/mint_io.h      1970-01-01 00:00:00.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.h 2009-01-23 10:49:53.000000000 
+0000
-@@ -0,0 +1,22 @@
-+/*
-+ * mint_io.h
-+ *
-+ * Copyright (C) 2000 Frank Naumann <[email protected]>.
-+ *
-+ * %Begin-Header%
-+ * This file may be redistributed under the terms of the GNU Public
-+ * License.
-+ * %End-Header%
-+ */
-+
-+# ifdef __MINT__
-+
-+# ifndef _mint_io_h
-+# define _mint_io_h
-+
-+# define BLKGETSIZE           (('b'<< 8) | 1)
-+# define BLOCKSIZE            (('b'<< 8) | 2)
-+
-+# endif /* _mint_io_h */
-+
-+# endif /* __MINT__ */
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/unix_io.c 
e2fsprogs-1.41.3-mint/lib/ext2fs/unix_io.c
---- e2fsprogs-1.41.3/lib/ext2fs/unix_io.c      2008-10-13 03:12:22.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/unix_io.c 2009-01-23 10:47:35.000000000 
+0000
-@@ -51,9 +51,15 @@
- #define BLKROGET   _IO(0x12, 94) /* Get read-only status (0 = read_write).  */
- #endif
- 
-+#ifdef __MINT__
-+#include <sys/ioctl.h>
-+#include "mint_io.h"
-+#endif
-+
- #include "ext2_fs.h"
- #include "ext2fs.h"
- 
-+
- /*
-  * For checking structure magic numbers...
-  */
-@@ -512,6 +518,16 @@
-               }
-       }
- #endif
-+      
-+#ifdef __MINT__
-+      {
-+              unsigned long block_size;
-+              retval = ioctl(data->dev, BLOCKSIZE, &block_size);
-+              if (retval == 0)
-+                      io->block_size = block_size;
-+      }
-+#endif
-+      
-       *channel = io;
-       return 0;
- 
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/xhdi.c 
e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.c
---- e2fsprogs-1.41.3/lib/ext2fs/xhdi.c 1970-01-01 00:00:00.000000000 +0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.c    2009-01-23 10:49:55.000000000 
+0000
-@@ -0,0 +1,577 @@
-+/*
-+ * Copyright 2000 Frank Naumann <[email protected]>
-+ * All rights reserved.
-+ * 
-+ * 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 file 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ * 
-+ * 
-+ * Started:      2000-05-02
-+ * 
-+ * Changes:
-+ * 
-+ * 0.1:
-+ * 
-+ * fix: Cookie handling stuff; use Getcookie from MiNT-Lib now
-+ *      requires an actual MiNT-Lib (>= PL49)
-+ * 
-+ * 0.0:
-+ * 
-+ * - inital version
-+ * 
-+ */
-+
-+# include "xhdi.h"
-+
-+# include <stdio.h>
-+# include <stdlib.h>
-+# include <errno.h>
-+# include <mintbind.h>
-+# include <mint/cookie.h>
-+
-+
-+/*
-+ * internal usage
-+ */
-+
-+/* dummy routine */
-+static long
-+XHDIfail (void)
-+{
-+      return -ENOSYS;
-+}
-+
-+/* XHDI handler function */
-+static long (*XHDI)() = XHDIfail;
-+
-+ushort XHDI_installed = 0;
-+
-+
-+# define C_XHDI               0x58484449L
-+# define XHDIMAGIC    0x27011992L
-+
-+/* initalize flag */
-+static ushort init = 1;
-+
-+long
-+init_XHDI (void)
-+{
-+      long *val;
-+      long r;
-+      
-+      init = 0;
-+      
-+      r = Getcookie (C_XHDI, (long *) &val);
-+      if (r == C_FOUND)
-+      {
-+              long *magic_test = val;
-+              
-+              /* check magic */
-+              if (magic_test)
-+              {
-+                      magic_test--;
-+                      if (*magic_test == XHDIMAGIC)
-+                      {
-+                              XHDI = val;
-+                      }
-+              }
-+      }
-+      
-+      r = XHGetVersion ();
-+      if (r < 0)
-+      {
-+              perror ("XHGetVersion");
-+              
-+              XHDI = XHDIfail;
-+              return r;
-+      }
-+      
-+      /* we need at least XHDI 1.10 */
-+      if (r >= 0x110)
-+      {
-+              XHDI_installed = r;
-+              return 0;
-+      }
-+      
-+      XHDI = XHDIfail;
-+      return -1;
-+}
-+
-+
-+/*
-+ * XHDI wrapper routines
-+ */
-+
-+# define CALL \
-+      long oldstack = 0;              \
-+      long r;                         \
-+                                      \
-+      if (init) init_XHDI ();         \
-+                                      \
-+      if (!Super (1L))                \
-+              oldstack = Super (0L);  \
-+                                      \
-+      r = XHDI (args);                \
-+      if (r < 0)                      \
-+      {                               \
-+              __set_errno (-r);       \
-+              r = -1;                 \
-+      }                               \
-+                                      \
-+      if (oldstack)                   \
-+              Super (oldstack);       \
-+                                      \
-+      return r
-+
-+long
-+XHGetVersion (void)
-+{
-+      struct args_XHGetVersion
-+      {
-+              ushort  opcode;
-+      }
-+      args = 
-+      {
-+              0
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHInqTarget (ushort major, ushort minor, ulong *block_size, ulong 
*device_flags, char *product_name)
-+{
-+      struct args_XHInqTarget
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ulong   *block_size;
-+              ulong   *device_flags;
-+              char    *product_name;
-+      }
-+      args =
-+      {
-+              1,
-+              major,
-+              minor,
-+              block_size,
-+              device_flags,
-+              product_name
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHReserve (ushort major, ushort minor, ushort do_reserve, ushort key)
-+{
-+      struct args_XHReserve
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ushort  do_reserve;
-+              ushort  key;
-+      }
-+      args =
-+      {
-+              2,
-+              major,
-+              minor,
-+              do_reserve,
-+              key
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHLock (ushort major, ushort minor, ushort do_lock, ushort key)
-+{
-+      struct args_XHLock
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ushort  do_lock;
-+              ushort  key;
-+      }
-+      args =
-+      {
-+              3,
-+              major,
-+              minor,
-+              do_lock,
-+              key
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHStop (ushort major, ushort minor, ushort do_stop, ushort key)
-+{
-+      struct args_XHStop
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ushort  do_stop;
-+              ushort  key;
-+      }
-+      args =
-+      {
-+              4,
-+              major,
-+              minor,
-+              do_stop,
-+              key
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHEject (ushort major, ushort minor, ushort do_eject, ushort key)
-+{
-+      struct args_XHEject
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ushort  do_eject;
-+              ushort  key;
-+      }
-+      args =
-+      {
-+              5,
-+              major,
-+              minor,
-+              do_eject,
-+              key
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHDrvMap (void)
-+{
-+      struct args_XHDrvMap
-+      {
-+              ushort  opcode;
-+      }
-+      args =
-+      {
-+              6
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHInqDev (ushort bios, ushort *major, ushort *minor, ulong *start, __BPB *bpb)
-+{
-+      struct args_XHInqDev
-+      {
-+              ushort  opcode;
-+              ushort  bios;
-+              ushort  *major;
-+              ushort  *minor;
-+              ulong   *start;
-+              __BPB   *bpb;
-+      }
-+      args =
-+      {
-+              7,
-+              bios,
-+              major,
-+              minor,
-+              start,
-+              bpb
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHInqDriver (ushort bios, char *name, char *version, char *company, ushort 
*ahdi_version, ushort *maxIPL)
-+{
-+      struct args_XHInqDriver
-+      {
-+              ushort  opcode;
-+              ushort  bios;
-+              char    *name;
-+              char    *version;
-+              char    *company;
-+              ushort  *ahdi_version;
-+              ushort  *maxIPL;
-+      }
-+      args =
-+      {
-+              8,
-+              bios,
-+              name,
-+              version,
-+              company,
-+              ahdi_version,
-+              maxIPL
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHNewCookie (void *newcookie)
-+{
-+      struct args_XHNewCookie
-+      {
-+              ushort  opcode;
-+              void    *newcookie;
-+      }
-+      args =
-+      {
-+              9,
-+              newcookie
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHReadWrite (ushort major, ushort minor, ushort rwflag, ulong recno, ushort 
count, void *buf)
-+{
-+      struct args_XHReadWrite
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ushort  rwflag;
-+              ulong   recno;
-+              ushort  count;
-+              void    *buf;
-+      }
-+      args =
-+      {
-+              10,
-+              major,
-+              minor,
-+              rwflag,
-+              recno,
-+              count,
-+              buf
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHInqTarget2 (ushort major, ushort minor, ulong *block_size, ulong 
*device_flags, char *product_name, ushort stringlen)
-+{
-+      struct args_XHInqTarget2
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ulong   *block_size;
-+              ulong   *device_flags;
-+              char    *product_name;
-+              ushort  stringlen;
-+      }
-+      args =
-+      {
-+              11,
-+              major,
-+              minor,
-+              block_size,
-+              device_flags,
-+              product_name,
-+              stringlen
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHInqDev2 (ushort bios, ushort *major, ushort *minor, ulong *start, __BPB 
*bpb, ulong *blocks, char *partid)
-+{
-+      struct args_XHInqDev2
-+      {
-+              ushort  opcode;
-+              ushort  bios;
-+              ushort  *major;
-+              ushort  *minor;
-+              ulong   *start;
-+              __BPB   *bpb;
-+              ulong   *blocks;
-+              char    *partid;
-+      }
-+      args =
-+      {
-+              12,
-+              bios,
-+              major,
-+              minor,
-+              start,
-+              bpb,
-+              blocks,
-+              partid
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHDriverSpecial (ulong key1, ulong key2, ushort subopcode, void *data)
-+{
-+      struct args_XHDriverSpecial
-+      {
-+              ushort  opcode;
-+              ulong   key1;
-+              ulong   key2;
-+              ushort  subopcode;
-+              void    *data;
-+      }
-+      args =
-+      {
-+              13,
-+              key1,
-+              key2,
-+              subopcode,
-+              data
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHGetCapacity (ushort major, ushort minor, ulong *blocks, ulong *bs)
-+{
-+      struct args_XHGetCapacity
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ulong   *blocks;
-+              ulong   *bs;
-+      }
-+      args =
-+      {
-+              14,
-+              major,
-+              minor,
-+              blocks,
-+              bs
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHMediumChanged (ushort major, ushort minor)
-+{
-+      struct args_XHMediumChanged
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+      }
-+      args =
-+      {
-+              15,
-+              major,
-+              minor
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHMiNTInfo (ushort op, void *data)
-+{
-+      struct args_XHMiNTInfo
-+      {
-+              ushort  opcode;
-+              ushort  op;
-+              void    *data;
-+      }
-+      args =
-+      {
-+              16,
-+              op,
-+              data
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHDOSLimits (ushort which, ulong limit)
-+{
-+      struct args_XHDOSLimits
-+      {
-+              ushort  opcode;
-+              ushort  which;
-+              ulong   limit;
-+      }
-+      args =
-+      {
-+              17,
-+              which,
-+              limit
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHLastAccess (ushort major, ushort minor, ulong *ms)
-+{
-+      struct args_XHLastAccess
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+              ulong   *ms;
-+      }
-+      args =
-+      {
-+              18,
-+              major,
-+              minor,
-+              ms
-+      };
-+      
-+      CALL;
-+}
-+
-+long
-+XHReaccess (ushort major, ushort minor)
-+{
-+      struct args_XHReaccess
-+      {
-+              ushort  opcode;
-+              ushort  major;
-+              ushort  minor;
-+      }
-+      args =
-+      {
-+              19,
-+              major,
-+              minor
-+      };
-+      
-+      CALL;
-+}
-diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/xhdi.h 
e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.h
---- e2fsprogs-1.41.3/lib/ext2fs/xhdi.h 1970-01-01 00:00:00.000000000 +0000
-+++ e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.h    2009-01-23 10:49:56.000000000 
+0000
-@@ -0,0 +1,144 @@
-+/*
-+ * Copyright 2000 Frank Naumann <[email protected]>
-+ * All rights reserved.
-+ * 
-+ * 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 file 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ * 
-+ */
-+
-+# ifndef _xhdi_h
-+# define _xhdi_h
-+
-+# include <sys/types.h>
-+
-+typedef unsigned char uchar;
-+
-+
-+/*
-+ * BIOS parameter block (osbind.h is buggy)
-+ */
-+
-+typedef struct
-+{
-+      ushort  recsiz;         /* bytes per sector */
-+      short   clsiz;          /* sectors per cluster */
-+      ushort  clsizb;         /* bytes per cluster */
-+      short   rdlen;          /* root directory size */
-+      short   fsiz;           /* size of FAT */
-+      short   fatrec;         /* startsector of second FAT */
-+      short   datrec;         /* first data sector */
-+      ushort  numcl;          /* total number of clusters */
-+      short   bflags;         /* some flags */
-+      
-+} __BPB;
-+
-+
-+/*
-+ * Extended BIOS Parameter Block (XHDI)
-+ */
-+
-+typedef struct
-+{
-+      ushort  recsiz;         /* bytes per sector */
-+      short   clsiz;          /* sectors per cluster */
-+      ushort  clsizb;         /* bytes per cluster */
-+      short   rdlen;          /* root directory size or 0 if FAT32 */
-+      short   fsiz;           /* size of FAT or 0 if FAT32 */
-+      short   fatrec;         /* startsector of second FAT or 0 if FAT32 */
-+      short   datrec;         /* first data sector or 0 if FAT32 */
-+      ushort  numcl;          /* total number of clusters or 0 if FAT32 */
-+      short   bflags;         /* bit 0: 0 = FAT12, 1 = FAT16
-+                               * bit 1: 0 = 2 FATs, 1 = 1 FAT
-+                               * bit 2: 0 = BPB, 1 = EXTENDED_BPB
-+                               */
-+      
-+      /* Ab hier undokumentiert, nur A: und B:! */
-+      short   ntracks;        /* Anzahl Spuren */
-+      short   nsides;         /* Anzahl Seiten */
-+      short   spc;            /* Sektoren pro Zylinder */
-+      short   spt;            /* Sektoren pro Spur */
-+      ushort  nhid;           /* Anzahl versteckte Sektoren */
-+      uchar   ser[3];         /* Seriennummer */
-+      uchar   serms[4];       /* ab TOS 2.06: MS-DOS-4.0-Seriennummer */
-+      char    unused;
-+      
-+      /* if bit 2 of bflags are set */
-+      long    l_recsiz;       /* bytes per sector */
-+      long    l_clsiz;        /* sectors per cluster */
-+      long    l_clsizb;       /* bytes per cluster */
-+      long    l_rdlen;        /* root directory size */
-+      long    l_fsiz;         /* size of FAT */
-+      long    l_fatrec;       /* startsector of second FAT */
-+      long    l_datrec;       /* first data sector */
-+      long    l_numcl;        /* total number of clusters */
-+      long    l_rdstcl;       /* if FAT32: startcluster of root directory
-+                               * otherwise 0
-+                               */
-+} __xhdi_BPB;
-+
-+
-+# define XH_TARGET_STOPPABLE  0x00000001L
-+# define XH_TARGET_REMOVABLE  0x00000002L
-+# define XH_TARGET_LOCKABLE   0x00000004L
-+# define XH_TARGET_EJECTABLE  0x00000008L
-+# define XH_TARGET_LOCKED     0x20000000L
-+# define XH_TARGET_STOPPED    0x40000000L
-+# define XH_TARGET_RESERVED   0x80000000L
-+
-+# define XH_MI_SETKERINFO     0
-+# define XH_MI_GETKERINFO     1
-+
-+# define XH_DL_SECSIZ         0
-+# define XH_DL_MINFAT         1
-+# define XH_DL_MAXFAT         2
-+# define XH_DL_MINSPC         3
-+# define XH_DL_MAXSPC         4
-+# define XH_DL_CLUSTS         5
-+# define XH_DL_MAXSEC         6
-+# define XH_DL_DRIVES         7
-+# define XH_DL_CLSIZB         8
-+# define XH_DL_RDLEN          9
-+# define XH_DL_CLUSTS12               12
-+# define XH_DL_CLUSTS32               13
-+# define XH_DL_BFLAGS         14
-+
-+
-+extern ushort XHDI_installed;
-+
-+long  init_XHDI       (void);
-+
-+long  XHGetVersion    (void);
-+long  XHInqTarget     (ushort major, ushort minor, ulong *block_size, ulong 
*device_flags, char *product_name);
-+long  XHReserve       (ushort major, ushort minor, ushort do_reserve, ushort 
key);
-+long  XHLock          (ushort major, ushort minor, ushort do_lock, ushort 
key);
-+long  XHStop          (ushort major, ushort minor, ushort do_stop, ushort 
key);
-+long  XHEject         (ushort major, ushort minor, ushort do_eject, ushort 
key);
-+long  XHDrvMap        (void);
-+long  XHInqDev        (ushort bios, ushort *major, ushort *minor, ulong 
*start, __BPB *bpb);
-+long  XHInqDriver     (ushort bios, char *name, char *version, char *company, 
ushort *ahdi_version, ushort *maxIPL);
-+long  XHNewCookie     (void *newcookie);
-+long  XHReadWrite     (ushort major, ushort minor, ushort rwflag, ulong 
recno, ushort count, void *buf);
-+long  XHInqTarget2    (ushort major, ushort minor, ulong *block_size, ulong 
*device_flags, char *product_name, ushort stringlen);
-+long  XHInqDev2       (ushort bios, ushort *major, ushort *minor, ulong 
*start, __BPB *bpb, ulong *blocks, char *partid);
-+long  XHDriverSpecial (ulong key1, ulong key2, ushort subopcode, void *data);
-+long  XHGetCapacity   (ushort major, ushort minor, ulong *blocks, ulong *bs);
-+long  XHMediumChanged (ushort major, ushort minor);
-+long  XHMiNTInfo      (ushort op, void *data);
-+long  XHDOSLimits     (ushort which, ulong limit);
-+long  XHLastAccess    (ushort major, ushort minor, ulong *ms);
-+long  XHReaccess      (ushort major, ushort minor);
-+
-+
-+# endif /* _xhdi_h */
-diff -ur --new-file e2fsprogs-1.41.3/misc/e2undo.c 
e2fsprogs-1.41.3-mint/misc/e2undo.c
---- e2fsprogs-1.41.3/misc/e2undo.c     2009-01-23 12:59:44.000000000 +0000
-+++ e2fsprogs-1.41.3-mint/misc/e2undo.c        2009-01-23 12:56:40.000000000 
+0000
-@@ -19,6 +19,7 @@
- #if HAVE_ERRNO_H
- #include <errno.h>
- #endif
-+#include <sys/types.h>
- #include "ext2fs/tdb.h"
- #include "ext2fs/ext2fs.h"
- #include "nls-enable.h"
-diff -ur --new-file e2fsprogs-1.41.3/misc/e2initrd_helper.c 
e2fsprogs-1.41.3-mint/misc/e2initrd_helper.c
---- e2fsprogs-1.41.3/misc/e2initrd_helper.c    2009-01-23 12:58:29.000000000 
+0000
-+++ e2fsprogs-1.41.3-mint/misc/e2initrd_helper.c       2009-01-23 
12:59:11.000000000 +0000
-@@ -50,7 +50,7 @@
-       int     ptr;
- };
- 
--struct fs_info {
-+struct _fs_info {
-       char  *device;
-       char  *mountpt;
-       char  *type;
-@@ -58,7 +58,7 @@
-       int   freq;
-       int   passno;
-       int   flags;
--      struct fs_info *next;
-+      struct _fs_info *next;
- };
- 
- static void usage(void)
-@@ -230,7 +230,7 @@
-       *q = 0;
- }
- 
--static int parse_fstab_line(char *line, struct fs_info *fs)
-+static int parse_fstab_line(char *line, struct _fs_info *fs)
- {
-       char    *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp;
- 
-@@ -280,7 +280,7 @@
-       return 0;
- }
- 
--static void free_fstab_line(struct fs_info *fs)
-+static void free_fstab_line(struct _fs_info *fs)
- {
-       if (fs->device)
-               fs->device = 0;
-@@ -290,7 +290,7 @@
-               fs->type = 0;
-       if (fs->opts)
-               fs->opts = 0;
--      memset(fs, 0, sizeof(struct fs_info));
-+      memset(fs, 0, sizeof(struct _fs_info));
- }
- 
- 
-@@ -334,7 +334,7 @@
-       errcode_t retval;
-       struct mem_file file;
-       char            *buf;
--      struct fs_info fs_info;
-+      struct _fs_info _fs_info;
-       int             ret;
- 
-       retval = get_file(fs, "/etc/fstab", &file);
-@@ -344,14 +344,14 @@
-               if (!buf)
-                       continue;
- 
--              ret = parse_fstab_line(buf, &fs_info);
-+              ret = parse_fstab_line(buf, &_fs_info);
-               if (ret < 0)
-                       goto next_line;
- 
--              if (!strcmp(fs_info.mountpt, "/"))
--                      printf("%s\n", fs_info.type);
-+              if (!strcmp(_fs_info.mountpt, "/"))
-+                      printf("%s\n", _fs_info.type);
- 
--              free_fstab_line(&fs_info);
-+              free_fstab_line(&_fs_info);
- 
-       next_line:
-               free(buf);
-diff -ur --new-file e2fsprogs-1.41.3/misc/mke2fs.c 
e2fsprogs-1.41.3-mint/misc/mke2fs.c
---- e2fsprogs-1.41.3/misc/mke2fs.c     2008-10-07 14:22:39.000000000 +0000
-+++ e2fsprogs-1.41.3-mint/misc/mke2fs.c        2009-01-23 10:47:35.000000000 
+0000
-@@ -1819,6 +1819,36 @@
-       return retval;
- }
- 
-+#ifdef __MINT__
-+void
-+warn (const char *drv)
-+{
-+      char c;
-+      int check;
-+      
-+      check = open (drv, O_RDONLY);
-+      if (check == -1)
-+              return;
-+      
-+      close (check);
-+      
-+      if (check < 1024)
-+              return;
-+      
-+      fprintf (stderr, "\n");
-+      fprintf (stderr, "WARNING: THIS WILL TOTALLY DESTROY ANY DATA ON 
%s:\n", drv);
-+      fprintf (stderr, "Are you ABSOLUTELY SURE you want to do this? (y/n) ");
-+      scanf ("%c", &c);
-+      fprintf (stderr, "\n");
-+      
-+      if (c == 'y' || c == 'Y')
-+              return;
-+      
-+      fprintf (stderr, "Aborted\n");
-+      exit (1);
-+}
-+#endif
-+
- int main (int argc, char *argv[])
- {
-       errcode_t       retval = 0;
-@@ -1839,6 +1869,11 @@
- #endif
-       PRS(argc, argv);
- 
-+#ifdef __MINT__
-+      if (!quiet)
-+              warn (device_name);
-+#endif
-+
- #ifdef CONFIG_TESTIO_DEBUG
-       if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
-               io_ptr = test_io_manager;

diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.41.12-darwin-makefile.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.41.12-darwin-makefile.patch
deleted file mode 100644
index 8444067..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.41.12-darwin-makefile.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-On Darwin, create dylibs with a versioning scheme like Linux/ELF, not
-like BSD/ELF.
-This patch uses intentionally ELF_* vars to make it easier to diff
-against the ELF Makefile.
-
-http://sourceforge.net/tracker/index.php?func=detail&aid=2555389&group_id=2406&atid=302406
-
---- lib/Makefile.darwin-lib
-+++ lib/Makefile.darwin-lib
-@@ -1,14 +1,15 @@
- #
--# This is a Makefile stub which handles the creation of Darwin BSD shared
--# libraries.
-+# This is a Makefile stub which handles the creation of Darwin shared
-+# libraries based on the ELF scheme.
- #
- # In order to use this stub, the following makefile variables must be defined.
--#
--# BSDLIB_VERSION = 1.0
--# BSDLIB_IMAGE = libce
--# BSDLIB_MYDIR = et
--# BSDLIB_INSTALL_DIR = $(SHLIBDIR)
--#
-+# 
-+# ELF_VERSION = 1.0
-+# ELF_SO_VERSION = 1
-+# ELF_IMAGE = libce
-+# ELF_MYDIR = et
-+# ELF_INSTALL_DIR = $(SHLIBDIR)
-+# ELF_OTHER_LIBS = -lc
- 
- all:: image
- 
-@@ -16,36 +17,58 @@
-       $(E) "  MKDIR pic"
-       $(Q) mkdir -p pic
- 
--BSD_LIB = $(BSDLIB_IMAGE).$(BSDLIB_VERSION).dylib
--BSDLIB_PIC_FLAG = -fPIC
-+ELF_LIB = $(ELF_IMAGE).$(ELF_VERSION).dylib
-+ELF_SONAME = $(ELF_IMAGE).$(ELF_SO_VERSION).dylib
- 
--image:                $(BSD_LIB)
-+image:                $(ELF_LIB)
- 
--$(BSD_LIB): $(OBJS)
--      $(E) "  GEN_BSD_SOLIB $(BSD_LIB)"
--      $(Q) (cd pic; $(CC) -dynamiclib -compatibility_version 1.0 
-current_version $(BSDLIB_VERSION) \
--              -flat_namespace -undefined warning -o $(BSD_LIB) $(OBJS))
--      $(Q) $(MV) pic/$(BSD_LIB) .
--      $(Q) $(RM) -f ../$(BSD_LIB)
-+$(ELF_LIB): $(OBJS)
-+      $(E) "  GEN_ELF_SOLIB $(ELF_LIB)"
-+      $(Q) (cd pic; $(CC) -dynamiclib -o $(ELF_LIB) $(LDFLAGS) \
-+              -Wl,-install_name,$(libdir)/$(ELF_SONAME) $(OBJS) 
$(ELF_OTHER_LIBS))
-+      $(Q) $(MV) pic/$(ELF_LIB) .
-+      $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).dylib ../$(ELF_SONAME)
-       $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \
--              `echo $(my_dir) | sed -e 's;lib/;;'`/$(BSD_LIB) $(BSD_LIB))
--      $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(BSD_LIB) $(BSDLIB_IMAGE).dylib)
--
--install-shlibs install:: $(BSD_LIB)
--      $(E) "  INSTALL_PROGRAM $(BSDLIB_INSTALL_DIR)/$(BSD_LIB)"
--      $(Q) $(INSTALL_PROGRAM) $(BSD_LIB) \
--              $(DESTDIR)$(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
--      -$(Q) $(LDCONFIG)
-+              `echo $(my_dir) | sed -e 's;lib/;;'`/$(ELF_LIB) $(ELF_LIB))
-+      $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(ELF_LIB) $(ELF_IMAGE).dylib)
-+      $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(ELF_LIB) $(ELF_SONAME))
-+
-+installdirs-elf-lib::
-+      $(E) "  MKINSTALLDIRS $(ELF_INSTALL_DIR) $(libdir)"
-+      $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(ELF_INSTALL_DIR) \
-+              $(DESTDIR)$(libdir)
-+
-+installdirs:: installdirs-elf-lib
-+
-+install-shlibs install:: $(ELF_LIB) installdirs-elf-lib
-+      $(E) "  INSTALL-ELF-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
-+      $(Q) $(INSTALL_PROGRAM) $(ELF_LIB) 
$(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
-+      $(E) "  SYMLINK $(ELF_INSTALL_DIR)/$(ELF_SONAME)"
-+      $(Q) $(LN_S) -f $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME)
-+      $(E) "  SYMLINK $(libdir)/$(ELF_IMAGE).dylib"
-+      $(Q) if test "$(ELF_INSTALL_DIR)" = "$(libdir)"; then \
-+              $(LN_S) -f $(ELF_SONAME) $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib 
; \
-+      else \
-+              $(LN_S) -f $(ELF_INSTALL_DIR)/$(ELF_SONAME) \
-+                      $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib; \
-+      fi                      
- 
- install-strip: install
-+      $(E) "  STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
-+      $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \
-+              --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
- 
- install-shlibs-strip: install-shlibs
-+      $(E) "  STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
-+      $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \
-+              --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
- 
- uninstall-shlibs uninstall::
--      $(RM) -f $(DESTDIR)$(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
-+      $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \
-+              $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \
-+              $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib
- 
- clean::
-       $(RM) -rf pic
--      $(RM) -f $(BSD_LIB)
--      $(RM) -f ../$(BSD_LIB)
--      $(RM) -f ../$(BSDLIB_IMAGE).dylib
-+      $(RM) -f $(ELF_LIB)
-+      $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).dylib ../$(ELF_SONAME)

diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.41.12-mint-blkid.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.41.12-mint-blkid.patch
deleted file mode 100644
index 886ece5..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.41.12-mint-blkid.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-http://bugs.gentoo.org/276055
-
-<[email protected]>:
-The configure test program links against libblkid to test. This works
-fine on shared library systems as libblkid automatically depends on
-libuuid. But on static systems it needs explicit linking.
-
-
---- configure.in
-+++ configure.in
-@@ -398,8 +398,8 @@
-       fi
- 
-       AC_CHECK_LIB(blkid, blkid_get_cache,
--              [LIBBLKID=`$PKG_CONFIG --libs blkid`;
--               STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
-+              [LIBBLKID=`$PKG_CONFIG --libs blkid --libs uuid`;
-+               STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid --libs 
uuid`],
-               [AC_MSG_ERROR([external blkid library not found])],
-               [$LIBBLKID])
-       BLKID_CMT=#
---- configure.old      2011-01-01 14:20:07.000000000 +0000
-+++ configure  2011-01-01 14:22:01.000000000 +0000
-@@ -5228,7 +5228,7 @@
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lblkid $LIBBLKID $LIBS"
-+LIBS="-lblkid -luuid $LIBBLKID $LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
- 
-@@ -5259,8 +5259,8 @@
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_blkid_blkid_get_cache" >&5
- $as_echo "$ac_cv_lib_blkid_blkid_get_cache" >&6; }
- if test "x$ac_cv_lib_blkid_blkid_get_cache" = x""yes; then :
--  LIBBLKID=`$PKG_CONFIG --libs blkid`;
--               STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`
-+  LIBBLKID=`$PKG_CONFIG --libs blkid --libs uuid`;
-+                 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid --libs 
uuid`
- else
-   as_fn_error "external blkid library not found" "$LINENO" 5
- fi

diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.41.8-makefile.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.41.8-makefile.patch
deleted file mode 100644
index b7d3d96..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.41.8-makefile.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- e2fsprogs-1.41.5/Makefile.in
-+++ e2fsprogs-1.41.5/Makefile.in
-@@ -281,6 +66,7 @@
- uninstall: uninstall-progs-recursive uninstall-shlibs-libs-recursive 
uninstall-doc-libs
- 
- install-libs: install-libs-recursive
-+install-libs-recursive: | install-shlibs-libs-recursive
- 
- uninstall-libs: uninstall-libs-recursive
- 

diff --git 
a/sys-fs/e2fsprogs/files/e2fsprogs-1.42.7-libext2fs-fix-return-value.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.42.7-libext2fs-fix-return-value.patch
deleted file mode 100644
index 2d48fdf..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.42.7-libext2fs-fix-return-value.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 266eb87990025e82a8884e30993ce93c00d19db3 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <[email protected]>
-Date: Sat, 4 May 2013 01:00:58 -0400
-Subject: [PATCH] libext2fs: fix return value
-
-The ext2fs_test_block_bitmap_range2 func is not a void, so make sure we
-return a value.  I picked EINVAL as it looks like what other things in
-this func use.
-
-URL: http://bugs.gentoo.org/467986
-Reported-by: Vicente Olivert Riera <[email protected]>
-Signed-off-by: Mike Frysinger <[email protected]>
----
- lib/ext2fs/gen_bitmap64.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
-index 42a97d4..44ac499 100644
---- a/lib/ext2fs/gen_bitmap64.c
-+++ b/lib/ext2fs/gen_bitmap64.c
-@@ -658,7 +658,7 @@ int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap 
bmap,
-       if ((block < bmap->start) || (block+num-1 > bmap->end)) {
-               ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST, block,
-                                  bmap->description);
--              return;
-+              return EINVAL;
-       }
- 
-       return bmap->bitmap_ops->test_clear_bmap_extent(bmap, block, num);
--- 
-1.8.2.1
-

diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.42.7-use-uint64_t.patch 
b/sys-fs/e2fsprogs/files/e2fsprogs-1.42.7-use-uint64_t.patch
deleted file mode 100644
index 5171936..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.42.7-use-uint64_t.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -Naur e2fsprogs-1.42.7.orig/lib/ext2fs/unix_io.c 
e2fsprogs-1.42.7/lib/ext2fs/unix_io.c
---- e2fsprogs-1.42.7.orig/lib/ext2fs/unix_io.c 2013-01-02 00:47:20.000000000 
+0000
-+++ e2fsprogs-1.42.7/lib/ext2fs/unix_io.c      2014-01-23 19:33:52.851912147 
+0000
-@@ -931,10 +931,10 @@
- 
-       if (channel->flags & CHANNEL_FLAGS_BLOCK_DEVICE) {
- #ifdef BLKDISCARD
--              __uint64_t range[2];
-+              uint64_t range[2];
- 
--              range[0] = (__uint64_t)(block) * channel->block_size;
--              range[1] = (__uint64_t)(count) * channel->block_size;
-+              range[0] = (uint64_t)(block) * channel->block_size;
-+              range[1] = (uint64_t)(count) * channel->block_size;
- 
-               ret = ioctl(data->dev, BLKDISCARD, &range);
- #else

diff --git a/sys-fs/e2fsprogs/files/fsck_ext2fs.8 
b/sys-fs/e2fsprogs/files/fsck_ext2fs.8
deleted file mode 100644
index ee40b26..0000000
--- a/sys-fs/e2fsprogs/files/fsck_ext2fs.8
+++ /dev/null
@@ -1,96 +0,0 @@
-.TH fsck_ext2fs 8 2006-07-02 "Matthias Andree" "FreeBSD Ports"
-.\"
-.\" fsck_ext2fs.8 - manual page for fsck_ext2fs wrapper
-.\"
-.\" (C) Copyright 2006 by Matthias Andree <[email protected]>
-.\"
-.\" License: This file may be redistributed in accordance with the terms
-.\" of the GNU General Public License v2.
-.\"
-.\" Upstream $Id: fsck_ext2fs.8,v 1.1 2007/09/15 08:54:26 uberlord Exp $
-.\" $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.8,v 1.1 2006/07/04 
15:47:51 leeym Exp $
-.\"
-.SH NAME
-.B fsck_ext2fs
-\- compatibility wrapper for e2fsck
-.SH SYNOPSIS
-.P
-.B fsck_ext2fs
-[\fB\-Fpfnyv\fR] [\fB\-b\fR \fIblock\fR]
-.SH DESCRIPTION
-.P
-\fBfsck_ext2fs\fR maps the traditional FreeBSD \fBfsck_ffs\fR options to
-options with the same functionality for \fBe2fsck,\fR runs \fBe2fsck\fR
-and then maps its exit status to values that FreeBSD understands.
-\fBe2fsck\fR is a utility to check and repair ext2 and ext3 file
-systems.
-
-.SH OPTIONS
-.IP \fB\-F\fR
-(check foreground mode required) Immediately exits with status 1 to tell
-\fBfsck\fR that ext2fs cannot be checked in the background. \fBfsck\fR
-usually runs \fBfsck_*\fR programs twice, first with \fB\-F\fR to find
-out if they can do background checking, then either immediately without
-\fB\-F\fR for foreground checking or deferred in the background with
-\fB\-B\fR.
-.IP \fB\-p\fR
-(preen mode) This option suppresses adding the \fB\-f\fR option (unless
-\fB\-f\fR is also given) and adds the \fB\-p\fR option to the
-\fBe2fsck\fR command line. This causes \fBe2fsck\fR to automatically fix
-any filesystem problems that can safely be fixed without operator
-intervention. Without this option given, \fBe2fsck\fR will be run with
-the \fB\-f\fR option to force a check, since interactive scan and repair
-mode is the default on FreeBSD, but not on Linux where \fBe2fsck\fR
-comes from.
-.IP \fB\-f\fR
-(force check) This option forces the check of a clean file system while
-preening and is passed to \fBe2fsck\fR verbatim.
-.IP \fB\-n\fR
-("no" mode) This option causes the file system to be opened in read-only
-mode and assume "no" as answer to all questions. This is the only way to
-safely run \fBfsck\fR on a mounted ext2 or ext3 file system. This option
-is passed to \fBe2fsck\fR verbatim.
-.IP \fB\-y\fR
-("yes" mode) This option is passed verbatim to \fBe2fsck\fR and causes
-it to assume "yes" as answer to all questions. This allows the
-non-interactive use of e2fsck but is rather aggressive. Use with care.
-.IP \fB\-v\fR
-(verbose output) This option is passed verbatim to \fBe2fsck\fR and
-causes it to verbosely report its progress.
-.IP "\fB\-b\fR \fIblock\fR"
-(use alternate super block) This option is passed verbatim to
-\fBe2fsck\fR and selects an alternate super block, for use when the
-primary super block has been damaged. Please see the \fBe2fsck\fR(8)
-manual page for details.
-
-.SH EXIT STATUS
-If errors remain after \fBe2fsck\fR, an invalid option or too many
-options have been specified, \fBe2fsck\fR was killed with a signal or
-the \fIfork\fB system call failed, \fBfsck_ext2fs\fR exits with status
-EXIT_FAILURE (usually 1). If \fBe2fsck\fR cannot be started, exits with
-status 127. If the file system is clean after \fBe2fsck\fR operation,
-exits with status EXIT_SUCCESS (0).
-
-.SH NOTES
-.P
-This utility is merely meant as an adaptor so that \fBe2fsck\fR can be
-run during the boot process, it does not support all options that
-\fBe2fsck\fR offers. If you need one of its advanced options, please run
-\fBe2fsck\fR directly.
-
-.SH FILES
-.TP
-.I /sbin/e2fsck
-is the location of the \fBe2fsck\fR program to run.
-
-.SH AUTHOR
-.P
-Matthias Andree <[email protected]> wrote the program and this
-manual page.
-.SH CONFORMING TO
-The FreeBSD 6.1 command line interface for \fBfsck_ufs\fR(8).
-.SH SEE ALSO
-.BR fsck (8),
-.BR e2fsck (8)
-and
-.BR fsck_ufs (8).

diff --git a/sys-fs/e2fsprogs/files/fsck_ext2fs.c 
b/sys-fs/e2fsprogs/files/fsck_ext2fs.c
deleted file mode 100644
index 0b6a74e..0000000
--- a/sys-fs/e2fsprogs/files/fsck_ext2fs.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * fsck_ext2fs - wrapper for e2fsck on FreeBSD
- * Copyright (C) 2004,2006 Matthias Andree <[email protected]>
- * redistributable in accordance with the
- * GNU General Public License v2
- *
- * $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.c,v 1.5 2006/07/04 
15:47:51 leeym Exp $
- *
- * Upstream: $Id: fsck_ext2fs.c,v 1.1 2007/09/15 08:54:26 uberlord Exp $
- *
- * format: gindent -kr
- */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <errno.h>
-
-__attribute__ ((noreturn))
-static int die(const char *tag)
-{
-       perror(tag);
-       exit(EXIT_FAILURE);
-}
-
-int main(int argc, char **argv)
-{
-       int ch, i = 1, force = 0, status, verbose = 0, t;
-       long block = 0;
-       enum { normal, preen, yes, no } mode = normal;
-       char *cmd[256];
-       pid_t pid;
-
-       cmd[0] = "/sbin/e2fsck";
-       while ((ch = getopt(argc, argv, "BFpfnyb:v")) != -1) {
-               switch (ch) {
-               case 'p':
-                       mode = preen;
-                       break;
-               case 'f':
-                       force = 1;
-                       break;
-               case 'n':
-                       mode = no;
-                       break;
-               case 'y':
-                       mode = yes;
-                       break;
-               case 'b':
-                       block = atol(optarg);
-                       break;
-               case 'v':
-                       verbose++;
-                       break;
-               case 'F':
-                       /* e2fsck does not support background checking,
-                        * hence exit with nonzero status to force
-                        * the foreground check. */
-                       exit(1);
-               case 'B':
-               default:
-                       fprintf(stderr, "%s: unknown option -%c\n",
-                               argv[0], optopt);
-                       exit(EXIT_FAILURE);
-               }
-       }
-
-       if (force)
-               cmd[i++] = "-f";
-
-       switch (mode) {
-       case normal:
-               /* FreeBSD needs -f to force a check only in context
-                * with -p -- so map normal to force to match
-                * expectations */
-               if (!force)
-                   cmd[i++] = "-f";
-               break;
-       case yes:
-               cmd[i++] = "-y";
-               break;
-       case no:
-               cmd[i++] = "-n";
-               break;
-       case preen:
-               cmd[i++] = "-p";
-               break;
-       }
-
-       if (block) {
-               static char b[30];
-
-               sprintf(b, "-b %ld", block);
-               cmd[i++] = b;
-       }
-
-       /* silently limit verbose to 15 so we don't overflow the cmd array */
-       if (verbose > 15)
-           verbose = 15;
-
-       for (t = verbose; t > 1; t--)
-           cmd[i++] = "-v";
-
-       while (optind < argc) {
-               cmd[i++] = argv[optind++];
-               /* sanity check so we don't overflow the cmd buffer */
-               if (i+1 == sizeof(cmd)/sizeof(cmd[0])) {
-                   errno = E2BIG;
-                   die(argv[0]);
-               }
-       }
-
-       cmd[i++] = 0;
-
-       if (verbose) {
-               for (i=0; cmd[i]; i++)
-                       fputs(cmd[i], stderr),
-                       fputc(' ', stderr);
-               fputc('\n', stderr);
-       }
-
-       pid = fork();
-       switch (pid) {
-       case -1:
-               /* error */
-               die("fork");
-               break;
-       case 0:
-               /* child */
-               (void) execv(cmd[0], cmd);
-               perror("execve");
-               _exit(127);
-       default:
-               /* parent */
-               if (pid != waitpid(pid, &status, 0))
-                       die("waitpid");
-               if (WIFSIGNALED(status)
-                   || (WIFEXITED(status) && WEXITSTATUS(status) >= 4))
-                       exit(EXIT_FAILURE);
-       }
-       exit(EXIT_SUCCESS);
-}

diff --git a/sys-fs/e2fsprogs/metadata.xml b/sys-fs/e2fsprogs/metadata.xml
deleted file mode 100644
index 0abb95a..0000000
--- a/sys-fs/e2fsprogs/metadata.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
-<pkgmetadata>
-<herd>base-system</herd>
-<upstream>
-  <remote-id type="cpe">cpe:/a:ext2_filesystems_utilities:e2fsprogs</remote-id>
-</upstream>
-</pkgmetadata>

Reply via email to