From 65c1360c7150ee56ed5deee30cf2187d9db9a81d Mon Sep 17 00:00:00 2001 From: Thorsten Otto Date: Sat, 10 Aug 2024 11:45:26 +0200 Subject: [PATCH] Port mint patch to 1.47.1 --- configure | 4 +- configure.ac | 4 +- debugfs/Makefile.in | 12 +- e2fsck/Makefile.in | 56 +- e2fsck/sigcatcher.c | 2 + e2fsck/unix.c | 2 + lib/e2p/Makefile.in | 4 +- lib/ext2fs/Makefile.in | 25 +- lib/ext2fs/bmap64.h | 1 + lib/ext2fs/{compiler.h => e2_compiler.h} | 0 lib/ext2fs/ext2_fs.h | 4 + lib/ext2fs/getsize.c | 5 + lib/ext2fs/kernel-list.h | 2 +- lib/ext2fs/llseek.c | 4 + lib/ext2fs/mint_io.c | 841 +++++++++++++++++++++++ lib/ext2fs/mint_io.h | 22 + lib/ext2fs/rbtree.h | 2 +- lib/ext2fs/unix_io.c | 17 +- lib/ext2fs/xhdi.c | 577 ++++++++++++++++ lib/ext2fs/xhdi.h | 144 ++++ misc/Makefile.in | 10 +- misc/e2initrd_helper.c | 5 + misc/fsmap.h | 4 + misc/mke2fs.c | 35 + 24 files changed, 1724 insertions(+), 58 deletions(-) rename lib/ext2fs/{compiler.h => e2_compiler.h} (100%) create mode 100644 lib/ext2fs/mint_io.c create mode 100644 lib/ext2fs/mint_io.h create mode 100644 lib/ext2fs/xhdi.c create mode 100644 lib/ext2fs/xhdi.h diff --git a/configure b/configure index cba3191c..02cfb71b 100755 --- a/configure +++ b/configure @@ -5539,7 +5539,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$GCC" = yes; then - RDYNAMIC="-rdynamic" + RDYNAMIC="" fi ac_ext=c @@ -14809,7 +14809,7 @@ fi printf "%s\n" "$UNI_DIFF_OPTS" >&6; } case "$host_os" in -linux*) +linux*|mint*) printf "%s\n" "#define HAVE_EXT2_IOCTLS 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 131caef3..feef41c7 100644 --- a/configure.ac +++ b/configure.ac @@ -106,7 +106,7 @@ AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead])) dnl AC_PROG_CC if test "$GCC" = yes; then - RDYNAMIC="-rdynamic" + RDYNAMIC="" AC_SUBST(RDYNAMIC) fi AC_PROG_CPP @@ -1500,7 +1500,7 @@ dnl dnl We use the EXT2 ioctls only under Linux dnl case "$host_os" in -linux*) +linux*|mint*) AC_DEFINE(HAVE_EXT2_IOCTLS, 1, [Define to 1 if Ext2 ioctls present]) ;; esac diff --git a/debugfs/Makefile.in b/debugfs/Makefile.in index 50a21e52..7e61bcae 100644 --- a/debugfs/Makefile.in +++ b/debugfs/Makefile.in @@ -195,7 +195,7 @@ debugfs.o: $(srcdir)/debugfs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(top_srcdir)/version.h \ $(srcdir)/../e2fsck/jfs_user.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ - $(top_srcdir)/lib/ext2fs/compiler.h $(top_srcdir)/lib/support/plausible.h + $(top_srcdir)/lib/ext2fs/e2_compiler.h $(top_srcdir)/lib/support/plausible.h util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -286,7 +286,7 @@ logdump.o: $(srcdir)/logdump.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/../e2fsck/jfs_user.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h htree.o: $(srcdir)/htree.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ @@ -408,7 +408,7 @@ journal.o: $(srcdir)/journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ - $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/e2_compiler.h revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -418,7 +418,7 @@ revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ - $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/e2_compiler.h recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -428,7 +428,7 @@ recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ - $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/e2_compiler.h do_journal.o: $(srcdir)/do_journal.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -441,5 +441,5 @@ do_journal.o: $(srcdir)/do_journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/journal.h $(srcdir)/../e2fsck/jfs_user.h diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in index fbb7b156..d8245ef5 100644 --- a/e2fsck/Makefile.in +++ b/e2fsck/Makefile.in @@ -282,7 +282,7 @@ e2fsck.o: $(srcdir)/e2fsck.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h super.o: $(srcdir)/super.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -296,7 +296,7 @@ super.o: $(srcdir)/super.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h pass1.o: $(srcdir)/pass1.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -310,7 +310,7 @@ pass1.o: $(srcdir)/pass1.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/problem.h pass1b.o: $(srcdir)/pass1b.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \ @@ -324,7 +324,7 @@ pass1b.o: $(srcdir)/pass1b.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h $(top_srcdir)/lib/support/dict.h pass2.o: $(srcdir)/pass2.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -338,7 +338,7 @@ pass2.o: $(srcdir)/pass2.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h $(top_srcdir)/lib/support/dict.h pass3.o: $(srcdir)/pass3.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -352,7 +352,7 @@ pass3.o: $(srcdir)/pass3.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h pass4.o: $(srcdir)/pass4.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -366,7 +366,7 @@ pass4.o: $(srcdir)/pass4.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h pass5.o: $(srcdir)/pass5.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -380,7 +380,7 @@ pass5.o: $(srcdir)/pass5.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h journal.o: $(srcdir)/journal.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \ @@ -394,7 +394,7 @@ journal.o: $(srcdir)/journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(srcdir)/problem.h recovery.o: $(srcdir)/recovery.c $(srcdir)/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ @@ -408,7 +408,7 @@ recovery.o: $(srcdir)/recovery.c $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h revoke.o: $(srcdir)/revoke.c $(srcdir)/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ @@ -422,7 +422,7 @@ revoke.o: $(srcdir)/revoke.c $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \ @@ -436,7 +436,7 @@ badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -449,7 +449,7 @@ util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h unix.o: $(srcdir)/unix.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/e2p/e2p.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -463,7 +463,7 @@ unix.o: $(srcdir)/unix.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/version.h dirinfo.o: $(srcdir)/dirinfo.c $(top_builddir)/lib/config.h \ @@ -478,7 +478,7 @@ dirinfo.o: $(srcdir)/dirinfo.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/tdb.h dx_dirinfo.o: $(srcdir)/dx_dirinfo.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -492,7 +492,7 @@ dx_dirinfo.o: $(srcdir)/dx_dirinfo.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h ehandler.o: $(srcdir)/ehandler.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -505,7 +505,7 @@ ehandler.o: $(srcdir)/ehandler.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h problem.o: $(srcdir)/problem.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -518,7 +518,7 @@ problem.o: $(srcdir)/problem.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h $(srcdir)/problemP.h message.o: $(srcdir)/message.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/support/quotaio.h \ @@ -531,7 +531,7 @@ message.o: $(srcdir)/message.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/support/profile.h $(top_builddir)/lib/support/prof_err.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h ea_refcount.o: $(srcdir)/ea_refcount.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -545,7 +545,7 @@ ea_refcount.o: $(srcdir)/ea_refcount.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h rehash.o: $(srcdir)/rehash.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -558,7 +558,7 @@ rehash.o: $(srcdir)/rehash.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h $(top_srcdir)/lib/support/sort_r.h readahead.o: $(srcdir)/readahead.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -572,7 +572,7 @@ readahead.o: $(srcdir)/readahead.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h region.o: $(srcdir)/region.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -585,7 +585,7 @@ region.o: $(srcdir)/region.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h sigcatcher.o: $(srcdir)/sigcatcher.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -598,7 +598,7 @@ sigcatcher.o: $(srcdir)/sigcatcher.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h logfile.o: $(srcdir)/logfile.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -611,7 +611,7 @@ logfile.o: $(srcdir)/logfile.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h quota.o: $(srcdir)/quota.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -624,7 +624,7 @@ quota.o: $(srcdir)/quota.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h extents.o: $(srcdir)/extents.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -638,7 +638,7 @@ extents.o: $(srcdir)/extents.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h encrypted_files.o: $(srcdir)/encrypted_files.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ @@ -652,5 +652,5 @@ encrypted_files.o: $(srcdir)/encrypted_files.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(srcdir)/problem.h $(top_srcdir)/lib/ext2fs/rbtree.h diff --git a/e2fsck/sigcatcher.c b/e2fsck/sigcatcher.c index e2027348..5d35d71e 100644 --- a/e2fsck/sigcatcher.c +++ b/e2fsck/sigcatcher.c @@ -9,6 +9,7 @@ * %End-Header% */ +#ifndef __MINT__ #include "config.h" #include #include @@ -444,3 +445,4 @@ int main(int argc, char** argv) exit(0); } #endif +#endif diff --git a/e2fsck/unix.c b/e2fsck/unix.c index de20b216..3509e48a 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1415,7 +1415,9 @@ int main (int argc, char *argv[]) struct ext2fs_journal_params jparams; clear_problem_context(&pctx); +#ifndef __MINT__ sigcatcher_setup(); +#endif #ifdef MTRACE mtrace(); #endif diff --git a/lib/e2p/Makefile.in b/lib/e2p/Makefile.in index 92d9c018..1794b9c9 100644 --- a/lib/e2p/Makefile.in +++ b/lib/e2p/Makefile.in @@ -131,7 +131,7 @@ feature.o: $(srcdir)/feature.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ - $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/e2_compiler.h fgetflags.o: $(srcdir)/fgetflags.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2p.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h @@ -173,7 +173,7 @@ ljs.o: $(srcdir)/ljs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/e2p.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h mntopts.o: $(srcdir)/mntopts.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2p.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index 1b3a91b6..60ec7889 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -135,7 +135,10 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \ unlink.o \ valid_blk.o \ version.o \ - rbtree.o + rbtree.o \ + mint_io.o \ + xhdi.o + SRCS= ext2_err.c \ $(srcdir)/alloc.c \ @@ -229,6 +232,8 @@ SRCS= ext2_err.c \ $(srcdir)/version.c \ $(srcdir)/write_bb_file.c \ $(srcdir)/rbtree.c \ + $(srcdir)/mint_io.c \ + $(srcdir)/xhdi.o \ $(srcdir)/tst_libext2fs.c \ $(DEBUG_SRCS) @@ -740,7 +745,7 @@ blkmap64_rb.o: $(srcdir)/blkmap64_rb.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \ $(srcdir)/hashmap.h $(srcdir)/bitops.h $(srcdir)/bmap64.h $(srcdir)/rbtree.h \ - $(srcdir)/compiler.h + $(srcdir)/e2_compiler.h block.o: $(srcdir)/block.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ @@ -1026,7 +1031,7 @@ mkjournal.o: $(srcdir)/mkjournal.c $(top_builddir)/lib/config.h \ $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \ $(srcdir)/hashmap.h $(srcdir)/bitops.h $(srcdir)/kernel-jbd.h \ - $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/compiler.h + $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/e2_compiler.h mmp.o: $(srcdir)/mmp.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ @@ -1226,7 +1231,7 @@ write_bb_file.o: $(srcdir)/write_bb_file.c $(top_builddir)/lib/config.h \ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(srcdir)/ext2_ext_attr.h $(srcdir)/hashmap.h $(srcdir)/bitops.h -rbtree.o: $(srcdir)/rbtree.c $(srcdir)/rbtree.h $(srcdir)/compiler.h +rbtree.o: $(srcdir)/rbtree.c $(srcdir)/rbtree.h $(srcdir)/e2_compiler.h tst_libext2fs.o: $(srcdir)/tst_libext2fs.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fsP.h \ @@ -1257,7 +1262,7 @@ debugfs.o: $(top_srcdir)/debugfs/debugfs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/quotaio.h $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(top_srcdir)/debugfs/../version.h \ $(srcdir)/../../e2fsck/jfs_user.h $(srcdir)/kernel-jbd.h \ - $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/compiler.h \ + $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/e2_compiler.h \ $(top_srcdir)/lib/support/plausible.h util.o: $(top_srcdir)/debugfs/util.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ss/ss.h \ @@ -1348,7 +1353,7 @@ logdump.o: $(top_srcdir)/debugfs/logdump.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/quotaio.h $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/../../e2fsck/jfs_user.h \ $(srcdir)/kernel-jbd.h $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \ - $(srcdir)/compiler.h $(srcdir)/fast_commit.h + $(srcdir)/e2_compiler.h $(srcdir)/fast_commit.h htree.o: $(top_srcdir)/debugfs/htree.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \ $(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \ @@ -1462,7 +1467,7 @@ journal.o: $(top_srcdir)/debugfs/journal.c $(top_builddir)/lib/config.h \ $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \ $(srcdir)/hashmap.h $(srcdir)/bitops.h $(srcdir)/kernel-jbd.h \ - $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/compiler.h + $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/e2_compiler.h revoke.o: $(top_srcdir)/e2fsck/revoke.c $(top_srcdir)/e2fsck/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ $(srcdir)/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -1470,7 +1475,7 @@ revoke.o: $(top_srcdir)/e2fsck/revoke.c $(top_srcdir)/e2fsck/jfs_user.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(srcdir)/ext2_ext_attr.h $(srcdir)/hashmap.h $(srcdir)/bitops.h \ $(srcdir)/kernel-jbd.h $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \ - $(srcdir)/compiler.h + $(srcdir)/e2_compiler.h recovery.o: $(top_srcdir)/e2fsck/recovery.c $(top_srcdir)/e2fsck/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ $(srcdir)/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -1478,7 +1483,7 @@ recovery.o: $(top_srcdir)/e2fsck/recovery.c $(top_srcdir)/e2fsck/jfs_user.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(srcdir)/ext2_ext_attr.h $(srcdir)/hashmap.h $(srcdir)/bitops.h \ $(srcdir)/kernel-jbd.h $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \ - $(srcdir)/compiler.h + $(srcdir)/e2_compiler.h do_journal.o: $(top_srcdir)/debugfs/do_journal.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \ $(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \ @@ -1490,5 +1495,5 @@ do_journal.o: $(top_srcdir)/debugfs/do_journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/debugfs/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ $(top_srcdir)/lib/support/quotaio.h $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/kernel-jbd.h \ - $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/compiler.h \ + $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h $(srcdir)/e2_compiler.h \ $(top_srcdir)/debugfs/journal.h $(srcdir)/../../e2fsck/jfs_user.h diff --git a/lib/ext2fs/bmap64.h b/lib/ext2fs/bmap64.h index de334548..820925b0 100644 --- a/lib/ext2fs/bmap64.h +++ b/lib/ext2fs/bmap64.h @@ -9,6 +9,7 @@ * %End-Header% */ +#include /* for timeval */ struct ext2_bmap_statistics { int type; struct timeval created; diff --git a/lib/ext2fs/compiler.h b/lib/ext2fs/e2_compiler.h similarity index 100% rename from lib/ext2fs/compiler.h rename to lib/ext2fs/e2_compiler.h diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 586141f8..5f6fc876 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -387,6 +387,7 @@ struct ext4_new_group_input { #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) @@ -397,6 +398,9 @@ struct ext4_new_group_input { #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) #define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) +#else +#include +#endif /* * Structure of an inode on the disk diff --git a/lib/ext2fs/getsize.c b/lib/ext2fs/getsize.c index a0286344..21d644a2 100644 --- a/lib/ext2fs/getsize.c +++ b/lib/ext2fs/getsize.c @@ -60,6 +60,11 @@ #define BLKGETSIZE DKIOCGETBLOCKCOUNT32 #endif /* APPLE_DARWIN */ +#ifdef __MINT__ +#include +#include "mint_io.h" +#endif + #include "ext2_fs.h" #include "ext2fs.h" diff --git a/lib/ext2fs/kernel-list.h b/lib/ext2fs/kernel-list.h index dd7b8e07..5d91422f 100644 --- a/lib/ext2fs/kernel-list.h +++ b/lib/ext2fs/kernel-list.h @@ -1,7 +1,7 @@ #ifndef _LINUX_LIST_H #define _LINUX_LIST_H -#include "compiler.h" +#include "e2_compiler.h" /* * Simple doubly linked list implementation. diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c index 9118b23f..6ec53038 100644 --- a/lib/ext2fs/llseek.c +++ b/lib/ext2fs/llseek.c @@ -85,6 +85,8 @@ ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin) #else /* !linux */ +#ifndef __MINT__ + #ifndef EINVAL #define EINVAL EXT2_ET_INVALID_ARGUMENT #endif @@ -103,6 +105,8 @@ ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin) #endif } +#endif /* __MINT__ */ + #endif /* linux */ diff --git a/lib/ext2fs/mint_io.c b/lib/ext2fs/mint_io.c new file mode 100644 index 00000000..9a286e9a --- /dev/null +++ b/lib/ext2fs/mint_io.c @@ -0,0 +1,841 @@ +/* + * $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 + * 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 + * Started: 200-06-14 + * + * Please send suggestions, patches or bug reports to me or + * the MiNT mailing list. + * + */ + +# ifdef __MINT__ + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include "et/com_err.h" +# include "ext2fs/ext2_io.h" +# include +# include +# define loff_t ext2_loff_t +# define llseek ext2fs_llseek + +# include +# 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); + +typeof(open) __open; +typeof(ioctl) __ioctl; +typeof(fsync) __fsync; +typeof(lseek) __lseek; +typeof(close) __close; +typeof(read) __read; +typeof(write) __write; +typeof(fstat) __fstat; + + +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) + +ssize_t +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; +} +} + +ssize_t +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 --git a/lib/ext2fs/mint_io.h b/lib/ext2fs/mint_io.h new file mode 100644 index 00000000..e96e0af1 --- /dev/null +++ b/lib/ext2fs/mint_io.h @@ -0,0 +1,22 @@ +/* + * mint_io.h + * + * Copyright (C) 2000 Frank Naumann . + * + * %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 --git a/lib/ext2fs/rbtree.h b/lib/ext2fs/rbtree.h index b96e6f2c..532d9fd9 100644 --- a/lib/ext2fs/rbtree.h +++ b/lib/ext2fs/rbtree.h @@ -96,7 +96,7 @@ static inline struct page * rb_insert_page_cache(struct inode * inode, #include #include -#include "compiler.h" +#include "e2_compiler.h" #if __GNUC_PREREQ (4, 6) #pragma GCC diagnostic push diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index 4b4f25a4..be04ace0 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -71,6 +71,11 @@ #undef ALIGN_DEBUG +#ifdef __MINT__ +#include +#include "mint_io.h" +#endif + #include "ext2_fs.h" #include "ext2fs.h" #include "ext2fsP.h" @@ -859,6 +864,16 @@ static errcode_t unix_open_channel(const char *name, int fd, } } #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; @@ -1188,7 +1203,7 @@ static errcode_t unix_cache_readahead(io_channel channel, unsigned long long block, unsigned long long count) { -#ifdef POSIX_FADV_WILLNEED +#if defined(POSIX_FADV_WILLNEED) && !defined(__MINT__) struct unix_private_data *data; data = (struct unix_private_data *)channel->private_data; diff --git a/lib/ext2fs/xhdi.c b/lib/ext2fs/xhdi.c new file mode 100644 index 00000000..26d35d4e --- /dev/null +++ b/lib/ext2fs/xhdi.c @@ -0,0 +1,577 @@ +/* + * Copyright 2000 Frank Naumann + * 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 +# include +# include +# include +# include + + +/* + * 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 = (void *)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 --git a/lib/ext2fs/xhdi.h b/lib/ext2fs/xhdi.h new file mode 100644 index 00000000..8023f955 --- /dev/null +++ b/lib/ext2fs/xhdi.h @@ -0,0 +1,144 @@ +/* + * Copyright 2000 Frank Naumann + * 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 + +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 --git a/misc/Makefile.in b/misc/Makefile.in index 8769620a..3d86a15b 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -736,7 +736,7 @@ tune2fs.o: $(srcdir)/tune2fs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ - $(top_srcdir)/lib/ext2fs/compiler.h $(top_srcdir)/lib/support/plausible.h \ + $(top_srcdir)/lib/ext2fs/e2_compiler.h $(top_srcdir)/lib/support/plausible.h \ $(top_srcdir)/lib/support/quotaio.h $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(top_srcdir)/lib/support/devname.h \ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/util.h $(top_srcdir)/version.h \ @@ -788,7 +788,7 @@ dumpe2fs.o: $(srcdir)/dumpe2fs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/e2p/e2p.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/support/nls-enable.h $(top_srcdir)/lib/support/plausible.h \ $(top_srcdir)/version.h badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \ @@ -902,7 +902,7 @@ journal.o: $(srcdir)/../debugfs/journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ @@ -916,7 +916,7 @@ revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \ @@ -930,5 +930,5 @@ recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \ $(top_srcdir)/lib/support/dqblk_v2.h \ $(top_srcdir)/lib/support/quotaio_tree.h \ $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/compiler.h \ + $(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/lib/ext2fs/e2_compiler.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h diff --git a/misc/e2initrd_helper.c b/misc/e2initrd_helper.c index b39fe15d..463935f4 100644 --- a/misc/e2initrd_helper.c +++ b/misc/e2initrd_helper.c @@ -52,6 +52,11 @@ struct mem_file { int ptr; }; +#ifdef __MINT__ +/* Avoid clash with mint/dcntl.h */ +#define fs_info _fs_info +#endif + struct fs_info { char *device; char *mountpt; diff --git a/misc/fsmap.h b/misc/fsmap.h index e9590aae..e2a74242 100644 --- a/misc/fsmap.h +++ b/misc/fsmap.h @@ -83,7 +83,11 @@ fsmap_advance( #define FMR_OWN_UNKNOWN FMR_OWNER(0, 2) /* unknown owner */ #define FMR_OWN_METADATA FMR_OWNER(0, 3) /* metadata */ +#ifdef __MINT__ +#define FS_IOC_GETFSMAP (('f' << 8) | 59) +#else #define FS_IOC_GETFSMAP _IOWR('X', 59, struct fsmap_head) +#endif #endif /* FS_IOC_GETFSMAP */ #endif diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 58ade9df..328d9306 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -3054,6 +3054,36 @@ static errcode_t set_error_behavior(ext2_filsys fs) return 0; } +#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; @@ -3082,6 +3112,11 @@ int main (int argc, char *argv[]) #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;