]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Many files: E2FSPROGS-0_5B
authorTheodore Ts'o <tytso@mit.edu>
Sat, 26 Apr 1997 13:58:21 +0000 (13:58 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 26 Apr 1997 13:58:21 +0000 (13:58 +0000)
  Checked in e2fsprogs 0.5c

182 files changed:
.hgtags [new file with mode: 0644]
ChangeLog
INSTALL
INSTALL.binary [new file with mode: 0644]
MCONFIG [deleted file]
MCONFIG.in [new file with mode: 0644]
Makefile [deleted file]
Makefile.in [new file with mode: 0644]
README
config.guess [new file with mode: 0644]
config.sub [new file with mode: 0644]
configure [new file with mode: 0644]
configure.in [new file with mode: 0644]
contrib/dconf [new file with mode: 0644]
debugfs/.depend
debugfs/ChangeLog
debugfs/Makefile [deleted file]
debugfs/Makefile.in [new file with mode: 0644]
debugfs/debug_cmds.ct
debugfs/debugfs.8
debugfs/debugfs.c
debugfs/debugfs.h
debugfs/dump.c
debugfs/icheck.c
debugfs/lsdel.c
debugfs/ncheck.c
depfix.sed [new file with mode: 0644]
e2fsck/.depend
e2fsck/ChangeLog
e2fsck/Makefile [deleted file]
e2fsck/Makefile.in [new file with mode: 0644]
e2fsck/badblocks.c
e2fsck/e2fsck.8
e2fsck/e2fsck.c
e2fsck/e2fsck.h
e2fsck/ehandler.c
e2fsck/extend.c [new file with mode: 0644]
e2fsck/flushb.c
e2fsck/images/README [deleted file]
e2fsck/images/badbblocks.img.gz [deleted file]
e2fsck/images/baddir.img.gz [deleted file]
e2fsck/images/badinode.img.gz [deleted file]
e2fsck/images/badlkcnt.img.gz [deleted file]
e2fsck/images/badroot.img.gz [deleted file]
e2fsck/images/badtable.img.gz [deleted file]
e2fsck/images/bbfile.img.gz [deleted file]
e2fsck/images/bitmapblks.img.gz [deleted file]
e2fsck/images/bitmaps.img.gz [deleted file]
e2fsck/images/dirlink.img.gz [deleted file]
e2fsck/images/dup.img.gz [deleted file]
e2fsck/images/dup2.img.gz [deleted file]
e2fsck/images/dupfsblks.img.gz [deleted file]
e2fsck/images/dupsuper.img.gz [deleted file]
e2fsck/images/end-bitmap.img.gz [deleted file]
e2fsck/images/expand.img.gz [deleted file]
e2fsck/images/illfsblks.img.gz [deleted file]
e2fsck/images/lotsbad.img.gz [deleted file]
e2fsck/images/lpf.img.gz [deleted file]
e2fsck/images/messy_inode.img.gz [deleted file]
e2fsck/images/mke2fs2b.img.gz [deleted file]
e2fsck/images/noroot.img.gz [deleted file]
e2fsck/images/okgroup.img.gz [deleted file]
e2fsck/images/overfsblks.img.gz [deleted file]
e2fsck/images/test_script [deleted file]
e2fsck/iscan.c [new file with mode: 0644]
e2fsck/pass1.c
e2fsck/pass1b.c
e2fsck/pass2.c
e2fsck/pass3.c
e2fsck/pass4.c
e2fsck/pass5.c
e2fsck/scantest.c
e2fsck/util.c
include/linux/ChangeLog [new file with mode: 0644]
include/linux/ext2_fs.h [new file with mode: 0644]
include/linux/types.h.in [new file with mode: 0644]
install-sh [new file with mode: 0644]
lib/ChangeLog [new file with mode: 0644]
lib/Makefile.bsd-lib [new file with mode: 0644]
lib/Makefile.checker [new file with mode: 0644]
lib/Makefile.dll-lib
lib/Makefile.elf-lib [new file with mode: 0644]
lib/Makefile.library [new file with mode: 0644]
lib/Makefile.profile [new file with mode: 0644]
lib/e2p/.depend
lib/e2p/ChangeLog
lib/e2p/MAKELOG [new file with mode: 0644]
lib/e2p/Makefile [deleted file]
lib/e2p/Makefile.in [new file with mode: 0644]
lib/e2p/configure [new file with mode: 0644]
lib/e2p/dll/jump.funcs [moved from lib/e2p/jump/jump.funcs with 100% similarity]
lib/e2p/dll/jump.ignore [new file with mode: 0644]
lib/e2p/dll/jump.import [moved from lib/e2p/jump/jump.import with 100% similarity]
lib/e2p/dll/jump.params [moved from lib/e2p/jump/jump.params with 84% similarity]
lib/e2p/dll/jump.undefs [new file with mode: 0644]
lib/e2p/dll/jump.vars [new file with mode: 0644]
lib/e2p/e2p.h
lib/e2p/fgetflags.c
lib/e2p/fgetversion.c
lib/e2p/fsetflags.c
lib/e2p/fsetversion.c
lib/e2p/getflags.c
lib/e2p/getversion.c
lib/e2p/iod.c
lib/e2p/jump/jump.undefs [deleted file]
lib/e2p/ls.c
lib/e2p/setflags.c
lib/e2p/setversion.c
lib/et/.depend
lib/et/ChangeLog
lib/et/Makefile [deleted file]
lib/et/Makefile.in [new file with mode: 0644]
lib/et/compile_et.sh.in [moved from lib/et/compile_et.sh with 93% similarity]
lib/et/config_script [deleted file]
lib/et/dll/jump.funcs [moved from lib/et/jump/jump.funcs with 100% similarity]
lib/et/dll/jump.ignore [moved from lib/et/jump/jump.ignore with 100% similarity]
lib/et/dll/jump.import [moved from lib/et/jump/jump.import with 100% similarity]
lib/et/dll/jump.params [moved from lib/et/jump/jump.params with 100% similarity]
lib/et/dll/jump.undefs [new file with mode: 0644]
lib/et/dll/jump.vars [moved from lib/et/jump/jump.vars with 100% similarity]
lib/et/init_et.c
lib/et/jump/jump.undefs [deleted file]
lib/et/vfprintf.c
lib/ext2fs/.depend
lib/ext2fs/ChangeLog
lib/ext2fs/MAKELOG [deleted file]
lib/ext2fs/Makefile [deleted file]
lib/ext2fs/Makefile.in [new file with mode: 0644]
lib/ext2fs/alloc.c
lib/ext2fs/badblocks.c
lib/ext2fs/bb_inode.c
lib/ext2fs/bitmaps.c
lib/ext2fs/bitops.c
lib/ext2fs/bitops.h
lib/ext2fs/block.c
lib/ext2fs/closefs.c
lib/ext2fs/cmp_bitmaps.c [new file with mode: 0644]
lib/ext2fs/dirblock.c [new file with mode: 0644]
lib/ext2fs/dll/jump.funcs [moved from lib/ext2fs/jump/jump.funcs with 77% similarity]
lib/ext2fs/dll/jump.ignore [new file with mode: 0644]
lib/ext2fs/dll/jump.import [moved from lib/ext2fs/jump/jump.import with 100% similarity]
lib/ext2fs/dll/jump.params [moved from lib/ext2fs/jump/jump.params with 84% similarity]
lib/ext2fs/dll/jump.undefs [new file with mode: 0644]
lib/ext2fs/dll/jump.vars [moved from lib/ext2fs/jump/jump.vars with 100% similarity]
lib/ext2fs/expanddir.c
lib/ext2fs/ext2_err.c [deleted file]
lib/ext2fs/ext2_err.et
lib/ext2fs/ext2_err.h [deleted file]
lib/ext2fs/ext2fs.h
lib/ext2fs/freefs.c
lib/ext2fs/get_pathname.c
lib/ext2fs/getsize.c [new file with mode: 0644]
lib/ext2fs/initialize.c
lib/ext2fs/inode.c
lib/ext2fs/ismounted.c [new file with mode: 0644]
lib/ext2fs/jump/jump.undefs [deleted file]
lib/ext2fs/llseek.c
lib/ext2fs/mkdir.c
lib/ext2fs/namei.c
lib/ext2fs/newdir.c
lib/ext2fs/openfs.c
lib/ext2fs/read_bb_file.c
lib/ext2fs/rw_bitmaps.c
lib/ext2fs/rw_bitmaps.size [deleted file]
lib/ext2fs/swapfs.c [new file with mode: 0644]
lib/ext2fs/unix_io.c
lib/ss/.depend
lib/ss/ChangeLog
lib/ss/MAKELOG [deleted file]
lib/ss/Makefile [deleted file]
lib/ss/Makefile.in [new file with mode: 0644]
lib/ss/config_script [deleted file]
lib/ss/error.c
lib/ss/help.c
lib/ss/list_rqs.c
lib/ss/mk_cmds.sh.in [moved from lib/ss/mk_cmds.sh with 91% similarity]
lib/ss/pager.c
lib/ss/parse.c
lib/ss/request_tbl.c
lib/ss/ss_err.c [deleted file]
mkinstalldirs [new file with mode: 0644]
version.h

diff --git a/.hgtags b/.hgtags
new file mode 100644 (file)
index 0000000..50a4554
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1 @@
+eed1bd163c2bbe64492dfc2c30c91273f4eb8fde E2FSPROGS-0_5B
index aed846c203a0804a1cb6e885970ca7d96783d6e9..18d41382190e59c81cd77438e60e3c8a4f202424 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,88 @@
+Thu Oct 26 11:59:44 1995    <tytso@rsts-11.mit.edu>
+
+       * configure.in (LDFALG_STATIC): Add temporary kludge for
+               determining how to link executables statically.  For now,
+               we assume that Linux systems only can link statically.
+
+Fri Sep 22 18:23:55 1995    <tytso@rsts-11.mit.edu>
+
+       * depfix.sed: Remove /usr/include lines which occur at the end of
+               the dependency listing.
+
+Mon Sep  4 21:40:22 1995  Remy Card  <card@bbj>
+
+       * configure.in: Added support for the --enable-bsd-shlibs option.
+
+Wed Aug  9 21:33:31 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * MCONFIG.in (LD): Add $(PURE) to the definition to make it easier
+               to link executables using programs like purify.
+
+Sat Aug  5 11:41:03 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * configure.in: Check to see if strdup() is present
+
+       * INSTALL: Updated building and installation instructions to
+               reflect the new configure system.
+
+       * Makefile.in (install): When doing a general install, install the
+               shared libraries as well by using the new target 
+               install-shlibs-libs-recursive.
+
+       * configure.in: If we are building on a Linux system, set $prefix
+               to be '/' by default.
+
+Sun Jul  9 13:38:20 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * configure.in (checking type sizes): provide some default for
+       type-sizes when cross-compiling, as we can't check them then.
+       (SS_DIR, ET_DIR): Make these correct even when ${srcdir} is absolute.
+
+Thu Jun 15 23:33:37 1995  Remy Card  <card@bbj>
+
+       * Makefile.in (distclean-local): Added config.cache and
+               include/linux/types.h.
+
+       * configure.in: Added support for the --enable-elf option.
+               Added a test to check for llseek() in the C library.
+
+       * lib/Makefile.dll-lib: Fixed incorrect RM and LN calls.
+
+       * lib/Makefile.elf-lib: New file, to create ELF shared libraries.
+
+Sat Jun 10 19:52:51 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * configure.in: Create ET_DIR and SS_DIR, which gives the absolute
+               pathname to the source directories of the lib/et and
+               lib/ss.  (Can't just use $srcdir since that may be a
+               relative path.)
+
+Thu Jun  8 12:25:57 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * lib/Makefile.library ($(LIBRARY).a): Changed to work with the
+       new makefiles.
+       * lib/Makefile.dll-lib: Ditto.
+       * lib/Makefile.profiled: Ditto.
+       * lib/Makefile.checker: Ditto.
+
+       * Add the include subdirectory to hold substitute include files
+       for systems that need them.
+
+       * Makefile.in: Rewritten to conform to GNU coding standards.
+       * MCONFIG: Moved to MCONFIG.in, and totally changed to support
+       GNU-style makefiles.
+       * mkinstalldirs: New file, copied from /gd/gnu/lib.
+       * config.guess: Ditto.
+       * config.sub: Ditto.
+       * install-sh: Ditto.
+
+       * configure.in: Many new tests added.  --with-cc and --with-ccopts
+       options removed as configure already supports a method to do this,
+       and they were interfering with normal usage.
+
 Sat Mar 11 18:23:45 1995  Theodore Y. Ts'o  <tytso@localhost>
 
-       * Makefile (bin-tree): Add Makefile target which automatically
+       * Makefile.in (bin-tree): Add Makefile target which automatically
                generates the binary distribution for e2fsprogs.
 
 
diff --git a/INSTALL b/INSTALL
index 24d13eabfab974d17cd846a97d423bce31603d9f..a6feeb3f4467122749f4542cc4464b728da556f5 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,31 +1,30 @@
-       To install the second extended file system management program,
+       To install the second extended file system management programs,
 just follow the steps:
 
-1) Edit the file MCONFIG
+1) Change directory into the top of the e2fsprogs source tree
 
-       This file contains definitions used in the various makefiles.  These
-definitions have reasonable default value but you may want to adjust them to 
-your system configuration.
+2) Create a build directory and cd into it:
 
-       In particular, if you don't have the tools to build shared
-libraries, you'll want to comment out the "BUILD_DLL_SHLIBS = YES"
-line.
+       mkdir build; cd build
 
-2) Compile the programs
+3)  Run the configure script
 
-       Run `make world' to (a) create the dependencies files, (b)
-compile the libraries and the programs, and (c) run a test suite on
-e2fsck.  The test suite runs a series of tests; for each one, e2fsck
-should return an exit status of 1 on the first pass, and an exit
-status of 0 on the second pass.  The one exception to this is the
-"okgroup.img" test, which should return an exit status of 0 for both
-passes.
+       ../configure
 
-3) Install the programs
+       If you wish to turn on DLL shared libraries, add the option
+flag --enable-dll-shlibs.  If you wish to turn on ELF shared
+libraries, add the option --enable-elf-shlibs.  If you wish to build
+profiling libraries, add the option --enable-profile.
+
+4)  Compile the programs
+
+       make
+
+5) Install the programs
 
        Run `make install'
 
-4) Install the include files and libraries
+6) Install the include files and libraries
 
        You can run `make install-libs' to install the include files and
 libraries.  Please note that this installation is not needed for the
@@ -33,14 +32,15 @@ programs to work.  It is only needed if you expect to develop other
 programs using the libraries or if you want to compile other program
 using these libraries (like the 4.4BSD dump and restore port).
 
-5) Remove any pre-formatted man pages.  Some distributions will have
-pre-formatted manual pages which will always be displayed in
-preference to newer man pages in /usr/man.  If this is the case, you
-may need to manually remove them in order to see the correct manual
-pages.  The shell script in install-utils/remove_preformat_manpages
-may be helpful in doing so.
+7) Remove any pre-formatted man pages.  
+
+       Some distributions will have pre-formatted manual pages which
+will always be displayed in preference to newer man pages in /usr/man.
+If this is the case, you may need to manually remove them in order to
+see the correct manual pages.  The shell script in
+install-utils/remove_preformat_manpages may be helpful in doing so.
 
-5) Make sure your /etc/fstab file is correct.
+8) Make sure your /etc/fstab file is correct.
 
        Some distributions install an /etc/fstab which is missing the
 fifth and sixth field of filesystem entry, which are the dump
@@ -56,6 +56,6 @@ you should add "1 1" at the end of each line, so that they look like this:
 
 /dev/hda4       /        ext2        defaults  1       1
 
-       There is a script in insatll-utils/convfstab (donated by
+       There is a script in install-utils/convfstab (donated by
 Michael Weller) that may help you correct your /etc/fstab file.
 
diff --git a/INSTALL.binary b/INSTALL.binary
new file mode 100644 (file)
index 0000000..f62fb3b
--- /dev/null
@@ -0,0 +1,47 @@
+NOTE: This is the DLL version of the binary distribution.  If you have
+an ELF system, please either compile e2fsprogs from sources yourself,
+or get the ELF version of the binary distribution.  The ELF version
+will have a filename of e2fsprogs-0.5c-elfbin.tar.gz
+
+
+       To install the binary distribution of the second extended file
+system management programs, just follow the steps:
+
+1) Install this tar file using the following command:
+
+       gunzip < e2fsprogs-0.5c-dllbin.tar.gz | (cd /; tar xvf - )
+
+2) Run ldconfig to update the shared library pointers.
+
+3) Remove any pre-formatted man pages.  
+
+       Some distributions will have pre-formatted manual pages which
+will always be displayed in preference to newer man pages in /usr/man.
+If this is the case, you may need to manually remove them in order to
+see the correct manual pages.  The shell script in
+install-utils/remove_preformat_manpages may be helpful in doing so.
+
+4) Make sure your /etc/fstab file is correct.
+
+       Some distributions install an /etc/fstab which is missing the
+fifth and sixth field of filesystem entry, which are the dump
+frequency, and the fsck pass number, respectively.  The problem with
+this is that the getmntent() library routine interprets those missing
+fields as "0", and a pass number of 0 is documented as meaning that
+fsck should not check that particular filesystem.  If your entries in
+your /etc/fstab file look liks this:
+
+/dev/hda4       /        ext2        defaults
+
+you should add "1 1" at the end of each line, so that they look like this:
+
+/dev/hda4       /        ext2        defaults  1       1
+
+       There is a script in install-utils/convfstab (donated by
+Michael Weller) that may help you correct your /etc/fstab file.
+
+5) Cleanup files from the installation.
+
+       When you're done with the installation, you will probably want
+to remove /INSTALL (this file), /README, and /install-utils from your
+root directory
diff --git a/MCONFIG b/MCONFIG
deleted file mode 100644 (file)
index e206ba9..0000000
--- a/MCONFIG
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# C Compiler
-#
-CC=            gcc
-
-#
-# Uncomment this line if you want to build shared DLL libraries, or
-# comment this line out if you don't want to build shared DLL libraries.
-#
-BUILD_DLL_SHLIBS = YES
-
-ifdef BUILD_DLL_SHLIBS
-#
-# Use these definitions is you use tools 2.x, x < 16
-#
-DLL_BIN=/usr/dll/bin
-JUMP_PREFIX=/usr/dll/jump/
-
-#
-# Use these definitions if you use tools 2.16 or above
-#
-#DLL_BIN=/usr/bin
-#JUMP_PREFIX=/usr/bin/jump
-
-endif
-
-#
-# Uncomment this line if you want to build profiled libraries, or
-# comment this line out if you don't want to build profiled libraries
-#
-BUILD_PROFILE_LIBS = YES
-
-#
-# Optimization flags
-#
-#OPT=  -g -O -fno-inline
-OPT=   -O2 -fomit-frame-pointer
-
-#
-# Warning flags
-#
-# Uncomment WFLAGS if you want really anal GCC warning messages
-#
-#WFLAGS=               -ansi -D_POSIX_SOURCE -pedantic \
-#                      -Wall -Wwrite-strings -Wpointer-arith \
-#                      -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional \
-#                      -Wstrict-prototypes -Wmissing-prototypes \
-#                      -Wnested-externs -Winline -Wshadow 
-
-#
-# Binaries tools
-#
-ARCHIVE=       ar r
-RANLIB=                ranlib
-
-#
-# Installation user and groups
-#
-BINGRP=                bin
-BINOWN=                bin
-BINMODE=       555
-INCGRP=                bin
-INCOWN=                bin
-INCMODE=       444
-LIBOWN=                bin
-LIBGRP=                bin
-LIBMODE=       444
-MANGRP=                bin
-MANOWN=                bin
-MANMODE=       444
-
-#
-# Installation programs
-#
-CHMOD=         chmod
-INSTALL=       install -c
-INSTALLBIN=    $(INSTALL) -o $(BINOWN) -g $(BINGRP) -m $(BINMODE) -s
-INSTALLINC=    $(INSTALL) -o $(INCOWN) -g $(INCGRP) -m $(INCMODE)
-INSTALLLIB=    $(INSTALL) -o $(LIBOWN) -g $(LIBGRP) -m $(LIBMODE)
-INSTALLMAN=    $(INSTALL) -o $(MANOWN) -g $(MANGRP) -m $(MANMODE)
-
-#
-# Destination directories
-#
-ETCDIR=                $(DESTDIR)/etc
-INCLDIR=       $(DESTDIR)/usr/include
-LIBDIR=                $(DESTDIR)/usr/lib
-SBINDIR=       $(DESTDIR)/sbin
-SHLIBDIR=      $(DESTDIR)/lib
-USRSHLIBDIR=   $(DESTDIR)/usr/lib
-SMANDIR=       $(DESTDIR)/usr/man/man8
-UMANDIR=       $(DESTDIR)/usr/man/man1
-FMANDIR=       $(DESTDIR)/usr/man/man5
-USRBINDIR=     $(DESTDIR)/usr/bin
-USRSBINDIR=    $(DESTDIR)/usr/sbin
diff --git a/MCONFIG.in b/MCONFIG.in
new file mode 100644 (file)
index 0000000..1d02cd2
--- /dev/null
@@ -0,0 +1,118 @@
+# Beginning of file MCONFIG
+
+SHELL = /bin/sh
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+usr_prefix = @usr_prefix@
+bindir = $(exec_prefix)/bin
+ubindir = $(usr_prefix)/bin
+sbindir = $(exec_prefix)/sbin
+usbindir = $(usr_prefix)/sbin
+libdir = $(exec_prefix)/lib
+ulibdir = $(usr_prefix)/lib
+includedir = $(usr_prefix)/include
+mandir = $(usr_prefix)/man
+man1dir = $(usr_prefix)/man/man1
+man8dir = $(usr_prefix)/man/man8
+cat1dir = $(usr_prefix)/man/cat1
+cat8dir = $(usr_prefix)/man/cat8
+
+@SET_MAKE@
+
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+CC = @CC@
+DEFS = @DEFS@
+LIBS = @LIBS@
+CFLAGS = $(CPPFLAGS) $(DEFS) $(WFLAGS) @CFLAGS@ $(XTRA_CFLAGS) \
+       -I$(top_builddir)/lib -I$(top_srcdir)/lib $(LINUX_INCLUDE) 
+LDFLAGS = @LDFLAGS@
+RM = @RM@
+LN = @LN@
+MV = @MV@
+CP = @CP@
+CHMOD = @CHMOD@
+AR = @AR@
+AWK = @AWK@
+SED = @SED@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+LD = $(PURE) @CC@
+ARUPD = $(AR) r
+
+#
+# Use these definitions is you use tools 2.x, x < 16
+#
+#DLL_BIN=/usr/dll/bin
+#JUMP_PREFIX=/usr/dll/jump/
+
+#
+# Use these definitions if you use tools 2.16 or above
+#
+DLL_BIN=/usr/bin
+JUMP_PREFIX=/usr/bin/jump
+
+# An include directive pointing to a directory holding enough linux-like
+# include files to satisfy some programs here
+LINUX_INCLUDE=@LINUX_INCLUDE@
+
+#
+# Warning flags
+#
+# Uncomment WFLAGS if you want really anal GCC warning messages
+#
+#
+@W@WFLAGS=             -ansi -D_POSIX_SOURCE -pedantic \
+@W@                    -Wall -Wwrite-strings -Wpointer-arith \
+@W@                    -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional \
+@W@                    -Wstrict-prototypes -Wmissing-prototypes \
+@W@                    -Wnested-externs -Winline -DNO_INLINE_FUNCS -Wshadow 
+
+#
+# Installation user and groups
+#
+BINGRP=                bin
+BINOWN=                bin
+BINMODE=       555
+INCGRP=                bin
+INCOWN=                bin
+INCMODE=       444
+LIBOWN=                bin
+LIBGRP=                bin
+LIBMODE=       444
+MANGRP=                bin
+MANOWN=                bin
+MANMODE=       444
+
+all::
+
+#
+# Make depend magic...
+#
+
+.depend: Makefile $(SRCS) $(top_srcdir)/depfix.sed
+       if test -n "$(SRCS)" ; then \
+               $(CC) -M $(CFLAGS) $(SRCS) | \
+                       sed -f $(top_srcdir)/depfix.sed | \
+                       sed -e 's; $(srcdir)/; $$(srcdir)/;g' | \
+                       sed -e 's; $(top_srcdir)/; $$(top_srcdir)/;g' | \
+                       sed -e 's; $(top_builddir)/; $$(top_builddir)/;g' | \
+                       sed -e 's; \./; ;g' | \
+               grep -v "  \\\\$$" > .depend; \
+       else :; fi
+
+depend:: .depend
+       if test -n "$(SRCS)" ; then \
+               sed -e '/^# +++ Dependency line eater +++/,$$d' \
+                       < $(srcdir)/Makefile.in | cat - .depend \
+                       > $(srcdir)/Makefile.in.new; \
+       $(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \
+       $(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \
+       else :; fi
+
+
+
+
+
+# End of file MCONFIG
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index f063866..0000000
--- a/Makefile
+++ /dev/null
@@ -1,100 +0,0 @@
-include ./MCONFIG
-
-all: libs 
-       (cd e2fsck; $(MAKE))
-       (cd debugfs ; $(MAKE))
-       (cd misc ; $(MAKE))
-
-libs:
-       (cd lib/et; $(MAKE))
-       (cd lib/ss; $(MAKE))
-       (cd lib/ext2fs; $(MAKE))
-       (cd lib/e2p; $(MAKE))
-
-install:
-       (cd lib/et; $(MAKE) install)
-       (cd lib/ss; $(MAKE) install)
-       (cd lib/ext2fs; $(MAKE) install)
-       (cd lib/e2p; $(MAKE) install)
-       (cd e2fsck; $(MAKE) install)
-       (cd debugfs; $(MAKE) install)
-       (cd misc ; $(MAKE) install)
-
-install-tree:
-       (cd lib/et; $(MAKE) install-tree)
-       (cd lib/ss; $(MAKE) install-tree)
-       (cd lib/ext2fs; $(MAKE) install-tree)
-       (cd lib/e2p; $(MAKE) install-tree)
-       (cd e2fsck; $(MAKE) install-tree)
-       (cd debugfs; $(MAKE) install-tree)
-       (cd misc ; $(MAKE) install-tree)
-
-install-libs:
-       (cd lib/et; $(MAKE) install-libs)
-       (cd lib/ss; $(MAKE) install-libs)
-       (cd lib/ext2fs; $(MAKE) install-libs)
-       (cd lib/e2p; $(MAKE) install-libs)
-
-install-dirs:
-       install -d $(ETCDIR)
-       install -d $(INCLDIR)
-       install -d $(LIBDIR)
-       install -d $(SBINDIR)
-       install -d $(SHLIBDIR)
-       install -d $(SMANDIR)
-       install -d $(UMANDIR)
-       install -d $(USRBINDIR)
-       install -d $(USRSBINDIR)
-
-bin-tree:
-       rm -rf dest
-       mkdir dest
-       $(MAKE) DESTDIR=`pwd`/dest install-dirs
-       $(MAKE) DESTDIR=`pwd`/dest install
-       mkdir dest/install-utils dest/usr/man/cat1 dest/usr/man/cat8
-       cp install-utils/convfstab dest/install-utils
-       cp install-utils/remove_preformat_manpages dest/install-utils
-       (cd dest; export MANPATH=`pwd`/usr/man; \
-               ../install-utils/compile_manpages)
-
-clean:
-       rm -f $(PROGS) \#* *.s *.o *.a *~ core MAKELOG 
-       rm -rf dest
-       (cd lib/et; $(MAKE) clean)
-       (cd lib/ss; $(MAKE) clean)
-       (cd lib/ext2fs; $(MAKE) clean)
-       (cd lib/e2p; $(MAKE) clean)
-       (cd e2fsck; $(MAKE) clean)
-       (cd debugfs; $(MAKE) clean)
-       (cd misc ; $(MAKE) clean)
-
-really-clean:
-       rm -f $(PROGS) \#* *.s *.o *.a *~ core MAKELOG 
-       rm -f .depend bin/* shlibs/*.so.*
-       (cd lib/et; $(MAKE) really-clean)
-       (cd lib/ss; $(MAKE) really-clean)
-       (cd lib/ext2fs; $(MAKE) really-clean)
-       (cd lib/e2p; $(MAKE) really-clean)
-       (cd e2fsck; $(MAKE) really-clean)
-       (cd debugfs; $(MAKE) really-clean)
-       (cd misc ; $(MAKE) really-clean)
-
-dep depend:
-       (cd lib/et; cp /dev/null .depend; $(MAKE) depend)
-       (cd lib/ss; cp /dev/null .depend; $(MAKE) depend)
-       (cd lib/ext2fs; cp /dev/null .depend; $(MAKE) depend)
-       (cd lib/e2p; cp /dev/null .depend; $(MAKE) depend)
-       (cd debugfs; cp /dev/null .depend; $(MAKE) depend)
-       (cd e2fsck; cp /dev/null .depend; $(MAKE) depend)
-       (cd misc ; cp /dev/null .depend; $(MAKE) depend)
-
-world: 
-       @date
-       $(MAKE) depend 
-       @date
-       $(MAKE) all
-       @date
-       (cd e2fsck/images; ./test_script)
-       @date
-
-
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..7aaa85e
--- /dev/null
@@ -0,0 +1,69 @@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = .
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+LIB_SUBDIRS=lib/et lib/ss lib/ext2fs lib/e2p
+PROG_SUBDIRS=e2fsck debugfs misc
+SUBDIRS=$(LIB_SUBDIRS) $(PROG_SUBDIRS) tests
+
+all:: libs progs check
+
+progs: all-progs-recursive
+libs: all-libs-recursive
+
+install: all-libs-recursive install-progs-recursive \
+       install-shlibs-libs-recursive
+       (export MANPATH=$(DESTDIR)$(mandir); $(srcdir)/install-utils/compile_manpages)
+
+install-libs: install-libs-recursive
+
+TAGS clean-recursive distclean-recursive \
+           mostlyclean-recursive realclean-recursive install-recursive:
+       for subdir in $(SUBDIRS); do \
+         target=`echo $@|$(SED) 's/-recursive//'`; \
+         echo making $$target in $$subdir; \
+         (cd $$subdir && $(MAKE) $$target) || exit 1; \
+       done
+
+all-progs-recursive install-progs-recursive:
+       for subdir in $(PROG_SUBDIRS); do \
+         target=`echo $@|$(SED) 's/-progs-recursive//'`; \
+         echo making $$target in $$subdir; \
+         (cd $$subdir && $(MAKE) $$target) || exit 1; \
+       done
+
+all-libs-recursive install-libs-recursive install-shlibs-libs-recursive:
+       for subdir in $(LIB_SUBDIRS); do \
+         target=`echo $@|$(SED) 's/-libs-recursive//'`; \
+         echo making $$target in $$subdir; \
+         (cd $$subdir && $(MAKE) $$target) || exit 1; \
+       done
+
+mostlyclean: mostlyclean-recursive mostlyclean-local
+clean: clean-recursive clean-local
+distclean: distclean-recursive distclean-local
+realclean: realclean-recursive realclean-local
+
+mostlyclean-local:
+       $(RM) -f \#* *~ core MAKELOG 
+clean-local: mostlyclean-local
+distclean-local: clean-local
+       $(RM) -f include/linux/types.h
+       $(RM) -f config.status config.log config.cache MCONFIG Makefile
+realclean-local: distclean-local
+       $(RM) -f configure
+
+check:
+       (cd tests; make check)
+
+Makefile: config.status $(srcdir)/Makefile.in
+       CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+
+config.status: $(srcdir)/configure
+       ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in
+       cd $(srcdir) && autoconf
diff --git a/README b/README
index 621966487ced47aca021c378e4bf4dd50eb3d63a..7e39091f6e6a5c7b82acb3590e2ae91f9a922f29 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,5 @@
-       This is the new version (0.5b) of the second extended file system
-management programs.  You need to run Linux 1.0 or above to use it since
-some programs used some ext2fs features that where not available in
-previous kernel versions.
+       This is the new version (0.5c) of the second extended file system
+management programs.  
 
        See the file INSTALL for installation instructions.  This is
 important!  Note that your /etc/fstab file may need modifying before
diff --git a/config.guess b/config.guess
new file mode 100644 (file)
index 0000000..19066fb
--- /dev/null
@@ -0,0 +1,539 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+#
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    alpha:OSF1:V*:*)
+       # After 1.2, OSF1 uses "V1.3" for uname -r.
+       echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
+       exit 0 ;;
+    alpha:OSF1:*:*)
+       # 1.2 uses "1.2" for uname -r.
+       echo alpha-dec-osf${UNAME_RELEASE}
+        exit 0 ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit 0 ;;
+    amiga:NetBSD:*:*)
+      echo m68k-cbm-netbsd${UNAME_RELEASE}
+      exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit 0;;
+    Pyramid*:OSx*:*:*)
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit 0 ;;
+    sun4*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit 0 ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:NetBSD:*:*)
+       echo m68k-atari-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sun3*:NetBSD:*:*)
+       echo m68k-sun-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:NetBSD:*:*)
+       echo m68k-apple-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    mips:*:5*:RISCos)
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit 0 ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit 0 ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit 0 ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    AViiON:dgux:*:*)
+       if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+            -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+       else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+       fi
+       exit 0 ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit 0 ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit 0 ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit 0 ;;
+   ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i[34]86:AIX:*:*)
+       echo i386-ibm-aix
+       exit 0 ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               sed 's/^                //' << EOF >dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+               rm -f dummy.c dummy
+               echo rs6000-ibm-aix3.2.5
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit 0 ;;
+    *:AIX:*:4)
+       if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
+               IBM_REV=4.1
+       elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
+               IBM_REV=4.1.1
+       else
+               IBM_REV=4.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to 
+       exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit 0 ;;
+    9000/[3478]??:HP-UX:*:*)
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
+           9000/8?? )            HP_ARCH=hppa1.0 ;;
+       esac
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    3050*:HI-UX:*:*)
+       sed 's/^        //' << EOF >dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+       rm -f dummy.c dummy
+       echo unknown-hitachi-hiuxwe2
+       exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit 0 ;;
+    hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit 0 ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit 0 ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*X-MP:*:*:*)
+       echo xmp-cray-unicos
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE}
+       exit 0 ;;
+    CRAY*C90:*:*:*)
+       echo c90-cray-unicos${UNAME_RELEASE}
+       exit 0 ;;
+    CRAY-2:*:*:*)
+       echo cray2-cray-unicos
+        exit 0 ;;
+    hp3[0-9][05]:NetBSD:*:*)
+       echo m68k-hp-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit 0 ;;
+    *:NetBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+       exit 0 ;;
+    *:GNU:*:*)
+       echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit 0 ;;
+    *:Linux:*:*)
+       # Systems without a BFD linker
+       if test -d /usr/lib/ldscripts/. ; then
+         :
+       else
+         echo "${UNAME_MACHINE}-unknown-linuxoldld"
+         exit 0
+       fi
+       # Determine whether the default compiler is a.out or elf
+       cat >dummy.c <<EOF
+main(argc, argv)
+int argc;
+char *argv[];
+{
+#ifdef __ELF__
+  printf ("%s-unknown-linux\n", argv[1]);
+#else
+  printf ("%s-unknown-linuxaout\n", argv[1]);
+#endif
+  return 0;
+}
+EOF
+       ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+       rm -f dummy.c dummy;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+    i[34]86:DYNIX/ptx:4*:*)
+       echo i386-sequent-sysv4
+       exit 0 ;;
+    i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+       else
+               echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+       fi
+       exit 0 ;;
+    i[34]86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+               echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-unknown-sysv32
+       fi
+       exit 0 ;;
+    Intel:Mach:3*:*)
+       echo i386-unknown-mach3
+       exit 0 ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit 0 ;;
+    M680[234]0:*:R3V[567]*:*)
+       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
+        uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4.3 && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m680[234]0:LynxOS:2.2*:*)
+       echo m68k-lynx-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit 0 ;;
+    i[34]86:LynxOS:2.2*:*)
+       echo i386-lynx-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    TSUNAMI:LynxOS:2.2*:*)
+       echo sparc-lynx-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    rs6000:LynxOS:2.2*:*)
+       echo rs6000-lynx-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  printf ("%s-next-nextstep%s\n", __ARCHITECTURE__,  version==2 ? "2" : "3");
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-unknown-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+  printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+  printf ("vax-dec-bsd\n"); exit (0);
+#else
+  printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit 0 ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit 0 ;;
+    c34*)
+       echo c34-convex-bsd
+       exit 0 ;;
+    c38*)
+       echo c38-convex-bsd
+       exit 0 ;;
+    c4*)
+       echo c4-convex-bsd
+       exit 0 ;;
+    esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.sub b/config.sub
new file mode 100644 (file)
index 0000000..93371be
--- /dev/null
@@ -0,0 +1,866 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+#   Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can. 
+#
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+       echo Configuration name missing. 1>&2
+       echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+       echo "or     $0 ALIAS" 1>&2
+       echo where ALIAS is a recognized configuration type. 1>&2
+       exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+       *local*)
+               echo $1
+               exit 0
+               ;;
+       *)
+       ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS (if any).
+basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+if [ $basic_machine != $1 ]
+then os=`echo $1 | sed 's/.*-/-/'`
+else os=; fi
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
+               os=
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
+               | arme[lb] | pyramid \
+               | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
+               | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
+               | powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+               | pdp11 | mips64el | mips64orion | mips64orionel \
+               | sparc)
+               basic_machine=$basic_machine-unknown
+               ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+             | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
+             | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
+             | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+             | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+             | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+             | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+             | mips64el-* | mips64orion-* | mips64orionel-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-cbm
+               ;;
+       amigados)
+               basic_machine=m68k-cbm
+               os=-amigados
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-cbm
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       cray2)
+               basic_machine=cray2-cray
+               os=-unicos
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i[345]86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               os=-sysv32
+               ;;
+       i[345]86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               os=-sysv4
+               ;;
+       i[345]86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               os=-sysv
+               ;;
+       i[345]86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+               os=-solaris2
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+        pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | p6)
+               # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
+               basic_machine=i586-intel
+               ;;
+       pentium-* | p5-* | p6-*)
+               # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       k5)
+               # We don't have specific support for AMD's K5 yet, so just call it a Pentium
+               basic_machine=i586-amd
+               ;;
+       nexen)
+               # We don't have specific support for Nexgen yet, so just call it a Pentium
+               basic_machine=i586-nexgen
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=rs6000-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       xmp)
+               basic_machine=xmp-cray
+               os=-unicos
+               ;;
+        xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       mips)
+               basic_machine=mips-mips
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sparc)
+               basic_machine=sparc-sun
+               ;;
+        cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -unixware* | svr4*)
+               os=-sysv4
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
+             | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
+             | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+             | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* )
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+        pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigados
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+        *-gould)
+               os=-sysv
+               ;;
+        *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+        *-sgi)
+               os=-irix
+               ;;
+        *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -lynxos*)
+                               vendor=lynx
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -vxworks*)
+                               vendor=wrs
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
diff --git a/configure b/configure
new file mode 100644 (file)
index 0000000..92b515d
--- /dev/null
+++ b/configure
@@ -0,0 +1,2033 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.4 
+# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --enable-dll-shlibs  select DLL libraries"
+ac_help="$ac_help
+  --enable-elf-shlibs  select ELF shared libraries"
+ac_help="$ac_help
+  --enable-bsd-shlibs  select BSD shared libraries"
+ac_help="$ac_help
+  --enable-profile     build profiling libraries"
+ac_help="$ac_help
+  --enable-checker     build checker libraries"
+ac_help="$ac_help
+  --enable-gcc-wall    enable GCC anal warnings"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Initialize some other variables.
+subdirs=
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -build | --build | --buil | --bui | --bu | --b)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
+                          [same as prefix]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+--enable and --with options recognized:$ac_help
+EOF
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.4"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *) 
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=version.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='       '
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+MCONFIG=./MCONFIG
+
+# Check whether --enable-dll-shlibs or --disable-dll-shlibs was given.
+enableval="$enable_dll_shlibs"
+if test -n "$enableval"; then
+  if test "$enableval" = "no"
+then
+       DLL_CMT=#
+       MAKEFILE_DLL=/dev/null
+       echo "Disabling DLL shared libraries"
+else
+       DLL_CMT=
+       MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
+       echo "Enabling DLL shared libraries"
+fi
+
+else
+  MAKEFILE_DLL=/dev/null
+DLL_CMT=#
+echo "Disabling DLL shared libraries by default"
+
+fi
+
+
+
+# Check whether --enable-elf-shlibs or --disable-elf-shlibs was given.
+enableval="$enable_elf_shlibs"
+if test -n "$enableval"; then
+  if test "$enableval" = "no"
+then
+       ELF_CMT=#
+       MAKEFILE_ELF=/dev/null
+       echo "Disabling ELF shared libraries"
+else
+       ELF_CMT=
+       MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
+       echo "Enabling ELF shared libraries"
+fi
+
+else
+  MAKEFILE_ELF=/dev/null
+ELF_CMT=#
+echo "Disabling ELF shared libraries by default"
+
+fi
+
+
+
+# Check whether --enable-bsd-shlibs or --disable-bsd-shlibs was given.
+enableval="$enable_bsd_shlibs"
+if test -n "$enableval"; then
+  if test "$enableval" = "no"
+then
+       BSDLIB_CMT=#
+       MAKEFILE_BSDLIB=/dev/null
+       echo "Disabling BSD shared libraries"
+else
+       BSDLIB_CMT=
+       MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
+       echo "Enabling BSD shared libraries"
+fi
+
+else
+  MAKEFILE_BSDLIB=/dev/null
+BSDLIB_CMT=#
+echo "Disabling BSD shared libraries by default"
+
+fi
+
+
+
+# Check whether --enable-profile or --disable-profile was given.
+enableval="$enable_profile"
+if test -n "$enableval"; then
+  if test "$enableval" = "no"
+then
+       PROFILE_CMT=#
+       MAKEFILE_PROFILE=/dev/null
+       echo "Disabling profiling libraries"
+else
+       PROFILE_CMT=
+       MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
+       echo "Building profiling libraries"
+fi
+
+else
+  PROFILE_CMT=#
+MAKEFILE_PROFILE=/dev/null
+echo "Disabling profiling libraries by default"
+
+fi
+
+
+
+# Check whether --enable-checker or --disable-checker was given.
+enableval="$enable_checker"
+if test -n "$enableval"; then
+  if test "$enableval" = "no"
+then
+       CHECKER_CMT=#
+       MAKEFILE_CHECKER=/dev/null
+       echo "Disabling checker libraries"
+else
+       CHECKER_CMT=
+       MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
+       echo "Building checker libraries"
+fi
+
+else
+  CHECKER_CMT=#
+MAKEFILE_CHECKER=/dev/null
+echo "Disabling checker libraries by default"
+
+fi
+
+
+
+# Check whether --enable-gcc-wall or --disable-gcc-wall was given.
+enableval="$enable_gcc_wall"
+if test -n "$enableval"; then
+  if test "$enableval" = "no"
+then
+       W=#
+       echo "Disabling GCC warnings"
+else
+       W=
+       echo "Enabling GCC warnings"
+fi
+
+else
+  W=#
+echo "Disabling GCC warnings by default"
+
+fi
+
+
+MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+set dummy ${MAKE-make}; ac_make=$2
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+       @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "ln", so it can be a program name with args.
+set dummy ln; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_LN'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$LN" in
+  /*)
+  ac_cv_path_LN="$LN" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_LN="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_LN" && ac_cv_path_LN="ln"
+  ;;
+esac
+fi
+LN="$ac_cv_path_LN"
+if test -n "$LN"; then
+  echo "$ac_t""$LN" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "mv", so it can be a program name with args.
+set dummy mv; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MV" in
+  /*)
+  ac_cv_path_MV="$MV" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_MV="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_MV" && ac_cv_path_MV="mv"
+  ;;
+esac
+fi
+MV="$ac_cv_path_MV"
+if test -n "$MV"; then
+  echo "$ac_t""$MV" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "cp", so it can be a program name with args.
+set dummy cp; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$CP" in
+  /*)
+  ac_cv_path_CP="$CP" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_CP="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_CP" && ac_cv_path_CP="cp"
+  ;;
+esac
+fi
+CP="$ac_cv_path_CP"
+if test -n "$CP"; then
+  echo "$ac_t""$CP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "rm", so it can be a program name with args.
+set dummy rm; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$RM" in
+  /*)
+  ac_cv_path_RM="$RM" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_RM="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm"
+  ;;
+esac
+fi
+RM="$ac_cv_path_RM"
+if test -n "$RM"; then
+  echo "$ac_t""$RM" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "chmod", so it can be a program name with args.
+set dummy chmod; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_CHMOD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$CHMOD" in
+  /*)
+  ac_cv_path_CHMOD="$CHMOD" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_CHMOD="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_CHMOD" && ac_cv_path_CHMOD=":"
+  ;;
+esac
+fi
+CHMOD="$ac_cv_path_CHMOD"
+if test -n "$CHMOD"; then
+  echo "$ac_t""$CHMOD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "awk", so it can be a program name with args.
+set dummy awk; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_AWK'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$AWK" in
+  /*)
+  ac_cv_path_AWK="$AWK" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_AWK="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_AWK" && ac_cv_path_AWK="awk"
+  ;;
+esac
+fi
+AWK="$ac_cv_path_AWK"
+if test -n "$AWK"; then
+  echo "$ac_t""$AWK" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$SED" in
+  /*)
+  ac_cv_path_SED="$SED" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_SED="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_SED" && ac_cv_path_SED="sed"
+  ;;
+esac
+fi
+SED="$ac_cv_path_SED"
+if test -n "$SED"; then
+  echo "$ac_t""$SED" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`$ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`$ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`$ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AR="${ac_tool_prefix}ar"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_AR"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AR="ar"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+  echo "$ac_t""$AR" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  AR="ar"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  if test "${CFLAGS+set}" != set; then
+    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_gcc_g=yes
+else
+  ac_cv_prog_gcc_g=no
+fi
+rm -f conftest*
+
+fi
+    echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
+    if test $ac_cv_prog_gcc_g = yes; then
+      CFLAGS="-g -O"
+    else
+      CFLAGS="-O"
+    fi
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS=        }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      for ac_prog in ginstall installbsd scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           # OSF/1 installbsd also uses dspmsg, but is usable.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_ifs"
+  # As a last resort, use the slow shell script.
+  test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"
+fi
+  INSTALL="$ac_cv_path_install"
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# If we cannot run a trivial program, we must be cross compiling.
+echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_cross=yes
+else
+cat > conftest.$ac_ext <<EOF
+#line 1186 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  ac_cv_c_cross=no
+else
+  ac_cv_c_cross=yes
+fi
+fi
+rm -fr conftest*
+fi
+cross_compiling=$ac_cv_c_cross
+echo "$ac_t""$ac_cv_c_cross" 1>&6
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1217 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1231 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h linux/fd.h sys/disklabel.h
+do
+ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1264 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for vprintf""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1297 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char vprintf(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+char vprintf(); 
+
+int main() { return 0; }
+int t() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_vprintf) || defined (__stub___vprintf)
+choke me
+#else
+vprintf();
+#endif
+
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_func_vprintf=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_func_vprintf=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_VPRINTF 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "$ac_cv_func_vprintf" != yes; then
+echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1345 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _doprnt(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+char _doprnt(); 
+
+int main() { return 0; }
+int t() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+_doprnt();
+#endif
+
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_func__doprnt=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_func__doprnt=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_DOPRNT 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking whether struct dirent has a d_namlen field""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'e2fsprogs_cv_struct_d_namlen'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1394 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <dirent.h>
+int main() { return 0; }
+int t() {
+struct dirent de; de.d_namlen = 0;
+; return 0; }
+EOF
+if eval $ac_compile; then
+  rm -rf conftest*
+  e2fsprogs_cv_struct_d_namlen=yes
+else
+  rm -rf conftest*
+  e2fsprogs_cv_struct_d_namlen=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$e2fsprogs_cv_struct_d_namlen" 1>&6
+if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_DIRENT_NAMLEN 1
+EOF
+
+fi
+if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
+  # if cross-compiling, with no cached values, just assume something common. 
+  ac_cv_sizeof_short=2
+  ac_cv_sizeof_int=4
+  ac_cv_sizeof_long=4
+  echo "configure: warning: Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4" 1>&2
+fi
+echo $ac_n "checking size of short""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1436 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", sizeof(short));
+  exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  ac_cv_sizeof_short=`cat conftestval`
+else
+  ac_cv_sizeof_short=0
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_short" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+EOF
+
+
+echo $ac_n "checking size of int""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1470 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", sizeof(int));
+  exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  ac_cv_sizeof_int=`cat conftestval`
+else
+  ac_cv_sizeof_int=0
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_int" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+EOF
+
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1504 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", sizeof(long));
+  exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+  ac_cv_sizeof_long=`cat conftestval`
+else
+  ac_cv_sizeof_long=0
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+SIZEOF_SHORT=$ac_cv_sizeof_short
+SIZEOF_INT=$ac_cv_sizeof_int
+SIZEOF_LONG=$ac_cv_sizeof_long
+
+
+
+echo $ac_n "checking whether struct stat has a st_flags field""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'e2fsprogs_cv_struct_st_flags'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1541 "configure"
+#include "confdefs.h"
+#include <sys/stat.h>
+int main() { return 0; }
+int t() {
+struct stat stat; stat.st_flags = 0;
+; return 0; }
+EOF
+if eval $ac_compile; then
+  rm -rf conftest*
+  e2fsprogs_cv_struct_st_flags=yes
+else
+  rm -rf conftest*
+  e2fsprogs_cv_struct_st_flags=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$e2fsprogs_cv_struct_st_flags" 1>&6
+if test "$e2fsprogs_cv_struct_st_flags" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_STAT_FLAGS 1
+EOF
+
+fi
+for ac_func in chflags getrusage llseek strdup getmntinfo
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1574 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+char $ac_func(); 
+
+int main() { return 0; }
+int t() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if eval $ac_link; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+ac_safe=`echo "linux/fs.h" | tr './\055' '___'`
+echo $ac_n "checking for linux/fs.h""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1624 "configure"
+#include "confdefs.h"
+#include <linux/fs.h>
+EOF
+eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  linux_headers=yes
+else
+  echo "$ac_t""no" 1>&6
+linux_headers=no
+fi
+
+
+if test "$linux_headers" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_LINUX_FS_H 1
+EOF
+
+  # These are some programs that depend on having linux headers around, and
+  # won't work otherwise.  So we only compile them if we can.
+  EXTRA_PROGS="$EXTRA_PROGS flushb"
+else
+  LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
+  # Use this include directory with test compiles in the configure script too.
+  CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
+fi
+
+echo $ac_n "checking for optreset""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_have_optreset'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1668 "configure"
+#include "confdefs.h"
+#include <unistd.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "optreset" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_have_optreset=yes
+else
+  rm -rf conftest*
+  ac_cv_have_optreset=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_have_optreset" 1>&6
+if test $ac_cv_have_optreset = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_OPTRESET 1
+EOF
+
+fi
+echo $ac_n "checking whether struct ext2_inode has frags fields""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'e2fsprogs_cv_struct_ext2_inode_frags'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1695 "configure"
+#include "confdefs.h"
+#include <linux/ext2_fs.h>
+int main() { return 0; }
+int t() {
+struct ext2_inode i; i.i_frag = i.i_fsize = 0;
+; return 0; }
+EOF
+if eval $ac_compile; then
+  rm -rf conftest*
+  e2fsprogs_cv_struct_ext2_inode_frags=yes
+else
+  rm -rf conftest*
+  e2fsprogs_cv_struct_ext2_inode_frags=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$e2fsprogs_cv_struct_ext2_inode_frags" 1>&6
+if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_EXT2_FRAGS 1
+EOF
+
+fi
+echo $ac_n "checking whether the ext2 ioctls compile""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'e2fsprogs_cv_ioctl_ext2'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1726 "configure"
+#include "confdefs.h"
+#include <linux/ext2_fs.h>
+#include <sys/ioctl.h>
+int main() { return 0; }
+int t() {
+ioctl (0, EXT2_IOC_SETVERSION, 0);
+; return 0; }
+EOF
+if eval $ac_compile; then
+  rm -rf conftest*
+  e2fsprogs_cv_ioctl_ext2=yes
+else
+  rm -rf conftest*
+  e2fsprogs_cv_ioctl_ext2=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$e2fsprogs_cv_ioctl_ext2" 1>&6
+if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_EXT2_IOCTLS 1
+EOF
+
+fi
+
+case "$host_os" in
+linux*)
+       if test "$prefix" = NONE ; then
+               prefix='/';
+               echo "On Linux systems, prefix defaults to '/'"
+       fi
+;;
+esac
+
+LDFALG_STATIC=
+case "$host_os" in
+linux*)
+       LDFLAG_STATIC=-static
+       echo "On Linux systems, assume -static works"
+;;
+esac
+
+if test "$prefix" = / ; then
+       usr_prefix=/usr
+else
+       usr_prefix="\${prefix}"
+fi
+
+SS_DIR=`cd ${srcdir}/lib/ss; pwd`
+ET_DIR=`cd ${srcdir}/lib/et; pwd`
+
+
+if test "$cross_compiling" = yes ; then
+  DO_TEST_SUITE=
+else
+  DO_TEST_SUITE=check
+fi
+
+test -d lib || mkdir lib
+test -d include || mkdir include
+test -d include/linux || mkdir include/linux
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
+  >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
+s%[    `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.4"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "MCONFIG include/linux/types.h Makefile lib/et/Makefile 
+       lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh 
+       lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile 
+       e2fsck/Makefile debugfs/Makefile tests/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+
+# Protect against being on the right side of a sed subst in config.status. 
+sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
+ s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+$ac_vpsub
+$extrasub
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+/@MCONFIG@/r $MCONFIG
+s%@MCONFIG@%%g
+s%@DLL_CMT@%$DLL_CMT%g
+/@MAKEFILE_DLL@/r $MAKEFILE_DLL
+s%@MAKEFILE_DLL@%%g
+s%@ELF_CMT@%$ELF_CMT%g
+/@MAKEFILE_ELF@/r $MAKEFILE_ELF
+s%@MAKEFILE_ELF@%%g
+s%@BSDLIB_CMT@%$BSDLIB_CMT%g
+/@MAKEFILE_BSDLIB@/r $MAKEFILE_BSDLIB
+s%@MAKEFILE_BSDLIB@%%g
+s%@PROFILE_CMT@%$PROFILE_CMT%g
+/@MAKEFILE_PROFILE@/r $MAKEFILE_PROFILE
+s%@MAKEFILE_PROFILE@%%g
+s%@CHECKER_CMT@%$CHECKER_CMT%g
+/@MAKEFILE_CHECKER@/r $MAKEFILE_CHECKER
+s%@MAKEFILE_CHECKER@%%g
+s%@W@%$W%g
+/@MAKEFILE_LIBRARY@/r $MAKEFILE_LIBRARY
+s%@MAKEFILE_LIBRARY@%%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@LN@%$LN%g
+s%@MV@%$MV%g
+s%@CP@%$CP%g
+s%@RM@%$RM%g
+s%@CHMOD@%$CHMOD%g
+s%@AWK@%$AWK%g
+s%@SED@%$SED%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@STRIP@%$STRIP%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CPP@%$CPP%g
+s%@SIZEOF_SHORT@%$SIZEOF_SHORT%g
+s%@SIZEOF_INT@%$SIZEOF_INT%g
+s%@SIZEOF_LONG@%$SIZEOF_LONG%g
+s%@EXTRA_PROGS@%$EXTRA_PROGS%g
+s%@LINUX_INCLUDE@%$LINUX_INCLUDE%g
+s%@LDFLAG_STATIC@%$LDFLAG_STATIC%g
+s%@usr_prefix@%$usr_prefix%g
+s%@SS_DIR@%$SS_DIR%g
+s%@ET_DIR@%$ET_DIR%g
+s%@DO_TEST_SUITE@%$DO_TEST_SUITE%g
+
+CEOF
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"MCONFIG include/linux/types.h Makefile lib/et/Makefile 
+       lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh 
+       lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile 
+       e2fsck/Makefile debugfs/Makefile tests/Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust relative srcdir, etc. for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
+fi; done
+rm -f conftest.subs
+
+
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..5349abc
--- /dev/null
@@ -0,0 +1,322 @@
+AC_INIT(version.h)
+MCONFIG=./MCONFIG
+AC_SUBST_FILE(MCONFIG)
+dnl
+dnl handle --enable-dll-shlibs
+dnl
+AC_ARG_ENABLE([dll-shlibs],
+[  --enable-dll-shlibs select DLL libraries],
+if test "$enableval" = "no"
+then
+       DLL_CMT=#
+       MAKEFILE_DLL=/dev/null
+       echo "Disabling DLL shared libraries"
+else
+       DLL_CMT=
+       MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
+       echo "Enabling DLL shared libraries"
+fi
+,
+MAKEFILE_DLL=/dev/null
+DLL_CMT=#
+echo "Disabling DLL shared libraries by default"
+)
+AC_SUBST(DLL_CMT)
+AC_SUBST_FILE(MAKEFILE_DLL)
+dnl
+dnl handle --enable-elf-shlibs
+dnl
+AC_ARG_ENABLE([elf-shlibs],
+[  --enable-elf-shlibs select ELF shared libraries],
+if test "$enableval" = "no"
+then
+       ELF_CMT=#
+       MAKEFILE_ELF=/dev/null
+       echo "Disabling ELF shared libraries"
+else
+       ELF_CMT=
+       MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
+       echo "Enabling ELF shared libraries"
+fi
+,
+MAKEFILE_ELF=/dev/null
+ELF_CMT=#
+echo "Disabling ELF shared libraries by default"
+)
+AC_SUBST(ELF_CMT)
+AC_SUBST_FILE(MAKEFILE_ELF)
+dnl
+dnl handle --enable-bsd-shlibs
+dnl
+AC_ARG_ENABLE([bsd-shlibs],
+[  --enable-bsd-shlibs select BSD shared libraries],
+if test "$enableval" = "no"
+then
+       BSDLIB_CMT=#
+       MAKEFILE_BSDLIB=/dev/null
+       echo "Disabling BSD shared libraries"
+else
+       BSDLIB_CMT=
+       MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
+       echo "Enabling BSD shared libraries"
+fi
+,
+MAKEFILE_BSDLIB=/dev/null
+BSDLIB_CMT=#
+echo "Disabling BSD shared libraries by default"
+)
+AC_SUBST(BSDLIB_CMT)
+AC_SUBST_FILE(MAKEFILE_BSDLIB)
+dnl
+dnl handle --enable-profile
+dnl
+AC_ARG_ENABLE([profile],
+[  --enable-profile    build profiling libraries],
+if test "$enableval" = "no"
+then
+       PROFILE_CMT=#
+       MAKEFILE_PROFILE=/dev/null
+       echo "Disabling profiling libraries"
+else
+       PROFILE_CMT=
+       MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
+       echo "Building profiling libraries"
+fi
+,
+PROFILE_CMT=#
+MAKEFILE_PROFILE=/dev/null
+echo "Disabling profiling libraries by default"
+)
+AC_SUBST(PROFILE_CMT)
+AC_SUBST_FILE(MAKEFILE_PROFILE)
+dnl
+dnl handle --enable-checker
+dnl
+AC_ARG_ENABLE([checker],
+[  --enable-checker    build checker libraries],
+if test "$enableval" = "no"
+then
+       CHECKER_CMT=#
+       MAKEFILE_CHECKER=/dev/null
+       echo "Disabling checker libraries"
+else
+       CHECKER_CMT=
+       MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
+       echo "Building checker libraries"
+fi
+,
+CHECKER_CMT=#
+MAKEFILE_CHECKER=/dev/null
+echo "Disabling checker libraries by default"
+)
+AC_SUBST(CHECKER_CMT)
+AC_SUBST_FILE(MAKEFILE_CHECKER)
+dnl
+dnl handle --enable-gcc-wall
+dnl
+AC_ARG_ENABLE([gcc-wall],
+[  --enable-gcc-wall   enable GCC anal warnings],
+if test "$enableval" = "no"
+then
+       W=#
+       echo "Disabling GCC warnings"
+else
+       W=
+       echo "Enabling GCC warnings"
+fi
+,
+W=#
+echo "Disabling GCC warnings by default"
+)
+AC_SUBST(W)
+dnl
+dnl
+MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
+AC_SUBST_FILE(MAKEFILE_LIBRARY)
+dnl
+dnl End of configuration options
+dnl
+AC_PROG_MAKE_SET
+AC_PATH_PROG(LN, ln, ln)
+AC_PATH_PROG(MV, mv, mv)
+AC_PATH_PROG(CP, cp, cp)
+AC_PATH_PROG(RM, rm, rm)
+AC_PATH_PROG(CHMOD, chmod, :)
+AC_PATH_PROG(AWK, awk, awk)
+AC_PATH_PROG(SED, sed, sed)
+AC_CHECK_TOOL(AR, ar, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_C_CROSS
+AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h linux/fd.h sys/disklabel.h)
+AC_FUNC_VPRINTF
+dnl
+dnl See if struct dirent has a d_namlen field (like bsd systems), implying
+dnl that the actual length of the structure may be grater than the declared
+dnl length. 
+dnl
+AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
+AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
+       AC_TRY_COMPILE(
+[#include <sys/types.h>
+#include <dirent.h>],
+               [struct dirent de; de.d_namlen = 0;],
+               [e2fsprogs_cv_struct_d_namlen=yes],
+               [e2fsprogs_cv_struct_d_namlen=no]))
+AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
+if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
+  AC_DEFINE(HAVE_DIRENT_NAMLEN)
+fi
+dnl
+dnl Word sizes...
+dnl
+if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
+  # if cross-compiling, with no cached values, just assume something common. 
+  ac_cv_sizeof_short=2
+  ac_cv_sizeof_int=4
+  ac_cv_sizeof_long=4
+  AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
+fi
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+SIZEOF_SHORT=$ac_cv_sizeof_short
+SIZEOF_INT=$ac_cv_sizeof_int
+SIZEOF_LONG=$ac_cv_sizeof_long
+AC_SUBST(SIZEOF_SHORT)
+AC_SUBST(SIZEOF_INT)
+AC_SUBST(SIZEOF_LONG)
+dnl
+dnl See if struct stat has a st_flags field, in which case we can get file
+dnl flags somewhat portably.  Also check for the analogous setter, chflags().
+dnl
+AC_MSG_CHECKING(whether struct stat has a st_flags field)
+AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
+       AC_TRY_COMPILE([#include <sys/stat.h>],
+               [struct stat stat; stat.st_flags = 0;],
+               [e2fsprogs_cv_struct_st_flags=yes],
+               [e2fsprogs_cv_struct_st_flags=no]))
+AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
+if test "$e2fsprogs_cv_struct_st_flags" = yes; then
+  AC_DEFINE(HAVE_STAT_FLAGS)
+fi
+AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo)
+dnl
+dnl On systems without linux header files, we add an extra include directory
+dnl that holds enough to fake it (hopefully).  Note that the $(top_srcdir) here
+dnl is quoted so that it gets expanded by make, not by configure.
+dnl
+AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
+AC_SUBST(EXTRA_PROGS)
+if test "$linux_headers" = yes; then
+  AC_DEFINE(HAVE_LINUX_FS_H)
+  # These are some programs that depend on having linux headers around, and
+  # won't work otherwise.  So we only compile them if we can.
+  EXTRA_PROGS="$EXTRA_PROGS flushb"
+else
+  LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
+  # Use this include directory with test compiles in the configure script too.
+  CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
+fi
+AC_SUBST(LINUX_INCLUDE)
+dnl
+dnl See if optreset exists
+dnl
+AC_MSG_CHECKING(for optreset)
+AC_CACHE_VAL(ac_cv_have_optreset,
+[AC_EGREP_HEADER(optreset, unistd.h,
+  ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
+AC_MSG_RESULT($ac_cv_have_optreset)
+if test $ac_cv_have_optreset = yes; then
+  AC_DEFINE(HAVE_OPTRESET)
+fi
+dnl
+dnl See if our system has frags enabled (at least in the header file)
+dnl
+AC_MSG_CHECKING(whether struct ext2_inode has frags fields)
+AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags,
+       AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
+               [struct ext2_inode i; i.i_frag = i.i_fsize = 0;],
+               [e2fsprogs_cv_struct_ext2_inode_frags=yes],
+               [e2fsprogs_cv_struct_ext2_inode_frags=no]))
+AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags)
+if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
+  AC_DEFINE(HAVE_EXT2_FRAGS)
+fi
+dnl
+dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
+dnl
+AC_MSG_CHECKING(whether the ext2 ioctls compile)
+AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
+       AC_TRY_COMPILE([#include <linux/ext2_fs.h>
+#include <sys/ioctl.h>],
+               [ioctl (0, EXT2_IOC_SETVERSION, 0);],
+               [e2fsprogs_cv_ioctl_ext2=yes],
+               [e2fsprogs_cv_ioctl_ext2=no]))
+AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
+if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
+  AC_DEFINE(HAVE_EXT2_IOCTLS)
+fi
+dnl
+dnl On linux, force the prefix to be '/'
+dnl
+AC_REQUIRE([AC_CANONICAL_HOST])
+case "$host_os" in
+linux*)
+       if test "$prefix" = NONE ; then
+               prefix='/';
+               echo "On Linux systems, prefix defaults to '/'"
+       fi
+;;
+esac
+dnl
+dnl See if -static works.
+dnl XXX for now, assume that only Linux systems support -static
+dnl
+AC_REQUIRE([AC_CANONICAL_HOST])
+LDFALG_STATIC=
+case "$host_os" in
+linux*)
+       LDFLAG_STATIC=-static
+       echo "On Linux systems, assume -static works"
+;;
+esac
+AC_SUBST(LDFLAG_STATIC)
+dnl
+dnl Check to see if prefix is '/'
+dnl
+if test "$prefix" = / ; then
+       usr_prefix=/usr
+else
+       usr_prefix="\${prefix}"
+fi
+AC_SUBST(usr_prefix)
+dnl
+dnl Make the ss and et directories work correctly.
+dnl
+SS_DIR=`cd ${srcdir}/lib/ss; pwd`
+ET_DIR=`cd ${srcdir}/lib/et; pwd`
+AC_SUBST(SS_DIR)
+AC_SUBST(ET_DIR)
+dnl
+dnl Only try to run the test suite if we're not cross compiling.
+dnl
+if test "$cross_compiling" = yes ; then
+  DO_TEST_SUITE=
+else
+  DO_TEST_SUITE=check
+fi
+AC_SUBST(DO_TEST_SUITE)
+dnl
+dnl Make our output files, being sure that we create the some miscellaneous 
+dnl directories
+dnl
+test -d lib || mkdir lib
+test -d include || mkdir include
+test -d include/linux || mkdir include/linux
+AC_OUTPUT(MCONFIG include/linux/types.h Makefile lib/et/Makefile 
+       lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh 
+       lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile 
+       e2fsck/Makefile debugfs/Makefile tests/Makefile)
diff --git a/contrib/dconf b/contrib/dconf
new file mode 100644 (file)
index 0000000..cef4cc6
--- /dev/null
@@ -0,0 +1,118 @@
+#!/bin/sh
+#$Id$
+# Create Adobe-PostScript file that graphically displays the output of
+# dumpe2fs(8). Use "dumpe2fs | dconf" to create a PostScript file on stdout.
+# Developed and tested for Linux 1.0.
+# Copyright (c) 1994
+# Ulrich Windl
+# ALte Regensburger Strasse 11a
+# D-93149 Nittenau, Germany
+# <Ulrich.Windl@rz.uni-regensburg.de>
+SELF=`basename $0`
+AWKFILE=/tmp/${SELF}.awk
+TEMPFILE=/tmp/${SELF}.tmp
+echo '
+BEGIN {
+       print "B"
+}
+/^Inode count:/ {
+       ic=$3; next
+}
+/^Block count:/ {
+       bc=$3; next
+}
+/^First block:/ {
+       fb=$3; next
+}
+/^Block size:/ {
+       bs=$3; next
+}
+/^Blocks per group:/ {
+       bpg=$4
+       printf("BC %d\n", bpg)
+       printf("GC %d\n", (bc + bpg - 1) / bpg)
+       next
+}
+/^Inodes per group:/ {
+       ipg=$4; next
+}
+/^Last write time:/ {
+       lwtime=$0; gsub("Last write time:[ ]+", "", lwtime)
+       printf("T %s\n", lwtime)
+       next
+}
+/^Group [0-9]+:/ {
+       group=$2; gsub(":", "", group)
+       block=""
+       group_start=group*bpg+fb
+       group_end=group_start+bpg
+       printf("G %d : %d - %d\n", group, group_start, group_end)
+       next
+}
+/^[ ]+Free blocks: / {
+       for ( i=3; i < NF; ++i ) {
+               block=$i; gsub(",", "", block)
+               if ( index(block, "-") == 0 ) block=block "-" block
+               pos=index(block, "-")
+               printf("FB %d-%d\n",
+                      substr(block, 0, pos) - group_start,
+                      substr(block, pos + 1) - group_start)
+       }
+       if ( block == "" ) printf("Group %d is full\n", group)
+       print "----"
+       next
+}
+END {
+       printf("E %s\n", lwtime)
+}' >$AWKFILE
+awk -f $AWKFILE $* >$TEMPFILE
+echo '
+BEGIN {
+        printf("%%!PS-Adobe\n")
+        printf("%%%%BoundingBox: 0 0 1 1\n")
+       printf("/rect {/y2 exch def /x2 exch def /y1 exch def /x1 exch def\n")
+       printf("       newpath x1 y1 moveto x2 y1 lineto x2 y2 lineto\n")
+       printf("       x1 y2 lineto closepath} def\n")
+       printf("/fb {rect gsave 1.0 setgray fill grestore} def\n")
+       printf("/dg {rect gsave gsave 0.0 setgray fill grestore\n")
+       printf("     0.5 setgray stroke grestore} def\n")
+       printf("/textxy {moveto show} bind def\n")
+       printf("0.0001 setlinewidth\n")
+}
+$1 == "GC" && NF == 2 {
+       number_of_groups=$2
+       printf("/Times-Roman findfont %g scalefont setfont\n",
+              1.0 / number_of_groups)
+       next
+}
+$1 == "BC" && NF == 2 {
+       blocks_per_group=$2; next
+}
+$1 == "T" && NF > 1 {
+       printf("(%s) %g %g textxy\n",
+              substr($0, 2), 0, 1.02)
+       next
+}
+$1 == "G" && NF == 6 && $3 == ":" && $5 == "-" {
+       group_index=$2
+       gs=$4
+       ge=$6
+       height=1.0 / number_of_groups
+       vstart=group_index * height
+       printf("%% group %d of %d:\n0 %g 1 %g dg\n",
+              group_index, number_of_groups, vstart, vstart + height)
+       printf("(Group %s) 1.02 %g textxy\n", group_index, vstart)
+       next
+}
+$1 == "FB" && NF == 2 {
+       pos = index($2, "-")
+       printf("%% hole %s\n%g %g %g %g fb\n",
+              $2, substr($2, 0, pos) / blocks_per_group, vstart,
+              (substr($2, pos + 1) + 1) / blocks_per_group, vstart + height)
+       next
+}
+END {
+       printf("%%%%EOF\n")
+}
+' >$AWKFILE
+awk -f $AWKFILE $TEMPFILE
index 65ffaa3594c7e35f848c174e34490b32307b9778..5655062761450167896f4748ff13111e1636b3e7 100644 (file)
@@ -1,55 +1,60 @@
-debugfs.o : debugfs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+debugfs.o : ./debugfs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/ctype.h /usr/include/string.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/sys/stat.h /usr/include/linux/stat.h ../lib/et/com_err.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ss/ss.h ../lib/ss/mit-sipb-copyright.h \
-  ../lib/ss/ss_err.h debugfs.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/ctype.h \
+  /usr/include/string.h /usr/include/time.h /usr/include/getopt.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ../lib/ss/ss.h ../lib/ss/mit-sipb-copyright.h ../lib/ss/ss_err.h ./debugfs.h \
+  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h \
+  ../lib/ext2fs/bitops.h 
+dump.o : ./dump.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
+  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/ctype.h \
+  /usr/include/string.h /usr/include/time.h /usr/include/getopt.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h /usr/include/fcntl.h /usr/include/linux/fcntl.h ./debugfs.h \
+  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-dump.o : dump.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+icheck.o : ./icheck.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/ctype.h /usr/include/string.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/fcntl.h \
-  /usr/include/linux/fcntl.h debugfs.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/ctype.h \
+  /usr/include/string.h /usr/include/time.h /usr/include/getopt.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h ./debugfs.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
   ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
   ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-icheck.o : icheck.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+lsdel.o : ./lsdel.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/ctype.h /usr/include/string.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/sys/stat.h /usr/include/linux/stat.h debugfs.h \
-  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-lsdel.o : lsdel.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/ctype.h /usr/include/string.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/sys/stat.h /usr/include/linux/stat.h debugfs.h \
-  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-ncheck.o : ncheck.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/ctype.h \
+  /usr/include/string.h /usr/include/time.h /usr/include/getopt.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h ./debugfs.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
+  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
+  ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
+ncheck.o : ./ncheck.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/ctype.h /usr/include/string.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/sys/stat.h /usr/include/linux/stat.h debugfs.h \
-  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-util.o : util.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/ctype.h \
+  /usr/include/string.h /usr/include/time.h /usr/include/getopt.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h ./debugfs.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
+  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
+  ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
+util.o : ./util.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/ctype.h /usr/include/string.h debugfs.h /usr/include/linux/ext2_fs.h \
-  ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/ctype.h \
+  /usr/include/string.h ./debugfs.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
+  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
+  ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
index bff94200de0dc87af8944a2e0465fe5c883218e9..74df53fa8f28af1e620007a4eff75829cd45a2e7 100644 (file)
@@ -1,3 +1,58 @@
+Thu Oct 26 12:05:06 1995    <tytso@rsts-11.mit.edu>
+
+       * Makefile.in (install): Strip programs when they are installed.
+
+Fri Aug 18 15:09:08 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * debugfs.c (do_find_free_block): Fix typo in code which checked
+               to see if the usage message should be printed.
+
+Thu Aug 17 22:55:58 1995    <tytso@rsts-11.mit.edu>
+
+       * debugfs.c (do_open_filesys): Change to always set optreset to 1,
+               to make BSD getopt()'s happy.  Also set optind to 1, which
+               should make more getopt()'s happy.
+
+Fri Aug 11 08:45:01 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * debugfs.c (do_find_free_block, do_find_free_inode): Fix bug in
+               the usage handling where "ffi ?" or "ffb ?" would
+               dereference a NULL pointer.
+
+Fri Aug 11 14:21:07 1995  Remy Card  <card@bbj>
+
+       * debugfs.8: Updated date and version number.
+
+Thu Aug 10 14:28:50 1995  Remy Card  <card@bbj>
+
+       * debugfs.8: Fixed a spelling error in Ted's name :-)
+
+Mon Jun 12 19:08:25 1995  Theodore Y. Ts'o  (tytso@dcl)
+
+       * debugfs.c, ncheck.c, icheck.c, lsdel.c, dump.c: Include
+               <errno.h> (if it exists)
+
+       * debugfs.c, dump.c, icheck.c, lsdel.c, ncheck.c: Don't include
+               <getopt.h> if it doesn't exist.
+
+Sun Jun 11 15:21:07 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * ncheck.c (do_ncheck): Use LINUX_S_ISDIR instead of S_ISDIR
+
+       * debugfs.c: Implement the mknod and write commands (from Linus).
+
+               Change names of modify_char, modify_short, and modify_long
+               to be modify_u8, modify_u16, and modify_u32, respectively.
+
+Thu Jun  8 12:29:15 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * debugfs.c (dump_inode): Only print out inode frag fields if
+       HAVE_EXT2_FRAGS is defined (by configure).  Don't print out the
+       reserved field at all for  now.
+
+       * Makefile.in: Rewritten to conform to GNU coding standards and
+       support separate compilation directories.
+
 Thu Nov 24 17:46:23 1994  Theodore Y. Ts'o  (tytso@rt-11)
 
        * dump.c: Added two new commands, "dump" and "cat", which allow
diff --git a/debugfs/Makefile b/debugfs/Makefile
deleted file mode 100644 (file)
index aef6ac6..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-include ../MCONFIG
-
-CFLAGS=                $(OPT) -Wall -I../lib
-LDFLAGS=       $(OPT)
-PROGS=         debugfs
-BINDIR=                $(SBINDIR)
-MANPAGES=      debugfs.8
-MANDIR=                $(SMANDIR)
-
-MK_CMDS=       ../lib/ss/mk_cmds
-
-DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o lsdel.o dump.o
-
-LIBS= -L../lib -lss -lcom_err -lext2fs
-DEPLIBS= ../lib/libss.a ../lib/libcom_err.a ../lib/libext2fs.a
-
-debugfs: $(DEBUG_OBJS) $(DEPLIBS)
-       $(CC) $(LDFLAGS) -o debugfs $(DEBUG_OBJS) $(LIBS)
-
-debug_cmds.c debug_cmds.h: debug_cmds.ct
-       $(MK_CMDS) debug_cmds.ct
-
-install:: $(PROGS)
-       for i in $(PROGS); do \
-               $(INSTALLBIN) $$i $(BINDIR)/$$i; \
-       done
-
-install:: $(MANPAGES)
-       for i in $(MANPAGES); do \
-               $(INSTALLMAN) $$i $(MANDIR)/$$i; \
-       done
-
-install-tree:: $(PROGS)
-       for i in $(PROGS); do \
-               rm -f ../bin/$$i; \
-               cp $$i ../bin; \
-               strip ../bin/$$i; \
-               chmod 555 ../bin/$$i; \
-       done
-
-clean:
-       rm -f debugfs \#* *.s *.o *.a *~ debug_cmds.c core
-
-really-clean: clean
-       rm -f debug_cmds.c .depend 
-
-dep depend .depend:
-       $(CPP) $(CFLAGS) -M *.c >.depend
-
-include .depend
diff --git a/debugfs/Makefile.in b/debugfs/Makefile.in
new file mode 100644 (file)
index 0000000..36c8ab7
--- /dev/null
@@ -0,0 +1,103 @@
+#
+# Standard e2fsprogs prologue....
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ..
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+PROGS=         debugfs
+MANPAGES=      debugfs.8
+
+MK_CMDS=       ../lib/ss/mk_cmds
+
+DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o lsdel.o dump.o
+
+SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c \
+       $(srcdir)/ncheck.c $(srcdir)/icheck.c $(srcdir)/lsdel.c \
+       $(srcdir)/dump.c
+
+LIBS= -L../lib -lss -lcom_err -lext2fs
+DEPLIBS= ../lib/libss.a ../lib/libcom_err.a ../lib/libext2fs.a
+
+.c.o:
+       $(CC) -c $(CFLAGS) $< -o $@
+
+all:: $(PROGS)
+
+debugfs: $(DEBUG_OBJS) $(DEPLIBS)
+       $(CC) $(LDFLAGS) -o debugfs $(DEBUG_OBJS) $(LIBS)
+
+debug_cmds.c debug_cmds.h: debug_cmds.ct
+       $(MK_CMDS) $(srcdir)/debug_cmds.ct
+
+installdirs:
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(usbindir) \
+               $(DESTDIR)$(man8dir) $(DESTDIR)$(cat8dir)
+
+install: $(PROGS) $(MANPAGES) installdirs
+       for i in $(PROGS); do \
+               $(INSTALL_PROGRAM) $$i $(DESTDIR)$(usbindir)/$$i; \
+               $(STRIP) $(DESTDIR)$(usbindir)/$$i; \
+       done
+       for i in $(MANPAGES); do \
+               $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(man8dir)/$$i; \
+       done
+
+uninstall:
+       for i in $(PROGS); do \
+               $(RM) -f $(usbindir)/$$i; \
+       done
+       for i in $(MANPAGES); do \
+               $(RM) -f $(man8dir)/$$i; \
+       done
+
+clean:
+       $(RM) -f debugfs \#* *.s *.o *.a *~ debug_cmds.c core
+mostlyclean: clean
+distclean: clean
+       $(RM) -f debug_cmds.c .depend Makefile
+
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+debug_cmds.o: debug_cmds.c $(top_srcdir)/lib/ss/ss.h \
+  $(top_srcdir)/lib/ss/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h
+debugfs.o: $(srcdir)/debugfs.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ss/ss.h $(top_srcdir)/lib/ss/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h \
+  $(srcdir)/debugfs.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(top_srcdir)/lib/ext2fs/bitops.h
+util.o: $(srcdir)/util.c \
+  $(srcdir)/debugfs.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+ncheck.o: $(srcdir)/ncheck.c \
+  $(srcdir)/debugfs.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+icheck.o: $(srcdir)/icheck.c \
+  $(srcdir)/debugfs.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+lsdel.o: $(srcdir)/lsdel.c \
+  $(srcdir)/debugfs.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+dump.o: $(srcdir)/dump.c \
+  $(srcdir)/debugfs.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h
+
index 2b8005912aaf870b797248dc493caaf3b53594b7..7e07045138188682085dd763952b94852a680ed7 100644 (file)
@@ -91,9 +91,15 @@ request      do_print_working_directory, "Print current working directory",
 request        do_expand_dir, "Expand directory",
        expand_dir, expand;
 
+request do_mknod, "Create a special file",
+       mknod;
+
 request do_lsdel, "List deleted inodes",
        list_deleted_inodes, lsdel;
 
+request do_write, "Copy a file from your native filesystem",
+       write;
+
 request do_dump, "Dump an inode out to a file",
        dump_inode, dump;
 
index 8bb0a7494f47b7c64507f73de765f4c7d1fc1564..9ff19d63b38a696ffcd6d2c29090d4c0cd028b42 100644 (file)
@@ -1,5 +1,8 @@
 .\" -*- nroff -*-
-.TH DEBUGFS 8 "November 1994" "Version 0.5b"
+.\" Copyright 1993, 1994, 1995 by Theodore Ts'o.  All Rights Reserved.
+.\" This file may be copied under the terms of the GNU Public License.
+.\" 
+.TH DEBUGFS 8 "October 1995" "Version 0.5c"
 .SH NAME
 debugfs \- ext2 file system debugger
 .SH SYNOPSIS
@@ -27,18 +30,26 @@ option, the file system is open in read-only mode.
 .B debugfs
 is an interactive debugger. It understands a number of commands.
 .TP
-.I cd file
+.I cat <file>
+Dump the contents of an inode to stdout.
 .TP
-.I chroot file
+.I cd <directory>
+Change the current working directory to specified directory
+.TP
+.I chroot <directory>
+Change the root directory to be the specified inode.
 .TP
 .I close
 Close the currently open file system.
 .TP
-.I clri file
+.I clri <file>
 Clear the contents of the inode corresponding to
 .I file
 .TP
-.I expand_dir, file
+.I dump <file> <out_file>
+Dump the contents of an inode to a file.
+.TP
+.I expand_dir <file>
 Expand a directory.
 .TP
 .I find_free_block [goal]
@@ -49,28 +60,33 @@ and allocates it.
 .I find_free_inode [dir [mode]]
 Find a free inode and allocates it.
 .TP
-.I freeb block
+.I freeb <block>
 Mark the block as not allocated.
 .TP
-.I freei file
+.I freei <file>
 Free the inode corresponding to
 .I file
 .TP
 .I help
+Print a list of commands understood by 
+.BR debugfs (8).
+.TP
+.I icheck <block>
+Do block->inode translation.
 .TP
-.I iname inode
+.I iname <inode>
 Print the file name corresponding to
 .I inode
-(currently not implemented).
+(currently not implemented - see ncheck).
 .TP
-.I initialize device blocksize
+.I initialize <device> <blocksize>
 Create an ext2 file system on
 .I device
 .TP
-.I kill_file file
+.I kill_file <file>
 Remove a file and deallocates its blocks.
 .TP
-.I ln source_file dest_file
+.I ln <source_file> <dest_file>
 Create a link.
 .TP
 .I ls [pathname]
@@ -78,55 +94,69 @@ Emulate the
 .BR ls (1)
 command.
 .TP
-.I modify_inode file
+.I modify_inode <file>
 Modify the contents of the inode corresponding to
 .I file
 .TP
-.I mkdir file
+.I mkdir <file>
 Make a directory.
 .TP
-.I open [-w] device
+.I mknod <file> [p|[[c|b] <major> <minor>]]
+Create a special device file
+.TP
+.I ncheck <inode>
+Do inode->name translation.
+.TP
+.I open [-w] <device>
 Open a file system.
 .TP
 .I pwd
+Print the current working directory.
 .TP
 .I quit
 Quit
 .B debugfs
 .TP
-.I rm file
+.I rm <file>
 Remove a file.
 .TP
-.I rmdir file
+.I rmdir <directory>
 Remove a directory.
 .TP
-.I setb block
+.I setb <block>
 Mark the block as allocated.
 .TP
-.I seti file
+.I seti <file>
 Mark in use the inode corresponding to
 .I file
 .TP
 .I show_super_stats
 List the contents of the super block.
 .TP
-.I stat file
+.I stat <file>
 Dump the contents of the inode corresponding to
 .I file
 .TP
-.I testb block
+.I testb <block>
 Test if the block is marked as allocated.
 .TP
-.I testi file
+.I testi <file>
 Test if the inode correponding to
 .I file
 is marked as allocated.
 .TP
-.I unlink file
+.I unlink <file>
 Remove a link.
+.TP
+.I write source_file <file>
+Create a file in the filesystem named
+.IR file ,
+and copy the contents of
+.I source_file
+into the destination file.
 .SH AUTHOR
 .B debugfs
-has been written by Theodore T'so <tytso@mit.edu>.
+was written by Theodore Ts'o <tytso@mit.edu>.
 .SH SEE ALSO
 .BR dumpe2fs (8),
 .BR e2fsck (8),
index 6c16af86a181d1da51e1af58226ca6951085a187..b0ba7c3fd1b205c032931f3a14f9d905c2156544 100644 (file)
 #include <ctype.h>
 #include <string.h>
 #include <time.h>
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#else 
+extern int optind;
+extern char *optarg;
+#endif
+#ifdef HAVE_OPTRESET
+extern int optreset;           /* defined by BSD, but not others */
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -27,7 +39,7 @@ extern ss_request_table debug_cmds;
 ext2_filsys fs = NULL;
 ino_t  root, cwd;
 
-void open_filesystem(char *device, int open_flags)
+static void open_filesystem(char *device, int open_flags)
 {
        int     retval;
        
@@ -59,11 +71,14 @@ errout:
 
 void do_open_filesys(int argc, char **argv)
 {
-       char    *usage = "Usage: open [-w] <device>";
+       const char      *usage = "Usage: open [-w] <device>";
        char    c;
        int open_flags = 0;
        
-       optind = 0;
+       optind = 1;
+#ifdef HAVE_OPTRESET
+       optreset = 1;           /* Makes BSD getopt happy */
+#endif
        while ((c = getopt (argc, argv, "w")) != EOF) {
                switch (c) {
                case 'w':
@@ -83,7 +98,7 @@ void do_open_filesys(int argc, char **argv)
        open_filesystem(argv[optind], open_flags);
 }
 
-void close_filesystem()
+static void close_filesystem(NOARGS)
 {
        int     retval;
        
@@ -117,7 +132,7 @@ void do_close_filesys(int argc, char **argv)
 
 void do_init_filesys(int argc, char **argv)
 {
-       char    *usage = "Usage: initialize <device> <blocksize>";
+       const char      *usage = "Usage: initialize <device> <blocksize>";
        struct ext2_super_block param;
        errcode_t       retval;
        char            *tmp;
@@ -166,22 +181,22 @@ void do_show_super_stats(int argc, char *argv[])
        fprintf(out, "Superblock size = %d\n", sizeof(struct ext2_super_block));
        fprintf(out, "Block size = %d, fragment size = %d\n",
                EXT2_BLOCK_SIZE(fs->super), EXT2_FRAG_SIZE(fs->super));
-       fprintf(out, "%ld inodes, %ld free\n", fs->super->s_inodes_count,
+       fprintf(out, "%d inodes, %d free\n", fs->super->s_inodes_count,
                fs->super->s_free_inodes_count);
-       fprintf(out, "%ld blocks, %ld free, %ld reserved, first block = %ld\n",
+       fprintf(out, "%d blocks, %d free, %d reserved, first block = %d\n",
                fs->super->s_blocks_count, fs->super->s_free_blocks_count,
                fs->super->s_r_blocks_count, fs->super->s_first_data_block);
-       fprintf(out, "%ld blocks per group\n", fs->super->s_blocks_per_group);
-       fprintf(out, "%ld fragments per group\n", fs->super->s_frags_per_group);
-       fprintf(out, "%ld inodes per group\n", EXT2_INODES_PER_GROUP(fs->super));
+       fprintf(out, "%d blocks per group\n", fs->super->s_blocks_per_group);
+       fprintf(out, "%d fragments per group\n", fs->super->s_frags_per_group);
+       fprintf(out, "%d inodes per group\n", EXT2_INODES_PER_GROUP(fs->super));
        fprintf(out, "%d inodes per block\n", EXT2_INODES_PER_BLOCK(fs->super));
        fprintf(out, "%ld group%s (%ld descriptors block%s)\n",
                fs->group_desc_count, (fs->group_desc_count != 1) ? "s" : "",
                fs->desc_blocks, (fs->desc_blocks != 1) ? "s" : "");
        for (i = 0; i < fs->group_desc_count; i++)
-               fprintf(out, " Group %2d: block bitmap at %ld, "
-                       "inode bitmap at %ld, "
-                       "inode table at %ld\n"
+               fprintf(out, " Group %2d: block bitmap at %d, "
+                       "inode bitmap at %d, "
+                       "inode table at %d\n"
                        "           %d free block%s, "
                        "%d free inode%s, "
                        "%d used director%s\n",
@@ -202,17 +217,18 @@ struct list_blocks_struct {
        int     total;
 };
 
-int list_blocks_proc(ext2_filsys fs, blk_t *blocknr, int blockcnt, void *private)
+static int list_blocks_proc(ext2_filsys fs, blk_t *blocknr, int blockcnt,
+                           void *private)
 {
        struct list_blocks_struct *lb = (struct list_blocks_struct *) private;
 
-       fprintf(lb->f, "%ld ", *blocknr);
+       fprintf(lb->f, "%d ", *blocknr);
        lb->total++;
        return 0;
 }
 
 
-void dump_blocks(FILE *f, ino_t inode)
+static void dump_blocks(FILE *f, ino_t inode)
 {
        struct list_blocks_struct lb;
 
@@ -226,41 +242,43 @@ void dump_blocks(FILE *f, ino_t inode)
 }
 
 
-void dump_inode(ino_t inode_num, struct ext2_inode inode)
+static void dump_inode(ino_t inode_num, struct ext2_inode inode)
 {
-       char *i_type;
+       const char *i_type;
        FILE    *out;
        
        out = open_pager();
-       if (S_ISDIR(inode.i_mode)) i_type = "directory";
-       else if (S_ISREG(inode.i_mode)) i_type = "regular";
-       else if (S_ISLNK(inode.i_mode)) i_type = "symlink";
-       else if (S_ISBLK(inode.i_mode)) i_type = "block special";
-       else if (S_ISCHR(inode.i_mode)) i_type = "character special";
-       else if (S_ISFIFO(inode.i_mode)) i_type = "FIFO";
-       else if (S_ISSOCK(inode.i_mode)) i_type = "socket";
+       if (LINUX_S_ISDIR(inode.i_mode)) i_type = "directory";
+       else if (LINUX_S_ISREG(inode.i_mode)) i_type = "regular";
+       else if (LINUX_S_ISLNK(inode.i_mode)) i_type = "symlink";
+       else if (LINUX_S_ISBLK(inode.i_mode)) i_type = "block special";
+       else if (LINUX_S_ISCHR(inode.i_mode)) i_type = "character special";
+       else if (LINUX_S_ISFIFO(inode.i_mode)) i_type = "FIFO";
+       else if (LINUX_S_ISSOCK(inode.i_mode)) i_type = "socket";
        else i_type = "bad type";
        fprintf(out, "Inode: %ld   Type: %s    ", inode_num, i_type);
-       fprintf(out, "Mode:  %04o   Flags: 0x%lx   Version: %ld\n",
+       fprintf(out, "Mode:  %04o   Flags: 0x%x   Version: %d\n",
                inode.i_mode & 0777, inode.i_flags, inode.i_version);
-       fprintf(out, "User: %5d   Group: %5d   Size: %ld\n",  
+       fprintf(out, "User: %5d   Group: %5d   Size: %d\n",  
                inode.i_uid, inode.i_gid, inode.i_size);
-       fprintf(out, "File ACL: %ld    Directory ACL: %ld\n",
+       fprintf(out, "File ACL: %d    Directory ACL: %d\n",
                inode.i_file_acl, inode.i_dir_acl);
-       fprintf(out, "Links: %d   Blockcount: %ld\n", inode.i_links_count,
+       fprintf(out, "Links: %d   Blockcount: %d\n", inode.i_links_count,
                inode.i_blocks);
-       fprintf(out, "Fragment:  Address: %ld    Number: %d    Size: %d\n",
+#if HAVE_EXT2_FRAGS
+       fprintf(out, "Fragment:  Address: %d    Number: %d    Size: %d\n",
                inode.i_faddr, inode.i_frag, inode.i_fsize);
-       fprintf(out, "ctime: 0x%08lx -- %s", inode.i_ctime,
+#endif
+       fprintf(out, "ctime: 0x%08x -- %s", inode.i_ctime,
                ctime(&inode.i_ctime));
-       fprintf(out, "atime: 0x%08lx -- %s", inode.i_atime,
+       fprintf(out, "atime: 0x%08x -- %s", inode.i_atime,
                ctime(&inode.i_atime));
-       fprintf(out, "mtime: 0x%08lx -- %s", inode.i_mtime,
+       fprintf(out, "mtime: 0x%08x -- %s", inode.i_mtime,
                ctime(&inode.i_mtime));
        if (inode.i_dtime) 
-         fprintf(out, "dtime: 0x%08lx -- %s", inode.i_dtime,
+         fprintf(out, "dtime: 0x%08x -- %s", inode.i_dtime,
                  ctime(&inode.i_dtime));
-       if (S_ISLNK(inode.i_mode) && inode.i_blocks == 0)
+       if (LINUX_S_ISLNK(inode.i_mode) && inode.i_blocks == 0)
                fprintf(out, "Fast_link_dest: %s\n", (char *)inode.i_block);
        else
                dump_blocks(out, inode_num);
@@ -490,11 +508,12 @@ void do_testb(int argc, char *argv[])
                return;
        } 
        if (ext2fs_test_block_bitmap(fs->block_map,block))
-               printf("Block %ld marked in use\n", block);
-       else printf("Block %ld not in use\n", block);
+               printf("Block %d marked in use\n", block);
+       else printf("Block %d not in use\n", block);
 }
 
-void modify_char(char *com, char *prompt, char *format, u_char *val)
+static void modify_u8(char *com, const char *prompt,
+                     const char *format, __u8 *val)
 {
        char buf[200];
        u_char v;
@@ -514,7 +533,8 @@ void modify_char(char *com, char *prompt, char *format, u_char *val)
                *val = v;
 }
 
-void modify_short(char *com, char *prompt, char *format, u_short *val)
+static void modify_u16(char *com, const char *prompt,
+                      const char *format, __u16 *val)
 {
        char buf[200];
        u_short v;
@@ -534,7 +554,8 @@ void modify_short(char *com, char *prompt, char *format, u_short *val)
                *val = v;
 }
 
-void modify_long(char *com, char *prompt, char *format, u_long *val)
+static void modify_u32(char *com, const char *prompt,
+                      const char *format, __u32 *val)
 {
        char buf[200];
        u_long v;
@@ -562,9 +583,9 @@ void do_modify_inode(int argc, char *argv[])
        int i;
        errcode_t       retval;
        char    buf[80];
-       char *hex_format = "0x%x";
-       char *octal_format = "0%o";
-       char *decimal_format = "%d";
+       const char *hex_format = "0x%x";
+       const char *octal_format = "0%o";
+       const char *decimal_format = "%d";
        
        if (argc != 2) {
                com_err(argv[0], 0, "Usage: modify_inode <file>");
@@ -588,32 +609,36 @@ void do_modify_inode(int argc, char *argv[])
                return;
        }
        
-       modify_short(argv[0], "Mode", octal_format, &inode.i_mode);
-       modify_short(argv[0], "User ID", decimal_format, &inode.i_uid);
-       modify_short(argv[0], "Group ID", decimal_format, &inode.i_gid);
-       modify_long(argv[0], "Size", decimal_format, &inode.i_size);
-       modify_long(argv[0], "Creation time", decimal_format, &inode.i_ctime);
-       modify_long(argv[0], "Modification time", decimal_format, &inode.i_mtime);
-       modify_long(argv[0], "Access time", decimal_format, &inode.i_atime);
-       modify_long(argv[0], "Deletion time", decimal_format, &inode.i_dtime);
-       modify_short(argv[0], "Link count", decimal_format, &inode.i_links_count);
-       modify_long(argv[0], "Block count", decimal_format, &inode.i_blocks);
-       modify_long(argv[0], "File flags", hex_format, &inode.i_flags);
-       modify_long(argv[0], "Reserved1", decimal_format, &inode.i_reserved1);
-       modify_long(argv[0], "File acl", decimal_format, &inode.i_file_acl);
-       modify_long(argv[0], "Directory acl", decimal_format, &inode.i_dir_acl);
-       modify_long(argv[0], "Fragment address", decimal_format, &inode.i_faddr);
-       modify_char(argv[0], "Fragment number", decimal_format, &inode.i_frag);
-       modify_char(argv[0], "Fragment size", decimal_format, &inode.i_fsize);
+       modify_u16(argv[0], "Mode", octal_format, &inode.i_mode);
+       modify_u16(argv[0], "User ID", decimal_format, &inode.i_uid);
+       modify_u16(argv[0], "Group ID", decimal_format, &inode.i_gid);
+       modify_u32(argv[0], "Size", decimal_format, &inode.i_size);
+       modify_u32(argv[0], "Creation time", decimal_format, &inode.i_ctime);
+       modify_u32(argv[0], "Modification time", decimal_format, &inode.i_mtime);
+       modify_u32(argv[0], "Access time", decimal_format, &inode.i_atime);
+       modify_u32(argv[0], "Deletion time", decimal_format, &inode.i_dtime);
+       modify_u16(argv[0], "Link count", decimal_format, &inode.i_links_count);
+       modify_u32(argv[0], "Block count", decimal_format, &inode.i_blocks);
+       modify_u32(argv[0], "File flags", hex_format, &inode.i_flags);
+#if 0
+       modify_u32(argv[0], "Reserved1", decimal_format, &inode.i_reserved1);
+#endif
+       modify_u32(argv[0], "File acl", decimal_format, &inode.i_file_acl);
+       modify_u32(argv[0], "Directory acl", decimal_format, &inode.i_dir_acl);
+       modify_u32(argv[0], "Fragment address", decimal_format, &inode.i_faddr);
+#if HAVE_EXT2_FRAGS
+       modify_u8(argv[0], "Fragment number", decimal_format, &inode.i_frag);
+       modify_u8(argv[0], "Fragment size", decimal_format, &inode.i_fsize);
+#endif
        for (i=0;  i < EXT2_NDIR_BLOCKS; i++) {
                sprintf(buf, "Direct Block #%d", i);
-               modify_long(argv[0], buf, decimal_format, &inode.i_block[i]);
+               modify_u32(argv[0], buf, decimal_format, &inode.i_block[i]);
        }
-       modify_long(argv[0], "Indirect Block", decimal_format,
+       modify_u32(argv[0], "Indirect Block", decimal_format,
                    &inode.i_block[EXT2_IND_BLOCK]);    
-       modify_long(argv[0], "Double Indirect Block", decimal_format,
+       modify_u32(argv[0], "Double Indirect Block", decimal_format,
                    &inode.i_block[EXT2_DIND_BLOCK]);
-       modify_long(argv[0], "Triple Indirect Block", decimal_format,
+       modify_u32(argv[0], "Triple Indirect Block", decimal_format,
                    &inode.i_block[EXT2_TIND_BLOCK]);
        retval = ext2fs_write_inode(fs, inode_num, &inode);
        if (retval) {
@@ -632,11 +657,11 @@ struct list_dir_struct {
        int     col;
 };
 
-int list_dir_proc(struct ext2_dir_entry *dirent,
-                 int   offset,
-                 int   blocksize,
-                 char  *buf,
-                 void  *private)
+static int list_dir_proc(struct ext2_dir_entry *dirent,
+                        int    offset,
+                        int    blocksize,
+                        char   *buf,
+                        void   *private)
 {
        char    name[EXT2_NAME_LEN];
        char    tmp[EXT2_NAME_LEN + 16];
@@ -649,7 +674,7 @@ int list_dir_proc(struct ext2_dir_entry *dirent,
        strncpy(name, dirent->name, thislen);
        name[thislen] = '\0';
 
-       sprintf(tmp, "%ld (%d) %s   ", dirent->inode, dirent->rec_len, name);
+       sprintf(tmp, "%d (%d) %s   ", dirent->inode, dirent->rec_len, name);
        thislen = strlen(tmp);
 
        if (ls->col + thislen > 80) {
@@ -748,8 +773,7 @@ void do_print_working_directory(int argc, char *argv[])
        return;
 }
 
-
-void make_link(char *sourcename, char *destname)
+static void make_link(char *sourcename, char *destname)
 {
        ino_t   inode;
        int     retval;
@@ -810,8 +834,7 @@ void do_link(int argc, char *argv[])
        make_link(argv[1], argv[2]);
 }
 
-
-void unlink_file_by_name(char *filename)
+static void unlink_file_by_name(char *filename)
 {
        int     retval;
        ino_t   dir;
@@ -851,8 +874,8 @@ void do_find_free_block(int argc, char *argv[])
        errcode_t       retval;
        char            *tmp;
        
-       if (argc > 2 || *argv[1] == '?') {
-               com_err(argv[0], 0, "Usage: find_free_block <goal>");
+       if ((argc > 2) || (argc==2 && *argv[1] == '?')) {
+               com_err(argv[0], 0, "Usage: find_free_block [goal]");
                return;
        }
        if (check_fs_open(argv[0]))
@@ -872,7 +895,7 @@ void do_find_free_block(int argc, char *argv[])
        if (retval)
                com_err("ext2fs_new_block", retval, "");
        else
-               printf("Free block found: %ld\n", free_blk);
+               printf("Free block found: %d\n", free_blk);
 
 }
 
@@ -883,8 +906,8 @@ void do_find_free_inode(int argc, char *argv[])
        int     retval;
        char    *tmp;
        
-       if (argc > 3 || *argv[1] == '?') {
-               com_err(argv[0], 0, "Usage: find_free_inode <dir> <mode>");
+       if (argc > 3 || (argc>1 && *argv[1] == '?')) {
+               com_err(argv[0], 0, "Usage: find_free_inode [dir] [mode]");
                return;
        }
        if (check_fs_open(argv[0]))
@@ -905,8 +928,7 @@ void do_find_free_inode(int argc, char *argv[])
                        com_err(argv[0], 0, "Bad mode - %s", argv[2]);
                        return;
                }
-       }
-       else
+       } else
                mode = 010755;
 
        retval = ext2fs_new_inode(fs, dir, mode, 0, &free_inode);
@@ -916,6 +938,263 @@ void do_find_free_inode(int argc, char *argv[])
                printf("Free inode found: %ld\n", free_inode);
 }
 
+struct copy_file_struct {
+       unsigned long size;
+       int     done, fd, blocks;
+       errcode_t err;
+};
+
+static int copy_file_proc(ext2_filsys fs,
+                          blk_t        *blocknr,
+                          int  blockcnt,
+                          void *private)
+{
+       struct copy_file_struct *cs = (struct copy_file_struct *) private;
+       blk_t   new_blk;
+       static blk_t    last_blk = 0;
+       char            *block;
+       errcode_t       retval;
+       int             group;
+       int             nr;
+       
+       if (*blocknr) {
+               new_blk = *blocknr;
+       } else {
+               retval = ext2fs_new_block(fs, last_blk, 0, &new_blk);
+               if (retval) {
+                       cs->err = retval;
+                       return BLOCK_ABORT;
+               }
+       }
+       last_blk = new_blk;
+       block = malloc(fs->blocksize);
+       if (!block) {
+               cs->err = ENOMEM;
+               return BLOCK_ABORT;
+       }
+       if (blockcnt >= 0) {
+               nr = read(cs->fd, block, fs->blocksize);
+       } else {
+               nr = fs->blocksize;
+               memset(block, 0, nr);
+       }
+       if (nr == 0) {
+               cs->done = 1;
+               return BLOCK_ABORT;
+       }
+       if (nr < 0) {
+               cs->err = nr;
+               return BLOCK_ABORT;
+       }
+       retval = io_channel_write_blk(fs->io, new_blk, 1, block);
+       if (retval) {
+               cs->err = retval;
+               return BLOCK_ABORT;
+       }
+       free(block);
+       if (blockcnt >= 0)
+               cs->size += nr;
+       cs->blocks += fs->blocksize / 512;
+       printf("%ld(%d) ", cs->size, blockcnt);
+       fflush(stdout);
+       if (nr < fs->blocksize) {
+               cs->done = 1;
+               printf("\n");
+       }
+       *blocknr = new_blk;
+       ext2fs_mark_block_bitmap(fs->block_map, new_blk);
+       ext2fs_mark_bb_dirty(fs);
+       group = ext2fs_group_of_blk(fs, new_blk);
+       fs->group_desc[group].bg_free_blocks_count--;
+       fs->super->s_free_blocks_count--;
+       ext2fs_mark_super_dirty(fs);
+       if (cs->done)
+               return (BLOCK_CHANGED | BLOCK_ABORT);
+       else
+               return BLOCK_CHANGED;
+}
+
+static errcode_t copy_file(int fd, ino_t newfile)
+{
+       errcode_t       retval;
+       struct  copy_file_struct cs;
+       struct ext2_inode       inode;
+
+       cs.fd = fd;
+       cs.done = 0;
+       cs.err = 0;
+       cs.size = 0;
+       cs.blocks = 0;
+       
+       retval = ext2fs_block_iterate(fs, newfile, BLOCK_FLAG_APPEND,
+                                     0, copy_file_proc, &cs);
+
+       if (cs.err)
+               return cs.err;
+       if (!cs.done)
+               return EXT2_ET_EXPAND_DIR_ERR;
+
+       /*
+        * Update the size and block count fields in the inode.
+        */
+       retval = ext2fs_read_inode(fs, newfile, &inode);
+       if (retval)
+               return retval;
+       
+       inode.i_blocks += cs.blocks;
+
+       retval = ext2fs_write_inode(fs, newfile, &inode);
+       if (retval)
+               return retval;
+
+       return 0;
+}
+
+void do_write(int argc, char *argv[])
+{
+       int     fd;
+       struct stat statbuf;
+       ino_t   newfile;
+       errcode_t retval;
+       struct ext2_inode inode;
+
+       if (check_fs_open(argv[0]))
+               return;
+       if (argc != 3) {
+               com_err(argv[0], 0, "Usage: write <nativefile> <newfile>");
+               return;
+       }
+       if (!(fs->flags & EXT2_FLAG_RW)) {
+               com_err(argv[0], 0, "read-only filesystem");
+               return;
+       }
+       fd = open(argv[1], O_RDONLY);
+       if (fd < 0) {
+               com_err(argv[1], fd, "");
+               return;
+       }
+       if (fstat(fd, &statbuf) < 0) {
+               com_err(argv[1], errno, "");
+               close(fd);
+               return;
+       }
+
+       retval = ext2fs_new_inode(fs, cwd, 010755, 0, &newfile);
+       if (retval) {
+               com_err(argv[0], retval, "");
+               close(fd);
+               return;
+       }
+       printf("Allocated inode: %ld\n", newfile);
+       retval = ext2fs_link(fs, cwd, argv[2], newfile, 0);
+       if (retval) {
+               com_err(argv[2], retval, "");
+               close(fd);
+               return;
+       }
+        if (ext2fs_test_inode_bitmap(fs->inode_map,newfile))
+               com_err(argv[0], 0, "Warning: inode already set");
+       ext2fs_mark_inode_bitmap(fs->inode_map,newfile);
+       ext2fs_mark_ib_dirty(fs);
+       memset(&inode, 0, sizeof(inode));
+       inode.i_mode = statbuf.st_mode;
+       inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL);
+       inode.i_links_count = 1;
+       inode.i_size = statbuf.st_size;
+       ext2fs_write_inode(fs, newfile, &inode);
+       retval = ext2fs_write_inode(fs, newfile, &inode);
+       if (retval) {
+               com_err(argv[0], retval, "while trying to write inode %d", inode);
+               close(fd);
+               return;
+       }
+       if (LINUX_S_ISREG(inode.i_mode)) {
+               retval = copy_file(fd, newfile);
+               if (retval)
+                       com_err("copy_file", retval, "");
+       }
+       close(fd);
+}
+
+void do_mknod(int argc, char *argv[])
+{
+       unsigned long mode, major, minor, nr;
+       ino_t   newfile;
+       errcode_t retval;
+       struct ext2_inode inode;
+
+       if (check_fs_open(argv[0]))
+               return;
+       if (argc < 3 || argv[2][1]) {
+               com_err(argv[0], 0, "Usage: mknod <name> [p| [c|b] <major> <minor>]");
+               return;
+       }
+       mode = minor = major = 0;
+       switch (argv[2][0]) {
+               case 'p':
+                       mode = LINUX_S_IFIFO;
+                       nr = 3;
+                       break;
+               case 'c':
+                       mode = LINUX_S_IFCHR;
+                       nr = 5;
+                       break;
+               case 'b':
+                       mode = LINUX_S_IFBLK;
+                       nr = 5;
+                       break;
+               default:
+                       nr = 0;
+       }
+       if (nr == 5) {
+               major = strtoul(argv[3], argv+3, 0);
+               minor = strtoul(argv[4], argv+4, 0);
+               if (major > 255 || minor > 255 || argv[3][0] || argv[4][0])
+                       nr = 0;
+       }
+       if (argc != nr) {
+               com_err(argv[0], 0, "Usage: mknod <name> [p| [c|b] <major> <minor>]");
+               return;
+       }
+       if (!(fs->flags & EXT2_FLAG_RW)) {
+               com_err(argv[0], 0, "read-only filesystem");
+               return;
+       }
+       retval = ext2fs_new_inode(fs, cwd, 010755, 0, &newfile);
+       if (retval) {
+               com_err(argv[0], retval, "");
+               return;
+       }
+       printf("Allocated inode: %ld\n", newfile);
+       retval = ext2fs_link(fs, cwd, argv[1], newfile, 0);
+       if (retval) {
+               if (retval == EXT2_ET_DIR_NO_SPACE) {
+                       retval = ext2fs_expand_dir(fs, cwd);
+                       if (!retval)
+                               retval = ext2fs_link(fs, cwd, argv[1], newfile, 0);
+               }
+               if (retval) {
+                       com_err(argv[1], retval, "");
+                       return;
+               }
+       }
+        if (ext2fs_test_inode_bitmap(fs->inode_map,newfile))
+               com_err(argv[0], 0, "Warning: inode already set");
+       ext2fs_mark_inode_bitmap(fs->inode_map,newfile);
+       ext2fs_mark_ib_dirty(fs);
+       memset(&inode, 0, sizeof(inode));
+       inode.i_mode = mode;
+       inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL);
+       inode.i_block[0] = major*256+minor;
+       inode.i_links_count = 1;
+       ext2fs_write_inode(fs, newfile, &inode);
+       retval = ext2fs_write_inode(fs, newfile, &inode);
+       if (retval) {
+               com_err(argv[0], retval, "while trying to write inode %d", inode);
+               return;
+       }
+}
+
 void do_mkdir(int argc, char *argv[])
 {
        char    *cp;
@@ -960,9 +1239,10 @@ void do_rmdir(int argc, char *argv[])
 }
 
 
-int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, int blockcnt, void *private)
+static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr,
+                              int blockcnt, void *private)
 {
-       printf("%ld ", *blocknr);
+       printf("%d ", *blocknr);
        ext2fs_unmark_block_bitmap(fs->block_map,*blocknr);
        return 0;
 }
@@ -1028,7 +1308,7 @@ void do_rm(int argc, char *argv[])
                return;
        }
 
-       if (S_ISDIR(inode.i_mode)) {
+       if (LINUX_S_ISDIR(inode.i_mode)) {
                com_err(argv[0], 0, "file is a directory");
                return;
        }
@@ -1078,11 +1358,11 @@ void do_expand_dir(int argc, char *argv[])
 
 void main(int argc, char **argv)
 {
-       int     retval;
-       int     sci_idx;
-       char    *usage = "Usage: debugfs [[-w] device]";
-       char    c;
-       int open_flags = 0;
+       int             retval;
+       int             sci_idx;
+       const char      *usage = "Usage: debugfs [[-w] device]";
+       char            c;
+       int             open_flags = 0;
        
        initialize_ext2_error_table();
 
index f7f5f0862d805d57fc14e8f9a62c7eb12898695c..7c3c21411608848a1168482d9609d871429bf836 100644 (file)
@@ -5,6 +5,13 @@
 #include <linux/ext2_fs.h>
 #include "ext2fs/ext2fs.h"
 
+#ifdef __STDC__
+#define NOARGS void
+#else
+#define NOARGS
+#define const
+#endif
+
 extern ext2_filsys fs;
 extern ino_t   root, cwd;
 
@@ -14,5 +21,57 @@ extern int check_fs_open(char *name);
 extern int check_fs_not_open(char *name);
 extern ino_t string_to_inode(char *str);
 
+/* ss command functions */
+
+/* dump.c */
+extern void do_dump(int argc, char **argv);
+extern void do_cat(int argc, char **argv);
+
+/* lsdel.c */
+extern void do_lsdel(int argc, char **argv);
+
+/* icheck.c */
+extern void do_icheck(int argc, char **argv);
+
+/* ncheck.c */
+extern void do_ncheck(int argc, char **argv);
+
+/* debugfs.c */
+
+extern void do_open_filesys(int argc, char **argv);
+extern void do_close_filesys(int argc, char **argv);
+extern void do_init_filesys(int argc, char **argv);
+extern void do_show_super_stats(int argc, char **argv);
+extern void do_kill_file(int argc, char **argv);
+extern void do_rm(int argc, char **argv);
+extern void do_link(int argc, char **argv);
+extern void do_unlink(int argc, char **argv);
+extern void do_find_free_block(int argc, char **argv);
+extern void do_find_free_inode(int argc, char **argv);
+extern void do_stat(int argc, char **argv);
+
+extern void do_chroot(int argc, char **argv);
+extern void do_clri(int argc, char **argv);
+extern void do_freei(int argc, char **argv);
+extern void do_seti(int argc, char **argv);
+extern void do_testi(int argc, char **argv);
+extern void do_freeb(int argc, char **argv);
+extern void do_setb(int argc, char **argv);
+extern void do_testb(int argc, char **argv);
+extern void do_modify_inode(int argc, char **argv);
+extern void do_list_dir(int argc, char **argv);
+extern void do_change_working_dir(int argc, char **argv);
+extern void do_print_working_directory(int argc, char **argv);
+extern void do_write(int argc, char **argv);
+extern void do_mknod(int argc, char **argv);
+extern void do_mkdir(int argc, char **argv);
+extern void do_rmdir(int argc, char **argv);
+extern void do_show_debugfs_params(int argc, char **argv);
+extern void do_expand_dir(int argc, char **argv);
+
+
+
+
+
 
 
index 06c588def8ab0fdb4257ab1d1338cc6f043bb460..7223bf57677bf97df7d925545cee05a5a9b12238 100644 (file)
@@ -11,7 +11,9 @@
 #include <ctype.h>
 #include <string.h>
 #include <time.h>
-#include <getopt.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -24,8 +26,8 @@ struct dump_block_struct {
        errcode_t       errcode;
 };
 
-int dump_block(ext2_filsys fs, blk_t *blocknr, int blockcnt, void
-              *private)
+static int dump_block(ext2_filsys fs, blk_t *blocknr, int blockcnt,
+                     void *private)
 {
        ssize_t nbytes;
        
@@ -58,7 +60,7 @@ retry_write:
        return 0;
 }
 
-void dump_file(char *cmdname, ino_t inode, int fd, char *outname)
+static void dump_file(char *cmdname, ino_t inode, int fd, char *outname)
 {
        errcode_t retval;
        struct dump_block_struct rec;
index 848c76a3b8c083136c807a1eac5243d35362ae22..ef053f5c104f3a6cf588eab5d2c0af4b98c791c1 100644 (file)
 #include <ctype.h>
 #include <string.h>
 #include <time.h>
-#include <getopt.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #include "debugfs.h"
 
@@ -29,10 +30,10 @@ struct block_walk_struct {
        ino_t                   inode;
 };
 
-int icheck_proc(ext2_filsys fs,
-               blk_t   *block_nr,
-               int blockcnt,
-               void *private)
+static int icheck_proc(ext2_filsys fs,
+                      blk_t    *block_nr,
+                      int blockcnt,
+                      void *private)
 {
        struct block_walk_struct *bw = (struct block_walk_struct *) private;
        int     i;
index 3da9a9efc7684fac98ddcd389dbca15c3072d242..8df894e9648073348045e838196a65f8527a73e8 100644 (file)
@@ -11,7 +11,9 @@
 #include <ctype.h>
 #include <string.h>
 #include <time.h>
-#include <getopt.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -34,20 +36,20 @@ struct lsdel_struct {
        int                     bad_blocks;
 };
 
-int deleted_info_compare(const void *a, const void *b)
+static int deleted_info_compare(const void *a, const void *b)
 {
-       struct deleted_info *arg1, *arg2;
+       const struct deleted_info *arg1, *arg2;
 
-       arg1 = (struct deleted_info *) a;
-       arg2 = (struct deleted_info *) b;
+       arg1 = (const struct deleted_info *) a;
+       arg2 = (const struct deleted_info *) b;
 
        return arg1->dtime - arg2->dtime;
 }
 
-int lsdel_proc(ext2_filsys fs,
-              blk_t    *block_nr,
-              int blockcnt,
-              void *private)
+static int lsdel_proc(ext2_filsys fs,
+                     blk_t     *block_nr,
+                     int blockcnt,
+                     void *private)
 {
        struct lsdel_struct *lsd = (struct lsdel_struct *) private;
 
index 062e7c53e18cdff3f006c642c883714bba0e0fe6..b5298c2605eec83b6c59b8a9d3bc1fb262574855 100644 (file)
 #include <ctype.h>
 #include <string.h>
 #include <time.h>
-#include <getopt.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #include "debugfs.h"
 
@@ -31,11 +32,11 @@ struct inode_walk_struct {
        ino_t                   parent;
 };
 
-int ncheck_proc(struct ext2_dir_entry *dirent,
-               int     offset,
-               int     blocksize,
-               char    *buf,
-               void    *private)
+static int ncheck_proc(struct ext2_dir_entry *dirent,
+                      int      offset,
+                      int      blocksize,
+                      char     *buf,
+                      void     *private)
 {
        struct inode_walk_struct *iw = (struct inode_walk_struct *) private;
        int     i;
@@ -113,7 +114,7 @@ void do_ncheck(int argc, char **argv)
                if (inode.i_dtime)
                        goto next;
                /* Ignore anything that isn't a directory */
-               if (!S_ISDIR(inode.i_mode))
+               if (!LINUX_S_ISDIR(inode.i_mode))
                        goto next;
 
                iw.position = 0;
diff --git a/depfix.sed b/depfix.sed
new file mode 100644 (file)
index 0000000..1bcf112
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Insert the header.....
+#
+1i\
+# +++ Dependency line eater +++\
+# \
+# Makefile dependencies follow.  This must be the last section in\
+# the Makefile.in file\
+#
+
+#
+# Remove line continuations....
+#
+#:FIRST
+#y/    / /
+#s/^ *//
+#/\\$/{
+#N
+#y/    / /
+#s/\\\n */ /
+#bFIRST
+#}
+#s/  */ /g
+
+s;/usr/include/[^ ]* *;;g
+s;/usr/lib/[^ ]* *;;g
+s;/mit/cygnus[^ ]* *;;g
+
+#
+# Now insert a trailing newline...
+#
+$a\
+
index e9715c62698604da6c7ec295fa2a24407d8bf649..0ffb52eeca3a5e3261017e594f353d316a627a06 100644 (file)
@@ -1,8 +1,8 @@
-badblocks.o : badblocks.c /usr/include/time.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h e2fsck.h \
+badblocks.o : ./badblocks.c /usr/include/time.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ./e2fsck.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
   /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/sys/stat.h \
   /usr/include/linux/stat.h /usr/include/sys/time.h /usr/include/linux/time.h \
@@ -15,12 +15,12 @@ badblocks.o : badblocks.c /usr/include/time.h /usr/include/features.h /usr/inclu
   /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
   /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h \
   ../lib/ext2fs/bitops.h 
-dirinfo.o : dirinfo.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+dirinfo.o : ./dirinfo.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/sys/time.h \
   /usr/include/linux/time.h /usr/include/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
   /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
@@ -31,35 +31,36 @@ dirinfo.o : dirinfo.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/incl
   /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
   /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
   ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-e2fsck.o : e2fsck.c /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h \
+e2fsck.o : ./e2fsck.c /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/fcntl.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/linux/fcntl.h \
-  /usr/include/ctype.h /usr/include/termios.h /usr/include/linux/termios.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h \
-  /usr/include/mntent.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
-  /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/malloc.h ../lib/et/com_err.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h e2fsck.h /usr/include/stdlib.h \
-  /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/sys/time.h \
-  /usr/include/linux/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
-  /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
-  /usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
-  /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
-  /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
-  /usr/include/linux/msdos_fs_i.h /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h \
-  /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
-  /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
-  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h ../version.h 
-ehandler.o : ehandler.c /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/gnu/types.h \
+  /usr/include/linux/fcntl.h /usr/include/ctype.h /usr/include/termios.h /usr/include/linux/termios.h \
+  /usr/include/time.h /usr/include/getopt.h /usr/include/unistd.h /usr/include/posix_opt.h \
+  /usr/include/confname.h /usr/include/mntent.h /usr/include/stdio.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
+  /usr/include/malloc.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./e2fsck.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h /usr/include/sys/time.h /usr/include/linux/time.h \
+  /usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
+  /usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
+  /usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
+  /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
+  /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
+  /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
+  /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
+  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h \
+  ../lib/ext2fs/bitops.h ./../version.h 
+ehandler.o : ./ehandler.c /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/unistd.h \
-  /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/string.h /usr/include/ctype.h /usr/include/termios.h \
-  /usr/include/linux/termios.h /usr/include/sys/resource.h /usr/include/sys/time.h \
-  /usr/include/linux/time.h /usr/include/time.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
+  /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/string.h /usr/include/ctype.h \
+  /usr/include/termios.h /usr/include/linux/termios.h /usr/include/sys/resource.h \
+  /usr/include/sys/time.h /usr/include/linux/time.h /usr/include/time.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
   /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
-  /usr/include/linux/resource.h e2fsck.h /usr/include/stdio.h /usr/include/libio.h \
+  /usr/include/linux/resource.h ./e2fsck.h /usr/include/stdio.h /usr/include/libio.h \
   /usr/include/_G_config.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/fs.h \
   /usr/include/linux/linkage.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
   /usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
@@ -70,11 +71,11 @@ ehandler.o : ehandler.c /usr/include/stdlib.h /usr/include/features.h /usr/inclu
   /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
   ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
   ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-flushb.o : flushb.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+flushb.o : ./flushb.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/sys/ioctl.h \
   /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
   /usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
@@ -84,18 +85,18 @@ flushb.o : flushb.c /usr/include/stdio.h /usr/include/features.h /usr/include/sy
   /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
   /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
   /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h 
-mtrace.o : mtrace.c ./malloc.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+mtrace.o : ./mtrace.c ././malloc.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/libio.h \
   /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
   /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
   /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h 
-pass1.o : pass1.c /usr/include/time.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h e2fsck.h \
+pass1.o : ./pass1.c /usr/include/time.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ./e2fsck.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
   /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/sys/stat.h \
   /usr/include/linux/stat.h /usr/include/sys/time.h /usr/include/linux/time.h \
@@ -108,11 +109,11 @@ pass1.o : pass1.c /usr/include/time.h /usr/include/features.h /usr/include/sys/c
   /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
   /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h \
   ../lib/ext2fs/bitops.h 
-pass1b.o : pass1b.c /usr/include/time.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h e2fsck.h \
+pass1b.o : ./pass1b.c /usr/include/time.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ./e2fsck.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
   /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/sys/stat.h \
   /usr/include/linux/stat.h /usr/include/sys/time.h /usr/include/linux/time.h \
@@ -125,12 +126,12 @@ pass1b.o : pass1b.c /usr/include/time.h /usr/include/features.h /usr/include/sys
   /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
   /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h \
   ../lib/ext2fs/bitops.h 
-pass2.o : pass2.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+pass2.o : ./pass2.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/sys/time.h \
   /usr/include/linux/time.h /usr/include/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
   /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
@@ -141,12 +142,12 @@ pass2.o : pass2.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/
   /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
   /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
   ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-pass3.o : pass3.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+pass3.o : ./pass3.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/sys/time.h \
   /usr/include/linux/time.h /usr/include/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
   /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
@@ -157,11 +158,28 @@ pass3.o : pass3.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/
   /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
   /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
   ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-pass4.o : pass4.c e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+pass4.o : ./pass4.c ./e2fsck.h /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
+  /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/sys/stat.h \
+  /usr/include/linux/stat.h /usr/include/sys/time.h /usr/include/linux/time.h \
+  /usr/include/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
+  /usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
+  /usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
+  /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
+  /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
+  /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
+  /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
+  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
+pass5.o : ./pass5.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/sys/time.h \
   /usr/include/linux/time.h /usr/include/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
   /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
@@ -171,17 +189,22 @@ pass4.o : pass4.c e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/inc
   /usr/include/linux/msdos_fs_i.h /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h \
   /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
   /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
-  ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
-  ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-pass5.o : pass5.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  e2fsck.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/sys/time.h \
-  /usr/include/linux/time.h /usr/include/time.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
-  /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
+  ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
+scantest.o : ./scantest.c /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/fcntl.h /usr/include/sys/types.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/gnu/types.h \
+  /usr/include/linux/fcntl.h /usr/include/ctype.h /usr/include/termios.h /usr/include/linux/termios.h \
+  /usr/include/time.h /usr/include/getopt.h /usr/include/unistd.h /usr/include/posix_opt.h \
+  /usr/include/confname.h /usr/include/mntent.h /usr/include/stdio.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
+  /usr/include/malloc.h /usr/include/sys/resource.h /usr/include/sys/time.h /usr/include/linux/time.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h \
+  /usr/include/limits.h /usr/include/posix1_lim.h /usr/include/linux/limits.h \
+  /usr/include/posix2_lim.h /usr/include/linux/resource.h ../lib/et/com_err.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ./../version.h /usr/include/stdlib.h \
+  /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/fs.h \
+  /usr/include/linux/linkage.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
   /usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
   /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
   /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
@@ -189,38 +212,16 @@ pass5.o : pass5.c ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/
   /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
   /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
   ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h 
-scantest.o : scantest.c /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/fcntl.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/linux/fcntl.h \
-  /usr/include/ctype.h /usr/include/termios.h /usr/include/linux/termios.h /usr/include/time.h \
-  /usr/include/getopt.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h \
-  /usr/include/mntent.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
-  /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/malloc.h /usr/include/sys/resource.h \
-  /usr/include/sys/time.h /usr/include/linux/time.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
-  /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
-  /usr/include/linux/resource.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ../version.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/sys/stat.h \
-  /usr/include/linux/stat.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
-  /usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
-  /usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
-  /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
-  /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
-  /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
-  /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
-  /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h \
-  ../lib/ext2fs/bitops.h 
-util.o : util.c /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
+util.o : ./util.c /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/unistd.h \
-  /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/string.h /usr/include/ctype.h /usr/include/termios.h \
-  /usr/include/linux/termios.h /usr/include/sys/resource.h /usr/include/sys/time.h \
-  /usr/include/linux/time.h /usr/include/time.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
+  /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/string.h /usr/include/ctype.h \
+  /usr/include/termios.h /usr/include/linux/termios.h /usr/include/sys/resource.h \
+  /usr/include/sys/time.h /usr/include/linux/time.h /usr/include/time.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
   /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
-  /usr/include/linux/resource.h e2fsck.h /usr/include/stdio.h /usr/include/libio.h \
+  /usr/include/linux/resource.h ./e2fsck.h /usr/include/stdio.h /usr/include/libio.h \
   /usr/include/_G_config.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/fs.h \
   /usr/include/linux/linkage.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
   /usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
index be0ac6cd761c8921b2d377b55fbd5bbedf15ab81..847d9cd49ab1901dc76fb06929e6a89a9c14cacc 100644 (file)
@@ -1,3 +1,256 @@
+Thu Oct 26 12:05:30 1995    <tytso@rsts-11.mit.edu>
+
+       * Makefile.in (install): Strip programs when they are installed.
+               (e2fsck): Build e2fsck statically.
+
+Wed Oct 25 21:18:16 1995    <tytso@rsts-11.mit.edu>
+
+       * util.c (preenhalt): Preenhalt now takes an argument, which is an
+               ext2fs_filsys; this allows it to set the EXT2_ERROR_FS
+               flag in the superblock in cases where preenhalt is called.
+               All calls to preenhalt() were changed to either
+               preenhalt(fs) or preenhalt(NULL) in a few cases where the
+               fs pointer was not available.  (Most notable, for block
+               read/write errors.)
+
+Mon Sep  4 21:41:03 1995  Remy Card  <card@bbj>
+
+       * ehandler.c:
+         util.c: Include <sys/time.h> before <sys/resource.h>.  BSD needs it.
+
+Mon Sep  4 10:14:49 1995    <tytso@rsts-11.mit.edu>
+
+       * e2fsck.c (show_stats): Show statistics about how many inodes
+               have indirect, doubly indirect, and triply indirect
+               blocks.  Allow up to 8 digits for statistics, instead of
+               merely 6, so things look pretty for large filesystems.
+
+       * pass1.c (pass1): Keep statistics about indirect, doubly
+               indirect, and triply indirect blocks.
+
+       * pass1.c (unwind_pass1): Clear the above statistics when unwinding
+               pass 1.
+
+Fri Aug 18 15:17:10 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * util.c, ehandler.c: Move #include of <sys/resource.h> after
+               #include of "e2fsck.h", since sys/resource.h may depend on
+               sys/time.h, which is #included in e2fsck.h.
+
+Thu Aug 17 22:33:37 1995    <tytso@rsts-11.mit.edu>
+
+       * e2fsck.c (check_mount):  Use the new ext2fs_check_if_mounted()
+               function to determine if the device is mounted.
+
+       * e2fsck.c (main):  Add better error messages if ext2fs_open()
+               fails. 
+
+Wed Aug 16 16:25:02 1995    <tytso@rsts-11.mit.edu>
+
+       * pass1.c (check_blocks): If we're clearing a directory, clear
+               pb.is_dir so we don't do the following check of making
+               sure the directory size matches; this is pointless, since
+               we've already cleared the inode.
+
+Fri Aug 11 09:08:54 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * pass1.c (bad_primary_block): New function, called by
+               process_bad_block, which explains the facts of life to the
+               user when a block in the primary superblock or primary
+               group descriptors is bad.
+
+       * pass2.c (check_dot): Handle the case where the first directory
+               entry is used, but not ".".
+
+       * pass2.c (check_dotdot): Handle the case where the second directory
+               entry is used, but is not "..".
+
+Thu Aug 10 10:05:10 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * e2fsck.c (check_super_block): Get the size of the physical
+               device and if it is smaller than the reported size of the
+               filesystem, report an error.
+
+Sat Aug 12 03:39:18 1995  Remy Card  <card@bbj>
+
+       * e2fsck.c (check_if_skip): Print the number of allocated files and
+               blocks on clean filesystems.
+
+Fri Aug 11 14:15:36 1995  Remy Card  <card@bbj>
+
+       * e2fsck.8: Updated date and version number.
+
+Thu Aug 10 14:26:01 1995  Remy Card  <card@bbj>
+
+       * pass1.c (check_blocks): Check that directory size matches *exactly*
+               the count of allocated blocks.
+
+Wed Aug  9 21:21:24 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * pass1b.c (pass1d): Free the shared[] array when we're done with
+               it to avoid a memory leak.
+
+       * pass1.c (unwind_pass1): Use ext2fs_free_block_bitmap to free the
+               block_dup_map.
+
+       * pass2.c (process_bad_inode): When clearing the inode, make sure
+               the pathname is freed, to prevent a memory leak.
+
+       * pass5.c (check_inode_bitmaps): Free free_array and dir_array
+               when we're finished with them.
+               (check_block_bitmaps): Free free_array when we're finished
+               with them.
+
+       * Makefile.in (e2fsck, flushb): Use $(LD) instead of $(CC) when
+               linking the executable.
+
+       * pass2.c (process_bad_inode): Even on OS's that don't support the
+               fragment fields, make sure the Linux equivalent fields are
+               set to zero.  If an OS wants to reuse these fields, which
+               is probably a bad idea (although we may get desperate in
+               the future) this code will have to be changed.
+
+       * pass1.c (dir_block_cmp): If the block numbers are equal, compare
+               on the inode field, and then blockcnt field.  This is just
+               to keep the ordering of dir_blocks the same on all
+               platforms when there are more than on missing directory
+               blocks, which are indicated directories with holes, which
+               are indicated with the block number being set to zero.
+
+Sun Aug  6 15:40:58 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * pass1.c (check_blocks, process_block): check_blocks() modified
+               to call the ext2fs_block_iterate() with BLOCK_FLAG_HOLE if
+               the inode is a directory.  process_block() now checks to
+               see if a directory has a "hole", or missing block.  If so,
+               this fact is recorded in the directory block list so that
+               the problem can be resolved in pass #2.
+
+       * pass2.c (allocate_dir_block): Added allocate_dir_block() to
+               allocate new blocks for directories with "holes".  Called
+               out of check_dir_block if a block in the directory block
+               list is zero.
+
+       * pass3.c (get_lost_and_found): Move location of free(block) to
+               prevent possible memory leak.
+
+Sat Aug  5 12:42:22 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * pass2.c (check_dir_block): Use a automatic, fixed-saize array
+               instead of alloca() --- alloca is not portable!  Check to
+               make sure the filename is not longer than EXT2_NAME_LEN,
+               and offer to fix it by truncating it, since it should
+               never happen.
+
+       * e2fsck.c (PRS): Use malloc() instead of alloca() --- alloca() is
+               not portable!!  In any case putenv() in some systems must
+               take a static character array or malloc()'ed memory;
+               passing memory allocated using alloca() to putenv() is not
+               advisable.
+
+       * pass2.c (check_dot, check_dotdot): Use malloc() instead of
+               alloca() --- alloca() is not portable!!!
+
+Tue Jul 18 20:04:02 1995    <tytso@rsx-11.mit.edu>
+
+       * pass1b.c (pass1c): 
+       * pass3.c (check_root, get_lost_and_found): 
+       * pass2.c (check_dir_block): Use ext2fs_{read,write}_dir_block
+               to read/write the directory block.
+
+Mon Jul 17 04:00:56 1995    <tytso@rsx-11.mit.edu>
+
+       * util.c (ask_yn): Apply patch supplied by Peter A. Zaitcev to
+               make sure VMIN and VTIME are set correct.
+
+Fri Jul 14 19:26:29 1995    <tytso@rsx-11.mit.edu>
+
+       * pass1.c (mark_block_used): Change to be an inline function.
+               Assume that the block validity checks are already done,
+               and use the fast variant of the bitmap functions.
+
+Thu Jul 13 08:10:55 1995    <tytso@rsx-11.mit.edu>
+
+       * pass5.c (check_block_bitmaps, check_inode_bitmaps): Check the
+               bounds of the bitmaps in advance, and then use the fast
+               variant of e2fs_test_{block,inode}_bitmap.
+
+       * pass1.c (mark_block_used): Use ext2_fast_mark_block_bitmap since
+               the bounds checking has already been done earlier.
+
+Wed Jul 12 02:22:46 1995    <tytso@rsx-11.mit.edu>
+
+       * pass1.c (pass1): Allocate and free the block_illegal_map, which
+               is used for shortcut processing in process_block.
+               (mark_table_blocks): Initialize block_illegal_map with the
+               filesystem blocks.
+               (describe_illegal_block): New helper function that
+               describes why a block is illegal.
+               (process_block): Use block_illegal_map as a shortcut
+               to determine whether a block is bad.  Use
+               describe_illegal_block to print out why the block is illegal.
+
+Mon Jun 12 19:11:06 1995  Theodore Y. Ts'o  (tytso@dcl)
+
+       * flushb.c: Don't include <linux/fs.h> if it doesn't exist.
+
+       * scantest.c: Don't include <linux/fs.h>, <getopt.h>, or
+               <mntent.h> if they don't exist.  (Mostly so that "make
+               depend" works.)
+
+       * pass1.c, pass1b.c, pass3.c, badblocks.c: Include <errno.h> (if
+               it exists).
+
+       * e2fsck.c, scantest.c: Don't include <getopt.h> if it doesn't
+               exist. 
+
+Mon Jun 12 08:37:49 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * pass2.c (process_bad_inode, check_for_zero_long,
+               check_for_zero_char):  Change long to u32, and char to u8.
+
+Sun Jun 11 15:05:57 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * util.c (inode_has_valid_blocks): 
+       * pass2.c (process_bad_inode): 
+       * pass1.c (pass1, check_blocks, pass1_check_directory): Use
+               LINUX_S_IS* instead of S_IS*.
+
+       * e2fsck.h: Don't #include <sys/stat.h>
+
+       * flushb.c (main): Add #ifdef BLKFLSBUF around ioctl.  (Although
+               this program is pretty much useless if BLKFLSBUF isn't
+               supported.)
+
+       * e2fsck.c, badblocks.c: Add #include <errno.h>, since errno is
+               used.
+
+Thu Jun  8 12:31:19 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * pass2.c (check_dot, check_dotdot, check_dir_block): Use alloca
+       to allocate space for file names instead of using fixed size buffers.
+       (process_bad_inode): Only check inode frag fields if
+       HAVE_EXT2_FRAGS is defined (by configure).
+       * pass1.c (pass1): Only check the inode frag fields if
+       HAVE_EXT2_FRAGS is defined (by configure).
+
+       * e2fsck.c (check_mount): Only check for a mounted filesystem if
+       HAVE_MNTENT_H is defined (by configure).
+       (PRS): Use alloca to allocate the new path string, instead of
+       having a fixed size buffer (which was the wrong size anyway).
+       (PRS): Only support the -F (flush) option if the BLKFLSBUF ioctl
+       is defined.
+
+       * e2fsck.h: Only include <linux/fs.h> if HAVE_LINUX_FS_H is
+       defined (by configure).
+
+       * Makefile.in: Rewritten to conform to GNU coding standards and
+       support separate compilation directories.
+
+Thu Apr  6 15:04:36 1995  Remy Card  <card@bbj.ibp.fr>
+
+       * pass1.c (pass1): Test the mode in reserved inodes (must be zero).
+
 Sat Mar 11 13:12:16 1995  Theodore Y. Ts'o  <tytso@localhost>
 
        * pass1.c (unwind_pass1): Clear the file type statistics counter
diff --git a/e2fsck/Makefile b/e2fsck/Makefile
deleted file mode 100644 (file)
index a8e0f75..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# Makefile for e2fsck
-#
-
-include ../MCONFIG
-
-MK_CMDS=       ../lib/ss/mk_cmds
-CFLAGS=                $(PROF) $(OPT) $(MTRACE) $(MCHECK) $(WFLAGS) -I../lib
-LDFLAGS=       $(PROF) $(OPT)
-PROGS=         e2fsck flushb
-MANPAGES=      e2fsck.8
-
-LIBS= -L../lib -lss -lcom_err -lext2fs $(CHECKLIB)
-DEPLIBS= ../lib/libss.a ../lib/libcom_err.a ../lib/libext2fs.a
-
-#
-# Flags for using Checker
-#      Note: The optimization flags must include -g
-#
-#MCHECK=       -checker
-#LIBS= -L../lib -lss -lcom_err -le2fs $(CHECKLIB)
-#DEPLIBS= ../lib/libss.a ../lib/libcom_err.a ../lib/libext2fs.a
-#CHECKLIB= /usr/lib/libchecker.o
-
-#
-# Flags for doing mtrace --- uncomment to produce mtracing e2fsck
-#      Note:  The optimization flags must include -g
-#
-#MTRACE=       -DMTRACE
-#MTRACE_OBJ= mtrace.o
-#OPT= -g
-
-#
-# Flags for doing mcheck --- uncomment to produce mchecking e2fsck
-#      Note:  The optimization flags must include -g
-#
-#MCHECK= -DMCHECK
-
-#
-# Flags for profiling --- uncomment to produce profiling e2fsck
-#
-#PROF=         -pg
-#LIBS= -L../lib -lss -lcom_err_p -lext2fs_p 
-#DEPLIBS= ../lib/libss.a ../lib/libcom_err_p.a ../lib/libext2fs_p.a
-
-OBJS= e2fsck.o pass1.o pass1b.o pass2.o pass3.o pass4.o pass5.o \
-       badblocks.o util.o dirinfo.o ehandler.o $(MTRACE_OBJ)
-
-all: $(PROGS)
-
-#e2fsck: $(OBJS)  $(DEPLIBS)
-#      cc $(LDFLAGS) -o e2fsck $(OBJS) $(LIBS) 
-
-e2fsck: $(OBJS)  $(DEPLIBS)
-       $(CC) $(LDFLAGS) -static -o e2fsck $(OBJS) $(LIBS) 
-
-flushb: flushb.o
-       $(CC) $(LDFLAGS) -o flushb flushb.o $(CHECKLIB)
-
-install:: $(PROGS)
-       $(INSTALLBIN) e2fsck $(SBINDIR)/e2fsck
-       $(INSTALLBIN) flushb $(USRSBINDIR)/flushb
-       ln -sf e2fsck $(SBINDIR)/fsck.ext2
-
-install:: $(MANPAGES)
-       for i in $(MANPAGES); do \
-               $(INSTALLMAN) $$i $(SMANDIR)/$$i; \
-       done
-
-install-tree:: $(PROGS)
-       for i in $(PROGS); do \
-               rm -f ../bin/$$i; \
-               cp $$i ../bin; \
-               strip ../bin/$$i; \
-               chmod 555 ../bin/$$i; \
-       done
-       ln -sf e2fsck ../bin/fsck.ext2
-
-clean:
-       rm -f $(PROGS) \#* *\# *.s *.o *.a *~ core
-
-really-clean: clean
-       rm -f .depend
-
-dep depend .depend:
-       $(CPP) $(CFLAGS) -M *.c >.depend
-
-include .depend
diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in
new file mode 100644 (file)
index 0000000..328fc55
--- /dev/null
@@ -0,0 +1,167 @@
+#
+# Makefile for e2fsck
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ..
+INSTALL = @INSTALL@
+LDFLAG_STATIC = @LDFLAG_STATIC@
+
+@MCONFIG@
+
+PROGS=         e2fsck extend @EXTRA_PROGS@
+MANPAGES=      e2fsck.8
+
+LIBS= -L../lib -lss -lcom_err -lext2fs $(CHECKLIB)
+DEPLIBS= ../lib/libss.a ../lib/libcom_err.a ../lib/libext2fs.a
+
+.c.o:
+       $(CC) -c $(CFLAGS) $< -o $@
+
+#
+# Flags for using Checker
+#      Note: The optimization flags must include -g
+#
+#MCHECK=       -checker
+#LIBS= -L../lib -lss -lcom_err -le2fs $(CHECKLIB)
+#DEPLIBS= ../lib/libss.a ../lib/libcom_err.a ../lib/libext2fs.a
+#CHECKLIB= /usr/lib/libchecker.o
+
+#
+# Flags for doing mtrace --- uncomment to produce mtracing e2fsck
+#      Note:  The optimization flags must include -g
+#
+#MTRACE=       -DMTRACE
+#MTRACE_OBJ= mtrace.o
+#MTRACE_SRC= $(srcdir)/mtrace.c
+#OPT= -g
+
+#
+# Flags for doing mcheck --- uncomment to produce mchecking e2fsck
+#      Note:  The optimization flags must include -g
+#
+#MCHECK= -DMCHECK
+
+#
+# Flags for profiling --- uncomment to produce profiling e2fsck
+#
+#PROF=         -pg
+#LIBS= -L../lib -lss -lcom_err_p -lext2fs_p 
+#DEPLIBS= ../lib/libss.a ../lib/libcom_err_p.a ../lib/libext2fs_p.a
+
+OBJS= e2fsck.o pass1.o pass1b.o pass2.o pass3.o pass4.o pass5.o \
+       badblocks.o util.o dirinfo.o ehandler.o $(MTRACE_OBJ)
+
+SRCS= $(srcdir)/e2fsck.c \
+       $(srcdir)/pass1.c \
+       $(srcdir)/pass1b.c \
+       $(srcdir)/pass2.c \
+       $(srcdir)/pass3.c \
+       $(srcdir)/pass4.c \
+       $(srcdir)/pass5.c \
+       $(srcdir)/badblocks.c \
+       $(srcdir)/util.c \
+       $(srcdir)/dirinfo.c \
+       $(srcdir)/ehandler.c \
+       $(MTRACE_SRC)
+
+all:: $(PROGS)
+
+e2fsck: $(OBJS)  $(DEPLIBS)
+       $(LD) $(LDFLAGS) $(LDFLAG_STATIC) -o e2fsck $(OBJS) $(LIBS) 
+
+extend: extend.o
+       $(LD) $(LDFLAGS) -o extend extend.o $(CHECKLIB)
+
+flushb: flushb.o
+       $(LD) $(LDFLAGS) -o flushb flushb.o $(CHECKLIB)
+
+iscan: iscan.o util.o
+       $(LD) $(LDFLAGS) -o iscan iscan.o util.o ehandler.o $(LIBS)
+
+
+installdirs:
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) \
+               $(DESTDIR)$(cat8dir)
+
+install: $(PROGS) $(MANPAGES) installdirs
+       for i in $(PROGS); do \
+               $(INSTALL_PROGRAM) $$i $(DESTDIR)$(sbindir)/$$i; \
+               $(STRIP) $(DESTDIR)$(sbindir)/$$i; \
+       done
+       $(LN) -f $(DESTDIR)$(sbindir)/e2fsck $(DESTDIR)$(sbindir)/fsck.ext2
+       for i in $(MANPAGES); do \
+               $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(man8dir)/$$i; \
+       done
+uninstall:
+       $(RM) -f $(sbindir)/e2fsck
+       $(RM) -f $(sbindir)/flushb
+       $(RM) -f $(sbindir)/fsck.ext2
+       for i in $(MANPAGES); do \
+               $(RM) -f $(man8dir)/$$i; \
+       done
+
+clean:
+       $(RM) -f $(PROGS) \#* *\# *.s *.o *.a *~ core
+mostlyclean: clean
+distclean: clean
+       $(RM) -f .depend Makefile
+
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+e2fsck.o : $(srcdir)/e2fsck.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/../version.h 
+pass1.o : $(srcdir)/pass1.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+pass1b.o : $(srcdir)/pass1b.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+pass2.o : $(srcdir)/pass2.c $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+pass3.o : $(srcdir)/pass3.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+pass4.o : $(srcdir)/pass4.c $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+pass5.o : $(srcdir)/pass5.c $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+badblocks.o : $(srcdir)/badblocks.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+util.o : $(srcdir)/util.c \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(top_srcdir)/lib/ext2fs/bitops.h 
+dirinfo.o : $(srcdir)/dirinfo.c $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h 
+ehandler.o : $(srcdir)/ehandler.c \
+  $(srcdir)/e2fsck.h \
+  $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(top_srcdir)/lib/ext2fs/bitops.h 
+
index 62f99c9c83400846bcb464e62e1023eb9daa58f5..f0613d9dc764ae3f1d2c981ea542d69414a5bb08 100644 (file)
@@ -6,6 +6,9 @@
  */
 
 #include <time.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <et/com_err.h>
 #include "e2fsck.h"
@@ -16,7 +19,7 @@ static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt,
 
 static void invalid_block(ext2_filsys fs, blk_t blk)
 {
-       printf("Bad block %lu out of range; ignored.\n", blk);
+       printf("Bad block %u out of range; ignored.\n", blk);
        return;
 }
 
@@ -97,7 +100,7 @@ static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt,
         */
        if (*block_nr >= fs->super->s_blocks_count ||
            *block_nr < fs->super->s_first_data_block) {
-               printf("Warning illegal block %lu found in bad block inode.  Cleared.\n", *block_nr);
+               printf("Warning illegal block %u found in bad block inode.  Cleared.\n", *block_nr);
                *block_nr = 0;
                return BLOCK_CHANGED;
        }
@@ -127,7 +130,7 @@ void test_disk(ext2_filsys fs)
        /*
         * Now run the bad blocks program
         */
-       sprintf(buf, "badblocks %s%s %ld", preen ? "" : "-s ",
+       sprintf(buf, "badblocks %s%s %d", preen ? "" : "-s ",
                fs->device_name,
                fs->super->s_blocks_count);
        if (verbose)
index ca8296307d9c4299ee5372542a1a9fa93c25b83f..bc12fc10de4cd85f8f0e8215abd4a114afb6e3f0 100644 (file)
@@ -1,8 +1,8 @@
 .\" -*- nroff -*-
-.\" Copyright 1993, 1994 by Theodore Ts'o.  All Rights Reserved.
+.\" Copyright 1993, 1994, 1995 by Theodore Ts'o.  All Rights Reserved.
 .\" This file may be copied under the terms of the GNU Public License.
 .\" 
-.TH E2FSCK 8 "November 1994" "Version 0.5b"
+.TH E2FSCK 8 "October 1995" "Version 0.5c"
 .SH NAME
 e2fsck \- check a Linux second extended file system
 .SH SYNOPSIS
index 78fe3c9244b99944233532c3eb908eae89ecba15..e35e1bace28924f615cad17a19c60d359e29399d 100644 (file)
 #include <ctype.h>
 #include <termios.h>
 #include <time.h>
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#endif
 #include <unistd.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <sys/ioctl.h>
 #include <malloc.h>
 
@@ -36,6 +43,7 @@ extern int isatty(int);
 
 const char * program_name = "e2fsck";
 const char * device_name = NULL;
+const char * filesystem_name = NULL;
 
 /* Command line options */
 int nflag = 0;
@@ -99,24 +107,26 @@ static void show_stats(ext2_filsys fs)
                       inodes_used, inodes, blocks_used, blocks);
                return;
        }
-       printf ("\n%6d inode%s used (%d%%)\n", inodes_used,
+       printf ("\n%8d inode%s used (%d%%)\n", inodes_used,
                (inodes_used != 1) ? "s" : "",
                100 * inodes_used / inodes);
-       printf ("%6d block%s used (%d%%)\n"
-               "%6d bad block%s\n", blocks_used,
+       printf ("         # of inodes with ind/dind/tind blocks: %d/%d/%d\n",
+               fs_ind_count, fs_dind_count, fs_tind_count);
+       printf ("%8d block%s used (%d%%)\n"
+               "%8d bad block%s\n", blocks_used,
                (blocks_used != 1) ? "s" : "",
                100 * blocks_used / blocks, fs_badblocks_count,
                fs_badblocks_count != 1 ? "s" : "");
-       printf ("\n%6d regular file%s\n"
-               "%6d director%s\n"
-               "%6d character device file%s\n"
-               "%6d block device file%s\n"
-               "%6d fifo%s\n"
-               "%6d link%s\n"
-               "%6d symbolic link%s (%d fast symbolic link%s)\n"
-               "%6d socket%s\n"
-               "------\n"
-               "%6d file%s\n",
+       printf ("\n%8d regular file%s\n"
+               "%8d director%s\n"
+               "%8d character device file%s\n"
+               "%8d block device file%s\n"
+               "%8d fifo%s\n"
+               "%8d link%s\n"
+               "%8d symbolic link%s (%d fast symbolic link%s)\n"
+               "%8d socket%s\n"
+               "--------\n"
+               "%8d file%s\n",
                fs_regular_count, (fs_regular_count != 1) ? "s" : "",
                fs_directory_count, (fs_directory_count != 1) ? "ies" : "y",
                fs_chardev_count, (fs_chardev_count != 1) ? "s" : "",
@@ -133,36 +143,26 @@ static void show_stats(ext2_filsys fs)
 
 static void check_mount(NOARGS)
 {
-       FILE * f;
-       struct mntent * mnt;
-       int cont;
-       int fd;
+       errcode_t       retval;
+       int             mount_flags, cont;
 
-       if ((f = setmntent (MOUNTED, "r")) == NULL)
+       retval = ext2fs_check_if_mounted(filesystem_name, &mount_flags);
+       if (retval) {
+               com_err("ext2fs_check_if_mount", retval,
+                       "while determining whether %s is mounted.",
+                       filesystem_name);
                return;
-       while ((mnt = getmntent (f)) != NULL)
-               if (strcmp (device_name, mnt->mnt_fsname) == 0)
-                       break;
-       endmntent (f);
-       if (!mnt)
+       }
+       if (!(mount_flags & EXT2_MF_MOUNTED))
                return;
-
-       if  (!strcmp(mnt->mnt_dir, "/"))
-               root_filesystem = 1;
-
        /*
         * If the root is mounted read-only, then /etc/mtab is
         * probably not correct; so we won't issue a warning based on
         * it.
         */
-       fd = open(MOUNTED, O_RDWR);
-       if (fd < 0) {
-               if (errno == EROFS) {
-                       read_only_root = 1;
-                       return;
-               }
-       } else
-               close(fd);
+       if ((mount_flags & EXT2_MF_ISROOT) &&
+           (mount_flags & EXT2_MF_READONLY))
+               return;
        
        if (!rwflag) {
                printf("Warning!  %s is mounted.\n", device_name);
@@ -217,6 +217,7 @@ static void check_super_block(ext2_filsys fs)
        blk_t   blocks_per_group = fs->super->s_blocks_per_group;
        int     i;
        blk_t   should_be;
+       errcode_t retval;
 
        /*
         * Verify the super block constants...
@@ -241,6 +242,23 @@ static void check_super_block(ext2_filsys fs)
        check_super_value("r_blocks_count", s->s_r_blocks_count,
                          MAX_CHECK, 0, s->s_blocks_count);
 
+       retval = ext2fs_get_device_size(filesystem_name, EXT2_BLOCK_SIZE(s),
+                                       &should_be);
+       if (retval) {
+               com_err("ext2fs_get_device_size", retval,
+                       "while trying to check physical size of filesystem");
+               fatal_error(0);
+       }
+       if (should_be < s->s_blocks_count) {
+               printf("The filesystem size (according to the superblock) is %d blocks\n", s->s_blocks_count);
+               printf("The physical size of the device is %d blocks\n",
+                      should_be);
+               printf("Either the superblock or the partition table is likely to be corrupt!\n");
+               preenhalt(fs);
+               if (ask("Abort", 1))
+                       fatal_error(0);
+       }
+
        if (s->s_log_block_size != s->s_log_frag_size) {
                printf("Superblock block_size = %d, fragsize = %d.\n",
                       EXT2_BLOCK_SIZE(s), EXT2_FRAG_SIZE(s));
@@ -253,16 +271,16 @@ static void check_super_block(ext2_filsys fs)
        should_be = s->s_frags_per_group /
                (s->s_log_block_size - s->s_log_frag_size + 1);
        if (s->s_blocks_per_group != should_be) {
-               printf("Superblock blocks_per_group = %lu, should "
-                      "have been %lu\n", s->s_blocks_per_group,
+               printf("Superblock blocks_per_group = %u, should "
+                      "have been %u\n", s->s_blocks_per_group,
                       should_be);
                printf(corrupt_msg);
        }
 
        should_be = (s->s_log_block_size == 0) ? 1 : 0;
        if (s->s_first_data_block != should_be) {
-               printf("Superblock first_data_block = %lu, should "
-                      "have been %lu\n", s->s_first_data_block,
+               printf("Superblock first_data_block = %u, should "
+                      "have been %u\n", s->s_first_data_block,
                       should_be);
                printf(corrupt_msg);
        }
@@ -278,12 +296,12 @@ static void check_super_block(ext2_filsys fs)
                        last_block = fs->super->s_blocks_count;
                if ((fs->group_desc[i].bg_block_bitmap < first_block) ||
                    (fs->group_desc[i].bg_block_bitmap >= last_block)) {
-                       printf("Block bitmap %lu for group %d is "
-                              "not in group.\n",
-                              fs->group_desc[i].bg_block_bitmap, i);
-                       preenhalt();
-                       if (!ask("Continue (and relocate)", 1)) {
-                               fatal_error(0);
+                       printf("Block bitmap for group %d is not in group.  "
+                              "(block %u)\n",
+                              i, fs->group_desc[i].bg_block_bitmap);
+                       preenhalt(fs);
+                       if (!ask("Relocate", 1)) {
+                               fatal_error("Block bitmap not in group");
                        }
                        fs->group_desc[i].bg_block_bitmap = 0;
                        invalid_block_bitmap[i]++;
@@ -291,12 +309,12 @@ static void check_super_block(ext2_filsys fs)
                }
                if ((fs->group_desc[i].bg_inode_bitmap < first_block) ||
                    (fs->group_desc[i].bg_inode_bitmap >= last_block)) {
-                       printf("Warning: Inode bitmap %lu for group %d "
-                              "not in group.\n",
-                              fs->group_desc[i].bg_inode_bitmap, i);
-                       preenhalt();
-                       if (!ask("Continue", 1)) {
-                               fatal_error(0);
+                       printf("Inode bitmap group %d not in group.  "
+                              "(block %u)\n",
+                              i, fs->group_desc[i].bg_inode_bitmap);
+                       preenhalt(fs);
+                       if (!ask("Relocate", 1)) {
+                               fatal_error("Inode bitmap not in group");
                        }
                        fs->group_desc[i].bg_inode_bitmap = 0;
                        invalid_inode_bitmap[i]++;
@@ -305,13 +323,13 @@ static void check_super_block(ext2_filsys fs)
                if ((fs->group_desc[i].bg_inode_table < first_block) ||
                    ((fs->group_desc[i].bg_inode_table +
                      fs->inode_blocks_per_group - 1) >= last_block)) {
-                       printf("Warning: Inode table %lu for group %d "
-                              "not in group.\n",
-                              fs->group_desc[i].bg_inode_table, i);
+                       printf("Inode table for group %d not in group.  "
+                              "(block %u)\n",
+                              i, fs->group_desc[i].bg_inode_table);
                        printf("WARNING: SEVERE DATA LOSS POSSIBLE.\n");
-                       preenhalt();
-                       if (!ask("Continue", 1)) {
-                               fatal_error(0);
+                       preenhalt(fs);
+                       if (!ask("Relocate", 1)) {
+                               fatal_error("Inode table not in group");
                        }
                        fs->group_desc[i].bg_inode_table = 0;
                        invalid_inode_table[i]++;
@@ -349,11 +367,17 @@ static void check_if_skip(ext2_filsys fs)
                return;
        }
        if (fs->super->s_state & EXT2_VALID_FS) {
-               printf("%s is clean, no check.\n", device_name);
+               printf("%s: clean, %d/%d files, %d/%d blocks\n", device_name,
+                      fs->super->s_inodes_count - fs->super->s_free_inodes_count,
+                      fs->super->s_inodes_count,
+                      fs->super->s_blocks_count - fs->super->s_free_blocks_count,
+                      fs->super->s_blocks_count);
                exit(FSCK_OK);
        }
 }      
 
+#define PATH_SET "PATH=/sbin"
+
 static void PRS(int argc, char *argv[])
 {
        int             flush = 0;
@@ -361,14 +385,21 @@ static void PRS(int argc, char *argv[])
 #ifdef MTRACE
        extern void     *mallwatch;
 #endif
-       char            *oldpath;
-       static char     newpath[PATH_MAX];
+       char            *oldpath = getenv("PATH");
 
        /* Update our PATH to include /sbin  */
-       strcpy(newpath, "PATH=/sbin:");
-       if ((oldpath = getenv("PATH")) != NULL)
-               strcat(newpath, oldpath);
-       putenv(newpath);
+       if (oldpath) {
+               char *newpath;
+
+               newpath = malloc(sizeof (PATH_SET) + 1 + strlen (oldpath));
+               if (!newpath)
+                       fatal_error("Couldn't malloc() newpath");
+               strcpy (newpath, PATH_SET);
+               strcat (newpath, ":");
+               strcat (newpath, oldpath);
+               putenv (newpath);
+       } else
+               putenv (PATH_SET);
 
        setbuf(stdout, NULL);
        setbuf(stderr, NULL);
@@ -376,7 +407,7 @@ static void PRS(int argc, char *argv[])
        
        if (argc && *argv)
                program_name = *argv;
-       while ((c = getopt (argc, argv, "panyrcB:dfvtFVM:b:I:P:l:L:")) != EOF)
+       while ((c = getopt (argc, argv, "panyrcB:dfvtFVM:b:I:P:l:L:N:")) != EOF)
                switch (c) {
                case 'p':
                case 'a':
@@ -427,7 +458,11 @@ static void PRS(int argc, char *argv[])
                        force = 1;
                        break;
                case 'F':
+#ifdef BLKFLSBUF
                        flush = 1;
+#else
+                       fatal_error ("-F not supported");
+#endif
                        break;
                case 'v':
                        verbose = 1;
@@ -440,6 +475,9 @@ static void PRS(int argc, char *argv[])
                        mallwatch = (void *) strtol(optarg, NULL, 0);
                        break;
 #endif
+               case 'N':
+                       device_name = optarg;
+                       break;
                default:
                        usage ();
                }
@@ -449,21 +487,27 @@ static void PRS(int argc, char *argv[])
                usage ();
        if (nflag && !bad_blocks_file && !cflag)
                rwflag = 0;
-       device_name = argv[optind];
+       filesystem_name = argv[optind];
+       if (device_name == 0)
+               device_name = filesystem_name;
        if (flush) {
-               int     fd = open(device_name, O_RDONLY, 0);
+#ifdef BLKFLSBUF
+               int     fd = open(filesystem_name, O_RDONLY, 0);
 
                if (fd < 0) {
                        com_err("open", errno, "while opening %s for flushing",
-                               device_name);
+                               filesystem_name);
                        exit(FSCK_ERROR);
                }
                if (ioctl(fd, BLKFLSBUF, 0) < 0) {
                        com_err("BLKFLSBUF", errno, "while trying to flush %s",
-                               device_name);
+                               filesystem_name);
                        exit(FSCK_ERROR);
                }
                close(fd);
+#else
+               fatal_error ("BLKFLSBUF not supported");
+#endif /* BLKFLSBUF */
        }
 }
                                        
@@ -502,12 +546,13 @@ int main (int argc, char *argv[])
 restart:
        sync_disks();
        if (superblock && blocksize) {
-               retval = ext2fs_open(device_name, rwflag ? EXT2_FLAG_RW : 0,
+               retval = ext2fs_open(filesystem_name,
+                                    rwflag ? EXT2_FLAG_RW : 0,
                                     superblock, blocksize, unix_io_manager,
                                     &fs);
        } else if (superblock) {
                for (i=0; possible_block_sizes[i]; i++) {
-                       retval = ext2fs_open(device_name,
+                       retval = ext2fs_open(filesystem_name,
                                             rwflag ? EXT2_FLAG_RW : 0,
                                             superblock,
                                             possible_block_sizes[i],
@@ -516,22 +561,38 @@ restart:
                                break;
                }
        } else 
-               retval = ext2fs_open(device_name, rwflag ? EXT2_FLAG_RW : 0,
+               retval = ext2fs_open(filesystem_name,
+                                    rwflag ? EXT2_FLAG_RW : 0,
                                     0, 0, unix_io_manager, &fs);
        if (retval) {
                com_err(program_name, retval, "while trying to open %s",
-                       device_name);
-               if (retval == EXT2_ET_REV_TOO_HIGH)
+                       filesystem_name);
+               switch (retval) {
+               case EXT2_ET_REV_TOO_HIGH:
                        printf ("Get a newer version of e2fsck!\n");
-               else
+                       break;
+               case EXT2_ET_SHORT_READ:
+                       printf ("Could this be a zero-length partition?\n");
+                       break;
+               case EPERM:
+               case EACCES:
+                       printf("You must have %s access to the "
+                              "filesystem or be root\n",
+                              rwflag ? "r/w" : "r/o");
+                       break;
+               case ENXIO:
+                       printf("Possibly non-existent or swap device?\n");
+                       break;
+               default:
                        printf(corrupt_msg);
+               }
                fatal_error(0);
        }
 
 #ifdef EXT2_CURRENT_REV
        if (fs->super->s_rev_level > E2FSCK_CURRENT_REV) {
                com_err(program_name, retval, "while trying to open %s",
-                       device_name);
+                       filesystem_name);
                printf ("Get a newer version of e2fsck!\n");
                fatal_error(0);
        }
@@ -569,6 +630,9 @@ restart:
        ext2fs_mark_valid(fs);
        
        pass1(fs);
+       free(invalid_inode_bitmap);
+       free(invalid_block_bitmap);
+       free(invalid_inode_table);
        if (restart_e2fsck) {
                ext2fs_close(fs);
                printf("Restarting e2fsck from the beginning...\n");
index e9788443f9cb926fcf4393191a78ed7b3b7edc3c..debd56a5cbcab61f619479c47321f7c9bbce38b7 100644 (file)
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/time.h>
 
+#ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
+#endif
 #include <linux/ext2_fs.h>
 
 #include "ext2fs/ext2fs.h"
@@ -134,6 +135,9 @@ extern int fs_fifo_count;
 extern int fs_total_count;
 extern int fs_badblocks_count;
 extern int fs_sockets_count;
+extern int fs_ind_count;
+extern int fs_dind_count;
+extern int fs_tind_count;
 
 extern struct resource_track   global_rtrack;
 
@@ -173,7 +177,7 @@ extern int ask_yn(const char * string, int def);
 extern void fatal_error (const char * fmt_string);
 extern void read_bitmaps(ext2_filsys fs);
 extern void write_bitmaps(ext2_filsys fs);
-extern void preenhalt(NOARGS);
+extern void preenhalt(ext2_filsys fs);
 extern void print_resource_track(struct resource_track *track);
 extern void init_resource_track(struct resource_track *track);
 extern int inode_has_valid_blocks(struct ext2_inode *inode);
index 4873a95e5df587e63a5098f2b7e5d3b3beb3b9f2..131a0abb8415c6c1ce8d01d6085c65c6038eacb2 100644 (file)
 #include <string.h>
 #include <ctype.h>
 #include <termios.h>
-#include <sys/resource.h>
 
 #include "e2fsck.h"
 
+#include <sys/time.h>
+#include <sys/resource.h>
+
 static const char *operation;
 
 static errcode_t e2fsck_handle_read_error(io_channel channel,
@@ -49,7 +51,7 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
        else
                printf("Error reading block %lu (%s).  ", block,
                       error_message(error));
-       preenhalt();
+       preenhalt(NULL);
        if (ask("Ignore error", 1))
                return 0;
 
@@ -89,7 +91,7 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
        else
                printf("Error writing block %lu (%s).  ", block,
                       error_message(error));
-       preenhalt();
+       preenhalt(NULL);
        if (ask("Ignore error", 1))
                return 0;
 
diff --git a/e2fsck/extend.c b/e2fsck/extend.c
new file mode 100644 (file)
index 0000000..646348d
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * extend.c --- extend a file so that it has at least a specified
+ *     number of blocks.
+ * 
+ * Copyright (C) 1993, 1994, 1995 Theodore Ts'o.
+ *
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+static void usage(char *progname)
+{
+       fprintf(stderr, "%s: %s filename nblocks blocksize\n",
+               progname, progname);
+       exit(1);
+}
+
+
+int main(int argc, char **argv)
+{
+       char    *filename;
+       int     nblocks, blocksize;
+       int     fd;
+       char    *block;
+       int     ret;
+
+       if (argc != 4)
+               usage(argv[0]);
+
+       filename = argv[1];
+       nblocks = strtoul(argv[2], 0, 0) - 1;
+       blocksize = strtoul(argv[3], 0, 0);
+
+       if (nblocks < 0) {
+               fprintf(stderr, "Illegal number of blocks!\n");
+               exit(1);
+       }
+
+       block = malloc(blocksize);
+       if (block == 0) {
+               fprintf(stderr, "Couldn't allocate block buffer(size=%d)\n",
+                       blocksize);
+               exit(1);
+       }
+       memset(block, 0, blocksize);
+
+       fd = open(filename, O_RDWR);
+       if (fd < 0) {
+               perror(filename);
+               exit(1);
+       }
+       ret = lseek(fd, nblocks*blocksize, SEEK_SET);
+       if (ret < 0) {
+               perror("lseek");
+               exit(1);
+       }
+       ret = read(fd, block, blocksize);
+       if (ret < 0) {
+               perror("read");
+               exit(1);
+       }
+       ret = lseek(fd, nblocks*blocksize, SEEK_SET);
+       if (ret < 0) {
+               perror("lseek #2");
+               exit(1);
+       }
+       ret = write(fd, block, blocksize);
+       if (ret < 0) {
+               perror("read");
+               exit(1);
+       }
+       exit(0);
+}
index eba4e85d81da04a8a9d5343787b18fb586b26ae6..20b9917db73d1d64daad4440aea737f7dc9626e2 100644 (file)
@@ -9,7 +9,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 
+#ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
+#endif
 
 #ifdef __STDC__
 #define NOARGS void
@@ -43,9 +45,15 @@ int main(int argc, char **argv)
         * Note: to reread the partition table, use the ioctl
         * BLKRRPART instead of BLKFSLBUF.
         */
+#ifdef BLKFLSBUF
        if (ioctl(fd, BLKFLSBUF, 0) < 0) {
-               perror("ioctl");
+               perror("ioctl BLKFLSBUF");
                exit(1);
        }
        return 0;
+#else
+       fprintf(stderr,
+               "BLKFLSBUF ioctl not supported!  Can't flush buffers.\n");
+       return 1;
+#endif
 }
diff --git a/e2fsck/images/README b/e2fsck/images/README
deleted file mode 100644 (file)
index 73e2681..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-These images contain various forms of corrupted filesystem which
-e2fsck will correct.  They are used as a regression test for e2fsck.
-
-The test_script program will automatically run e2fsck against the
-filesystem images.  It will run them two times, and display the exit
-status for each run.  The meaning of the exit status codes are as
-follows:
-
-       0               No filesystem errors were detected
-       1               Filesystem errors detected, but corrected
-       2               System should be rebooted
-       4               Filesystem errors left uncorrected
-       8               Operational error (generally means internal error,
-                               or filesystem error that the e2fsck was not
-                               prepared to deal with)
-       16              Usage or syntax error
-
-During the regression test, the first exit code should be 1, and the
-second exit code should be 0.  In other words, all (with one
-exception) of the test filesystems in this directory have some sort of
-filesystem corruption, which e2fsck should fix on the first pass.
-After the first pass, e2fsck should leave a fully consistent
-filesystem with no detectable errors found in the second pass.  The
-exception is the okgroup.img filesystem, which contains no errors, and
-so both exit codes should be 0.
-
-NOTE: It appears that at least some versions of the original e2fsck do
-not exit with an exit status code of 1 after correcting filesystem
-errors.  So if you modify the test_script to try running these
-filesystems against the original e2fsck, you will have to inspect the
-test_script.log file manually.
-
---------------------------------------------------------------
-Here's a one-line descriptons of the various test images in this
-directory:
-
-baddir.img             Filesystem with a corrupted directory
-badbblocks.img         Filesystem with illegal blocks in the bad block inode.
-badinode.img           Filesystem with various different corrupted inode
-                               entries.
-badlkcnt.img           Filesystem with deleted files with non-zero link count
-badroot.img            Filesystem with a file for a root directory
-badtable.img           Filesystem with blocks shared between the bitmaps and
-                               inode table blocks and the bad block inode
-bbfile.img             Filesystem with files containing bad blocks
-bitmaps.img            Filesystem with corrupted inode and block bitmaps
-dirlink.img            Filesystem with a hard link to a directory
-dup.img                        Filesystem with blocks claimed by two different files
-dup2.img               Filesystem with blocks claimed by three different files
-dupfsblks.img          Filesystem with blocks claimed by a file and
-                               inode/block bitmaps and inode tables
-dupsuper.img           Filesystem with blocks claimed by a file and
-                               the superblock / group descriptors
-end-bitmap.img         Filesystem with corruption at the end of the block 
-                               bitmap
-expand.img             Tests e2fsck's ability to expand lost+found if 
-                               necessary
-lpf.img                        Filesystem with disconnected files and no /lost+found 
-                               directory
-mke2fs2b.img           Filesystem with corruption similar to that
-                               created by mke2fs version 0.2b
-noroot.img             Filesystem with a deleted root directory
-okgroup.img            Filesystem that's exactly 8193 blocks long 
-                               (otherwise OK)
-overfsblks.img         Filesystem with overlapping inode and block bitmaps
-
-
diff --git a/e2fsck/images/badbblocks.img.gz b/e2fsck/images/badbblocks.img.gz
deleted file mode 100644 (file)
index 3fd89cb..0000000
Binary files a/e2fsck/images/badbblocks.img.gz and /dev/null differ
diff --git a/e2fsck/images/baddir.img.gz b/e2fsck/images/baddir.img.gz
deleted file mode 100644 (file)
index c7af6c5..0000000
Binary files a/e2fsck/images/baddir.img.gz and /dev/null differ
diff --git a/e2fsck/images/badinode.img.gz b/e2fsck/images/badinode.img.gz
deleted file mode 100644 (file)
index 7d10bc1..0000000
Binary files a/e2fsck/images/badinode.img.gz and /dev/null differ
diff --git a/e2fsck/images/badlkcnt.img.gz b/e2fsck/images/badlkcnt.img.gz
deleted file mode 100644 (file)
index 96509f5..0000000
Binary files a/e2fsck/images/badlkcnt.img.gz and /dev/null differ
diff --git a/e2fsck/images/badroot.img.gz b/e2fsck/images/badroot.img.gz
deleted file mode 100644 (file)
index 5724105..0000000
Binary files a/e2fsck/images/badroot.img.gz and /dev/null differ
diff --git a/e2fsck/images/badtable.img.gz b/e2fsck/images/badtable.img.gz
deleted file mode 100644 (file)
index 72934ce..0000000
Binary files a/e2fsck/images/badtable.img.gz and /dev/null differ
diff --git a/e2fsck/images/bbfile.img.gz b/e2fsck/images/bbfile.img.gz
deleted file mode 100644 (file)
index 1924a3f..0000000
Binary files a/e2fsck/images/bbfile.img.gz and /dev/null differ
diff --git a/e2fsck/images/bitmapblks.img.gz b/e2fsck/images/bitmapblks.img.gz
deleted file mode 100644 (file)
index d5aa60f..0000000
Binary files a/e2fsck/images/bitmapblks.img.gz and /dev/null differ
diff --git a/e2fsck/images/bitmaps.img.gz b/e2fsck/images/bitmaps.img.gz
deleted file mode 100644 (file)
index 7eff4fc..0000000
Binary files a/e2fsck/images/bitmaps.img.gz and /dev/null differ
diff --git a/e2fsck/images/dirlink.img.gz b/e2fsck/images/dirlink.img.gz
deleted file mode 100644 (file)
index 7e1694a..0000000
Binary files a/e2fsck/images/dirlink.img.gz and /dev/null differ
diff --git a/e2fsck/images/dup.img.gz b/e2fsck/images/dup.img.gz
deleted file mode 100644 (file)
index f901f19..0000000
Binary files a/e2fsck/images/dup.img.gz and /dev/null differ
diff --git a/e2fsck/images/dup2.img.gz b/e2fsck/images/dup2.img.gz
deleted file mode 100644 (file)
index f5fcd37..0000000
Binary files a/e2fsck/images/dup2.img.gz and /dev/null differ
diff --git a/e2fsck/images/dupfsblks.img.gz b/e2fsck/images/dupfsblks.img.gz
deleted file mode 100644 (file)
index d3fd2a1..0000000
Binary files a/e2fsck/images/dupfsblks.img.gz and /dev/null differ
diff --git a/e2fsck/images/dupsuper.img.gz b/e2fsck/images/dupsuper.img.gz
deleted file mode 100644 (file)
index f5c2f3e..0000000
Binary files a/e2fsck/images/dupsuper.img.gz and /dev/null differ
diff --git a/e2fsck/images/end-bitmap.img.gz b/e2fsck/images/end-bitmap.img.gz
deleted file mode 100644 (file)
index b83478f..0000000
Binary files a/e2fsck/images/end-bitmap.img.gz and /dev/null differ
diff --git a/e2fsck/images/expand.img.gz b/e2fsck/images/expand.img.gz
deleted file mode 100644 (file)
index 0ea6729..0000000
Binary files a/e2fsck/images/expand.img.gz and /dev/null differ
diff --git a/e2fsck/images/illfsblks.img.gz b/e2fsck/images/illfsblks.img.gz
deleted file mode 100644 (file)
index f218c57..0000000
Binary files a/e2fsck/images/illfsblks.img.gz and /dev/null differ
diff --git a/e2fsck/images/lotsbad.img.gz b/e2fsck/images/lotsbad.img.gz
deleted file mode 100644 (file)
index 8e49295..0000000
Binary files a/e2fsck/images/lotsbad.img.gz and /dev/null differ
diff --git a/e2fsck/images/lpf.img.gz b/e2fsck/images/lpf.img.gz
deleted file mode 100644 (file)
index 527c09b..0000000
Binary files a/e2fsck/images/lpf.img.gz and /dev/null differ
diff --git a/e2fsck/images/messy_inode.img.gz b/e2fsck/images/messy_inode.img.gz
deleted file mode 100644 (file)
index a7eab4a..0000000
Binary files a/e2fsck/images/messy_inode.img.gz and /dev/null differ
diff --git a/e2fsck/images/mke2fs2b.img.gz b/e2fsck/images/mke2fs2b.img.gz
deleted file mode 100644 (file)
index 9716a13..0000000
Binary files a/e2fsck/images/mke2fs2b.img.gz and /dev/null differ
diff --git a/e2fsck/images/noroot.img.gz b/e2fsck/images/noroot.img.gz
deleted file mode 100644 (file)
index 3e597f3..0000000
Binary files a/e2fsck/images/noroot.img.gz and /dev/null differ
diff --git a/e2fsck/images/okgroup.img.gz b/e2fsck/images/okgroup.img.gz
deleted file mode 100644 (file)
index e353032..0000000
Binary files a/e2fsck/images/okgroup.img.gz and /dev/null differ
diff --git a/e2fsck/images/overfsblks.img.gz b/e2fsck/images/overfsblks.img.gz
deleted file mode 100644 (file)
index 15f391f..0000000
Binary files a/e2fsck/images/overfsblks.img.gz and /dev/null differ
diff --git a/e2fsck/images/test_script b/e2fsck/images/test_script
deleted file mode 100644 (file)
index c0842ef..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-#
-# Test script for e2fsck
-#
-
-FSCK=../e2fsck
-SECOND_FSCK=$FSCK
-FSCK_OPT=-yft
-SECOND_FSCK_OPT=$FSCK_OPT
-
-#
-# Uncomment to test against original e2fsck
-#
-#FSCK=/u4/src/e2fsprogs-0.3c/e2fsck
-#FSCK_OPT=-af
-
-OUTFILE=test_script.log
-
-cp /dev/null $OUTFILE
-
-for i in *.img.gz
-do
-       echo -n "Testing $i...  "
-       echo "Testing $i..." >> $OUTFILE
-       gunzip < $i > /tmp/$i.$$
-       echo $FSCK $FSCK_OPT /tmp/$i.$$  >> $OUTFILE
-       $FSCK $FSCK_OPT /tmp/$i.$$  >> $OUTFILE 2>&1 
-       status=$?
-       echo Exit status is $status >> $OUTFILE
-       echo " "  >> $OUTFILE
-       echo -n "Exit status $status    "
-       echo Running e2fsck again.... >> $OUTFILE
-       echo $SECOND_FSCK $SECOND_FSCK_OPT /tmp/$i.$$ >> $OUTFILE
-       $SECOND_FSCK $SECOND_FSCK_OPT /tmp/$i.$$ >> $OUTFILE 2>&1 
-       status=$?
-       echo Exit status is $status >> $OUTFILE
-       echo Exit status $status
-       rm /tmp/$i.$$
-       echo "---------------------------------------------------" >> $OUTFILE
-done
-       
-       
diff --git a/e2fsck/iscan.c b/e2fsck/iscan.c
new file mode 100644 (file)
index 0000000..d964b34
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Test to see how quickly we can scan the inode table (not doing
+ * anything else)
+ */
+
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <termios.h>
+#include <time.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#include <unistd.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#include <sys/ioctl.h>
+#include <malloc.h>
+
+#include "et/com_err.h"
+#include "e2fsck.h"
+#include "../version.h"
+
+extern int isatty(int);
+
+const char * program_name = "iscan";
+const char * device_name = NULL;
+
+int yflag = 0;
+int nflag = 0;
+int preen = 0;
+int inode_buffer_blocks = 0;
+int invalid_bitmaps = 0;
+
+struct resource_track  global_rtrack;
+
+static void usage(NOARGS)
+{
+       fprintf(stderr,
+               "Usage: %s [-F] [-I inode_buffer_blocks] device\n",
+               program_name);
+       exit(1);
+}
+
+static void PRS(int argc, char *argv[])
+{
+       int             flush = 0;
+       char            c;
+#ifdef MTRACE
+       extern void     *mallwatch;
+#endif
+
+       setbuf(stdout, NULL);
+       setbuf(stderr, NULL);
+       initialize_ext2_error_table();
+       
+       if (argc && *argv)
+               program_name = *argv;
+       while ((c = getopt (argc, argv, "FI")) != EOF)
+               switch (c) {
+               case 'F':
+#ifdef BLKFLSBUF
+                       flush = 1;
+#else
+                       fatal_error ("-F not supported");
+#endif
+                       break;
+               case 'I':
+                       inode_buffer_blocks = atoi(optarg);
+                       break;
+               default:
+                       usage ();
+               }
+       device_name = argv[optind];
+       if (flush) {
+#ifdef BLKFLSBUF
+               int     fd = open(device_name, O_RDONLY, 0);
+
+               if (fd < 0) {
+                       com_err("open", errno, "while opening %s for flushing",
+                               device_name);
+                       exit(FSCK_ERROR);
+               }
+               if (ioctl(fd, BLKFLSBUF, 0) < 0) {
+                       com_err("BLKFLSBUF", errno, "while trying to flush %s",
+                               device_name);
+                       exit(FSCK_ERROR);
+               }
+               close(fd);
+#else
+               fatal_error ("BLKFLSBUF not supported");
+#endif /* BLKFLSBUF */
+       }
+}
+                                       
+int main (int argc, char *argv[])
+{
+       errcode_t       retval = 0;
+       int             exit_value = FSCK_OK;
+       ext2_filsys     fs;
+       ino_t   ino;
+       int     num_inodes = 0;
+       struct ext2_inode inode;
+       ext2_inode_scan scan;
+       
+       init_resource_track(&global_rtrack);
+
+       PRS(argc, argv);
+
+       retval = ext2fs_open(device_name, 0,
+                            0, 0, unix_io_manager, &fs);
+       if (retval) {
+               com_err(program_name, retval, "while trying to open %s",
+                       device_name);
+               exit(1);
+       }
+
+       ehandler_init(fs->io);
+       
+       retval = ext2fs_open_inode_scan(fs, inode_buffer_blocks, &scan);
+       if (retval) {
+               com_err(program_name, retval, "while opening inode scan");
+               fatal_error(0);
+       }
+
+       while (1) {
+               retval = ext2fs_get_next_inode(scan, &ino, &inode);
+               if (retval) {
+                       com_err(program_name, retval,
+                               "while getting next inode");
+                       fatal_error(0);
+               }
+               if (ino == 0)
+                       break;
+               num_inodes++;
+       }
+       
+       print_resource_track(&global_rtrack);
+       printf("%d inodes scanned.\n", num_inodes);
+       
+       exit(0);
+}
index 7eadea80e6f5acca0b8ac4f8949519dcba496385..17b0939b2ed3e96502579338f571d8f76a551561 100644 (file)
  */
 
 #include <time.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <et/com_err.h>
 #include "e2fsck.h"
 
+#ifdef NO_INLINE_FUNCS
+#define _INLINE_
+#else
+#define _INLINE_ inline
+#endif
+
 /* Files counts */
 int fs_directory_count = 0;
 int fs_regular_count = 0;
@@ -47,6 +56,9 @@ int fs_fifo_count = 0;
 int fs_total_count = 0;
 int fs_badblocks_count = 0;
 int fs_sockets_count = 0;
+int fs_ind_count = 0;
+int fs_dind_count = 0;
+int fs_tind_count = 0;
 
 ext2fs_inode_bitmap inode_used_map = 0;        /* Inodes which are in use */
 ext2fs_inode_bitmap inode_bad_map = 0; /* Inodes which are bad in some way */
@@ -54,6 +66,7 @@ ext2fs_inode_bitmap inode_dir_map = 0;        /* Inodes which are directories */
 
 ext2fs_block_bitmap block_found_map = 0;
 ext2fs_block_bitmap block_dup_map = 0;
+ext2fs_block_bitmap block_illegal_map = 0;
 
 static int fix_link_count = -1;
 
@@ -75,6 +88,7 @@ static int process_inode_cmp(const void *a, const void *b);
 static int dir_block_cmp(const void *a, const void *b);
 static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan,
                                  dgrp_t group, void * private);
+static char *describe_illegal_block(ext2_filsys fs, blk_t block);
 
 struct process_block_struct {
        ino_t   ino;
@@ -125,7 +139,7 @@ static void unwind_pass1(ext2_filsys fs)
        free(dir_blocks);       dir_blocks = 0;
        dir_block_size = 0;
        if (block_dup_map) {
-               free(block_dup_map); block_dup_map = 0;
+               ext2fs_free_block_bitmap(block_dup_map); block_dup_map = 0;
        }
 
        /* Clear statistic counters */
@@ -140,6 +154,9 @@ static void unwind_pass1(ext2_filsys fs)
        fs_total_count = 0;
        fs_badblocks_count = 0;
        fs_sockets_count = 0;
+       fs_ind_count = 0;
+       fs_dind_count = 0;
+       fs_tind_count = 0;
 }
 
 void pass1(ext2_filsys fs)
@@ -184,6 +201,13 @@ void pass1(ext2_filsys fs)
                        "while allocating block_found_map");
                fatal_error(0);
        }
+       retval = ext2fs_allocate_block_bitmap(fs, "illegal block map",
+                                             &block_illegal_map);
+       if (retval) {
+               com_err("ext2fs_allocate_block_bitmap", retval,
+                       "while allocating block_illegal_map");
+               fatal_error(0);
+       }
        inode_link_info = allocate_memory((fs->super->s_inodes_count + 1) *
                                          sizeof(unsigned short),
                                          "inode link count array");
@@ -241,9 +265,9 @@ void pass1(ext2_filsys fs)
                         * not, offer to clear it.  It will be
                         * regnerated in pass #3.
                         */
-                       if (!S_ISDIR(inode.i_mode)) {
+                       if (!LINUX_S_ISDIR(inode.i_mode)) {
                                printf("Root inode is not a directory.  ");
-                               preenhalt();
+                               preenhalt(fs);
                                if (ask("Clear", 1)) {
                                        inode.i_dtime = time(0);
                                        inode.i_links_count = 0;
@@ -281,6 +305,15 @@ void pass1(ext2_filsys fs)
                }
                if ((ino != EXT2_ROOT_INO) && (ino < EXT2_FIRST_INO)) {
                        ext2fs_mark_inode_bitmap(inode_used_map, ino);
+                       if (inode.i_mode != 0) {
+                               printf("Reserved inode %lu has bad mode.  ", ino);
+                               if (ask("Clear", 1)) {
+                                       inode.i_mode = 0;
+                                       e2fsck_write_inode(fs, ino, &inode,
+                                                          "pass1");
+                               } else 
+                                       ext2fs_unmark_valid(fs);
+                       }
                        check_blocks(fs, ino, &inode, block_buf);
                        goto next;
                }
@@ -329,37 +362,46 @@ void pass1(ext2_filsys fs)
                }
                
                ext2fs_mark_inode_bitmap(inode_used_map, ino);
-               if (inode.i_faddr || inode.i_frag || inode.i_fsize ||
-                   inode.i_file_acl || inode.i_dir_acl) {
+               if (inode.i_faddr
+#if HAVE_EXT2_FRAGS
+                   || inode.i_frag || inode.i_fsize
+#endif
+                   || inode.i_file_acl || inode.i_dir_acl) {
                        if (!inode_bad_map)
                                alloc_bad_map(fs);
                        ext2fs_mark_inode_bitmap(inode_bad_map, ino);
                }
                
-               if (S_ISDIR(inode.i_mode)) {
+               if (LINUX_S_ISDIR(inode.i_mode)) {
                        ext2fs_mark_inode_bitmap(inode_dir_map, ino);
                        add_dir_info(fs, ino, 0, &inode);
                        fs_directory_count++;
-               } else if (S_ISREG (inode.i_mode))
+               } else if (LINUX_S_ISREG (inode.i_mode))
                        fs_regular_count++;
-               else if (S_ISCHR (inode.i_mode))
+               else if (LINUX_S_ISCHR (inode.i_mode))
                        fs_chardev_count++;
-               else if (S_ISBLK (inode.i_mode))
+               else if (LINUX_S_ISBLK (inode.i_mode))
                        fs_blockdev_count++;
-               else if (S_ISLNK (inode.i_mode)) {
+               else if (LINUX_S_ISLNK (inode.i_mode)) {
                        fs_symlinks_count++;
                        if (!inode.i_blocks)
                                fs_fast_symlinks_count++;
                }
-               else if (S_ISFIFO (inode.i_mode))
+               else if (LINUX_S_ISFIFO (inode.i_mode))
                        fs_fifo_count++;
-               else if (S_ISSOCK (inode.i_mode))
+               else if (LINUX_S_ISSOCK (inode.i_mode))
                        fs_sockets_count++;
                else {
                        if (!inode_bad_map)
                                alloc_bad_map(fs);
                        ext2fs_mark_inode_bitmap(inode_bad_map, ino);
                }
+               if (inode.i_block[EXT2_IND_BLOCK])
+                       fs_ind_count++;
+               if (inode.i_block[EXT2_DIND_BLOCK])
+                       fs_dind_count++;
+               if (inode.i_block[EXT2_TIND_BLOCK])
+                       fs_tind_count++;
                if (inode.i_block[EXT2_IND_BLOCK] ||
                    inode.i_block[EXT2_DIND_BLOCK] ||
                    inode.i_block[EXT2_TIND_BLOCK]) {
@@ -397,7 +439,7 @@ void pass1(ext2_filsys fs)
        if (block_dup_map) {
                if (preen) {
                        printf("Duplicate or bad blocks in use!\n");
-                       preenhalt();
+                       preenhalt(fs);
                }
                pass1_dupblocks(fs, block_buf);
        }
@@ -406,6 +448,9 @@ void pass1(ext2_filsys fs)
        free(inodes_to_process);
 endit:
        free(block_buf);
+       ext2fs_free_block_bitmap(block_illegal_map);
+       block_illegal_map = 0;
+       
        if (tflag > 1) {
                printf("Pass 1: ");
                print_resource_track(&rtrack);
@@ -446,7 +491,7 @@ static void process_inodes(ext2_filsys fs, char *block_buf)
                ino = inodes_to_process[i].ino;
                stashed_ino = ino;
 #if 0
-               printf("%lu ", ino);
+               printf("%u ", ino);
 #endif
                sprintf(buf, "reading indirect blocks of inode %lu", ino);
                ehandler_operation(buf);
@@ -479,7 +524,13 @@ static int dir_block_cmp(const void *a, const void *b)
        const struct dir_block_struct *db_b =
                (const struct dir_block_struct *) b;
 
-       return (db_a->blk - db_b->blk);
+       if (db_a->blk != db_b->blk)
+               return (db_a->blk - db_b->blk);
+       
+       if (db_a->ino != db_b->ino)
+               return (db_a->ino - db_b->ino);
+
+       return (db_a->blockcnt - db_b->blockcnt);
 }
 
 /*
@@ -501,12 +552,15 @@ static void alloc_bad_map(ext2_filsys fs)
 /*
  * Marks a block as in use, setting the dup_map if it's been set
  * already.  Called by process_block and process_bad_block.
+ *
+ * WARNING: Assumes checks have already been done to make sure block
+ * is valid.  This is true in both process_block and process_bad_block.
  */
-static void mark_block_used(ext2_filsys fs, blk_t block)
+static _INLINE_ void mark_block_used(ext2_filsys fs, blk_t block)
 {
        errcode_t       retval;
        
-       if (ext2fs_test_block_bitmap(block_found_map, block)) {
+       if (ext2fs_fast_test_block_bitmap(block_found_map, block)) {
                if (!block_dup_map) {
                        retval = ext2fs_allocate_block_bitmap(fs,
                              "multiply claimed block map", &block_dup_map);
@@ -516,9 +570,9 @@ static void mark_block_used(ext2_filsys fs, blk_t block)
                                fatal_error(0);
                        }
                }
-               ext2fs_mark_block_bitmap(block_dup_map, block);
+               ext2fs_fast_mark_block_bitmap(block_dup_map, block);
        } else {
-               ext2fs_mark_block_bitmap(block_found_map, block);
+               ext2fs_fast_mark_block_bitmap(block_found_map, block);
        }
 }
 
@@ -539,11 +593,12 @@ static void check_blocks(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
        pb.num_blocks = pb.last_block = 0;
        pb.num_illegal_blocks = 0;
        pb.suppress = pb.clear = 0;
-       pb.is_dir = S_ISDIR(inode->i_mode);
+       pb.is_dir = LINUX_S_ISDIR(inode->i_mode);
        pb.fix = -1;
        pb.inode = inode;
-       retval = ext2fs_block_iterate(fs, ino, 0, block_buf,
-                                     process_block, &pb);
+       retval = ext2fs_block_iterate(fs, ino,
+                                     pb.is_dir ? BLOCK_FLAG_HOLE : 0,
+                                     block_buf, process_block, &pb);
        if (retval)
                com_err(program_name, retval,
                        "while calling ext2fs_block_iterate in check_blocks");
@@ -575,7 +630,7 @@ static void check_blocks(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
 
        pb.num_blocks *= (fs->blocksize / 512);
 #if 0
-       printf("inode %lu, i_size = %lu, last_block = %lu, i_blocks=%lu, num_blocks = %lu\n",
+       printf("inode %u, i_size = %lu, last_block = %lu, i_blocks=%lu, num_blocks = %lu\n",
               ino, inode->i_size, pb.last_block, inode->i_blocks,
               pb.num_blocks);
 #endif
@@ -589,12 +644,14 @@ static void check_blocks(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
                        ext2fs_unmark_inode_bitmap(inode_dir_map, ino);
                        ext2fs_unmark_inode_bitmap(inode_used_map, ino);
                        fs_directory_count--;
+                       pb.is_dir = 0;
                } else
                        ext2fs_unmark_valid(fs);
        }
-       if (inode->i_size < pb.last_block * fs->blocksize) {
-               printf ("Inode %lu, incorrect size, %lu (counted = %u). ",
-                       ino, inode->i_size,
+       if ((pb.is_dir && (inode->i_size != (pb.last_block + 1) * fs->blocksize)) ||
+           (inode->i_size < pb.last_block * fs->blocksize)) {
+               printf ("%s %lu, incorrect size, %u (counted = %u). ",
+                       pb.is_dir ? "Directory" : "Inode", ino, inode->i_size,
                        (pb.last_block+1) * fs->blocksize);
                if (ask ("Set size to counted", 1)) {
                        inode->i_size = (pb.last_block+1) * fs->blocksize;
@@ -603,7 +660,7 @@ static void check_blocks(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
                        ext2fs_unmark_valid(fs);
        }
        if (pb.num_blocks != inode->i_blocks) {
-               printf ("Inode %lu, i_blocks wrong %lu (counted=%u).  ",
+               printf ("Inode %lu, i_blocks wrong %u (counted=%u).  ",
                        ino, inode->i_blocks, pb.num_blocks);
                if (ask ("Set i_blocks to counted", 1)) {
                        inode->i_blocks = pb.num_blocks;
@@ -611,7 +668,57 @@ static void check_blocks(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
                } else
                                ext2fs_unmark_valid(fs);
        }
-}      
+}
+
+/*
+ * Helper function called by process block when an illegal block is
+ * found.  It returns a description about why the block is illegal
+ */
+static char *describe_illegal_block(ext2_filsys fs, blk_t block)
+{
+       blk_t   super;
+       int     i;
+       static char     problem[80];
+
+       super = fs->super->s_first_data_block;
+       strcpy(problem, "PROGRAMMING ERROR: Unknown reason for illegal block");
+       if (block < super) {
+               sprintf(problem, "< FIRSTBLOCK (%u)", super);
+               return(problem);
+       } else if (block >= fs->super->s_blocks_count) {
+               sprintf(problem, "> BLOCKS (%u)", fs->super->s_blocks_count);
+               return(problem);
+       }
+       for (i = 0; i < fs->group_desc_count; i++) {
+               if (block == super) {
+                       sprintf(problem, "is the superblock in group %d", i);
+                       break;
+               }
+               if (block > super &&
+                   block <= (super + fs->desc_blocks)) {
+                       sprintf(problem, "is in the group descriptors "
+                               "of group %d", i);
+                       break;
+               }
+               if (block == fs->group_desc[i].bg_block_bitmap) {
+                       sprintf(problem, "is the block bitmap of group %d", i);
+                       break;
+               }
+               if (block == fs->group_desc[i].bg_inode_bitmap) {
+                       sprintf(problem, "is the inode bitmap of group %d", i);
+                       break;
+               }
+               if (block >= fs->group_desc[i].bg_inode_table &&
+                   (block < fs->group_desc[i].bg_inode_table
+                    + fs->inode_blocks_per_group)) {
+                       sprintf(problem, "is in the inode table of group %d",
+                               i);
+                       break;
+               }
+               super += fs->super->s_blocks_per_group;
+       }
+       return(problem);
+}
 
 /*
  * This is a helper function for check_blocks().
@@ -622,55 +729,41 @@ int process_block(ext2_filsys fs,
                  void *private)
 {
        struct process_block_struct *p;
-       int     group;
-       int     illegal_block = 0;
-       char    problem[80];
-       blk_t   firstblock, group_super;
+       char    *problem;
        blk_t   blk = *block_nr;
+       int     ret_code = 0;
 
-       if (!blk)
-               return 0;
        p = (struct process_block_struct *) private;
 
+       if (blk == 0) {
+               if (p->is_dir == 0) {
+                       printf("process_block() called with blk == 0, "
+                              "inode %lu???", p->ino);
+                       return 0;
+               }
+               if (blockcnt < 0)
+                       return 0;
+               if (blockcnt * fs->blocksize < p->inode->i_size) {
+                       printf("Hole found in directory inode %lu!  "
+                              "(blkcnt=%d)\n", p->ino, blockcnt);
+                       goto mark_dir;
+               }
+               return 0;
+       }
+
 #if 0
-       printf("Process_block, inode %lu, block %lu, #%d\n", p->ino, blk,
+       printf("Process_block, inode %lu, block %u, #%d\n", p->ino, blk,
               blockcnt);
-#endif 
+#endif
        
-       firstblock = fs->super->s_first_data_block;
-       group = (blk - firstblock) / fs->super->s_blocks_per_group;
-       group_super = ((group * fs->super->s_blocks_per_group) +
-                      fs->super->s_first_data_block);
-       if (blk < firstblock) {
-               sprintf(problem, "< FIRSTBLOCK (%lu)", firstblock);
-               illegal_block++;
-       } else if (blk >= fs->super->s_blocks_count) {
-               sprintf(problem, "> BLOCKS (%lu)", fs->super->s_blocks_count);
-               illegal_block++;
-       } else if (blk == group_super) {
-               sprintf(problem, "is the superblock in group %d", group);
-               illegal_block++;
-       } else if (blk > group_super &&
-                  blk <= (group_super + fs->desc_blocks)) {
-               sprintf(problem, "is in the group descriptors in group %d",
-                       group);
-               illegal_block++;
-       } else if (blk == fs->group_desc[group].bg_block_bitmap) {
-               sprintf(problem, "is the block bitmap of group %d", group);
-               illegal_block++;
-       } else if (blk == fs->group_desc[group].bg_inode_bitmap) {
-               sprintf(problem, "is the inode bitmap of group %d", group);
-               illegal_block++;
-       } else if (blk >= fs->group_desc[group].bg_inode_table &&
-                  blk < fs->group_desc[group].bg_inode_table + fs->inode_blocks_per_group) {
-               sprintf(problem, "is in the inode table of group %d", group);
-               illegal_block++;
-       }
-       if (illegal_block) {
+       if (blk < fs->super->s_first_data_block ||
+           blk >= fs->super->s_blocks_count ||
+           ext2fs_test_block_bitmap(block_illegal_map, blk)) {
+               problem = describe_illegal_block(fs, blk);
                if (preen) {
-                       printf("Block %lu of inode %lu %s\n", blk, p->ino,
+                       printf("Block %u of inode %lu %s\n", blk, p->ino,
                               problem);
-                       preenhalt();
+                       preenhalt(fs);
                }
                if (p->fix == -1) {
                        printf("Remove illegal block(s) in inode %lu", p->ino);
@@ -689,28 +782,34 @@ int process_block(ext2_filsys fs,
                        }
                }
                if (!p->suppress)
-                       printf("Block #%d (%lu) %s.  %s\n", blockcnt, blk,
+                       printf("Block #%d (%u) %s.  %s\n", blockcnt, blk,
                               problem, clear_msg[p->fix]);
                if (p->fix) {
-                       *block_nr = 0;
-                       return BLOCK_CHANGED;
+                       blk = *block_nr = 0;
+                       ret_code = BLOCK_CHANGED;
+                       goto mark_dir;
                } else {
                        ext2fs_unmark_valid(fs);
                        return 0;
                }
        }
 
-       p->num_blocks++;
-       if (blockcnt > 0)
-               p->last_block = blockcnt;
        mark_block_used(fs, blk);
+       p->num_blocks++;
+       if (blockcnt < 0)
+               return 0;
        
-       if (p->is_dir && (blockcnt >= 0)) {
+       p->last_block = blockcnt;
+mark_dir:
+       if (p->is_dir) {
                if (dir_block_count >= dir_block_size) {
                        dir_block_size += 100;
                        dir_blocks = realloc(dir_blocks,
                                             dir_block_size *
                                             sizeof(struct dir_block_struct));
+                       if (dir_blocks == 0)
+                               fatal_error("Not enough memory to "
+                                           "realloc dir_blocks");
                }
 
                dir_blocks[dir_block_count].blk = blk;
@@ -718,19 +817,13 @@ int process_block(ext2_filsys fs,
                dir_blocks[dir_block_count].blockcnt = blockcnt;
                dir_block_count++;
        }
-       
-#if 0
-       printf("process block, inode %lu, block #%d is %lu\n",
-              p->ino, blockcnt, blk);
-#endif
-       
-       return 0;
+       return ret_code;
 }
 
-static void bad_block_indirect(blk_t blk)
+static void bad_block_indirect(ext2_filsys fs, blk_t blk)
 {
-       printf("Bad block %lu used as bad block indirect block?!?\n", blk);
-       preenhalt();
+       printf("Bad block %u used as bad block indirect block?!?\n", blk);
+       preenhalt(fs);
        printf("\nThis inconsistency can not be fixed with "
               "e2fsck; to fix it, use\n"
               """dumpe2fs -b"" to dump out the bad block "
@@ -741,6 +834,22 @@ static void bad_block_indirect(blk_t blk)
        fatal_error(0);
 }
 
+static int bad_primary_block(ext2_filsys fs, blk_t *block_nr)
+{
+       printf("\nIf the block is really bad, the filesystem can not be "
+              "fixed.\n");
+       preenhalt(fs);
+       printf("You can clear the this block from the bad block list\n");
+       printf("and hope that block is really OK, but there are no "
+              "guarantees.\n\n");
+       if (ask("Clear (and hope for the best)", 1)) {
+               *block_nr = 0;
+               return 1;
+       }
+       ext2fs_unmark_valid(fs);
+       return 0;
+}
+
 int process_bad_block(ext2_filsys fs,
                      blk_t *block_nr,
                      int blockcnt,
@@ -758,12 +867,12 @@ int process_bad_block(ext2_filsys fs,
        if ((blk < fs->super->s_first_data_block) ||
            (blk >= fs->super->s_blocks_count)) {
                if (preen) {
-                       printf("Illegal block %lu in bad block inode\n", blk);
-                       preenhalt();
+                       printf("Illegal block %u in bad block inode\n", blk);
+                       preenhalt(fs);
                }
                if (p->fix == -1)
                        p->fix = ask("Remove illegal block(s) in bad block inode", 1);
-               printf("Illegal block %lu in bad block inode.  %s\n", blk,
+               printf("Illegal block %u in bad block inode.  %s\n", blk,
                       clear_msg[p->fix]);
                if (p->fix) {
                        *block_nr = 0;
@@ -776,13 +885,13 @@ int process_bad_block(ext2_filsys fs,
 
        if (blockcnt < 0) {
                if (ext2fs_test_block_bitmap(block_found_map, blk))
-                       bad_block_indirect(blk);
+                       bad_block_indirect(fs, blk);
                else
                        mark_block_used(fs, blk);
                return 0;
        }
 #if 0 
-       printf ("DEBUG: Marking %lu as bad.\n", blk);
+       printf ("DEBUG: Marking %u as bad.\n", blk);
 #endif
        fs_badblocks_count++;
        /*
@@ -803,31 +912,35 @@ int process_bad_block(ext2_filsys fs,
        for (i = 0; i < fs->group_desc_count; i++ ) {
                if (blk == first_block) {
                        if (i == 0) {
-                               printf("The primary superblock (%lu) is "
-                                      "bad.  Aiiieeee....\n", blk);
-                               fatal_error(0);
+                               printf("The primary superblock (%u) is "
+                                      "on the bad block list.\n", blk);
+                               if (bad_primary_block(fs, block_nr))
+                                       return BLOCK_CHANGED;
+                               return 0;
                        }
                        if (!preen)
                                printf("Warning: Group %d's superblock "
-                                      "(%lu) is bad.\n", i, blk);
+                                      "(%u) is bad.\n", i, blk);
                        return 0;
                }
                if ((blk > first_block) &&
                    (blk <= first_block + fs->desc_blocks)) {
                        if (i == 0) {
-                               printf("Bad block %lu is in the primary "
-                                      "group descriptors.  Aiiieeee....\n",
-                                      blk);
-                               fatal_error(0);
+                               printf("Block %u in the primary group "
+                                      "descriptors is on the bad block "
+                                      "list\n", blk);
+                               if (bad_primary_block(fs, block_nr))
+                                       return BLOCK_CHANGED;
+                               return 0;
                        }
                        if (!preen)
                                printf("Warning: Group %d's copy of the "
                                       "group descriptors has a bad "
-                                      "block (%lu).\n", i, blk);
+                                      "block (%u).\n", i, blk);
                        return 0;
                }
                if (blk == fs->group_desc[i].bg_block_bitmap) {
-                       printf("Group %d's block bitmap (%lu) is bad.  ",
+                       printf("Group %d's block bitmap (%u) is bad.  ",
                               i, blk);
                        if (ask("Relocate", 1)) {
                                invalid_block_bitmap[i]++;
@@ -837,7 +950,7 @@ int process_bad_block(ext2_filsys fs,
                        return 0;
                }
                if (blk == fs->group_desc[i].bg_inode_bitmap) {
-                       printf("Group %d's inode bitmap (%lu) is bad.  ",
+                       printf("Group %d's inode bitmap (%u) is bad.  ",
                               i, blk);
                        if (ask("Relocate", 1)) {
                                invalid_inode_bitmap[i]++;
@@ -850,7 +963,7 @@ int process_bad_block(ext2_filsys fs,
                    (blk < (fs->group_desc[i].bg_inode_table +
                            fs->inode_blocks_per_group))) {
                        printf("WARNING: Severe data loss possible!!!!\n");
-                       printf("Bad block %lu in group %d's inode table.  ",
+                       printf("Bad block %u in group %d's inode table.  ",
                               blk, i);
                        if (ask("Relocate", 1)) {
                                invalid_inode_table[i]++;
@@ -868,11 +981,11 @@ int process_bad_block(ext2_filsys fs,
         */
        if ((blk == p->inode->i_block[EXT2_IND_BLOCK]) ||
            p->inode->i_block[EXT2_DIND_BLOCK]) {
-               bad_block_indirect(blk);
+               bad_block_indirect(fs, blk);
                return 0;
        }
        
-       printf("Programming error?  block #%lu claimed for no reason "
+       printf("Programming error?  block #%u claimed for no reason "
               "in process_bad_block.\n", blk);
        return 0;
 }
@@ -904,15 +1017,15 @@ static void new_table_block(ext2_filsys fs, blk_t first_block, int group,
        ext2fs_mark_super_dirty(fs);
        printf("Relocating group %d's %s ", group, name);
        if (old_block)
-               printf("from %lu ", old_block);
-       printf("to %lu...\n", *new_block);
+               printf("from %u ", old_block);
+       printf("to %u...\n", *new_block);
        for (i = 0; i < num; i++) {
                ext2fs_mark_block_bitmap(block_found_map, (*new_block)+i);
                if (old_block) {
                        retval = io_channel_read_blk(fs->io, old_block + i,
                                                     1, buf);
                        if (retval)
-                               printf("Warning: could not read block %lu "
+                               printf("Warning: could not read block %u "
                                       "of %s: %s\n",
                                       old_block + i, name,
                                       error_message(retval));
@@ -922,7 +1035,7 @@ static void new_table_block(ext2_filsys fs, blk_t first_block, int group,
                retval = io_channel_write_blk(fs->io, (*new_block) + i,
                                              1, buf);
                if (retval)
-                       printf("Warning: could not write block %lu for %s: %s\n",
+                       printf("Warning: could not write block %u for %s: %s\n",
                               (*new_block) + i, name, error_message(retval));
        }
        free(buf);
@@ -977,19 +1090,23 @@ static void mark_table_blocks(ext2_filsys fs)
                if (fs->group_desc[i].bg_block_bitmap) {
                        if (ext2fs_test_block_bitmap(block_found_map,
                                     fs->group_desc[i].bg_block_bitmap)) {
-                               printf("Group %i's block bitmap at %lu "
+                               printf("Group %i's block bitmap at %u "
                                       "conflicts with some other fs block.\n",
                                       i, fs->group_desc[i].bg_block_bitmap);
-                               preenhalt();
+                               preenhalt(fs);
                                if (ask("Relocate", 1)) {
                                        invalid_block_bitmap[i]++;
                                        invalid_bitmaps++;
                                } else {
                                        ext2fs_unmark_valid(fs);
                                }
-                       } else
+                       } else {
                            ext2fs_mark_block_bitmap(block_found_map,
                                     fs->group_desc[i].bg_block_bitmap);
+                           ext2fs_mark_block_bitmap(block_illegal_map,
+                                    fs->group_desc[i].bg_block_bitmap);
+                   }
+                       
                }
                /*
                 * Mark block used for the inode bitmap 
@@ -997,19 +1114,22 @@ static void mark_table_blocks(ext2_filsys fs)
                if (fs->group_desc[i].bg_inode_bitmap) {
                        if (ext2fs_test_block_bitmap(block_found_map,
                                     fs->group_desc[i].bg_inode_bitmap)) {
-                               printf("Group %i's inode bitmap at %lu "
+                               printf("Group %i's inode bitmap at %u "
                                       "conflicts with some other fs block.\n",
                                       i, fs->group_desc[i].bg_inode_bitmap);
-                               preenhalt();
+                               preenhalt(fs);
                                if (ask("Relocate", 1)) {
                                        invalid_inode_bitmap[i]++;
                                        invalid_bitmaps++;
                                } else {
                                        ext2fs_unmark_valid(fs);
                                }
-                       } else
+                       } else {
                            ext2fs_mark_block_bitmap(block_found_map,
                                     fs->group_desc[i].bg_inode_bitmap);
+                           ext2fs_mark_block_bitmap(block_illegal_map,
+                                    fs->group_desc[i].bg_inode_bitmap);
+                       }
                }
                    
                /*
@@ -1021,20 +1141,23 @@ static void mark_table_blocks(ext2_filsys fs)
                             j++, b++) {
                                if (ext2fs_test_block_bitmap(block_found_map,
                                                             b)) {
-                                       printf("Group %i's inode table at %lu "
+                                       printf("Group %i's inode table at %u "
                                               "conflicts with some other "
                                               "fs block.\n",
                                               i, b);
-                                       preenhalt();
+                                       preenhalt(fs);
                                        if (ask("Relocate", 1)) {
                                                invalid_inode_table[i]++;
                                                invalid_bitmaps++;
                                        } else {
                                                ext2fs_unmark_valid(fs);
                                        }
-                               } else
+                               } else {
                                    ext2fs_mark_block_bitmap(block_found_map,
                                                             b);
+                                   ext2fs_mark_block_bitmap(block_illegal_map,
+                                                            b);
+                                   }
                        }
                }
                            
@@ -1042,13 +1165,17 @@ static void mark_table_blocks(ext2_filsys fs)
                 * Mark this group's copy of the superblock
                 */
                ext2fs_mark_block_bitmap(block_found_map, block);
+               ext2fs_mark_block_bitmap(block_illegal_map, block);
                
                /*
                 * Mark this group's copy of the descriptors
                 */
-               for (j = 0; j < fs->desc_blocks; j++)
+               for (j = 0; j < fs->desc_blocks; j++) {
                        ext2fs_mark_block_bitmap(block_found_map,
                                                 block + j + 1);
+                       ext2fs_mark_block_bitmap(block_illegal_map,
+                                                block + j + 1);
+               }
                block += fs->super->s_blocks_per_group;
        }
 }
@@ -1077,7 +1204,7 @@ static errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
 static errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino)
 {
        if (ino == stashed_ino) {
-               if (!S_ISDIR(stashed_inode->i_mode))
+               if (!LINUX_S_ISDIR(stashed_inode->i_mode))
                        return ENOTDIR;
                return 0;
        }
index c98030fbecc30560614c8805ecce491a2657e7eb..287c24f1a6b0f5252baaeb93e0612a1827b23e9d 100644 (file)
@@ -24,6 +24,9 @@
  */
 
 #include <time.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <et/com_err.h>
 #include "e2fsck.h"
@@ -237,7 +240,7 @@ int process_pass1b_block(ext2_filsys fs,
                        if (!p->dup_blocks)
                                printf("Duplicate/bad block(s) in inode %lu:",
                                       p->ino);
-                       printf(" %lu", *block_nr);
+                       printf(" %u", *block_nr);
                }
                p->dup_blocks++;
                ext2fs_mark_block_bitmap(block_dup_map, *block_nr);
@@ -330,8 +333,8 @@ void pass1c(ext2_filsys fs, char *block_buf)
         * (by searching for the containing directory for that inode.)
         */
        for (i=0; inodes_left && i < dir_block_count; i++) {
-               retval = io_channel_read_blk(fs->io, dir_blocks[i].blk,
-                                            1, block_buf);
+               retval = ext2fs_read_dir_block(fs, dir_blocks[i].blk,
+                                              block_buf);
                entry = offset = 0;
                while (offset < fs->blocksize) {
                        entry++;
@@ -478,6 +481,7 @@ static void pass1d(ext2_filsys fs, char *block_buf)
                        ext2fs_unmark_valid(fs);
                printf("\n");
        }
+       free(shared);
 }
 
 static int delete_file_block(ext2_filsys fs,
index 3331cb9790262aacfa6ef79e8bff4f522049af6f..cd5b267b1de870d9777a361cd8e30d51afb9c1a9 100644 (file)
@@ -31,7 +31,6 @@
  *     - The inode_used_map bitmap
  *     - The inode_bad_map bitmap
  *     - The inode_dir_map bitmap
- *     - The block_dup_map bitmap
  *
  * Pass 2 frees the following data structures
  *     - The inode_bad_map bitmap
@@ -52,6 +51,13 @@ static int process_bad_inode(ext2_filsys fs, ino_t dir, ino_t ino);
 static int check_dir_block(ext2_filsys fs,
                           struct dir_block_struct *dir_blocks_info,
                           char *buf);
+static int allocate_dir_block(ext2_filsys fs,
+                             struct dir_block_struct *dir_blocks_info,
+                             char *buf);
+static int update_dir_block(ext2_filsys fs,
+                           blk_t       *block_nr,
+                           int blockcnt,
+                           void *private);
 
 void pass2(ext2_filsys fs)
 {
@@ -100,14 +106,29 @@ static int check_dot(ext2_filsys fs,
        int     status = 0;
        int     created = 0;
        int     new_len;
-       char    name[BLOCK_SIZE];
+       const char      *question = 0;
        
        if (!dirent->inode) {
                printf("Missing '.' in directory inode %lu.\n", ino);
+               question = "Fix";
+       } else if ((dirent->name_len != 1) ||
+                  strncmp(dirent->name, ".", dirent->name_len)) {
+               char *name = malloc(dirent->name_len + 1);
+               if (!name)
+                       fatal_error("Couldn't allocate . name");
+               strncpy(name, dirent->name, dirent->name_len);
+               name[dirent->name_len] = '\0';
+               printf("First entry in directory inode %lu contains '%s' "
+                      "(inode=%u)\n", ino, name, dirent->inode);
+               printf("instead of '.'.\n");
+               free(name);
+               question = "Change to be '.'";
+       }
+       if (question) {
                if (dirent->rec_len < 12)
                        fatal_error("Cannot fix, insufficient space to add '.'");
-               preenhalt();
-               if (ask("Fix", 1)) {
+               preenhalt(fs);
+               if (ask(question, 1)) {
                        dirent->inode = ino;
                        dirent->name_len = 1;
                        dirent->name[0] = '.';
@@ -118,19 +139,10 @@ static int check_dot(ext2_filsys fs,
                        return 0;
                }
        }
-       if ((dirent->name_len != 1) ||
-           strncmp(dirent->name, ".", dirent->name_len)) {
-               strncpy(name, dirent->name, dirent->name_len);
-               name[dirent->name_len] = '\0';
-               printf("Missing '.' in directory inode %lu.\n", ino);
-               printf("Cannot fix, first entry in directory contains '%s'\n",
-                      name);
-               exit(FSCK_ERROR);
-       }
        if (dirent->inode != ino) {
                printf("Bad inode number for '.' in directory inode %lu.\n",
                       ino);
-               preenhalt();
+               preenhalt(fs);
                if (ask("Fix", 1)) {
                        dirent->inode = ino;
                        status = 1;
@@ -140,7 +152,7 @@ static int check_dot(ext2_filsys fs,
        if (dirent->rec_len > 12) {
                new_len = dirent->rec_len - 12;
                if (new_len > 12) {
-                       preenhalt();
+                       preenhalt(fs);
                        if (created ||
                            ask("Directory entry for '.' is big.  Split", 1)) {
                                nextdir = (struct ext2_dir_entry *)
@@ -165,15 +177,30 @@ static int check_dotdot(ext2_filsys fs,
                        struct ext2_dir_entry *dirent,
                        struct dir_info *dir)
 {
-       char    name[BLOCK_SIZE];
        ino_t   ino = dir->ino;
+       const char      *question = 0;
        
        if (!dirent->inode) {
                printf("Missing '..' in directory inode %lu.\n", ino);
+               question = "Fix";
+       } else if ((dirent->name_len != 2) ||
+           strncmp(dirent->name, "..", dirent->name_len)) {
+               char *name = malloc(dirent->name_len + 1);
+               if (!name)
+                       fatal_error("Couldn't allocate bad .. name");
+               strncpy(name, dirent->name, dirent->name_len);
+               name[dirent->name_len] = '\0';
+               printf("Second entry in directory inode %lu contains '%s' "
+                      "(inode=%u)\n", ino, name, dirent->inode);
+               printf("instead of '..'.\n");
+               free(name);
+               question = "Change to be '..'";
+       }
+       if (question) {
                if (dirent->rec_len < 12)
                        fatal_error("Cannot fix, insufficient space to add '..'");
-               preenhalt();
-               if (ask("Fix", 1)) {
+               preenhalt(fs);
+               if (ask(question, 1)) {
                        /*
                         * Note: we don't have the parent inode just
                         * yet, so we will fill it in with the root
@@ -188,15 +215,6 @@ static int check_dotdot(ext2_filsys fs,
                        ext2fs_unmark_valid(fs);
                return 0;
        }
-       if ((dirent->name_len != 2) ||
-           strncmp(dirent->name, "..", dirent->name_len)) {
-               strncpy(name, dirent->name, dirent->name_len);
-               name[dirent->name_len] = '\0';
-               printf("Missing '..' in directory inode %lu.\n", ino);
-               printf("Cannot fix, first entry in directory contains %s\n",
-                      name);
-               exit(FSCK_ERROR);
-       }
        dir->dotdot = dirent->inode;
        return 0;
 }
@@ -232,7 +250,7 @@ static int check_name(ext2_filsys fs,
                                        name, pathname, dir_ino);
                                if (pathname != unknown_pathname)
                                        free(pathname);
-                               preenhalt();
+                               preenhalt(fs);
                                fixup = ask("Replace '/' or null by '.'", 1);
                        }
                        if (fixup) {
@@ -251,14 +269,14 @@ static int check_dir_block(ext2_filsys fs,
 {
        struct dir_info         *subdir, *dir;
        struct ext2_dir_entry   *dirent;
-       char                    name[BLOCK_SIZE];
        int                     offset = 0;
        int                     dir_modified = 0;
        errcode_t               retval;
        char                    *path1, *path2;
-       int                     dot_state;
+       int                     dot_state, name_len;
        blk_t                   block_nr = db->blk;
        ino_t                   ino = db->ino;
+       char                    name[EXT2_NAME_LEN+1];
 
        /*
         * Make sure the inode is still in use (could have been 
@@ -266,6 +284,12 @@ static int check_dir_block(ext2_filsys fs,
         */
        if (!(ext2fs_test_inode_bitmap(inode_used_map, ino))) 
                return 0;
+
+       if (db->blk == 0) {
+               if (allocate_dir_block(fs, db, buf))
+                       return 0;
+               block_nr = db->blk;
+       }
        
        if (db->blockcnt)
                dot_state = 2;
@@ -277,7 +301,7 @@ static int check_dir_block(ext2_filsys fs,
               db->blockcnt, ino);
 #endif
        
-       retval = io_channel_read_blk(fs->io, block_nr, 1, buf);
+       retval = ext2fs_read_dir_block(fs, block_nr, buf);
        if (retval) {
                com_err(program_name, retval,
                        "while reading directory block %d", block_nr);
@@ -291,7 +315,7 @@ static int check_dir_block(ext2_filsys fs,
                    ((dirent->name_len+8) > dirent->rec_len)) {
                        printf("Directory inode %lu, block %d, offset %d: directory corrupted\n",
                               ino, db->blockcnt, offset);
-                       preenhalt();
+                       preenhalt(fs);
                        if (ask("Salvage", 1)) {
                                dirent->rec_len = fs->blocksize - offset;
                                dirent->name_len = 0;
@@ -302,8 +326,22 @@ static int check_dir_block(ext2_filsys fs,
                                return DIRENT_ABORT;
                        }
                }
-               strncpy(name, dirent->name, dirent->name_len);
-               name[dirent->name_len] = '\0';
+
+               name_len = dirent->name_len;
+               if (dirent->name_len > EXT2_NAME_LEN) {
+                       printf("Directory inode %lu, block %d, offset %d: filename too long\n",
+                              ino, db->blockcnt, offset);
+                       preenhalt(fs);
+                       if (ask("Truncate filename", 1)) {
+                               dirent->name_len = EXT2_NAME_LEN;
+                               dir_modified++;
+                       }
+                       name_len = EXT2_NAME_LEN;
+               }
+
+               strncpy(name, dirent->name, name_len);
+               name[name_len] = '\0';
+
                if (dot_state == 1) {
                        if (check_dot(fs, dirent, ino))
                                dir_modified++;
@@ -324,7 +362,7 @@ static int check_dir_block(ext2_filsys fs,
                               name, path1, ino);
                        if (path1 != unknown_pathname)
                                free(path1);
-                       preenhalt();
+                       preenhalt(fs);
                        if (ask("Clear", 1)) {
                                dirent->inode = 0;
                                dir_modified++;
@@ -349,11 +387,11 @@ static int check_dir_block(ext2_filsys fs,
                        retval = ext2fs_get_pathname(fs, ino, 0, &path1);
                        if (retval)
                                path1 = unknown_pathname;
-                       printf("Entry '%s' in %s (%lu) has bad inode #: %lu.\n",
+                       printf("Entry '%s' in %s (%lu) has bad inode #: %u.\n",
                               name, path1, ino, dirent->inode);
                        if (path1 != unknown_pathname)
                                free(path1);
-                       preenhalt();
+                       preenhalt(fs);
                        if (ask("Clear", 1)) {
                                dirent->inode = 0;
                                dir_modified++;
@@ -370,7 +408,7 @@ static int check_dir_block(ext2_filsys fs,
                        retval = ext2fs_get_pathname(fs, ino, 0, &path1);
                        if (retval)
                                path1 = unknown_pathname;
-                       printf("Entry '%s' in %s (%lu) has deleted/unused inode %lu.\n",
+                       printf("Entry '%s' in %s (%lu) has deleted/unused inode %u.\n",
                               name, path1, ino, dirent->inode);
                        if (path1 != unknown_pathname)
                                free(path1);
@@ -410,7 +448,7 @@ static int check_dir_block(ext2_filsys fs,
                                              dirent->inode))) {
                        subdir = get_dir_info(dirent->inode);
                        if (!subdir) {
-                               printf("INTERNAL ERROR: missing dir %lu\n",
+                               printf("INTERNAL ERROR: missing dir %u\n",
                                       dirent->inode);
                                fatal_error(0);
                        }
@@ -425,7 +463,7 @@ static int check_dir_block(ext2_filsys fs,
                                                             &path2);
                                if (retval)
                                        path2 = unknown_pathname;
-                               printf("Entry '%s' in %s (%lu) is a link to directory %s (%lu).\n",
+                               printf("Entry '%s' in %s (%lu) is a link to directory %s (%u).\n",
                                       name, path1, ino, path2, 
                                       dirent->inode);
                                if (path1 != unknown_pathname)
@@ -457,8 +495,7 @@ static int check_dir_block(ext2_filsys fs,
                       dirent->rec_len - fs->blocksize + offset);
        }
        if (dir_modified) {
-               retval = io_channel_write_blk(fs->io, block_nr,
-                                             1, buf);
+               retval = ext2fs_write_dir_block(fs, block_nr, buf);
                if (retval) {
                        com_err(program_name, retval,
                                "while writing directory block %d", block_nr);
@@ -526,16 +563,16 @@ static void deallocate_inode(ext2_filsys fs, ino_t ino,
  * make sure that certain reserved fields are really zero.  If not,
  * prompt the user if he/she wants us to zeroize them.
  */
-static void check_for_zero_long(ext2_filsys fs, ino_t ino, char *pathname,
-                               const char *name, unsigned long *val,
+static void check_for_zero_u32(ext2_filsys fs, ino_t ino, char *pathname,
+                               const char *name, __u32 *val,
                                int *modified)
 {
        char prompt[80];
        
        if (*val) {
-               printf("%s for inode %lu (%s) is %lu, should be zero.\n",
+               printf("%s for inode %lu (%s) is %u, should be zero.\n",
                       name, ino, pathname, *val);
-               preenhalt();
+               preenhalt(fs);
                sprintf(prompt, "Clear %s", name);
                if (ask(prompt, 1)) {
                        *val = 0;
@@ -545,8 +582,8 @@ static void check_for_zero_long(ext2_filsys fs, ino_t ino, char *pathname,
        }
 }
 
-static void check_for_zero_char(ext2_filsys fs, ino_t ino, char *pathname,
-                               const char *name, unsigned char *val,
+static void check_for_zero_u8(ext2_filsys fs, ino_t ino, char *pathname,
+                               const char *name, __u8 *val,
                                int *modified)
 {
        char prompt[80];
@@ -554,7 +591,7 @@ static void check_for_zero_char(ext2_filsys fs, ino_t ino, char *pathname,
        if (*val) {
                printf("%s for inode %lu (%s) is %d, should be zero.\n",
                       name, ino, pathname, *val);
-               preenhalt();
+               preenhalt(fs);
                sprintf(prompt, "Clear %s", name);
                if (ask(prompt, 1)) {
                        *val = 0;
@@ -581,28 +618,42 @@ static int process_bad_inode(ext2_filsys fs, ino_t dir, ino_t ino)
                        ino);
                return 0;
        }
-       if (!S_ISDIR(inode.i_mode) && !S_ISREG(inode.i_mode) &&
-           !S_ISCHR(inode.i_mode) && !S_ISBLK(inode.i_mode) &&
-           !S_ISLNK(inode.i_mode) && !S_ISFIFO(inode.i_mode) &&
-           !(S_ISSOCK(inode.i_mode))) {
+       if (!LINUX_S_ISDIR(inode.i_mode) && !LINUX_S_ISREG(inode.i_mode) &&
+           !LINUX_S_ISCHR(inode.i_mode) && !LINUX_S_ISBLK(inode.i_mode) &&
+           !LINUX_S_ISLNK(inode.i_mode) && !LINUX_S_ISFIFO(inode.i_mode) &&
+           !(LINUX_S_ISSOCK(inode.i_mode))) {
                printf("Inode %lu (%s) has a bad mode (0%o).\n",
                       ino, pathname, inode.i_mode);
-               preenhalt();
+               preenhalt(fs);
                if (ask("Clear", 1)) {
                        deallocate_inode(fs, ino, 0);
+                       free(pathname);
                        return 1;
                } else
                        ext2fs_unmark_valid(fs);
        }
-       check_for_zero_long(fs, ino, pathname, "i_faddr", &inode.i_faddr,
+       check_for_zero_u32(fs, ino, pathname, "i_faddr", &inode.i_faddr,
                            &inode_modified);
-       check_for_zero_char(fs, ino, pathname, "i_frag", &inode.i_frag,
+#if HAVE_EXT2_FRAGS
+       check_for_zero_u8(fs, ino, pathname, "i_frag", &inode.i_frag,
                            &inode_modified);
-       check_for_zero_char(fs, ino, pathname, "i_fsize", &inode.i_fsize,
+       check_for_zero_u8(fs, ino, pathname, "i_fsize", &inode.i_fsize,
                            &inode_modified);
-       check_for_zero_long(fs, ino, pathname, "i_file_acl", &inode.i_file_acl,
+#else
+       /*
+        * Even if the OS specific fields don't support i_frag and
+        * i_fsize, make sure they are set to zero anyway.  This may
+        * cause problems if on some other OS these fields are reused
+        * for something else, but that's probably a bad idea....
+        */
+       check_for_zero_u8(fs, ino, pathname, "i_frag",
+                         &inode.osd2.linux2.l_i_frag, &inode_modified);
+       check_for_zero_u8(fs, ino, pathname, "i_fsize",
+                         &inode.osd2.linux2.l_i_fsize, &inode_modified);
+#endif
+       check_for_zero_u32(fs, ino, pathname, "i_file_acl", &inode.i_file_acl,
                            &inode_modified);
-       check_for_zero_long(fs, ino, pathname, "i_dir_acl", &inode.i_dir_acl,
+       check_for_zero_u32(fs, ino, pathname, "i_dir_acl", &inode.i_dir_acl,
                            &inode_modified);
        free(pathname);
        if (inode_modified)
@@ -610,3 +661,107 @@ static int process_bad_inode(ext2_filsys fs, ino_t dir, ino_t ino)
        return 0;
 }
 
+
+/*
+ * allocate_dir_block --- this function allocates a new directory
+ *     block for a particular inode; this is done if a directory has
+ *     a "hole" in it, or if a directory has a illegal block number
+ *     that was zeroed out and now needs to be replaced.
+ */
+static int allocate_dir_block(ext2_filsys fs,
+                             struct dir_block_struct *db,
+                             char *buf)
+{
+       blk_t                   blk;
+       char                    *block;
+       struct ext2_inode       inode;
+       errcode_t               retval;
+
+       printf("Directory inode %lu has a hole at block #%d\n",
+              db->ino, db->blockcnt);
+       if (ask("Allocate block", 1) == 0)
+               return 1;
+
+       /*
+        * Read the inode and block bitmaps in; we'll be messing with
+        * them.
+        */
+       read_bitmaps(fs);
+       
+       /*
+        * First, find a free block
+        */
+       retval = ext2fs_new_block(fs, 0, block_found_map, &blk);
+       if (retval) {
+               com_err("allocate_dir_block", retval,
+                       "while trying to fill a hole in a directory inode");
+               return 1;
+       }
+       ext2fs_mark_block_bitmap(block_found_map, blk);
+       ext2fs_mark_block_bitmap(fs->block_map, blk);
+       ext2fs_mark_bb_dirty(fs);
+
+       /*
+        * Now let's create the actual data block for the inode
+        */
+       if (db->blockcnt)
+               retval = ext2fs_new_dir_block(fs, 0, 0, &block);
+       else
+               retval = ext2fs_new_dir_block(fs, db->ino, EXT2_ROOT_INO,
+                                             &block);
+
+       if (retval) {
+               com_err("allocate_dir_block", retval,
+                       "while creating new directory block");
+               return 1;
+       }
+
+       retval = ext2fs_write_dir_block(fs, blk, block);
+       free(block);
+       if (retval) {
+               com_err("allocate_dir_block", retval,
+                       "while writing an empty directory block");
+               return 1;
+       }
+
+       /*
+        * Update the inode block count
+        */
+       e2fsck_read_inode(fs, db->ino, &inode, "allocate_dir_block");
+       inode.i_blocks += fs->blocksize / 512;
+       if (inode.i_size < (db->blockcnt+1) * fs->blocksize)
+               inode.i_size = (db->blockcnt+1) * fs->blocksize;
+       e2fsck_write_inode(fs, db->ino, &inode, "allocate_dir_block");
+
+       /*
+        * Finally, update the block pointers for the inode
+        */
+       db->blk = blk;
+       retval = ext2fs_block_iterate(fs, db->ino, BLOCK_FLAG_HOLE,
+                                     0, update_dir_block, db);
+       if (retval) {
+               com_err("allocate_dir_block", retval,
+                       "while calling ext2fs_block_iterate");
+               return 1;
+       }
+
+       return 0;
+}
+
+/*
+ * This is a helper function for allocate_dir_block().
+ */
+static int update_dir_block(ext2_filsys fs,
+                           blk_t       *block_nr,
+                           int blockcnt,
+                           void *private)
+{
+       struct dir_block_struct *db = private;
+
+       if (db->blockcnt == blockcnt) {
+               *block_nr = db->blk;
+               return BLOCK_CHANGED;
+       }
+       return 0;
+}
+       
index 7e3ad97ef0db05c9c44c490e90674abd6b3a8786..df2c5bb50307e6c558c9290dbe7ee4d92e4c3f4b 100644 (file)
@@ -30,6 +30,9 @@
  *             - The dirinfo directory information cache.
  */
 
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #include "et/com_err.h"
 
 #include "e2fsck.h"
@@ -134,7 +137,7 @@ void check_root(ext2_filsys fs, ino_t root_ino)
        }
 
        printf("Root inode not allocated.  ");
-       preenhalt();
+       preenhalt(fs);
        if (!ask("Rellocate", 1)) {
                ext2fs_unmark_valid(fs);
                fatal_error("Cannot proceed without a root inode.");
@@ -166,9 +169,9 @@ void check_root(ext2_filsys fs, ino_t root_ino)
                fatal_error(0);
        }
 
-       retval = io_channel_write_blk(fs->io, blk, 1, block);
+       retval = ext2fs_write_dir_block(fs, blk, block);
        if (retval) {
-               com_err("io_channel_write_blk", retval,
+               com_err("ext2fs_write_dir_block", retval,
                        "while writing the root directory block");
                fatal_error(0);
        }
@@ -275,7 +278,7 @@ static void check_directory(ext2_filsys fs, ino_t ino)
        printf("Unconnected directory inode %lu (%s)\n", p->ino, path1);
        if (path1 != unknown)
                free(path1);
-       preenhalt();
+       preenhalt(fs);
        if (ask("Connect to /lost+found", 1)) {
                if (reconnect_file(fs, p->ino))
                        ext2fs_unmark_valid(fs);
@@ -341,7 +344,7 @@ ino_t get_lost_and_found(ext2_filsys fs)
                       error_message(retval));
        else
                printf("/lost+found not found.  ");
-       preenhalt();
+       preenhalt(fs);
        if (!ask("Create", 1)) {
                ext2fs_unmark_valid(fs);
                return 0;
@@ -391,13 +394,13 @@ ino_t get_lost_and_found(ext2_filsys fs)
                return 0;
        }
 
-       retval = io_channel_write_blk(fs->io, blk, 1, block);
+       retval = ext2fs_write_dir_block(fs, blk, block);
+       free(block);
        if (retval) {
-               com_err("io_channel_write_blk", retval,
+               com_err("ext2fs_write_dir_block", retval,
                        "while writing the directory block for /lost+found");
                return 0;
        }
-       free(block);
 
        /*
         * Set up the inode structure
@@ -542,7 +545,7 @@ static int fix_dotdot_proc(struct ext2_dir_entry *dirent,
        
        retval = adjust_inode_count(fp->fs, dirent->inode, -1);
        if (retval)
-               printf("Error while adjusting inode count on inode %lu\n",
+               printf("Error while adjusting inode count on inode %u\n",
                       dirent->inode);
        retval = adjust_inode_count(fp->fs, fp->parent, 1);
        if (retval)
@@ -626,7 +629,7 @@ static int expand_dir_proc(ext2_filsys fs,
                }
                memset(block, 0, fs->blocksize);
        }       
-       retval = io_channel_write_blk(fs->io, new_blk, 1, block);
+       retval = ext2fs_write_dir_block(fs, new_blk, block);
        if (retval) {
                es->err = retval;
                return BLOCK_ABORT;
index 1075731e0e0fcfc58135d221391070c692136c33..67a4e9e00aca8145895b094ddd70e56826ffd70b 100644 (file)
@@ -34,7 +34,7 @@ void pass4(ext2_filsys fs)
                         * prompt to reconnect.
                         */
                        printf("Unattached inode %lu\n", i);
-                       preenhalt();
+                       preenhalt(fs);
                        if (ask("Connect to /lost+found", 1)) {
                                if (reconnect_file(fs, i))
                                        ext2fs_unmark_valid(fs);
@@ -45,7 +45,7 @@ void pass4(ext2_filsys fs)
                        e2fsck_read_inode(fs, i, &inode, "pass4");
                        if (inode_link_info[i] != inode.i_links_count) {
                                printf("WARNING: PROGRAMMING BUG IN E2FSCK!\n");
-                               printf("inode_link_info[%d] is %lu, "
+                               printf("inode_link_info[%ld] is %u, "
                                       "inode.i_links_count is %d.  "
                                       "They should be the same!\n",
                                       i, inode_link_info[i],
index 888ac97d053d7d61f912eb5ad3d40f6815e3e0c2..744aee20cd72f54433494cbddb2defa20566674b 100644 (file)
@@ -61,12 +61,39 @@ static void check_block_bitmaps(ext2_filsys fs)
        
        free_array = allocate_memory(fs->group_desc_count * sizeof(int),
                                     "free block count array");
-                                    
+
+       if ((fs->super->s_first_data_block <
+            ext2fs_get_block_bitmap_start(block_found_map)) ||
+           (fs->super->s_blocks_count-1 >
+            ext2fs_get_block_bitmap_end(block_found_map))) {
+               printf("PROGRAMMING ERROR: filesystem endpoints (%d, %d)\n\t"
+                      "don't match block_found_map endpoints (%d, %d).\n",
+                      fs->super->s_first_data_block,
+                      fs->super->s_blocks_count -1,
+                      ext2fs_get_block_bitmap_start(block_found_map),
+                      ext2fs_get_block_bitmap_end(block_found_map));
+               fatal_error(0);
+       }
+                      
+       if ((fs->super->s_first_data_block <
+            ext2fs_get_block_bitmap_start(fs->block_map)) ||
+           (fs->super->s_blocks_count-1 >
+            ext2fs_get_block_bitmap_end(fs->block_map))) {
+               printf("PROGRAMMING ERROR: filesystem endpoints (%d, %d)\n\t"
+                      "don't match fs->block_map endpoints (%d, %d).\n",
+                      fs->super->s_first_data_block,
+                      fs->super->s_blocks_count -1,
+                      ext2fs_get_block_bitmap_start(fs->block_map),
+                      ext2fs_get_block_bitmap_end(fs->block_map));
+               fatal_error(0);
+       }
+                      
+                      
        for (i = fs->super->s_first_data_block;
             i < fs->super->s_blocks_count;
             i++) {
-               actual = ext2fs_test_block_bitmap(block_found_map, i);
-               bitmap = ext2fs_test_block_bitmap(fs->block_map, i);
+               actual = ext2fs_fast_test_block_bitmap(block_found_map, i);
+               bitmap = ext2fs_fast_test_block_bitmap(fs->block_map, i);
                
                if (actual == bitmap)
                        goto do_counts;
@@ -82,7 +109,7 @@ static void check_block_bitmaps(ext2_filsys fs)
                         * Block not used, but marked in use in the bitmap.
                         */
                        if (!preen)
-                               printf(" -%lu", i);
+                               printf(" -%u", i);
                        if (do_fix)
                                ext2fs_unmark_block_bitmap(fs->block_map,
                                                           i);
@@ -91,7 +118,7 @@ static void check_block_bitmaps(ext2_filsys fs)
                         * Block used, but not marked in use in the bitmap.
                         */
                        if (!preen)
-                               printf(" +%lu", i);
+                               printf(" +%u", i);
                        if (do_fix)
                                ext2fs_mark_block_bitmap(fs->block_map,
                                                         i);
@@ -124,7 +151,7 @@ static void check_block_bitmaps(ext2_filsys fs)
                                do_fix = ask(fix_question, 1);
                        if (!preen)
                                printf("Free blocks count wrong for "
-                                      "group %lu (%u, counted=%d).  %s\n", i,
+                                      "group %u (%u, counted=%d).  %s\n", i,
                                       fs->group_desc[i].bg_free_blocks_count,
                                       free_array[i], fix_msg[do_fix]);
                        if (do_fix) {
@@ -140,7 +167,7 @@ static void check_block_bitmaps(ext2_filsys fs)
                        do_fix = ask(fix_question, 1);
                if (!preen)
                        printf("Free blocks count wrong "
-                              "(%lu, counted=%d).  %s\n",
+                              "(%u, counted=%d).  %s\n",
                               fs->super->s_free_blocks_count, free_blocks,
                               fix_msg[do_fix]);
                if (do_fix) {
@@ -149,6 +176,7 @@ static void check_block_bitmaps(ext2_filsys fs)
                } else
                        ext2fs_unmark_valid(fs);
        }
+       free(free_array);
 }
                        
 static void check_inode_bitmaps(ext2_filsys fs)
@@ -170,9 +198,30 @@ static void check_inode_bitmaps(ext2_filsys fs)
        dir_array = allocate_memory(fs->group_desc_count * sizeof(int),
                                    "directory count array");
                                     
+       if ((1 < ext2fs_get_inode_bitmap_start(inode_used_map)) ||
+           (fs->super->s_inodes_count > 
+            ext2fs_get_inode_bitmap_end(inode_used_map))) {
+               printf("PROGRAMMING ERROR: filesystem inode endpoints (%d, %d)\n\t"
+                      "don't match inode_used_map endpoints (%d, %d).\n",
+                      1, fs->super->s_inodes_count,
+                      ext2fs_get_inode_bitmap_start(inode_used_map),
+                      ext2fs_get_inode_bitmap_end(inode_used_map));
+               fatal_error(0);
+       }
+       if ((1 < ext2fs_get_inode_bitmap_start(fs->inode_map)) ||
+           (fs->super->s_inodes_count > 
+            ext2fs_get_inode_bitmap_end(fs->inode_map))) {
+               printf("PROGRAMMING ERROR: filesystem inode endpoints (%d, %d)\n\t"
+                      "don't match fs->inode_map endpoints (%d, %d).\n",
+                      1, fs->super->s_inodes_count,
+                      ext2fs_get_inode_bitmap_start(fs->inode_map),
+                      ext2fs_get_inode_bitmap_end(fs->inode_map));
+               fatal_error(0);
+       }
+
        for (i = 1; i <= fs->super->s_inodes_count; i++) {
-               actual = ext2fs_test_inode_bitmap(inode_used_map, i);
-               bitmap = ext2fs_test_inode_bitmap(fs->inode_map, i);
+               actual = ext2fs_fast_test_inode_bitmap(inode_used_map, i);
+               bitmap = ext2fs_fast_test_inode_bitmap(fs->inode_map, i);
                
                if (actual == bitmap)
                        goto do_counts;
@@ -265,7 +314,7 @@ do_counts:
                        do_fix = ask(fix_question, 1);
                if (!preen)
                        printf("Free inodes count wrong "
-                              "(%lu, counted=%d).  %s\n",
+                              "(%u, counted=%d).  %s\n",
                               fs->super->s_free_inodes_count, free_inodes,
                               fix_msg[do_fix]);
                if (do_fix) {
@@ -274,6 +323,8 @@ do_counts:
                } else
                        ext2fs_unmark_valid(fs);
        }
+       free(free_array);
+       free(dir_array);
 }
 
 static void check_inode_end(ext2_filsys fs)
index a0b078d475bc8473589b9b5253951340a7ee1d00..29d1e888537933f06121f2ee5299697204144602 100644 (file)
@@ -7,9 +7,13 @@
 #include <ctype.h>
 #include <termios.h>
 #include <time.h>
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#endif
 #include <unistd.h>
+#ifdef HAVE_MNTENT_H
 #include <mntent.h>
+#endif
 #include <sys/ioctl.h>
 #include <malloc.h>
 #include <sys/resource.h>
@@ -25,7 +29,9 @@
 #include <sys/types.h>
 #include <sys/time.h>
 
+#ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
+#endif
 #include <linux/ext2_fs.h>
 
 #include "ext2fs/ext2fs.h"
index 3f5447d7e836f51ef43e2ec9815331ea540850a5..9fc22e92d238bba79ef739d94fd4fd3e1525c032 100644 (file)
 #include <string.h>
 #include <ctype.h>
 #include <termios.h>
-#include <sys/resource.h>
 
 #include "e2fsck.h"
 
+#include <sys/time.h>
+#include <sys/resource.h>
+
 const char * fix_msg[2] = { "IGNORED", "FIXED" };
 const char * clear_msg[2] = { "IGNORED", "CLEARED" };
 
@@ -51,6 +53,8 @@ int ask_yn(const char * string, int def)
        tcgetattr (0, &termios);
        tmp = termios;
        tmp.c_lflag &= ~(ICANON | ECHO);
+       tmp.c_cc[VMIN] = 1;
+       tmp.c_cc[VTIME] = 0;
        tcsetattr (0, TCSANOW, &tmp);
 
        if (def == 1)
@@ -152,24 +156,36 @@ void write_bitmaps(ext2_filsys fs)
        }
 }
 
-void preenhalt(NOARGS)
+void preenhalt(ext2_filsys fs)
 {
        if (!preen)
                return;
        fprintf(stderr, "\n\n%s: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.\n",
               device_name);
+       if (fs != NULL) {
+               fs->super->s_state |= EXT2_ERROR_FS;
+               ext2fs_mark_super_dirty(fs);
+               ext2fs_close(fs);
+       }
        exit(FSCK_UNCORRECTED);
 }
 
 void init_resource_track(struct resource_track *track)
 {
+#ifdef HAVE_GETRUSAGE
        struct rusage r;
+#endif
        
        track->brk_start = sbrk(0);
        gettimeofday(&track->time_start, 0);
+#ifdef HAVE_GETRUSAGE
        getrusage(RUSAGE_SELF, &r);
        track->user_start = r.ru_utime;
        track->system_start = r.ru_stime;
+#else
+       track->user_start.tv_sec = track->user_start.tv_usec = 0;
+       track->system_start.tv_sec = track->system_start.tv_usec = 0;
+#endif
 }
 
 static __inline__ float timeval_subtract(struct timeval *tv1,
@@ -181,10 +197,13 @@ static __inline__ float timeval_subtract(struct timeval *tv1,
 
 void print_resource_track(struct resource_track *track)
 {
+#ifdef HAVE_GETRUSAGE
        struct rusage r;
+#endif
        struct timeval time_end;
 
        gettimeofday(&time_end, 0);
+#ifdef HAVE_GETRUSAGE
        getrusage(RUSAGE_SELF, &r);
 
        printf("Memory used: %d, elapsed time: %6.3f/%6.3f/%6.3f\n",
@@ -192,6 +211,11 @@ void print_resource_track(struct resource_track *track)
               timeval_subtract(&time_end, &track->time_start),
               timeval_subtract(&r.ru_utime, &track->user_start),
               timeval_subtract(&r.ru_stime, &track->system_start));
+#else
+       printf("Memory used: %d, elapsed time: %6.3f\n",
+              (int) (((char *) sbrk(0)) - ((char *) track->brk_start)),
+              timeval_subtract(&time_end, &track->time_start));
+#endif
 }
 
 void e2fsck_read_inode(ext2_filsys fs, unsigned long ino,
@@ -230,15 +254,15 @@ int inode_has_valid_blocks(struct ext2_inode *inode)
         * Only directories, regular files, and some symbolic links
         * have valid block entries.
         */
-       if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) &&
-           !S_ISLNK(inode->i_mode))
+       if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) &&
+           !LINUX_S_ISLNK(inode->i_mode))
                return 0;
        
        /*
         * If the symbolic link is a "fast symlink", then the symlink
         * target is stored in the block entries.
         */
-       if (S_ISLNK (inode->i_mode) && inode->i_blocks == 0 &&
+       if (LINUX_S_ISLNK (inode->i_mode) && inode->i_blocks == 0 &&
            inode->i_size < EXT2_N_BLOCKS * sizeof (unsigned long))
                return 0;
 
diff --git a/include/linux/ChangeLog b/include/linux/ChangeLog
new file mode 100644 (file)
index 0000000..faa31c6
--- /dev/null
@@ -0,0 +1,4 @@
+Mon Sep  4 21:50:12 1995  Remy Card  <card@bbj>
+
+       * ext2_fs.h: Updated to latest version.
+
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
new file mode 100644 (file)
index 0000000..a443aa2
--- /dev/null
@@ -0,0 +1,498 @@
+/*
+ *  linux/include/linux/ext2_fs.h
+ *
+ * Copyright (C) 1992, 1993, 1994, 1995
+ * Remy Card (card@masi.ibp.fr)
+ * Laboratoire MASI - Institut Blaise Pascal
+ * Universite Pierre et Marie Curie (Paris VI)
+ *
+ *  from
+ *
+ *  linux/include/linux/minix_fs.h
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#ifndef _LINUX_EXT2_FS_H
+#define _LINUX_EXT2_FS_H
+
+#include <linux/types.h>
+
+/*
+ * The second extended filesystem constants/structures
+ */
+
+/*
+ * Define EXT2FS_DEBUG to produce debug messages
+ */
+#undef EXT2FS_DEBUG
+
+/*
+ * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
+ */
+#define EXT2_PREALLOCATE
+
+/*
+ * The second extended file system version
+ */
+#define EXT2FS_DATE            "95/08/09"
+#define EXT2FS_VERSION         "0.5b"
+
+/*
+ * Debug code
+ */
+#ifdef EXT2FS_DEBUG
+#      define ext2_debug(f, a...)      { \
+                                       printk ("EXT2-fs DEBUG (%s, %d): %s:", \
+                                               __FILE__, __LINE__, __FUNCTION__); \
+                                       printk (f, ## a); \
+                                       }
+#else
+#      define ext2_debug(f, a...)      /**/
+#endif
+
+/*
+ * Special inodes numbers
+ */
+#define        EXT2_BAD_INO             1      /* Bad blocks inode */
+#define EXT2_ROOT_INO           2      /* Root inode */
+#define EXT2_ACL_IDX_INO        3      /* ACL inode */
+#define EXT2_ACL_DATA_INO       4      /* ACL inode */
+#define EXT2_BOOT_LOADER_INO    5      /* Boot loader inode */
+#define EXT2_UNDEL_DIR_INO      6      /* Undelete directory inode */
+#define EXT2_FIRST_INO         11      /* First non reserved inode */
+
+/*
+ * The second extended file system magic number
+ */
+#define EXT2_SUPER_MAGIC       0xEF53
+
+/*
+ * Maximal count of links to a file
+ */
+#define EXT2_LINK_MAX          32000
+
+/*
+ * Macro-instructions used to manage several block sizes
+ */
+#define EXT2_MIN_BLOCK_SIZE            1024
+#define        EXT2_MAX_BLOCK_SIZE             4096
+#define EXT2_MIN_BLOCK_LOG_SIZE                  10
+#ifdef __KERNEL__
+# define EXT2_BLOCK_SIZE(s)            ((s)->s_blocksize)
+#else
+# define EXT2_BLOCK_SIZE(s)            (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
+#endif
+#define EXT2_ACLE_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
+#define        EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
+#ifdef __KERNEL__
+# define EXT2_BLOCK_SIZE_BITS(s)       ((s)->s_blocksize_bits)
+#else
+# define EXT2_BLOCK_SIZE_BITS(s)       ((s)->s_log_block_size + 10)
+#endif
+#define        EXT2_INODES_PER_BLOCK(s)        (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_inode))
+#ifdef __KERNEL__
+#define        EXT2_ADDR_PER_BLOCK_BITS(s)     ((s)->u.ext2_sb.s_addr_per_block_bits)
+#define        EXT2_INODES_PER_BLOCK_BITS(s)   ((s)->u.ext2_sb.s_inodes_per_block_bits)
+#endif
+
+/*
+ * Macro-instructions used to manage fragments
+ */
+#define EXT2_MIN_FRAG_SIZE             1024
+#define        EXT2_MAX_FRAG_SIZE              4096
+#define EXT2_MIN_FRAG_LOG_SIZE           10
+#ifdef __KERNEL__
+# define EXT2_FRAG_SIZE(s)             ((s)->u.ext2_sb.s_frag_size)
+# define EXT2_FRAGS_PER_BLOCK(s)       ((s)->u.ext2_sb.s_frags_per_block)
+#else
+# define EXT2_FRAG_SIZE(s)             (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
+# define EXT2_FRAGS_PER_BLOCK(s)       (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
+#endif
+
+/*
+ * ACL structures
+ */
+struct ext2_acl_header /* Header of Access Control Lists */
+{
+       __u32   aclh_size;
+       __u32   aclh_file_count;
+       __u32   aclh_acle_count;
+       __u32   aclh_first_acle;
+};
+
+struct ext2_acl_entry  /* Access Control List Entry */
+{
+       __u32   acle_size;
+       __u16   acle_perms;     /* Access permissions */
+       __u16   acle_type;      /* Type of entry */
+       __u16   acle_tag;       /* User or group identity */
+       __u16   acle_pad1;
+       __u32   acle_next;      /* Pointer on next entry for the */
+                                       /* same inode or on next free entry */
+};
+
+/*
+ * Structure of a blocks group descriptor
+ */
+struct ext2_group_desc
+{
+       __u32   bg_block_bitmap;                /* Blocks bitmap block */
+       __u32   bg_inode_bitmap;                /* Inodes bitmap block */
+       __u32   bg_inode_table;         /* Inodes table block */
+       __u16   bg_free_blocks_count;   /* Free blocks count */
+       __u16   bg_free_inodes_count;   /* Free inodes count */
+       __u16   bg_used_dirs_count;     /* Directories count */
+       __u16   bg_pad;
+       __u32   bg_reserved[3];
+};
+
+/*
+ * Macro-instructions used to manage group descriptors
+ */
+#ifdef __KERNEL__
+# define EXT2_BLOCKS_PER_GROUP(s)      ((s)->u.ext2_sb.s_blocks_per_group)
+# define EXT2_DESC_PER_BLOCK(s)                ((s)->u.ext2_sb.s_desc_per_block)
+# define EXT2_INODES_PER_GROUP(s)      ((s)->u.ext2_sb.s_inodes_per_group)
+# define EXT2_DESC_PER_BLOCK_BITS(s)   ((s)->u.ext2_sb.s_desc_per_block_bits)
+#else
+# define EXT2_BLOCKS_PER_GROUP(s)      ((s)->s_blocks_per_group)
+# define EXT2_DESC_PER_BLOCK(s)                (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
+# define EXT2_INODES_PER_GROUP(s)      ((s)->s_inodes_per_group)
+#endif
+
+/*
+ * Constants relative to the data blocks
+ */
+#define        EXT2_NDIR_BLOCKS                12
+#define        EXT2_IND_BLOCK                  EXT2_NDIR_BLOCKS
+#define        EXT2_DIND_BLOCK                 (EXT2_IND_BLOCK + 1)
+#define        EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
+#define        EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
+
+/*
+ * Inode flags
+ */
+#define        EXT2_SECRM_FL                   0x00000001 /* Secure deletion */
+#define        EXT2_UNRM_FL                    0x00000002 /* Undelete */
+#define        EXT2_COMPR_FL                   0x00000004 /* Compress file */
+#define EXT2_SYNC_FL                   0x00000008 /* Synchronous updates */
+#define EXT2_IMMUTABLE_FL              0x00000010 /* Immutable file */
+#define EXT2_APPEND_FL                 0x00000020 /* writes to file may only append */
+#define EXT2_NODUMP_FL                 0x00000040 /* do not dump file */
+
+/*
+ * ioctl commands
+ */
+#define        EXT2_IOC_GETFLAGS               _IOR('f', 1, long)
+#define        EXT2_IOC_SETFLAGS               _IOW('f', 2, long)
+#define        EXT2_IOC_GETVERSION             _IOR('v', 1, long)
+#define        EXT2_IOC_SETVERSION             _IOW('v', 2, long)
+
+/*
+ * Structure of an inode on the disk
+ */
+struct ext2_inode {
+       __u16   i_mode;         /* File mode */
+       __u16   i_uid;          /* Owner Uid */
+       __u32   i_size;         /* Size in bytes */
+       __u32   i_atime;        /* Access time */
+       __u32   i_ctime;        /* Creation time */
+       __u32   i_mtime;        /* Modification time */
+       __u32   i_dtime;        /* Deletion Time */
+       __u16   i_gid;          /* Group Id */
+       __u16   i_links_count;  /* Links count */
+       __u32   i_blocks;       /* Blocks count */
+       __u32   i_flags;        /* File flags */
+       union {
+               struct {
+                       __u32  l_i_reserved1;
+               } linux1;
+               struct {
+                       __u32  h_i_translator;
+               } hurd1;
+               struct {
+                       __u32  m_i_reserved1;
+               } masix1;
+       } osd1;                         /* OS dependent 1 */
+       __u32   i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
+       __u32   i_version;      /* File version (for NFS) */
+       __u32   i_file_acl;     /* File ACL */
+       __u32   i_dir_acl;      /* Directory ACL */
+       __u32   i_faddr;        /* Fragment address */
+       union {
+               struct {
+                       __u8    l_i_frag;       /* Fragment number */
+                       __u8    l_i_fsize;      /* Fragment size */
+                       __u16   i_pad1;
+                       __u32   l_i_reserved2[2];
+               } linux2;
+               struct {
+                       __u8    h_i_frag;       /* Fragment number */
+                       __u8    h_i_fsize;      /* Fragment size */
+                       __u16   h_i_mode_high;
+                       __u16   h_i_uid_high;
+                       __u16   h_i_gid_high;
+                       __u32   h_i_author;
+               } hurd2;
+               struct {
+                       __u8    m_i_frag;       /* Fragment number */
+                       __u8    m_i_fsize;      /* Fragment size */
+                       __u16   m_pad1;
+                       __u32   m_i_reserved2[2];
+               } masix2;
+       } osd2;                         /* OS dependent 2 */
+};
+
+#if defined(__KERNEL__) || defined(__linux__)
+#define i_reserved1    osd1.linux1.l_i_reserved1
+#define i_frag         osd2.linux2.l_i_frag
+#define i_fsize                osd2.linux2.l_i_fsize
+#define i_reserved2    osd2.linux2.l_i_reserved2
+#endif
+
+#ifdef __hurd__
+#define i_translator   osd1.hurd1.h_i_translator
+#define i_frag         osd2.hurd2.h_i_frag;
+#define i_fsize                osd2.hurd2.h_i_fsize;
+#define i_uid_high     osd2.hurd2.h_i_uid_high
+#define i_gid_high     osd2.hurd2.h_i_gid_high
+#define i_author       osd2.hurd2.h_i_author
+#endif
+
+#ifdef __masix__
+#define i_reserved1    osd1.masix1.m_i_reserved1
+#define i_frag         osd2.masix2.m_i_frag
+#define i_fsize                osd2.masix2.m_i_fsize
+#define i_reserved2    osd2.masix2.m_i_reserved2
+#endif
+
+/*
+ * File system states
+ */
+#define        EXT2_VALID_FS                   0x0001  /* Unmounted cleanly */
+#define        EXT2_ERROR_FS                   0x0002  /* Errors detected */
+
+/*
+ * Mount flags
+ */
+#define EXT2_MOUNT_CHECK_NORMAL                0x0001  /* Do some more checks */
+#define EXT2_MOUNT_CHECK_STRICT                0x0002  /* Do again more checks */
+#define EXT2_MOUNT_CHECK               (EXT2_MOUNT_CHECK_NORMAL | \
+                                        EXT2_MOUNT_CHECK_STRICT)
+#define EXT2_MOUNT_GRPID               0x0004  /* Create files with directory's group */
+#define EXT2_MOUNT_DEBUG               0x0008  /* Some debugging messages */
+#define EXT2_MOUNT_ERRORS_CONT         0x0010  /* Continue on errors */
+#define EXT2_MOUNT_ERRORS_RO           0x0020  /* Remount fs ro on errors */
+#define EXT2_MOUNT_ERRORS_PANIC                0x0040  /* Panic on errors */
+#define EXT2_MOUNT_MINIX_DF            0x0080  /* Mimics the Minix statfs */
+
+#define clear_opt(o, opt)              o &= ~EXT2_MOUNT_##opt
+#define set_opt(o, opt)                        o |= EXT2_MOUNT_##opt
+#define test_opt(sb, opt)              ((sb)->u.ext2_sb.s_mount_opt & \
+                                        EXT2_MOUNT_##opt)
+/*
+ * Maximal mount counts between two filesystem checks
+ */
+#define EXT2_DFL_MAX_MNT_COUNT         20      /* Allow 20 mounts */
+#define EXT2_DFL_CHECKINTERVAL         0       /* Don't use interval check */
+
+/*
+ * Behaviour when detecting errors
+ */
+#define EXT2_ERRORS_CONTINUE           1       /* Continue execution */
+#define EXT2_ERRORS_RO                 2       /* Remount fs read-only */
+#define EXT2_ERRORS_PANIC              3       /* Panic */
+#define EXT2_ERRORS_DEFAULT            EXT2_ERRORS_CONTINUE
+
+/*
+ * Structure of the super block
+ */
+struct ext2_super_block {
+       __u32   s_inodes_count;         /* Inodes count */
+       __u32   s_blocks_count;         /* Blocks count */
+       __u32   s_r_blocks_count;       /* Reserved blocks count */
+       __u32   s_free_blocks_count;    /* Free blocks count */
+       __u32   s_free_inodes_count;    /* Free inodes count */
+       __u32   s_first_data_block;     /* First Data Block */
+       __u32   s_log_block_size;       /* Block size */
+       __s32   s_log_frag_size;        /* Fragment size */
+       __u32   s_blocks_per_group;     /* # Blocks per group */
+       __u32   s_frags_per_group;      /* # Fragments per group */
+       __u32   s_inodes_per_group;     /* # Inodes per group */
+       __u32   s_mtime;                /* Mount time */
+       __u32   s_wtime;                /* Write time */
+       __u16   s_mnt_count;            /* Mount count */
+       __s16   s_max_mnt_count;        /* Maximal mount count */
+       __u16   s_magic;                /* Magic signature */
+       __u16   s_state;                /* File system state */
+       __u16   s_errors;               /* Behaviour when detecting errors */
+       __u16   s_pad;
+       __u32   s_lastcheck;            /* time of last check */
+       __u32   s_checkinterval;        /* max. time between checks */
+       __u32   s_creator_os;           /* OS */
+       __u32   s_rev_level;            /* Revision level */
+       __u16   s_def_resuid;           /* Default uid for reserved blocks */
+       __u16   s_def_resgid;           /* Default gid for reserved blocks */
+       __u32   s_reserved[235];        /* Padding to the end of the block */
+};
+
+/*
+ * Codes for operating systems
+ */
+#define EXT2_OS_LINUX          0
+#define EXT2_OS_HURD           1
+#define EXT2_OS_MASIX          2
+#define EXT2_OS_FREEBSD                3
+#define EXT2_OS_LITES          4
+
+/*
+ * Revision levels
+ */
+#define EXT2_GOOD_OLD_REV      0       /* The good old (original) format */
+
+#define EXT2_CURRENT_REV       EXT2_GOOD_OLD_REV
+
+/*
+ * Default values for user and/or group using reserved blocks
+ */
+#define        EXT2_DEF_RESUID         0
+#define        EXT2_DEF_RESGID         0
+
+/*
+ * Structure of a directory entry
+ */
+#define EXT2_NAME_LEN 255
+
+struct ext2_dir_entry {
+       __u32   inode;                  /* Inode number */
+       __u16   rec_len;                /* Directory entry length */
+       __u16   name_len;               /* Name length */
+       char    name[EXT2_NAME_LEN];    /* File name */
+};
+
+/*
+ * EXT2_DIR_PAD defines the directory entries boundaries
+ *
+ * NOTE: It must be a multiple of 4
+ */
+#define EXT2_DIR_PAD                   4
+#define EXT2_DIR_ROUND                         (EXT2_DIR_PAD - 1)
+#define EXT2_DIR_REC_LEN(name_len)     (((name_len) + 8 + EXT2_DIR_ROUND) & \
+                                        ~EXT2_DIR_ROUND)
+
+#ifdef __KERNEL__
+/*
+ * Function prototypes
+ */
+
+/*
+ * Ok, these declarations are also in <linux/kernel.h> but none of the
+ * ext2 source programs needs to include it so they are duplicated here.
+ */
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+# define NORET_TYPE    __volatile__
+# define ATTRIB_NORET  /**/
+# define NORET_AND     /**/
+#else
+# define NORET_TYPE    /**/
+# define ATTRIB_NORET  __attribute__((noreturn))
+# define NORET_AND     noreturn,
+#endif
+
+/* acl.c */
+extern int ext2_permission (struct inode *, int);
+
+/* balloc.c */
+extern int ext2_new_block (struct super_block *, unsigned long,
+                          __u32 *, __u32 *);
+extern void ext2_free_blocks (struct super_block *, unsigned long,
+                             unsigned long);
+extern unsigned long ext2_count_free_blocks (struct super_block *);
+extern void ext2_check_blocks_bitmap (struct super_block *);
+
+/* bitmap.c */
+extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
+
+/* dir.c */
+extern int ext2_check_dir_entry (const char *, struct inode *,
+                                struct ext2_dir_entry *, struct buffer_head *,
+                                unsigned long);
+
+/* file.c */
+extern int ext2_read (struct inode *, struct file *, char *, int);
+extern int ext2_write (struct inode *, struct file *, char *, int);
+
+/* fsync.c */
+extern int ext2_sync_file (struct inode *, struct file *);
+
+/* ialloc.c */
+extern struct inode * ext2_new_inode (const struct inode *, int);
+extern void ext2_free_inode (struct inode *);
+extern unsigned long ext2_count_free_inodes (struct super_block *);
+extern void ext2_check_inodes_bitmap (struct super_block *);
+
+/* inode.c */
+extern int ext2_bmap (struct inode *, int);
+
+extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *);
+extern struct buffer_head * ext2_bread (struct inode *, int, int, int *);
+
+extern int ext2_getcluster (struct inode * inode, long block);
+extern void ext2_read_inode (struct inode *);
+extern void ext2_write_inode (struct inode *);
+extern void ext2_put_inode (struct inode *);
+extern int ext2_sync_inode (struct inode *);
+extern void ext2_discard_prealloc (struct inode *);
+
+/* ioctl.c */
+extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
+                      unsigned long);
+
+/* namei.c */
+extern void ext2_release (struct inode *, struct file *);
+extern int ext2_lookup (struct inode *,const char *, int, struct inode **);
+extern int ext2_create (struct inode *,const char *, int, int,
+                       struct inode **);
+extern int ext2_mkdir (struct inode *, const char *, int, int);
+extern int ext2_rmdir (struct inode *, const char *, int);
+extern int ext2_unlink (struct inode *, const char *, int);
+extern int ext2_symlink (struct inode *, const char *, int, const char *);
+extern int ext2_link (struct inode *, struct inode *, const char *, int);
+extern int ext2_mknod (struct inode *, const char *, int, int, int);
+extern int ext2_rename (struct inode *, const char *, int,
+                       struct inode *, const char *, int);
+
+/* super.c */
+extern void ext2_error (struct super_block *, const char *, const char *, ...)
+       __attribute__ ((format (printf, 3, 4)));
+extern NORET_TYPE void ext2_panic (struct super_block *, const char *,
+                                  const char *, ...)
+       __attribute__ ((NORET_AND format (printf, 3, 4)));
+extern void ext2_warning (struct super_block *, const char *, const char *, ...)
+       __attribute__ ((format (printf, 3, 4)));
+extern void ext2_put_super (struct super_block *);
+extern void ext2_write_super (struct super_block *);
+extern int ext2_remount (struct super_block *, int *, char *);
+extern struct super_block * ext2_read_super (struct super_block *,void *,int);
+extern void ext2_statfs (struct super_block *, struct statfs *, int);
+
+/* truncate.c */
+extern void ext2_truncate (struct inode *);
+
+/*
+ * Inodes and files operations
+ */
+
+/* dir.c */
+extern struct inode_operations ext2_dir_inode_operations;
+
+/* file.c */
+extern struct inode_operations ext2_file_inode_operations;
+
+/* symlink.c */
+extern struct inode_operations ext2_symlink_inode_operations;
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_EXT2_FS_H */
diff --git a/include/linux/types.h.in b/include/linux/types.h.in
new file mode 100644 (file)
index 0000000..4353b5e
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _LINUX_TYPES_H
+#define _LINUX_TYPES_H
+
+typedef unsigned char __u8;
+typedef signed char __s8;
+
+#if (@SIZEOF_INT@ == 2)
+typedef        int             __s16;
+typedef        unsigned int    __u16;
+#elif (@SIZEOF_SHORT@ == 2)
+typedef        short           __s16;
+typedef        unsigned short  __u16;
+#else
+  ?==error: undefined 16 bit type
+#endif
+
+#if (@SIZEOF_LONG@ == 4)
+typedef        long            __s32;
+typedef        unsigned long   __u32;
+#elif (@SIZEOF_INT@ == 4)
+typedef        int             __s32;
+typedef        unsigned int    __u32;
+#elif (@SIZEOF_SHORT@ == 4)
+typedef        short           __s32;
+typedef        unsigned short  __u32;
+#else
+ ?== error: undefined 32 bit type
+#endif
+
+#endif /* LINUX_TYPES_H */
diff --git a/install-sh b/install-sh
new file mode 100644 (file)
index 0000000..89fc9b0
--- /dev/null
@@ -0,0 +1,238 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) instcmd="$cpprog"
+           shift
+           continue;;
+
+       -d) dir_arg=true
+           shift
+           continue;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           shift
+           continue;;
+
+       -o) chowncmd="$chownprog $2"
+           shift
+           shift
+           continue;;
+
+       -g) chgrpcmd="$chgrpprog $2"
+           shift
+           shift
+           continue;;
+
+       -s) stripcmd="$stripprog"
+           shift
+           continue;;
+
+       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+           shift
+           continue;;
+
+       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+           shift
+           continue;;
+
+       *)  if [ x"$src" = x ]
+           then
+               src=$1
+           else
+               # this colon is to work around a 386BSD /bin/sh bug
+               :
+               dst=$1
+           fi
+           shift
+           continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+       echo "install:  no input file specified"
+       exit 1
+else
+       true
+fi
+
+if [ x"$dir_arg" != x ]; then
+       dst=$src
+       src=""
+       
+       if [ -d $dst ]; then
+               instcmd=:
+       else
+               instcmd=mkdir
+       fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+       if [ -f $src -o -d $src ]
+       then
+               true
+       else
+               echo "install:  $src does not exist"
+               exit 1
+       fi
+       
+       if [ x"$dst" = x ]
+       then
+               echo "install:  no destination specified"
+               exit 1
+       else
+               true
+       fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+       if [ -d $dst ]
+       then
+               dst="$dst"/`basename $src`
+       else
+               true
+       fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='   
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+       pathcomp="${pathcomp}${1}"
+       shift
+
+       if [ ! -d "${pathcomp}" ] ;
+        then
+               $mkdirprog "${pathcomp}"
+       else
+               true
+       fi
+
+       pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+       $doit $instcmd $dst &&
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+       if [ x"$transformarg" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               dstfile=`basename $dst $transformbasename | 
+                       sed $transformarg`$transformbasename
+       fi
+
+# don't allow the sed command to completely eliminate the filename
+
+       if [ x"$dstfile" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               true
+       fi
+
+# Make a temp file name in the proper directory.
+
+       dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+       $doit $instcmd $src $dsttmp &&
+
+       trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+       $doit $rmcmd -f $dstdir/$dstfile &&
+       $doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/lib/ChangeLog b/lib/ChangeLog
new file mode 100644 (file)
index 0000000..14a8f19
--- /dev/null
@@ -0,0 +1,28 @@
+Mon Sep  4 21:42:46 1995  Remy Card  <card@bbj>
+
+       * Makefile.bsd-lib: New file containing support for BSD shared
+               libraries.
+
+Sat Aug  5 11:43:05 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * Makefile.dll-lib: Added new target install-shlibs, which just
+               installs the shared libraries.
+
+       * Makefile.elf-lib: Added new target install-shlibs, which just
+               installs the shared libraries.
+
+Tue Jul 18 21:24:13 1995    <tytso@rsx-11.mit.edu>
+
+       * Makefile.dll-lib (jump): For each of the libraries jump/jump.*
+               files are now in in dll/jump.*; now the subdirs target
+               takes care of creating the jump directory, and then copy
+               the jump.* files from the dll directory to the jump
+               directory.  This allows dll libraries to be built where
+               the build directory is not equal to the source directory.
+
+Tue Jul 11 22:05:56 1995    <tytso@rsx-11.mit.edu>
+
+       * Makefile.checker,Makefile.elf-lib,Makefile.dll-lib,
+               Makefile.profile: Add rule to mkdir the appropriate object
+               subdirectory (checker, elfshared, jump, profiled, etc.)
+
diff --git a/lib/Makefile.bsd-lib b/lib/Makefile.bsd-lib
new file mode 100644 (file)
index 0000000..e0227a2
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# This is a Makefile stub which handles the creation of Linux BSD shared
+# libraries.
+#
+# 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)
+#
+
+all:: pic image
+
+subdirs:: pic
+
+pic:
+       mkdir pic
+
+BSD_LIB = $(BSDLIB_IMAGE).so.$(BSDLIB_VERSION)
+
+image:         $(BSD_LIB)
+
+$(BSD_LIB): $(OBJS)
+       (cd pic; ld -Bshareable -o $(BSD_LIB) $(OBJS))
+       $(MV) pic/$(BSD_LIB) .
+       $(RM) -f ../$(BSD_LIB)
+       $(LN) $(BSD_LIB) ../$(BSD_LIB)
+
+install-shlibs install:: $(BSD_LIB)
+       $(INSTALL_PROGRAM) $(BSD_LIB) $(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
+       -ldconfig
+
+clean::
+       $(RM) -rf pic
+       $(RM) -f $(BSD_LIB)
+       $(RM) -f ../$(BSD_LIB)
diff --git a/lib/Makefile.checker b/lib/Makefile.checker
new file mode 100644 (file)
index 0000000..6064494
--- /dev/null
@@ -0,0 +1,16 @@
+all:: checker $(LIBRARY)_chk.a
+
+subdirs:: checker
+
+checker:
+       mkdir checker
+
+clean::
+       $(RM) -rf checker
+
+$(LIBRARY)_chk.a: $(OBJS)
+       @(test -r $@ && $(RM) -f $@.bak && $(MV) $@ $@.bak)
+       (cd checker; $(ARUPD) $@ $(OBJS))
+       -$(RANLIB) $@
+       $(RM) -f ../$@
+       $(LN) $@ ../$@
index dee8e62c29fd6c2a63df995df2221998414c3894..94864bf288543e5d7b717cb08e7efff3d645058a 100644 (file)
 # DLL_INSTALL_DIR = $(SHLIBDIR)
 #
 
-all:: image stubs
+all:: jump image stubs
+
+subdirs:: jump jump/jump.funcs jump/jump.ignore jump/jump.import \
+       jump/jump.params jump/jump.undefs jump/jump.vars
+
+jump:
+       mkdir jump
+
+jump/jump.funcs: dll/jump.funcs
+       $(CP) $< $@
+
+jump/jump.ignore: dll/jump.ignore
+       $(CP) $< $@
+
+jump/jump.import: dll/jump.import
+       $(CP) $< $@
+
+jump/jump.params: dll/jump.params
+       $(CP) $< $@
+
+jump/jump.undefs: dll/jump.undefs
+       $(CP) $< $@
+
+jump/jump.vars: dll/jump.vars
+       $(CP) $< $@
 
 #
 # This is a horrible hack to try to find libgcc.a  --- the DLL documentation
@@ -37,34 +61,31 @@ $(DLL_IMAGE).so.$(DLL_VERSION): $(OBJS)
                $(DLL_BIN)/mkimage -l $(DLL_IMAGE) -v $(DLL_VERSION) \
                -a $(DLL_ADDRESS) -j $(DLL_JUMPSIZE) -g $(DLL_GOTSIZE) -- \
                $(OBJS) -lc $(DLL_LIBS) $(DLL_LIBGCC) -lc)
-       mv jump/$(DLL_IMAGE).so.$(DLL_VERSION) .
+       $(MV) jump/$(DLL_IMAGE).so.$(DLL_VERSION) .
 
 $(DLL_STUB).sa:
        (cd jump; export JUMP_DIR=`pwd`; \
                $(DLL_BIN)/mkstubs -l $(DLL_IMAGE) -v $(DLL_VERSION) \
                -a $(DLL_ADDRESS) -j $(DLL_JUMPSIZE) -g $(DLL_GOTSIZE) \
                -- $(DLL_STUB))
-       mv jump/$(DLL_STUB).sa .
-       @$(RM) ../$@
-       @$(LN) $(DLL_MYDIR)/$@ ../$@
+       $(MV) jump/$(DLL_STUB).sa .
+       $(RM) -f ../$@
+       $(LN) $@ ../$@
 
-install:: $(DLL_IMAGE).so.$(DLL_VERSION)
-       $(INSTALLBIN) $(DLL_IMAGE).so.$(DLL_VERSION) \
-               $(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION)
-       -ldconfig
+installdirs::
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(DLL_INSTALL_DIR)
 
-install-libs:: $(DLL_STUB).sa
-       $(INSTALLLIB) $(DLL_STUB).sa $(LIBDIR)/$(DLL_STUB).sa
-       $(CHMOD) 644 $(LIBDIR)/$(DLL_STUB).sa
-       $(RANLIB) $(LIBDIR)/$(DLL_STUB).sa
-       $(CHMOD) $(LIBMODE) $(LIBDIR)/$(DLL_STUB).sa
+install-shlibs install:: $(DLL_IMAGE).so.$(DLL_VERSION) installdirs
+       $(INSTALL_PROGRAM) $(DLL_IMAGE).so.$(DLL_VERSION) \
+               $(DESTDIR)$(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION)
+       -ldconfig
 
-install-tree:: $(DLL_IMAGE).so.$(DLL_VERSION)
-       rm -f ../../shlibs/$(DLL_IMAGE).so.$(DLL_VERSION)
-       cp $(DLL_IMAGE).so.$(DLL_VERSION) ../../shlibs
-       strip ../../shlibs/$(DLL_IMAGE).so.$(DLL_VERSION)
-       chmod 555 ../../shlibs/$(DLL_IMAGE).so.$(DLL_VERSION)
+install:: $(DLL_STUB).sa
+       $(INSTALL_DATA) $(DLL_STUB).sa $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa
+       $(CHMOD) 644 $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa
+       $(RANLIB) $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa
+       $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/$(DLL_STUB).sa
 
 clean::
-       (cd jump; $(RM) *~ *.o *.s jump.log size.nm)
-       $(RM) ../$(DLL_STUB).sa $(DLL_STUB).sa $(DLL_IMAGE).so.$(DLL_VERSION)
+       $(RM) -f ../$(DLL_STUB).sa $(DLL_STUB).sa $(DLL_IMAGE).so.$(DLL_VERSION)
+       $(RM) -rf jump
diff --git a/lib/Makefile.elf-lib b/lib/Makefile.elf-lib
new file mode 100644 (file)
index 0000000..10051dd
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# This is a Makefile stub which handles the creation of Linux ELF shared
+# libraries.
+#
+# In order to use this stub, the following makefile variables must be defined.
+# 
+# ELF_VERSION = 1.0
+# ELF_IMAGE = libce
+# ELF_MYDIR = et
+# ELF_INSTALL_DIR = $(SHLIBDIR)
+#
+
+all:: elfshared image
+
+subdirs:: elfshared
+
+elfshared:
+       mkdir elfshared
+
+ELF_LIB = $(ELF_IMAGE).so.$(ELF_VERSION)
+
+image:         $(ELF_LIB)
+
+$(ELF_LIB): $(OBJS)
+       (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(OBJS))
+       $(MV) elfshared/$(ELF_LIB) .
+       $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so
+       $(LN) $(ELF_LIB) ../$(ELF_LIB)
+       $(LN) ../$(ELF_LIB) ../$(ELF_IMAGE).so
+
+installdirs::
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ELF_INSTALL_DIR)
+
+install-shlibs install:: $(ELF_LIB) installdirs
+       $(INSTALL_PROGRAM) $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
+       -ldconfig
+
+clean::
+       $(RM) -rf elfshared
+       $(RM) -f $(ELF_LIB)
+       $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so
diff --git a/lib/Makefile.library b/lib/Makefile.library
new file mode 100644 (file)
index 0000000..2ea95c1
--- /dev/null
@@ -0,0 +1,13 @@
+all:: subdirs $(LIBRARY).a
+
+install-shlibs::
+
+subdirs::
+
+$(LIBRARY).a: $(OBJS)
+       (if test -r $@; then $(RM) -f $@.bak && $(MV) $@ $@.bak; fi)
+       $(ARUPD) $@ $(OBJS)
+       -$(RANLIB) $@
+       $(RM) -f ../$@
+       $(LN) $@ ../$@
+
diff --git a/lib/Makefile.profile b/lib/Makefile.profile
new file mode 100644 (file)
index 0000000..8cb197a
--- /dev/null
@@ -0,0 +1,16 @@
+all:: profiled $(LIBRARY)_p.a
+
+subdirs:: profiled
+
+profiled:
+       mkdir profiled
+
+clean::
+       $(RM) -rf profiled
+
+$(LIBRARY)_p.a: $(OBJS)
+       (if test -r $@; then $(RM) -f $@.bak && $(MV) $@ $@.bak; fi)
+       (cd profiled; $(ARUPD) ../$@ $(OBJS))
+       -$(RANLIB) $@
+       $(RM) -f ../$@
+       $(LN) $@ ../$@
index f3bd91644f81688ee5234b21c478f831e18fda20..0ba793d8650dc601b3c5658d5a09e9a4212b26d6 100644 (file)
@@ -1,86 +1,88 @@
-fgetflags.o : fgetflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/linux/fcntl.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+fgetflags.o : ./fgetflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/linux/errno.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/confname.h /usr/include/sys/types.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/fcntl.h /usr/include/linux/fcntl.h \
   /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
-  /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
+  /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
   /usr/include/linux/dirent.h /usr/include/posix1_lim.h /usr/include/stdio.h /usr/include/libio.h \
   /usr/include/_G_config.h 
-fgetversion.o : fgetversion.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/linux/fcntl.h /usr/include/unistd.h /usr/include/posix_opt.h \
+fgetversion.o : ./fgetversion.c /usr/include/errno.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/linux/errno.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
-  /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/sys/ioctl.h \
+  /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
+  /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
   /usr/include/linux/dirent.h /usr/include/posix1_lim.h /usr/include/stdio.h /usr/include/libio.h \
   /usr/include/_G_config.h 
-fsetflags.o : fsetflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/linux/fcntl.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+fsetflags.o : ./fsetflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/linux/errno.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/confname.h /usr/include/sys/types.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/fcntl.h /usr/include/linux/fcntl.h \
   /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
-  /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
+  /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
   /usr/include/linux/dirent.h /usr/include/posix1_lim.h /usr/include/stdio.h /usr/include/libio.h \
   /usr/include/_G_config.h 
-fsetversion.o : fsetversion.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/linux/fcntl.h /usr/include/unistd.h /usr/include/posix_opt.h \
+fsetversion.o : ./fsetversion.c /usr/include/errno.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/linux/errno.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
-  /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/sys/ioctl.h \
+  /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
+  /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
   /usr/include/linux/dirent.h /usr/include/posix1_lim.h /usr/include/stdio.h /usr/include/libio.h \
   /usr/include/_G_config.h 
-getflags.o : getflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+getflags.o : ./getflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/linux/errno.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
   /usr/include/termios.h /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h \
+  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h 
-getversion.o : getversion.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+getversion.o : ./getversion.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/linux/errno.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
   /usr/include/termios.h /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h \
+  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h 
-iod.o : iod.c /usr/include/dirent.h /usr/include/features.h /usr/include/sys/cdefs.h \
+iod.o : ./iod.c ./e2p.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/dirent.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
-  e2p.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/linux/ext2_fs.h 
-ls.o : ls.c /usr/include/grp.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/gnu/types.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/pwd.h /usr/include/time.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h /usr/include/linux/limits.h \
-  /usr/include/linux/dirent.h /usr/include/posix1_lim.h 
-pe.o : pe.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/linux/ext2_fs.h 
+ls.o : ./ls.c /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/grp.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/types.h \
+  /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+  /usr/include/pwd.h /usr/include/time.h /usr/include/linux/ext2_fs.h ./e2p.h \
+  /usr/include/dirent.h /usr/include/linux/limits.h /usr/include/linux/dirent.h \
+  /usr/include/posix1_lim.h 
+pe.o : ./pe.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/linux/ext2_fs.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h e2p.h /usr/include/dirent.h /usr/include/gnu/types.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/sys/types.h \
+  /usr/include/asm/types.h ./e2p.h /usr/include/sys/types.h /usr/include/dirent.h \
+  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h 
-pf.o : pf.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+pf.o : ./pf.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/linux/ext2_fs.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h e2p.h /usr/include/dirent.h /usr/include/gnu/types.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/sys/types.h \
+  /usr/include/asm/types.h ./e2p.h /usr/include/sys/types.h /usr/include/dirent.h \
+  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h 
-ps.o : ps.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ps.o : ./ps.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/linux/ext2_fs.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h e2p.h /usr/include/dirent.h /usr/include/gnu/types.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/sys/types.h \
+  /usr/include/asm/types.h ./e2p.h /usr/include/sys/types.h /usr/include/dirent.h \
+  /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h 
-setflags.o : setflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+setflags.o : ./setflags.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/linux/errno.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
   /usr/include/termios.h /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h \
+  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h 
-setversion.o : setversion.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+setversion.o : ./setversion.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/linux/errno.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
   /usr/include/termios.h /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h e2p.h /usr/include/dirent.h \
+  /usr/include/linux/termios.h /usr/include/linux/ext2_fs.h ./e2p.h /usr/include/dirent.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
   /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h 
index f96ffa82d956932164d0e47bbca4fa6b185745b7..228b47220d48ee2e6ba8a9ebf823c29eb4c84fdc 100644 (file)
@@ -1,3 +1,61 @@
+Fri Oct 27 18:07:48 1995    <tytso@rsts-11.mit.edu>
+
+       * iod.c (iterate_on_dir): Don't assume that d->reclen is the size
+               of the dirent structure; it isn't under Linux.
+
+Mon Sep  4 21:43:53 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for BSD shared libraries.
+
+Fri Aug 11 08:36:40 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * setflags.c: #include <sys/types.h> before including <sys/stat.h>
+
+Sat Aug 12 03:11:45 1995  Remy Card  <card@bbj>
+
+       * Makefile.in (install): Install static libraries in $(ulibdir)
+               (/usr/lib on Linux) instead of $(libdir) (/lib on Linux).
+
+Sat Aug  5 11:43:36 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * Makefile.in (DLL_INSTALL_DIR, ELF_INSTALL_DIR): Set the
+               installation directories correctly.
+
+Thu Jun 15 23:41:20 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for ELF shared libraries.
+
+Mon Jun 12 08:34:44 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * e2p.h: Move <direct.h> after <stdio.h>
+
+Thu Jun  8 12:47:04 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * iod.c (iterate_on_dir): If struct dirent has a d_namlen field,
+       assume that actual dirent entries may be larger than the structure
+       (by the name field), and take extra care deal with this case.
+       This code assumes that d_reclen is a valid dirent field.
+       Also, don't include <dirent.h>, as e2p.h already does.
+
+       * fgetversion.c (fgetversion): Only use the ext2 ioctl if it
+       doesn't cause a compile-time barf, otherwise just return EOPNOTSUPP.
+       * getversion.c (getversion): Ditto.
+       * fsetversion.c (fsetversion): Ditto.
+       * setversion.c (setversion): Ditto.
+       * fsetflags.c (fsetflags): Use chflags instead of the ext2 ioctl
+       if possible, and otherwise only use the ioctl if it doesn't barf.
+       * setflags.c (setflags): Ditto (with fchflags).
+       * fgetflags.c (fgetflags): Use the stat st_flags field instead of
+       the ext2 ioctl if possible, and otherwise only use the ioctl if it
+       doesn't barf.
+       * getflags.c (getflags): Ditto.
+
+       * e2p.h: Include <sys/types.h>, as some <dirent.h>s need it.
+       * ls.c: Move the include of <sys/types.h> to where <grp.h> can see it.
+
+       * Makefile.in: Rewritten to conform to GNU coding standards and
+       support separate compilation directories.
+
 Mon Nov  7 21:59:12 1994  Remy Card  <card@bbj>
 
        * ls.c (list_super): List the new fields s_def_resuid and
diff --git a/lib/e2p/MAKELOG b/lib/e2p/MAKELOG
new file mode 100644 (file)
index 0000000..27e4420
--- /dev/null
@@ -0,0 +1,181 @@
+gcc -O2 -fomit-frame-pointer  -I.. -c pe.c
+In file included from pe.c:19:
+/usr/include/linux/ext2_fs.h:127: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:127: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:128: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:129: parse error before `aclh_acle_count'
+/usr/include/linux/ext2_fs.h:129: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:130: parse error before `aclh_first_acle'
+/usr/include/linux/ext2_fs.h:130: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:135: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:135: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:136: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:137: parse error before `acle_type'
+/usr/include/linux/ext2_fs.h:137: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:138: parse error before `acle_tag'
+/usr/include/linux/ext2_fs.h:138: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:139: parse error before `acle_pad1'
+/usr/include/linux/ext2_fs.h:139: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:140: parse error before `acle_next'
+/usr/include/linux/ext2_fs.h:140: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:149: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:149: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:150: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:151: parse error before `bg_inode_table'
+/usr/include/linux/ext2_fs.h:151: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:152: parse error before `bg_free_blocks_count'
+/usr/include/linux/ext2_fs.h:152: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:153: parse error before `bg_free_inodes_count'
+/usr/include/linux/ext2_fs.h:153: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:158: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:158: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:159: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:160: parse error before `bg_inode_table'
+/usr/include/linux/ext2_fs.h:160: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:161: parse error before `bg_free_blocks_count'
+/usr/include/linux/ext2_fs.h:161: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:162: parse error before `bg_free_inodes_count'
+/usr/include/linux/ext2_fs.h:162: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:163: parse error before `bg_used_dirs_count'
+/usr/include/linux/ext2_fs.h:163: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:164: parse error before `bg_pad'
+/usr/include/linux/ext2_fs.h:164: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:165: parse error before `bg_reserved'
+/usr/include/linux/ext2_fs.h:165: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:166: parse error before `}'
+/usr/include/linux/ext2_fs.h:213: parse error before `__u16'
+/usr/include/linux/ext2_fs.h:213: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:214: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:215: parse error before `i_size'
+/usr/include/linux/ext2_fs.h:215: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:216: parse error before `i_atime'
+/usr/include/linux/ext2_fs.h:216: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:217: parse error before `i_ctime'
+/usr/include/linux/ext2_fs.h:217: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:218: parse error before `i_mtime'
+/usr/include/linux/ext2_fs.h:218: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:219: parse error before `i_dtime'
+/usr/include/linux/ext2_fs.h:219: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:220: parse error before `i_gid'
+/usr/include/linux/ext2_fs.h:220: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:221: parse error before `i_links_count'
+/usr/include/linux/ext2_fs.h:221: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:222: parse error before `i_blocks'
+/usr/include/linux/ext2_fs.h:222: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:223: parse error before `i_flags'
+/usr/include/linux/ext2_fs.h:223: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:226: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:226: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:226: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:227: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:229: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:229: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:230: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:232: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:232: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:233: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:234: parse error before `}'
+/usr/include/linux/ext2_fs.h:234: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:235: parse error before `i_block'
+/usr/include/linux/ext2_fs.h:235: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:236: parse error before `i_version'
+/usr/include/linux/ext2_fs.h:236: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:237: parse error before `i_file_acl'
+/usr/include/linux/ext2_fs.h:237: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:238: parse error before `i_dir_acl'
+/usr/include/linux/ext2_fs.h:238: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:239: parse error before `i_faddr'
+/usr/include/linux/ext2_fs.h:239: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:242: parse error before `__u8'
+/usr/include/linux/ext2_fs.h:242: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:242: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:243: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:244: parse error before `i_pad1'
+/usr/include/linux/ext2_fs.h:244: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:245: parse error before `l_i_reserved2'
+/usr/include/linux/ext2_fs.h:245: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:246: parse error before `}'
+/usr/include/linux/ext2_fs.h:246: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:248: parse error before `__u8'
+/usr/include/linux/ext2_fs.h:248: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:249: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:250: parse error before `h_i_mode_high'
+/usr/include/linux/ext2_fs.h:250: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:251: parse error before `h_i_uid_high'
+/usr/include/linux/ext2_fs.h:251: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:252: parse error before `h_i_gid_high'
+/usr/include/linux/ext2_fs.h:252: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:253: parse error before `h_i_author'
+/usr/include/linux/ext2_fs.h:253: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:254: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:256: parse error before `__u8'
+/usr/include/linux/ext2_fs.h:256: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:257: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:258: parse error before `m_pad1'
+/usr/include/linux/ext2_fs.h:258: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:259: parse error before `m_i_reserved2'
+/usr/include/linux/ext2_fs.h:259: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:260: parse error before `}'
+/usr/include/linux/ext2_fs.h:260: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:261: parse error before `}'
+/usr/include/linux/ext2_fs.h:261: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:262: parse error before `}'
+/usr/include/linux/ext2_fs.h:329: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:329: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:330: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:331: parse error before `s_r_blocks_count'
+/usr/include/linux/ext2_fs.h:331: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:332: parse error before `s_free_blocks_count'
+/usr/include/linux/ext2_fs.h:332: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:333: parse error before `s_free_inodes_count'
+/usr/include/linux/ext2_fs.h:333: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:334: parse error before `s_first_data_block'
+/usr/include/linux/ext2_fs.h:334: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:335: parse error before `s_log_block_size'
+/usr/include/linux/ext2_fs.h:335: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:336: parse error before `s_log_frag_size'
+/usr/include/linux/ext2_fs.h:336: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:337: parse error before `s_blocks_per_group'
+/usr/include/linux/ext2_fs.h:337: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:338: parse error before `s_frags_per_group'
+/usr/include/linux/ext2_fs.h:338: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:339: parse error before `s_inodes_per_group'
+/usr/include/linux/ext2_fs.h:339: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:340: parse error before `s_mtime'
+/usr/include/linux/ext2_fs.h:340: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:341: parse error before `s_wtime'
+/usr/include/linux/ext2_fs.h:341: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:342: parse error before `s_mnt_count'
+/usr/include/linux/ext2_fs.h:342: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:343: parse error before `s_max_mnt_count'
+/usr/include/linux/ext2_fs.h:343: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:344: parse error before `s_magic'
+/usr/include/linux/ext2_fs.h:344: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:345: parse error before `s_state'
+/usr/include/linux/ext2_fs.h:345: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:346: parse error before `s_errors'
+/usr/include/linux/ext2_fs.h:346: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:347: parse error before `s_pad'
+/usr/include/linux/ext2_fs.h:347: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:348: parse error before `s_lastcheck'
+/usr/include/linux/ext2_fs.h:348: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:349: parse error before `s_checkinterval'
+/usr/include/linux/ext2_fs.h:349: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:350: parse error before `s_creator_os'
+/usr/include/linux/ext2_fs.h:350: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:351: parse error before `s_rev_level'
+/usr/include/linux/ext2_fs.h:351: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:352: parse error before `s_def_resuid'
+/usr/include/linux/ext2_fs.h:352: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:353: parse error before `s_def_resgid'
+/usr/include/linux/ext2_fs.h:353: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:354: parse error before `s_reserved'
+/usr/include/linux/ext2_fs.h:354: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:355: parse error before `}'
+/usr/include/linux/ext2_fs.h:372: parse error before `__u32'
+/usr/include/linux/ext2_fs.h:372: warning: no semicolon at end of struct or union
+/usr/include/linux/ext2_fs.h:373: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:374: parse error before `name_len'
+/usr/include/linux/ext2_fs.h:374: warning: data definition has no type or storage class
+/usr/include/linux/ext2_fs.h:376: parse error before `}'
+make: *** [pe.o] Error 1
diff --git a/lib/e2p/Makefile b/lib/e2p/Makefile
deleted file mode 100644 (file)
index 8ade7fa..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-# Makefile for the second extended file system utility functions
-#
-# Copyright (C) 1993 Remy Card (card@masi.ibp.fr)
-#
-# This file can be redistributed under the terms of the GNU General
-# Public License
-
-all::
-
-include ../../MCONFIG
-
-CFLAGS_NO=     $(WFLAGS) -I..
-CFLAGS=                $(OPT) $(CFLAGS_NO)
-LDFLAGS=       $(OPT)
-
-RM=rm -f
-MV=mv
-LN=ln -s
-
-OBJS=          fgetflags.o fsetflags.o fgetversion.o fsetversion.o \
-               getflags.o getversion.o iod.o ls.o pe.o pf.o ps.o \
-               setflags.o setversion.o
-
-ifdef BUILD_DLL_SHLIBS
-DLL_ADDRESS = 0x66980000
-DLL_JUMPSIZE = 0x1000
-DLL_GOTSIZE  = 0x1000
-DLL_VERSION = 1.0
-DLL_IMAGE = libe2p
-DLL_STUB = libe2p
-DLL_MYDIR = e2p
-DLL_INSTALL_DIR = $(SHLIBDIR)
-
-include ../Makefile.dll-lib
-endif
-
-.c.o:
-       $(CC) $(CFLAGS) -c $*.c
-ifdef BUILD_PROFILE_LIBS
-       $(CC) $(CFLAGS_NO) -pg -o profiled/$*.o -c $*.c
-endif
-ifdef BUILD_DLL_SHLIBS
-       (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
-               -o jump/$*.o -c $*.c)
-endif
-#      $(CC) $(CFLAGS_NO) -checker -g -o checker/$*.o -c $*.c
-all:: libe2p.a
-
-ifdef BUILD_PROFILE_LIBS
-all:: libe2p_p.a
-endif
-
-libe2p.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       $(ARCHIVE) $@ $(OBJS)
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) e2p/$@ ../$@
-
-libe2p_p.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       (cd profiled; $(ARCHIVE) ../$@ $(OBJS))
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) e2p/$@ ../$@
-
-libe2p_chk.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       (cd checker; $(ARCHIVE) ../$@ $(OBJS))
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) e2p/$@ ../$@
-
-install::
-
-install-libs::
-       $(INSTALLLIB) libe2p.a $(LIBDIR)/libe2p.a
-       $(CHMOD) 644 $(LIBDIR)/libe2p.a
-       $(RANLIB) $(LIBDIR)/libe2p.a
-       $(CHMOD) $(LIBMODE) $(LIBDIR)/libe2p.a
-
-install-tree::
-
-clean::
-       rm -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/*
-       rm -f ../libe2p.a ../libe2p_p.a
-
-really-clean:: clean
-       rm -f .depend
-
-dep depend .depend:
-       $(CC) -M $(CFLAGS) *.c >.depend
-
-include .depend
diff --git a/lib/e2p/Makefile.in b/lib/e2p/Makefile.in
new file mode 100644 (file)
index 0000000..2e8da28
--- /dev/null
@@ -0,0 +1,129 @@
+# Makefile for the second extended file system utility functions
+#
+# Copyright (C) 1993 Remy Card (card@masi.ibp.fr)
+#
+# This file can be redistributed under the terms of the GNU General
+# Public License
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ../..
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+all::
+
+OBJS=          fgetflags.o fsetflags.o fgetversion.o fsetversion.o \
+               getflags.o getversion.o iod.o ls.o pe.o pf.o ps.o \
+               setflags.o setversion.o
+
+SRCS=          $(srcdir)/fgetflags.c $(srcdir)/fsetflags.c \
+               $(srcdir)/fgetversion.c $(srcdir)/fsetversion.c \
+               $(srcdir)/getflags.c $(srcdir)/getversion.c \
+               $(srcdir)/iod.c $(srcdir)/ls.c $(srcdir)/pe.c \
+               $(srcdir)/pf.c $(srcdir)/ps.c \
+               $(srcdir)/setflags.c $(srcdir)/setversion.c
+
+LIBRARY= libe2p
+LIBDIR= e2p
+
+DLL_ADDRESS = 0x66980000
+DLL_JUMPSIZE = 0x1000
+DLL_GOTSIZE  = 0x1000
+DLL_VERSION = 1.2
+DLL_IMAGE = libe2p
+DLL_STUB = libe2p
+DLL_MYDIR = e2p
+DLL_INSTALL_DIR = $(libdir)
+
+ELF_VERSION = 2.1
+ELF_IMAGE = libe2p
+ELF_MYDIR = e2p
+ELF_INSTALL_DIR = $(libdir)
+
+BSDLIB_VERSION = 2.1
+BSDLIB_IMAGE = libe2p
+BSDLIB_MYDIR = e2p
+BSDLIB_INSTALL_DIR = $(libdir)
+
+@MAKEFILE_LIBRARY@
+@MAKEFILE_DLL@
+@MAKEFILE_ELF@
+@MAKEFILE_BSDLIB@
+@MAKEFILE_PROFILE@
+@MAKEFILE_CHECKER@
+
+.c.o:
+       $(CC) $(CFLAGS) -c $< -o $@
+@PROFILE_CMT@  $(CC) $(CFLAGS) -pg -o profiled/$*.o -c $<
+@CHECKER_CMT@  $(CC) $(CFLAGS) -checker -g -o checker/$*.o -c $<
+@DLL_CMT@      (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
+@DLL_CMT@              -o jump/$*.o -c $<)
+@ELF_CMT@      $(CC) $(CFLAGS) -fPIC -o elfshared/$*.o -c $<
+@BSDLIB_CMT@   $(CC) $(CFLAGS) -fpic -o pic/$*.o -c $<
+
+installdirs::
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ulibdir)
+
+install:: all installdirs 
+       $(INSTALL_DATA) libe2p.a $(DESTDIR)$(ulibdir)/libe2p.a
+       $(CHMOD) 644 $(DESTDIR)$(ulibdir)/libe2p.a
+       -$(RANLIB) $(DESTDIR)$(ulibdir)/libe2p.a
+       $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/libe2p.a
+
+uninstall::
+       $(RM) -f $(ulibdir)/libe2p.a
+
+clean::
+       $(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/*
+       $(RM) -f ../libe2p.a ../libe2p_p.a
+mostlyclean:: clean
+distclean:: clean
+       $(RM) -f .depend Makefile
+
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+fgetflags.o : $(srcdir)/fgetflags.c \
+  $(srcdir)/e2p.h \
+  
+fsetflags.o : $(srcdir)/fsetflags.c \
+  $(srcdir)/e2p.h \
+  
+fgetversion.o : $(srcdir)/fgetversion.c \
+  $(srcdir)/e2p.h \
+  
+fsetversion.o : $(srcdir)/fsetversion.c \
+  $(srcdir)/e2p.h \
+  
+getflags.o : $(srcdir)/getflags.c \
+  $(srcdir)/e2p.h \
+  
+getversion.o : $(srcdir)/getversion.c \
+  $(srcdir)/e2p.h \
+  
+iod.o : $(srcdir)/iod.c $(srcdir)/e2p.h \
+  
+ls.o : $(srcdir)/ls.c \
+  $(srcdir)/e2p.h \
+  
+pe.o : $(srcdir)/pe.c \
+  $(srcdir)/e2p.h \
+  
+pf.o : $(srcdir)/pf.c \
+  $(srcdir)/e2p.h \
+  
+ps.o : $(srcdir)/ps.c \
+  $(srcdir)/e2p.h \
+  
+setflags.o : $(srcdir)/setflags.c \
+  $(srcdir)/e2p.h \
+  
+setversion.o : $(srcdir)/setversion.c \
+  $(srcdir)/e2p.h \
+  
+
diff --git a/lib/e2p/configure b/lib/e2p/configure
new file mode 100644 (file)
index 0000000..db75368
--- /dev/null
@@ -0,0 +1,613 @@
+#!/bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.1 
+# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+select compiler to use"
+ac_help="$ac_help
+select compiler command line options"
+ac_help="$ac_help
+select compiler preprocessor command line options"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Initialize some other variables.
+subdirs=
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -build | --build | --buil | --bui | --bu | --b)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
+                          [same as prefix]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+--enable and --with options recognized:$ac_help
+EOF
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.1"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *) 
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 unused; standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 unused; some systems may open it to /dev/tty
+# 4 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 4>/dev/null
+else
+  exec 4>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=e2p.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} $CFLAGS $CPPFLAGS conftest.$ac_ext -c 1>&5 2>&5'
+ac_link='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext -o conftest $LIBS 1>&5 2>&5'
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='       '
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+# Check whether --with-cc or --without-cc was given.
+withval="$with_cc"
+if test -n "$withval"; then
+  echo "$ac_t""CC=$withval" 1>&4
+CC=$withval
+else
+  if test -z "$CC" ; then CC=cc; fi
+echo "$ac_t""CC defaults to $CC" 1>&4
+fi
+
+
+# Check whether --with-ccopts or --without-ccopts was given.
+withval="$with_ccopts"
+if test -n "$withval"; then
+  echo "$ac_t""CCOPTS is $withval" 1>&4
+CCOPTS=$withval
+CFLAGS="$CFLAGS $withval"
+else
+  CCOPTS=
+fi
+
+
+# Check whether --with-cppopts or --without-cppopts was given.
+withval="$with_cppopts"
+if test -n "$withval"; then
+  echo "$ac_t""CPPOPTS=$withval" 1>&4
+CPPOPTS=$withval
+CPPFLAGS="$CPPFLAGS $withval"
+else
+  echo "$ac_t""CPPOPTS defaults to $CPPOPTS" 1>&4
+fi
+
+trap '' 1 2 15
+if test -w $cache_file; then
+echo "updating cache $cache_file"
+cat > $cache_file <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# Ultrix sh set writes to stderr and can't be redirected directly.
+(set) 2>&1 |
+  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \
+  >> $cache_file
+else
+echo "not updating unwritable cache $cache_file"
+fi
+
+trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
+s%[    `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#!/bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.1"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+
+trap 'rm -f Makefile; exit 1' 1 2 15
+
+# Protect against being on the right side of a sed subst in config.status. 
+sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
+ s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+$ac_vpsub
+$extrasub
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@CC@%$CC%g
+s%@CCOPTS@%$CCOPTS%g
+s%@CPPOPTS@%$CPPOPTS%g
+
+CEOF
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust relative srcdir, etc. for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/$ac_dir"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
+fi; done
+rm -f conftest.subs
+
+
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS
+
diff --git a/lib/e2p/dll/jump.ignore b/lib/e2p/dll/jump.ignore
new file mode 100644 (file)
index 0000000..e69de29
similarity index 84%
rename from lib/e2p/jump/jump.params
rename to lib/e2p/dll/jump.params
index 7d3efe93fccaea91b30d635007bc3b793e4525da..ebaa892c562fa197af1d012ecfc9c4c50e84e516 100644 (file)
@@ -3,4 +3,4 @@ Text=0x66980000
 Data=0x00000000
 Jump=0x00001000
 GOT=0x00001000
-Version=1.0.0
+Version=1.2.0
diff --git a/lib/e2p/dll/jump.undefs b/lib/e2p/dll/jump.undefs
new file mode 100644 (file)
index 0000000..48d61ea
--- /dev/null
@@ -0,0 +1 @@
+66982040 D __NEEDS_SHRLIB_libc_4
diff --git a/lib/e2p/dll/jump.vars b/lib/e2p/dll/jump.vars
new file mode 100644 (file)
index 0000000..e69de29
index 8ff770f580bf597e6e8e74c05d3622f6bb2a1c54..dc2dbe5747db9a612b208a1744c10db01274e752 100644 (file)
@@ -1,5 +1,6 @@
-#include <dirent.h>
+#include <sys/types.h>         /* Needed by dirent.h on netbsd */
 #include <stdio.h>
+#include <dirent.h>
 
 #include <linux/ext2_fs.h>
 
index 95b0bdc861b7510c7955a4624d19b3cd76802600..752da0b5c9816822a06be4cba5a53d4bc75d933b 100644 (file)
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
-#include <fcntl.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#if HAVE_STAT_FLAGS
+#include <sys/stat.h>
+#else
+#include <fcntl.h>
 #include <sys/ioctl.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
 
 int fgetflags (const char * name, unsigned long * flags)
 {
+#if HAVE_STAT_FLAGS
+  struct stat buf;
+
+  if (stat (name, &buf) == -1)
+    return -1;
+
+  *flags = 0;
+#ifdef UF_IMMUTABLE
+  if (buf.st_flags & UF_IMMUTABLE)
+    *flags |= EXT2_IMMUTABLE_FL;
+#endif
+#ifdef UF_APPEND
+  if (buf.st_flags & UF_APPEND)
+    *flags |= EXT2_APPEND_FL;
+#endif
+#ifdef UF_NODUMP
+  if (buf.st_flags & UF_NODUMP)
+    *flags |= EXT2_NODUMP_FL;
+#endif
+
+  return 0;
+#else
+#if HAVE_EXT2_IOCTLS
        int fd;
        int r;
 
@@ -32,6 +63,13 @@ int fgetflags (const char * name, unsigned long * flags)
        if (fd == -1)
                return -1;
        r = ioctl (fd, EXT2_IOC_GETFLAGS, flags);
+
        close (fd);
        return r;
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
+#endif
 }
index 73429f2a958d878ee91b45caa4e1ce462c9a285d..89e07131c7538945a4585d0e1010e9c6de4ad51a 100644 (file)
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
-#include <fcntl.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#include <fcntl.h>
 #include <sys/ioctl.h>
 
 #include <linux/ext2_fs.h>
@@ -25,6 +29,7 @@
 
 int fgetversion (const char * name, unsigned long * version)
 {
+#if HAVE_EXT2_IOCTLS
        int fd;
        int r;
 
@@ -34,4 +39,9 @@ int fgetversion (const char * name, unsigned long * version)
        r = ioctl (fd, EXT2_IOC_GETVERSION, version);
        close (fd);
        return r;
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
 }
index 180d48f5f023b6d169dde9edeeaac92277143a24..a2584432a1109039633244aae178e98cb6cfa821 100644 (file)
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
-#include <fcntl.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#if HAVE_CHFLAGS
+#include <sys/stat.h>          /* For the flag values.  */
+#else
+#include <fcntl.h>
 #include <sys/ioctl.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
 
 int fsetflags (const char * name, unsigned long flags)
 {
+#if HAVE_CHFLAGS
+  unsigned long bsd_flags = 0;
+
+#ifdef UF_IMMUTABLE
+  if (flags & EXT2_IMMUTABLE_FL)
+    bsd_flags |= UF_IMMUTABLE;
+#endif
+#ifdef UF_APPEND
+  if (flags & EXT2_APPEND_FL)
+    bsd_flags |= UF_APPEND;
+#endif
+#ifdef UF_NODUMP
+  if (flags & EXT2_NODUMP_FL)
+    bsd_flags |= UF_NODUMP;
+#endif
+
+  return chflags (name, bsd_flags);
+#else
+#if HAVE_EXT2_IOCTLS
        int fd;
        int r;
 
@@ -34,4 +61,10 @@ int fsetflags (const char * name, unsigned long flags)
        r = ioctl (fd, EXT2_IOC_SETFLAGS, &flags);
        close (fd);
        return r;
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
+#endif
 }
index 1bb8acca3d51a48ba1782f217a6f36d5d001557c..afea36561d13b905af7d2889400665b7ebbd41a9 100644 (file)
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
-#include <fcntl.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#include <fcntl.h>
 #include <sys/ioctl.h>
 
 #include <linux/ext2_fs.h>
@@ -25,6 +29,7 @@
 
 int fsetversion (const char * name, unsigned long version)
 {
+#if HAVE_EXT2_IOCTLS
        int fd;
        int r;
 
@@ -34,4 +39,9 @@ int fsetversion (const char * name, unsigned long version)
        r = ioctl (fd, EXT2_IOC_SETVERSION, &version);
        close (fd);
        return r;
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
 }
index 4e537490d91d68a543027fcf4125691909bff21b..ac014a703c847deee9bfa22dcdab63ec6a373e6a 100644 (file)
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
+#endif
+#if HAVE_STAT_FLAGS
+#include <sys/stat.h>
+#else
 #include <sys/ioctl.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
 
 int getflags (int fd, unsigned long * flags)
 {
+#if HAVE_STAT_FLAGS
+  struct stat buf;
+
+  if (fstat (fd, &buf) == -1)
+    return -1;
+
+  *flags = 0;
+#ifdef UF_IMMUTABLE
+  if (buf.st_flags & UF_IMMUTABLE)
+    *flags |= EXT2_IMMUTABLE_FL;
+#endif
+#ifdef UF_APPEND
+  if (buf.st_flags & UF_APPEND)
+    *flags |= EXT2_APPEND_FL;
+#endif
+#ifdef UF_NODUMP
+  if (buf.st_flags & UF_NODUMP)
+    *flags |= EXT2_NODUMP_FL;
+#endif
+
+  return 0;
+#else
+#if HAVE_EXT2_IOCTLS
        return ioctl (fd, EXT2_IOC_GETFLAGS, flags);
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
+#endif
 }
index 04dc0f75df332a7c8c3784386b8ada4350c24aca..309dfb6f537a16a1dc2971d1ac4ae9a0b778c83b 100644 (file)
@@ -14,7 +14,9 @@
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
+#endif
 #include <sys/ioctl.h>
 
 #include <linux/ext2_fs.h>
 
 int getversion (int fd, unsigned long * version)
 {
+#if HAVE_EXT2_IOCTLS
        return ioctl (fd, EXT2_IOC_GETVERSION, version);
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
 }
index 52c16a13efce6d639531e2867fe780a8452c8777..7b02a7f3ef410f9b2e06c9a2d2fbd287ab63688e 100644 (file)
@@ -14,8 +14,6 @@
  * 93/10/30    - Creation
  */
 
-#include <dirent.h>
-
 #include "e2p.h"
 
 int iterate_on_dir (const char * dir_name,
@@ -23,7 +21,13 @@ int iterate_on_dir (const char * dir_name,
                    void * private)
 {
        DIR * dir;
-       struct dirent de;
+#if HAVE_DIRENT_NAMELEN
+       /* Declare DE_BUF with some extra room for the name.  */
+       char de_buf[sizeof (struct dirent) + 32];
+       struct dirent *de = (struct dirent *)&de_buf;
+#else
+       struct dirent de_buf, *de = &de_buf;
+#endif
        struct dirent *dep;
 
        dir = opendir (dir_name);
@@ -31,12 +35,32 @@ int iterate_on_dir (const char * dir_name,
                return -1;
        while ((dep = readdir (dir)))
        {
-               de.d_ino = dep->d_ino;
-               de.d_off = dep->d_off;
-               de.d_reclen = dep->d_reclen;
-               strcpy (de.d_name, dep->d_name);
-               (*func) (dir_name, &de, private);
+#if HAVE_DIRENT_NAMELEN
+         /* See if there's enough room for this entry in DE, and grow if
+            not.  */
+         if (de_len < dep->d_reclen)
+           {
+             de_len = dep->d_reclen + 32;
+             de =
+               (de == (struct dirent *)&de_buf
+                ? malloc (de_len)
+                : realloc (de, de_len));
+             if (de == NULL)
+               {
+                 errno = ENOMEM;
+                 return -1;
+               }
+           }
+         memcpy (de, dep, dep->d_reclen);
+#else
+         *de = *dep;
+#endif
+         (*func) (dir_name, de, private);
        }
+#if HAVE_DIRENT_NAMELEN
+       if (de != (struct dirent *)&de_buf)
+         free (de);
+#endif
        closedir (dir);
        return 0;
 }
diff --git a/lib/e2p/jump/jump.undefs b/lib/e2p/jump/jump.undefs
deleted file mode 100644 (file)
index 4492562..0000000
+++ /dev/null
@@ -1 +0,0 @@
-66983040 D __NEEDS_SHRLIB_libc_4
index f879a3c6d55e891eaf37989591f27513f1ea6cae..6870098c844fe8286986c0685b64c2dfdd95d8d1 100644 (file)
@@ -9,11 +9,11 @@
  * Public License
  */
 
+#include <sys/types.h>
 #include <grp.h>
 #include <pwd.h>
 #include <stdio.h>
 #include <time.h>
-#include <sys/types.h>
 
 #include <linux/ext2_fs.h>
 
@@ -52,23 +52,23 @@ void list_super (struct ext2_super_block * s)
        printf ("Errors behavior:          ");
        print_fs_errors (stdout, s->s_errors);
        printf ("\n");
-       printf ("Inode count:              %lu\n", s->s_inodes_count);
-       printf ("Block count:              %lu\n", s->s_blocks_count);
-       printf ("Reserved block count:     %lu\n", s->s_r_blocks_count);
-       printf ("Free blocks:              %lu\n", s->s_free_blocks_count);
-       printf ("Free inodes:              %lu\n", s->s_free_inodes_count);
-       printf ("First block:              %lu\n", s->s_first_data_block);
+       printf ("Inode count:              %u\n", s->s_inodes_count);
+       printf ("Block count:              %u\n", s->s_blocks_count);
+       printf ("Reserved block count:     %u\n", s->s_r_blocks_count);
+       printf ("Free blocks:              %u\n", s->s_free_blocks_count);
+       printf ("Free inodes:              %u\n", s->s_free_inodes_count);
+       printf ("First block:              %u\n", s->s_first_data_block);
        printf ("Block size:               %u\n", EXT2_BLOCK_SIZE(s));
        printf ("Fragment size:            %u\n", EXT2_FRAG_SIZE(s));
-       printf ("Blocks per group:         %lu\n", s->s_blocks_per_group);
-       printf ("Fragments per group:      %lu\n", s->s_frags_per_group);
-       printf ("Inodes per group:         %lu\n", s->s_inodes_per_group);
+       printf ("Blocks per group:         %u\n", s->s_blocks_per_group);
+       printf ("Fragments per group:      %u\n", s->s_frags_per_group);
+       printf ("Inodes per group:         %u\n", s->s_inodes_per_group);
        printf ("Last mount time:          %s", ctime ((time_t *) &s->s_mtime));
        printf ("Last write time:          %s", ctime ((time_t *) &s->s_wtime));
        printf ("Mount count:              %u\n", s->s_mnt_count);
        printf ("Maximum mount count:      %d\n", s->s_max_mnt_count);
        printf ("Last checked:             %s", ctime ((time_t *) &s->s_lastcheck));
-       printf ("Check interval:           %lu\n", s->s_checkinterval);
+       printf ("Check interval:           %u\n", s->s_checkinterval);
        if (s->s_checkinterval)
        {
                time_t next;
index c1e9fcbb3305f92518cf54b47c1f5f434bbb6a83..06f127f2ea28f90b58561a05ab2b472617a7842f 100644 (file)
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
+#endif
+#if HAVE_CHFLAGS
+#include <sys/types.h>
+#include <sys/stat.h>          /* For the flag values.  */
+#else
 #include <sys/ioctl.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
 
 int setflags (int fd, unsigned long flags)
 {
+#if HAVE_CHFLAGS
+  unsigned long bsd_flags = 0;
+
+#ifdef UF_IMMUTABLE
+  if (flags & EXT2_IMMUTABLE_FL)
+    bsd_flags |= UF_IMMUTABLE;
+#endif
+#ifdef UF_APPEND
+  if (flags & EXT2_APPEND_FL)
+    bsd_flags |= UF_APPEND;
+#endif
+#ifdef UF_NODUMP
+  if (flags & EXT2_NODUMP_FL)
+    bsd_flags |= UF_NODUMP;
+#endif
+
+  return fchflags (fd, bsd_flags);
+#else
+#if HAVE_EXT2_IOCTLS
        return ioctl (fd, EXT2_IOC_SETFLAGS, &flags);
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
+#endif
 }
index a6da31e28b55b7e4c2f0ac5478ebbcab6626b850..f2c48cd99eb7675c800d93842f482474c167a71e 100644 (file)
@@ -14,7 +14,9 @@
  * 93/10/30    - Creation
  */
 
+#if HAVE_ERRNO_H
 #include <errno.h>
+#endif
 #include <sys/ioctl.h>
 
 #include <linux/ext2_fs.h>
 
 int setversion (int fd, unsigned long version)
 {
+#if HAVE_EXT2_IOCTLS
        return ioctl (fd, EXT2_IOC_SETVERSION, &version);
+#else /* ! HAVE_EXT2_IOCTLS */
+       extern int errno;
+       errno = EOPNOTSUPP;
+       return -1;
+#endif /* ! HAVE_EXT2_IOCTLS */
 }
index 2556ee49a0758889a655eaf4c9a1fe963a40b698..42855603acf83d6e49304470b3ed7158c5d987f8 100644 (file)
@@ -1,17 +1,16 @@
-com_err.o : com_err.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  mit-sipb-copyright.h error_table.h internal.h /usr/include/errno.h /usr/include/linux/errno.h 
-error_message.o : error_message.c /usr/include/stdio.h /usr/include/features.h \
+com_err.o : ./com_err.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/libio.h /usr/include/_G_config.h ./com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./mit-sipb-copyright.h ./error_table.h ./internal.h /usr/include/errno.h /usr/include/linux/errno.h 
+error_message.o : ./error_message.c /usr/include/stdio.h /usr/include/features.h \
   /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/errno.h /usr/include/linux/errno.h \
-  com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h error_table.h mit-sipb-copyright.h \
-  internal.h 
-et_name.o : et_name.c error_table.h mit-sipb-copyright.h internal.h /usr/include/errno.h \
-  /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/linux/errno.h 
-init_et.o : init_et.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  ./com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ./error_table.h \
+  ./mit-sipb-copyright.h ./internal.h 
+et_name.o : ./et_name.c ./error_table.h ./mit-sipb-copyright.h ./internal.h \
+  /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/linux/errno.h 
+init_et.o : ./init_et.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/include/stdlib.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  error_table.h mit-sipb-copyright.h 
-vfprintf.o : vfprintf.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/varargs.h 
+  /usr/include/alloca.h ./com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./error_table.h ./mit-sipb-copyright.h 
+vfprintf.o : ./vfprintf.c 
index 3c372243a444f9134a887db479788acb476f794d..99436325b749697efc4652c5659451cf7742bbf2 100644 (file)
@@ -1,3 +1,39 @@
+Mon Sep  4 21:44:47 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for BSD shared libraries.
+
+Sat Aug 12 03:11:28 1995  Remy Card  <card@bbj>
+
+       * Makefile.in (install): Install static libraries in $(ulibdir)
+               (/usr/lib on Linux) instead of $(libdir) (/lib on Linux).
+
+Sat Aug  5 11:44:17 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * Makefile.in (DLL_INSTALL_DIR, ELF_INSTALL_DIR): Set the
+               installation directories correctly.
+
+Thu Jun 15 23:39:51 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for ELF shared libraries.
+               Fixed typos in the compilation rules.
+               (distclean): Added compile_et.sh.
+
+Sat Jun 10 19:56:13 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * compile_et.sh.in: Use ET_DIR instead of srcdir to determine the
+               location of the et directory.
+
+Thu Jun  8 12:45:41 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * vfprintf.c (vfprintf): Only compile this function if vfprintf
+       doesn't already exist and _doprnt does.
+
+       * compile_et.sh: Moved to compile_et.sh.in.
+
+       * Makefile.in: Rewritten to conform to GNU coding standards and
+       support separate compilation directories.
+       Don't preprocess compile_et.sh, as this is now done by configure.
+
 Mon Nov  7 21:17:48 1994  Remy Card  <card@bbj>
 
        * Makefile: Added a dummy install target in case shared libraries
diff --git a/lib/et/Makefile b/lib/et/Makefile
deleted file mode 100644 (file)
index 2dcf1ef..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#
-# Makefile for lib/et
-#
-
-all:: compile_et libcom_err.a
-
-include ../../MCONFIG
-
-OBJS= error_message.o et_name.o init_et.o com_err.o
-SRCS = error_message.c et_name.c init_et.c com_err.c
-
-HFILES= com_err.h
-
-ifdef BUILD_PROFILE_LIBS
-all:: libcom_err_p.a
-endif
-
-ifdef BUILD_DLL_SHLIBS
-DLL_ADDRESS = 0x66800000
-DLL_JUMPSIZE = 0x1000
-DLL_GOTSIZE  = 0x1000
-DLL_VERSION = 1.0
-DLL_IMAGE = libet
-DLL_STUB = libcom_err
-DLL_MYDIR = et
-DLL_INSTALL_DIR = $(SHLIBDIR)
-
-include ../Makefile.dll-lib
-endif
-
-RM=rm -f
-MV=mv
-LN=ln -s
-TAGS=etags
-
-DEFS= -DHAS_STDLIB_H
-
-CFLAGS_NO= $(WFLAGS) $(DEFS)
-CFLAGS= $(CFLAGS_NO) $(OPT)
-
-#
-# what to build...
-#
-
-.c.o:
-       $(CC) $(CFLAGS) -c $*.c
-ifdef BUILD_PROFILE_LIBS
-       $(CC) $(CFLAGS_NO) -g -pg -o profiled/$*.o -c $*.c
-endif
-ifdef BUILD_DLL_SHLIBS
-       (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
-               -o jump/$*.o -c $*.c)
-endif
-
-
-compile_et: compile_et.sh
-       ./config_script compile_et.sh $(AWK) > compile_et
-       chmod +x compile_et
-
-libcom_err.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       $(ARCHIVE) $@ $(OBJS)
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) et/$@ ../$@
-
-libcom_err_p.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       (cd profiled ; $(ARCHIVE) ../$@ $(OBJS))
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) et/$@ ../$@
-
-clean::
-       $(RM) compile_et libcom_err.a libcom_err_p.a
-       $(RM) $(OBJS) profiled/*
-       $(RM) *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.ps TAGS *.ln
-       $(RM) ../libcom_err.a ../libcom_err_p.a
-
-really-clean:: clean
-       $(RM) .depend
-
-install-libs:: libcom_err.a
-       $(INSTALLLIB) libcom_err.a $(LIBDIR)/libcom_err.a
-       $(CHMOD) 644 $(LIBDIR)/libcom_err.a
-       $(RANLIB)    $(LIBDIR)/libcom_err.a
-       $(CHMOD) $(LIBMODE) $(LIBDIR)/libcom_err.a
-
-install-libs:: $(HFILES)
-       @rm -rf $(INCLDIR)/et
-       @mkdir $(INCLDIR)/et
-       for i in $(HFILES); do \
-               $(INSTALLINC) $$i $(INCLDIR)/et/$$i; \
-       done
-
-install-tree::
-
-install::
-
-## 
-
-com_err.ps : com_err.dvi
-com_err.dvi: com_err.texinfo
-
-libcom_err.o:  $(LIBOBJS)
-       ld -r -s -o libcom_err.o $(LIBOBJS)
-       chmod -x libcom_err.o
-
-
-TAGS:  $(SRCS)
-       $(TAGS) $(SRCS)
-
-dep depend .depend: compile_et
-       $(CPP) -M $(CFLAGS) *.c >.depend
-
-include .depend
diff --git a/lib/et/Makefile.in b/lib/et/Makefile.in
new file mode 100644 (file)
index 0000000..39141a4
--- /dev/null
@@ -0,0 +1,121 @@
+#
+# Makefile for lib/et
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ../..
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+all:: compile_et
+
+OBJS= error_message.o et_name.o init_et.o com_err.o
+SRCS = $(srcdir)/error_message.c $(srcdir)/et_name.c $(srcdir)/init_et.c \
+       $(srcdir)/com_err.c
+
+HFILES= com_err.h
+
+LIBRARY= libcom_err
+LIBDIR= et
+
+DLL_ADDRESS = 0x66800000
+DLL_JUMPSIZE = 0x1000
+DLL_GOTSIZE  = 0x1000
+DLL_VERSION = 1.0
+DLL_IMAGE = libet
+DLL_STUB = libcom_err
+DLL_MYDIR = et
+DLL_INSTALL_DIR = $(libdir)
+
+ELF_VERSION = 2.0
+ELF_IMAGE = libcom_err
+ELF_MYDIR = et
+ELF_INSTALL_DIR = $(libdir)
+
+BSDLIB_VERSION = 1.0
+BSDLIB_IMAGE = libcom_err
+BSDLIB_MYDIR = et
+BSDLIB_INSTALL_DIR = $(libdir)
+
+#
+# what to build...
+#
+.c.o:
+       $(CC) $(CFLAGS) -c $< -o $@
+@PROFILE_CMT@  $(CC) $(CFLAGS) -pg -o profiled/$*.o -c $<
+@CHECKER_CMT@  $(CC) $(CFLAGS) -checker -g -o checker/$*.o -c $<
+@DLL_CMT@      (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
+@DLL_CMT@              -o jump/$*.o -c $<)
+@ELF_CMT@      $(CC) $(CFLAGS) -fPIC -o elfshared/$*.o -c $<
+@BSDLIB_CMT@   $(CC) $(CFLAGS) -fpic -o pic/$*.o -c $<
+
+@MAKEFILE_LIBRARY@
+@MAKEFILE_DLL@
+@MAKEFILE_ELF@
+@MAKEFILE_BSDLIB@
+@MAKEFILE_PROFILE@
+@MAKEFILE_CHECKER@
+
+compile_et: compile_et.sh
+       $(CP) $< $@ && $(CHMOD) +x compile_et
+
+com_err.ps : com_err.dvi
+com_err.dvi: com_err.texinfo
+
+#libcom_err.o: $(LIBOBJS)
+#      $(LD) -r -s -o libcom_err.o $(LIBOBJS)
+#      chmod -x libcom_err.o
+
+TAGS:  $(SRCS)
+       $(TAGS) $(SRCS)
+
+installdirs::
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ulibdir) \
+               $(DESTDIR)$(includedir)/et
+
+install:: libcom_err.a $(HFILES) installdirs
+       $(INSTALL_DATA) libcom_err.a $(DESTDIR)$(ulibdir)/libcom_err.a
+       $(CHMOD) 644 $(DESTDIR)$(ulibdir)/libcom_err.a
+       -$(RANLIB) $(DESTDIR)$(ulibdir)/libcom_err.a
+       $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/libcom_err.a
+       for i in $(HFILES); do \
+               $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/et/$$i; \
+       done
+
+uninstall::
+       $(RM) -f $(ulibdir)/libcom_err.a
+       $(RM) -rf $(includedir)/et
+
+clean::
+       $(RM) -f compile_et libcom_err.a libcom_err_p.a
+       $(RM) -f $(OBJS) profiled/*
+       $(RM) -f *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.ps TAGS *.ln
+       $(RM) -f ../libcom_err.a ../libcom_err_p.a
+mostlyclean:: clean
+distclean:: clean
+       $(RM) -f .depend compile_et.sh Makefile
+
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+error_message.o : $(srcdir)/error_message.c \
+  $(srcdir)/com_err.h \
+  $(srcdir)/error_table.h $(srcdir)/mit-sipb-copyright.h $(srcdir)/internal.h 
+et_name.o : $(srcdir)/et_name.c $(srcdir)/error_table.h $(srcdir)/mit-sipb-copyright.h \
+  $(srcdir)/internal.h \
+  
+init_et.o : $(srcdir)/init_et.c \
+  $(srcdir)/com_err.h \
+  $(srcdir)/error_table.h \
+  $(srcdir)/mit-sipb-copyright.h 
+com_err.o : $(srcdir)/com_err.c \
+  $(srcdir)/com_err.h \
+  $(srcdir)/mit-sipb-copyright.h \
+  $(srcdir)/error_table.h $(srcdir)/internal.h \
+  
+
similarity index 93%
rename from lib/et/compile_et.sh
rename to lib/et/compile_et.sh.in
index fdd249e839bf049b72dc7330845c3360393eaa4b..0cae2971cbdefafa5d09c99049b6648b191d0462 100644 (file)
@@ -2,7 +2,7 @@
 #
 #
 AWK=@AWK@
-DIR=@DIR@
+DIR=@ET_DIR@
 
 ROOT=`echo $1 | sed -e s/.et$//`
 BASE=`basename $ROOT`
diff --git a/lib/et/config_script b/lib/et/config_script
deleted file mode 100644 (file)
index e3de35c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-#
-# This program takes a shell script and configures for the following
-# variables:   @DIR@
-#              @AWK@
-#              @SED@
-#
-# Usage: config_script <filename> [<awk>] [<sed>]
-#
-
-FILE=$1
-AWK=$2
-SED=$3
-
-# Grr.... not all Unix's have the dirname command
-TMP=`echo  $1 | sed -e 's;[^/]*$;;' -e 's/^$/./'`
-DIR=`cd ${TMP}; pwd`
-
-if test "${AWK}x" = "x" ; then
-       AWK=awk
-fi
-if test "${SED}x" = "x" ; then
-       SED=sed
-fi
-sed -e "s;@DIR@;${DIR};" -e "s;@AWK@;${AWK};" -e "s;@SED@;${SED};" $FILE
similarity index 100%
rename from lib/et/jump/jump.funcs
rename to lib/et/dll/jump.funcs
diff --git a/lib/et/dll/jump.undefs b/lib/et/dll/jump.undefs
new file mode 100644 (file)
index 0000000..de3f8d4
--- /dev/null
@@ -0,0 +1 @@
+66803000 D __NEEDS_SHRLIB_libc_4
similarity index 100%
rename from lib/et/jump/jump.vars
rename to lib/et/dll/jump.vars
index 8e5af84479745cdb8bd06421d6341a890f4763c5..969ef3626643d2da103bcdb1aeba7cd765221cae 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <stdio.h>
 #include <errno.h>
-#ifdef HAS_STDLIB_H
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
 #include "com_err.h"
diff --git a/lib/et/jump/jump.undefs b/lib/et/jump/jump.undefs
deleted file mode 100644 (file)
index c61658a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-66804000 D __NEEDS_SHRLIB_libc_4
index 94f0fb5824c13ba361228471dacae49fb563d8e7..a1dc1e8cf7f060e6bf166eb81d01cb2d8d766f8f 100644 (file)
@@ -19,6 +19,7 @@
 static char sccsid[] = "@(#)vfprintf.c 5.2 (Berkeley) 6/27/88";
 #endif /* LIBC_SCCS and not lint */
 
+#if !HAVE_VPRINTF && HAVE_DOPRNT
 #include <stdio.h>
 #include <varargs.h>
 
@@ -45,3 +46,4 @@ vfprintf(iop, fmt, ap)
 
        return (ferror(iop) ? EOF : len);
 }
+#endif /* !HAVE_VPRINTF */
index dd371f6592039b71b09ad8821a925b339df7ab06..192900962734faaf8e545e9eb8c4ba9f490e60d1 100644 (file)
-alloc.o : alloc.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+alloc.o : ./alloc.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/time.h /usr/include/sys/stat.h /usr/include/linux/stat.h \
-  /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/time.h \
+  /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-badblocks.o : badblocks.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+badblocks.o : ./badblocks.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-bb_inode.o : bb_inode.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+bb_inode.o : ./bb_inode.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-bitmaps.o : bitmaps.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+bitmaps.o : ./bitmaps.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-bitops.o : bitops.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+bitops.o : ./bitops.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
+  /usr/include/asm/types.h /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
   ../ext2fs/bitops.h 
-block.o : block.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+block.o : ./block.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
   ../ext2fs/bitops.h 
-check_desc.o : check_desc.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+check_desc.o : ./check_desc.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-closefs.o : closefs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+closefs.o : ./closefs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/time.h \
+  /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
+expanddir.o : ./expanddir.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
   /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
   /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/time.h /usr/include/linux/ext2_fs.h ext2fs.h \
-  ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h \
-  ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-expanddir.o : expanddir.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
+  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
   ../ext2fs/bitops.h 
-ext2_err.o : ext2_err.c 
-freefs.o : freefs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ext2_err.o : ./ext2_err.c 
+freefs.o : ./freefs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/unistd.h /usr/include/posix_opt.h \
   /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
-  ../ext2fs/bitops.h 
-get_pathname.o : get_pathname.c /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/linux/ext2_fs.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
+get_pathname.o : ./get_pathname.c /usr/include/stdio.h /usr/include/features.h \
   /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
   /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-initialize.o : initialize.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+initialize.o : ./initialize.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-inline.o : inline.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+inline.o : ./inline.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-inode.o : inode.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+inode.o : ./inode.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-link.o : link.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+link.o : ./link.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
   ../ext2fs/bitops.h 
-llseek.o : llseek.c /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+llseek.o : ./llseek.c /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
   /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/linux/errno.h \
   /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/linux/unistd.h /usr/include/asm/unistd.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ../ext2fs/io.h 
-mkdir.o : mkdir.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/confname.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ../ext2fs/io.h /usr/include/linux/unistd.h /usr/include/asm/unistd.h 
+mkdir.o : ./mkdir.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-namei.o : namei.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+namei.o : ./namei.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
   ../ext2fs/bitops.h 
-newdir.o : newdir.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+newdir.o : ./newdir.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/alloca.h /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../ext2fs/io.h ../ext2fs/ext2_err.h \
   ../ext2fs/bitops.h 
-openfs.o : openfs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+openfs.o : ./openfs.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-read_bb.o : read_bb.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+read_bb.o : ./read_bb.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-read_bb_file.o : read_bb_file.c /usr/include/stdio.h /usr/include/features.h \
+read_bb_file.o : ./read_bb_file.c /usr/include/stdio.h /usr/include/features.h \
   /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
-  /usr/include/gnu/types.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/gnu/types.h /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
   /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/fcntl.h \
   /usr/include/linux/fcntl.h /usr/include/time.h /usr/include/sys/stat.h /usr/include/linux/stat.h \
-  /usr/include/linux/ext2_fs.h ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  /usr/include/linux/ext2_fs.h ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-rw_bitmaps.o : rw_bitmaps.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+rw_bitmaps.o : ./rw_bitmaps.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
-  ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+  ./ext2fs.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
   ../ext2fs/io.h ../ext2fs/ext2_err.h ../ext2fs/bitops.h 
-unix_io.o : unix_io.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+unix_io.o : ./unix_io.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/sys/types.h \
-  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/stdlib.h /usr/include/errno.h \
-  /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+  /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/include/confname.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
   /usr/include/alloca.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/time.h \
   /usr/include/sys/stat.h /usr/include/linux/stat.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ext2_err.h io.h 
+  ./ext2_err.h ./io.h 
index 5fd3bfed249c6a47012273804c0fdd8391a6bcad..4dd44ed40ee4ec57a069b5e2a5a6d0c117cff4e8 100644 (file)
@@ -1,3 +1,234 @@
+Thu Oct 26 12:09:16 1995    <tytso@rsts-11.mit.edu>
+
+       * ext2_err.et: Updated message in EXT2_ET_BASE to say version 0.5c
+
+       * swapfs.c (ext2fs_swap_super): Put an #ifdef check around
+               s_def_resuid and s_def_resgid for backwards compatibility.
+
+Fri Oct 20 23:33:31 1995    <tytso@rsts-11.mit.edu>
+
+       * bitops.h: Added #ifdef's for Sparc.
+
+Wed Sep  6 22:14:46 1995    <tytso@rsts-11.mit.edu>
+
+       * getsize.c: #include <sys/ioctl.h> under Linux to pick up ioctl()
+               declaration
+
+       * closefs.c: #include <string.h> to pick up memset() declaration
+
+Mon Sep  4 21:45:29 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for BSD shared libraries.
+
+       * initialize.c (ext2fs_initialize): Correctly set the s_creator_os
+               flag.
+
+Mon Sep  4 09:55:30 1995    <tytso@rsts-11.mit.edu>
+
+       * unix_io.c (unix_open): Add a double check; if the passed in name
+               is NULL, return EXT2_ET_BAD_DEVICE_NAME.
+
+       * ext2_err.et (EXT2_ET_BAD_DEVICE_NAME): Added new error code
+
+Wed Aug 16 15:44:10 1995    <tytso@rsts-11.mit.edu>
+
+       * inode.c (ext2fs_check_directory): Use LINUX_S_ISDIR instead of
+               S_ISDIR.
+
+Tue Aug 15 13:08:36 1995    <tytso@rsts-11.mit.edu>
+
+       * getsize.c (ext2fs_get_device_size): Add support for reading the
+               partition size from a BSD disk label.
+
+Thu Aug 10 09:33:26 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * getsize.c (ext2fs_get_device_size): New function that determins
+               the size of a device.  Used by mke2fs and e2fsck.
+
+Sat Aug 12 03:09:54 1995  Remy Card  <card@bbj>
+
+       * Makefile.in (install): Install static libraries in $(ulibdir)
+               (/usr/lib on Linux) instead of $(libdir) (/lib on Linux).
+
+Wed Aug  9 17:04:23 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * bitmaps.c (ext2fs_free_inode_bitmap, ext2fs_free_block_bitmap):
+               Move these functions to freefs.c.
+
+       * closefs.c (ext2fs_flush): If swapping blocks, clear the group
+               descriptors shadow memory to keep purify quiet.  (This
+               also has the nice benefit that the unused portion of the
+               shadow descriptors are zeroed out.)
+
+       * dirblock.c (ext2fs_write_dir_block): We need to use
+               dirent->rec_len *before* it's byteswapped to find the
+               location of the next directory structure!
+
+       * alloc.c (ext2fs_new_inode): Fix bug which could potentially
+               cause ext2fs_new_inode to loop infinitely if we're trying
+               to allocate an inode in group #0 and there are no free
+               inodes at all in the system.
+
+       * closefs.c: #include <errno.h> if it exists.
+
+Sun Aug  6 13:27:50 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * ext2fs.h (BLOCK_FLAG_HOLE): Added new definition for
+               BLOCK_FLAG_APPEND.  Added documentation for the block
+               interator flags.
+
+Sat Aug  5 11:44:05 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * Makefile.in (DLL_INSTALL_DIR, ELF_INSTALL_DIR): Set the
+               installation directories correctly.
+
+Tue Jul 18 09:27:38 1995    <tytso@rsx-11.mit.edu>
+
+       * namei.c (process_dir_block): 
+       * mkdir.c (ext2fs_mkdir): 
+       * expanddir.c (expand_dir_proc): Use ext2fs_{read,write}_dir_block
+               to read/write the directory block.
+
+       * dirblock.c (ext2fs_read_dir_block), ext2fs_write_dir_block): New
+               file containing functions for reading and writing
+               directory blocks (byte swapping if necesssary)
+
+       * block.c (block_iterate_ind, block_iterate_dind, 
+               block_iterate_tind): Byte swap the block addresses if
+               EXT2_SWAP_BYTES is set (and swap them back before writing
+               them out.)
+
+       * inode.c (inocpy_with_swap): New function.
+       (ext2fs_get_next_inode, ext2fs_read_inode, ext2fs_write_inode):
+               Call inocpy_with_swap if EXT2_SWAP_BYTES if set.
+
+       * closefs.c (ext2fs_flush): If EXT2_SWAP_BYTES is set, then swap
+               the superblock and group descriptors before writing it out.
+
+       * openfs.c (ext2fs_open): If the magic number is byte-swapped,
+               then set the EXT2_SWAP_BYTES and byte-swap the superblock
+               and group descriptors.
+
+       * swapfs.c (ext2fs_swap_super, ext2fs_swap_group_desc): New functions
+               to desp ext2 filesystem structures.
+
+       * bitops.c (set_bit, clear_bit, test_bit): Use modifications
+               supplied by Pete A. Zaitcev so that the C language
+               versions of these functions are more portable.  They will
+               now work on both little and big endian systems, and the
+               assumption that 32-bit integers are used is gone.
+
+       * bitops.h (ext2_swab16, ext2_swab32): Added new functions for
+               doing byte swapping.
+
+       * ext2fs.h (EXT2_SWAP_BYTES): Add new flag which indicates that
+               byte swapping should take place.
+
+Sun Jul 16 06:21:43 1995    <tytso@rsx-11.mit.edu>
+
+       * Makefile.in, cmp_bitmaps.c (ext2fs_compare_block_bitmap_end,
+               ext2fs_compare_inode_bitmap_end): Added new file
+               containing routines to compare bitmaps.
+
+       * ext2_err.et (EXT2_ET_NEQ_BLOCK_BITMAP, EXT2_ET_NEQ_INODE_BITMAP): 
+               Added new error codes.
+
+Sat Jul 15 04:23:37 1995    <tytso@rsx-11.mit.edu>
+
+       * inode.c (ext2fs_get_next_inode): Don't check scan->inode_buffer;
+               if the magic number is correct, it will be allocated.
+
+Fri Jul 14 19:02:59 1995    <tytso@rsx-11.mit.edu>
+
+       * block.c (block_iterate_ind, block_iterate_dind, 
+               block_iterate_tind): Don't recompute block_nr each loop;
+               just increment it!  Factor check of BLOCK_FLAG_APPEND out
+               of the loop.  Factor mask of BLOCK_CHANGED into changed
+               variable out of the loop.  (block_iterate_ind, in
+               particular, gets called a lot, so every little
+               optimization helps.)
+
+Thu Jul 13 08:02:45 1995    <tytso@rsx-11.mit.edu>
+
+       * block.c (block_iterate_ind, block_iterate_dind, 
+               block_iterate_tind): Precompute limit of loop to speed up
+               block_iterate_ind and company.
+
+       * bitops.h (ext2fs_fast_mark_block_bitmap, 
+               ext2fs_fast_unmark_block_bitmap, ext2fs_fast_test_block_bitmap,
+               ext2fs_fast_mark_inode_bitmap, ext2fs_fast_unmark_inode_bitmap,
+               ext2fs_fast_test_inode_bitmap): Add fast version of these
+               functions, which don't do range checking.
+
+       * bitops.h (ext2fs_get_block_bitmap_start, 
+               ext2fs_get_inode_bitmap_start, ext2fs_get_block_bitmap_end,
+               ext2fs_get_inode_bitmap_end): Add new accessor functions
+               which return the start and end points of the bitmaps.
+
+Tue Jul 11 18:59:41 1995    <tytso@rsx-11.mit.edu>
+
+       * llseek.c (ext2_llseek): If the offset is small enough, use lseek
+               instead of llseek.  The errno if the offset is too large
+               and lseek is not supported should be EINVAL, not -EINVAL.
+
+Thu Jun 15 23:43:02 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for ELF shared libraries.
+               Fixed typos in the compilation rules.
+               (distclean): Added Makefile.
+
+       * llseek.c (llseek): New function, if llseek() does not exist in the
+       C library.
+       (ext2_llseek): Changed to call llseek().
+
+Mon Jun 12 08:29:07 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * ext2fs.h: Use __u32 to define blk_t, instead of unsigned long.
+
+Sun Jun 11 15:02:54 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * mkdir.c (ext2fs_mkdir): Use LINUX_S_IFDIR instead of S_IFDIR.
+
+       * ext2fs.h (LINUX_S_IFDIR): Define a linux specific versions of
+               the S_*, which are normally defined in <sys/stat.h>.  This
+               allows us to compile e2fsprogs on a non-Linux system,
+               which may have a different value for S_IFDIR.
+
+Sat Jun 10 23:47:05 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * bitops.c (clear_bit, set_bit): Remove calls to cli() and sti();
+               this is a user-mode application!
+
+Thu Jun  8 13:13:22 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * llseek.c: Put the include of <linux/unistd.h> inside the #ifdef
+       __linux__ so that non-linux systems won't see it.
+
+       * alloc.c: Include <errno.h> if possible.
+       * badblocks.c: Ditto.
+       * bb_inode.c: Ditto.
+       * bitmaps.c: Ditto.
+       * block.c: Ditto.
+       * expanddir.c: Ditto.
+       * get_pathname.c: Ditto.
+       * initialize.c: Ditto.
+       * inode.c: Ditto.
+       * llseek.c: Ditto.
+       * mkdir.c: Ditto.
+       * namei.c: Ditto.
+       * newdir.c: Ditto.
+       * openfs.c: Ditto.
+       * rw_bitmaps.c: Ditto.
+       * unix_io.c: Ditto.
+
+       * Makefile.in: Rewritten to conform to GNU coding standards and
+       support separate compilation directories.
+
+Thu May 11 04:13:12 1995    <tytso@rsx-11.mit.edu>
+
+       * initialize.c (ext2fs_initialize): Don't allow more than one
+               bitmaps's worth of inodes in a group.
+
 Sat Mar 11 14:07:11 1995  Theodore Y. Ts'o  <tytso@localhost>
 
        * llseek.c (ext2_llseek): Added error checking to the llseek()
diff --git a/lib/ext2fs/MAKELOG b/lib/ext2fs/MAKELOG
deleted file mode 100644 (file)
index bb85c24..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-gcc -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -I.. -c bitmaps.c
-In file included from ext2fs.h:22,
-                 from bitmaps.c:20:
-../ext2fs/io.h:12: warning: ANSI C does not support `long long'
-../ext2fs/bitops.h: In function `ext2fs_mark_block_bitmap':
-In file included from ext2fs.h:112,
-                 from bitmaps.c:20:
-../ext2fs/bitops.h:145: warning: passing arg 1 of `ext2fs_warn_bitmap' from incompatible pointer type
-../ext2fs/bitops.h: In function `ext2fs_unmark_block_bitmap':
-../ext2fs/bitops.h:154: warning: passing arg 1 of `ext2fs_warn_bitmap' from incompatible pointer type
-../ext2fs/bitops.h: At top level:
-../ext2fs/bitops.h:160: conflicting types for `ext2fs_test_block_bitmap'
-../ext2fs/bitops.h:31: previous declaration of `ext2fs_test_block_bitmap'
-../ext2fs/bitops.h: In function `ext2fs_test_block_bitmap':
-../ext2fs/bitops.h:163: warning: passing arg 1 of `ext2fs_warn_bitmap' from incompatible pointer type
-../ext2fs/bitops.h: In function `ext2fs_mark_inode_bitmap':
-../ext2fs/bitops.h:172: warning: passing arg 1 of `ext2fs_warn_bitmap' from incompatible pointer type
-../ext2fs/bitops.h: In function `ext2fs_unmark_inode_bitmap':
-../ext2fs/bitops.h:181: warning: passing arg 1 of `ext2fs_warn_bitmap' from incompatible pointer type
-../ext2fs/bitops.h: At top level:
-../ext2fs/bitops.h:187: conflicting types for `ext2fs_test_inode_bitmap'
-../ext2fs/bitops.h:36: previous declaration of `ext2fs_test_inode_bitmap'
-../ext2fs/bitops.h: In function `ext2fs_test_inode_bitmap':
-../ext2fs/bitops.h:190: warning: passing arg 1 of `ext2fs_warn_bitmap' from incompatible pointer type
-bitmaps.c: In function `ext2fs_read_inode_bitmap':
-bitmaps.c:108: warning: implicit declaration of function `ext2fs_free_inode_bitmap'
-bitmaps.c:109: structure has no member named `device'
-bitmaps.c:110: structure has no member named `device'
-bitmaps.c:110: warning: format argument is not a pointer (arg 3)
-bitmaps.c:103: warning: `nbytes' may be used uninitialized in this function
-bitmaps.c: In function `ext2fs_read_block_bitmap':
-bitmaps.c:154: warning: implicit declaration of function `ext2fs_free_block_bitmap'
-bitmaps.c:155: structure has no member named `device'
-bitmaps.c:156: structure has no member named `device'
-bitmaps.c:156: warning: format argument is not a pointer (arg 3)
-bitmaps.c:149: warning: `nbytes' may be used uninitialized in this function
-bitmaps.c: In function `ext2fs_allocate_inode_bitmap':
-bitmaps.c:194: warning: `map' may be used uninitialized in this function
-bitmaps.c: In function `ext2fs_allocate_block_bitmap':
-bitmaps.c:235: warning: `map' may be used uninitialized in this function
-bitmaps.c: At top level:
-bitmaps.c:272: warning: no previous prototype for `ext2fs_free_inode_bitmap'
-bitmaps.c:272: warning: type mismatch with previous external decl
-bitmaps.c:108: warning: previous external decl of `ext2fs_free_inode_bitmap'
-bitmaps.c:272: warning: type mismatch with previous implicit declaration
-bitmaps.c:108: warning: previous implicit declaration of `ext2fs_free_inode_bitmap'
-bitmaps.c:272: warning: `ext2fs_free_inode_bitmap' was previously implicitly declared to return `int'
-bitmaps.c:286: warning: no previous prototype for `ext2fs_free_block_bitmap'
-bitmaps.c:286: warning: type mismatch with previous external decl
-bitmaps.c:154: warning: previous external decl of `ext2fs_free_block_bitmap'
-bitmaps.c:286: warning: type mismatch with previous implicit declaration
-bitmaps.c:154: warning: previous implicit declaration of `ext2fs_free_block_bitmap'
-bitmaps.c:286: warning: `ext2fs_free_block_bitmap' was previously implicitly declared to return `int'
-make: *** [bitmaps.o] Error 1
diff --git a/lib/ext2fs/Makefile b/lib/ext2fs/Makefile
deleted file mode 100644 (file)
index 5f991cf..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-all:: libext2fs.a
-
-include ../../MCONFIG
-
-OBJS= ext2_err.o openfs.o freefs.o closefs.o bitmaps.o rw_bitmaps.o inode.o \
-       unix_io.o block.o namei.o newdir.o mkdir.o check_desc.o \
-       get_pathname.o bitops.o link.o alloc.o expanddir.o inline.o \
-       initialize.o badblocks.o read_bb.o bb_inode.o read_bb_file.o llseek.o
-
-HFILES= bitops.h ext2_err.h ext2fs.h io.h
-
-ifdef BUILD_PROFILE_LIBS
-all:: libext2fs_p.a
-endif
-
-ifdef BUILD_DLL_SHLIBS
-DLL_ADDRESS = 0x66900000
-DLL_JUMPSIZE = 0x1000
-DLL_GOTSIZE  = 0x1000
-DLL_VERSION = 1.0
-DLL_IMAGE = libe2fs
-DLL_STUB = libext2fs
-DLL_LIBS = -L../.. -lcom_err
-DLL_MYDIR = ext2fs
-DLL_INSTALL_DIR = $(SHLIBDIR)
-
-include ../Makefile.dll-lib
-endif
-
-COMPILE_ET=../et/compile_et
-
-CFLAGS_NO=     $(WFLAGS) -I..
-CFLAGS=                $(OPT) $(CFLAGS_NO)
-LDFLAGS=       $(OPT)
-
-RM=rm -f
-MV=mv
-LN=ln -s
-
-DISTFILES= Makefile *.c *.h image
-
-.c.o:
-       $(CC) $(CFLAGS) -c $*.c
-ifdef BUILD_PROFILE_LIBS
-       $(CC) $(CFLAGS_NO) -pg -o profiled/$*.o -c $*.c
-endif
-#      $(CC) $(CFLAGS_NO) -checker -g -o checker/$*.o -c $*.c
-ifdef BUILD_DLL_SHLIBS
-       (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
-               -o jump/$*.o -c $*.c)
-endif
-
-libext2fs.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       $(ARCHIVE) $@ $(OBJS)
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) ext2fs/$@ ../$@
-
-libext2fs_p.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       (cd profiled; $(ARCHIVE) ../$@ $(OBJS))
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) ext2fs/$@ ../$@
-
-libext2fs_chk.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       (cd checker; $(ARCHIVE) ../$@ $(OBJS))
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) ext2fs/$@ ../$@
-
-ext2_err.c ext2_err.h: ext2_err.et
-       $(COMPILE_ET) ext2_err.et
-
-install-libs:: all
-       $(INSTALLLIB) libext2fs.a $(LIBDIR)/libext2fs.a
-       $(CHMOD) 644 $(LIBDIR)/libext2fs.a
-       $(RANLIB) $(LIBDIR)/libext2fs.a
-       $(CHMOD) $(LIBMODE) $(LIBDIR)/libext2fs.a
-
-install-libs:: $(HFILES)
-       @rm -rf $(INCLDIR)/ext2fs
-       @mkdir $(INCLDIR)/ext2fs
-       for i in $(HFILES); do \
-               $(INSTALLINC) $$i $(INCLDIR)/ext2fs/$$i; \
-       done
-
-install-tree::
-
-install::
-
-clean::
-       rm -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/*
-       rm -f ../libext2fs.a ../libext2fs_p.a ../libext2fs_chk.a
-
-really-clean:: clean
-       rm -f .depend ext2_err.c ext2_err.h
-
-dep depend .depend: ext2_err.h
-       $(CC) -M $(CFLAGS) *.c >.depend
-
-include .depend
diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
new file mode 100644 (file)
index 0000000..879ea81
--- /dev/null
@@ -0,0 +1,289 @@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ../..
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+OBJS= ext2_err.o \
+       alloc.o \
+       badblocks.o \
+       bb_inode.o \
+       bitmaps.o \
+       bitops.o \
+       block.o \
+       check_desc.o \
+       closefs.o \
+       cmp_bitmaps.o \
+       dirblock.o \
+       expanddir.o \
+       freefs.o \
+       get_pathname.o \
+       getsize.o \
+       initialize.o \
+       inline.o \
+       inode.o \
+       ismounted.o \
+       link.o \
+       llseek.o \
+       mkdir.o \
+       namei.o \
+       newdir.o \
+       openfs.o \
+       read_bb.o \
+       read_bb_file.o \
+       rw_bitmaps.o \
+       swapfs.o \
+       unix_io.o 
+
+SRCS= ext2_err.c \
+       $(srcdir)/alloc.c \
+       $(srcdir)/badblocks.c \
+       $(srcdir)/bb_inode.c \
+       $(srcdir)/bitmaps.c \
+       $(srcdir)/bitops.c \
+       $(srcdir)/block.c \
+       $(srcdir)/check_desc.c \
+       $(srcdir)/closefs.c \
+       $(srcdir)/cmp_bitmaps.c \
+       $(srcdir)/dirblock.c \
+       $(srcdir)/expanddir.c \
+       $(srcdir)/freefs.c \
+       $(srcdir)/get_pathname.c \
+       $(srcdir)/getsize.c \
+       $(srcdir)/initialize.c \
+       $(srcdir)/inline.c \
+       $(srcdir)/inode.c \
+       $(srcdir)/ismounted.c \
+       $(srcdir)/link.c \
+       $(srcdir)/llseek.c \
+       $(srcdir)/mkdir.c \
+       $(srcdir)/namei.c \
+       $(srcdir)/newdir.c \
+       $(srcdir)/openfs.c \
+       $(srcdir)/read_bb.c \
+       $(srcdir)/read_bb_file.c \
+       $(srcdir)/rw_bitmaps.c \
+       $(srcdir)/swapfs.c \
+       $(srcdir)/unix_io.c 
+
+HFILES= bitops.h ext2fs.h io.h
+
+LIBRARY= libext2fs
+LIBDIR= ext2fs
+
+DLL_ADDRESS = 0x66900000
+DLL_JUMPSIZE = 0x1000
+DLL_GOTSIZE  = 0x1000
+DLL_VERSION = 1.1
+DLL_IMAGE = libe2fs
+DLL_STUB = libext2fs
+DLL_LIBS = -L../.. -lcom_err
+DLL_MYDIR = ext2fs
+DLL_INSTALL_DIR = $(libdir)
+
+ELF_VERSION = 2.0
+ELF_IMAGE = libext2fs
+ELF_MYDIR = ext2fs
+ELF_INSTALL_DIR = $(libdir)
+
+BSDLIB_VERSION = 2.0
+BSDLIB_IMAGE = libext2fs
+BSDLIB_MYDIR = ext2fs
+BSDLIB_INSTALL_DIR = $(libdir)
+
+@MAKEFILE_LIBRARY@
+@MAKEFILE_DLL@
+@MAKEFILE_ELF@
+@MAKEFILE_BSDLIB@
+@MAKEFILE_PROFILE@
+@MAKEFILE_CHECKER@
+
+.c.o:
+       $(CC) $(CFLAGS) -c $< -o $@
+@PROFILE_CMT@  $(CC) $(CFLAGS) -pg -o profiled/$*.o -c $<
+@CHECKER_CMT@  $(CC) $(CFLAGS) -checker -g -o checker/$*.o -c $<
+@DLL_CMT@      (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
+@DLL_CMT@              -o jump/$*.o -c $<)
+@ELF_CMT@      $(CC) $(CFLAGS) -fPIC -o elfshared/$*.o -c $<
+@BSDLIB_CMT@   $(CC) $(CFLAGS) -fpic -o pic/$*.o -c $<
+
+COMPILE_ET=../et/compile_et
+
+DISTFILES= Makefile *.c *.h image
+
+ext2_err.c ext2_err.h: $(srcdir)/ext2_err.et
+       $(COMPILE_ET) $(srcdir)/ext2_err.et
+
+installdirs::
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ulibdir) \
+               $(DESTDIR)$(includedir)/ext2fs
+
+install:: all $(HFILES) installdirs 
+       $(INSTALL_DATA) libext2fs.a $(DESTDIR)$(ulibdir)/libext2fs.a
+       $(CHMOD) 644 $(DESTDIR)$(ulibdir)/libext2fs.a
+       -$(RANLIB) $(DESTDIR)$(ulibdir)/libext2fs.a
+       $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/libext2fs.a
+       for i in $(HFILES); do \
+               $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/ext2fs/$$i; \
+       done
+       $(INSTALL_DATA) ext2_err.h  $(DESTDIR)$(includedir)/ext2fs/ext2_err.h
+
+uninstall::
+       $(RM) -f $(ulibdir)/libext2fs.a
+       $(RM) -rf $(includedir)/ext2fs
+
+clean::
+       $(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/* \
+               ext2_err.c ext2_err.h \
+               ../libext2fs.a ../libext2fs_p.a ../libext2fs_chk.a
+
+mostlyclean:: clean
+distclean:: clean
+       $(RM) -f .depend ext2_err.c ext2_err.h Makefile
+
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+ext2_err.o: ext2_err.c
+alloc.o: $(srcdir)/alloc.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+badblocks.o: $(srcdir)/badblocks.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+bb_inode.o: $(srcdir)/bb_inode.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+bitmaps.o: $(srcdir)/bitmaps.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+bitops.o: $(srcdir)/bitops.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+block.o: $(srcdir)/block.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+check_desc.o: $(srcdir)/check_desc.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+closefs.o: $(srcdir)/closefs.c \
+  $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+cmp_bitmaps.o: $(srcdir)/cmp_bitmaps.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+dirblock.o: $(srcdir)/dirblock.c \
+  $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+expanddir.o: $(srcdir)/expanddir.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+freefs.o: $(srcdir)/freefs.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+get_pathname.o: $(srcdir)/get_pathname.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+getsize.o: $(srcdir)/getsize.c \
+  $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+initialize.o: $(srcdir)/initialize.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+inline.o: $(srcdir)/inline.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+inode.o: $(srcdir)/inode.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+ismounted.o: $(srcdir)/ismounted.c \
+  $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+link.o: $(srcdir)/link.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+llseek.o: $(srcdir)/llseek.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h \
+  
+mkdir.o: $(srcdir)/mkdir.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+namei.o: $(srcdir)/namei.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+newdir.o: $(srcdir)/newdir.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+openfs.o: $(srcdir)/openfs.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+read_bb.o: $(srcdir)/read_bb.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+read_bb_file.o: $(srcdir)/read_bb_file.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+rw_bitmaps.o: $(srcdir)/rw_bitmaps.c \
+  $(srcdir)/ext2fs.h \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+swapfs.o: $(srcdir)/swapfs.c \
+  $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+  $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+  $(srcdir)/bitops.h
+unix_io.o: $(srcdir)/unix_io.c \
+  $(top_srcdir)/lib/et/com_err.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/io.h
+
index 26c01118819bafac43c7524581d4093855bfd3d0..5465e804b5d93d81a9bfce47038410dc4d5284df 100644 (file)
@@ -11,6 +11,9 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -40,9 +43,9 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode,
                dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super);
 
        start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1;
+       if (start_inode < EXT2_FIRST_INO)
+               start_inode = EXT2_FIRST_INO;
        i = start_inode;
-       if (i < EXT2_FIRST_INO)
-               i = EXT2_FIRST_INO;
 
        do {
                if (!ext2fs_test_inode_bitmap(map, i))
index 8a405012b67210c5b92d6da2115a6ddad7141be5..f286747bc08dbcad91f522dcd2453ddb5bd05bb1 100644 (file)
@@ -13,6 +13,9 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
index 2b0ea9f605b364b73c2d722761e9eeb8d16901f7..c8dfeba17c5000428e7d4d0f7d7ce95b6d224544 100644 (file)
@@ -17,6 +17,9 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
index 8712e2d580f5a752fd66ba34ba8b1d1783094408..d5ef0ec7e3aad04443bf374882ea7c954d4a350b 100644 (file)
@@ -14,6 +14,9 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -151,37 +154,3 @@ void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap)
               ((bitmap->real_end - bitmap->start) / 8) + 1);
 }
 
-void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap)
-{
-       if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP))
-               return;
-
-       bitmap->magic = 0;
-       if (bitmap->description) {
-               free(bitmap->description);
-               bitmap->description = 0;
-       }
-       if (bitmap->bitmap) {
-               free(bitmap->bitmap);
-               bitmap->bitmap = 0;
-       }
-       free(bitmap);
-}
-
-void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap)
-{
-       if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP))
-               return;
-
-       bitmap->magic = 0;
-       if (bitmap->description) {
-               free(bitmap->description);
-               bitmap->description = 0;
-       }
-       if (bitmap->bitmap) {
-               free(bitmap->bitmap);
-               bitmap->bitmap = 0;
-       }
-       free(bitmap);
-}
-
index c037199e7d662f5af337f1bab2ceb8694f1614dd..0dc89677a8c0804d34aa7230056387611deff003 100644 (file)
  * For the benefit of those who are trying to port Linux to another
  * architecture, here are some C-language equivalents.  You should
  * recode these in the native assmebly language, if at all possible.
- * To guarantee atomicity, these routines call cli() and sti() to
- * disable interrupts while they operate.  (You have to provide inline
- * routines to cli() and sti().)
  *
- * Also note, these routines assume that you have 32 bit integers.
- * You will have to change this if you are trying to port Linux to the
- * Alpha architecture or to a Cray.  :-)
- * 
- * C language equivalents written by Theodore Ts'o, 9/26/92
+ * C language equivalents written by Theodore Ts'o, 9/26/92.
+ * Modified by Pete A. Zaitcev 7/14/95 to be portable to big endian
+ * systems, as well as non-32 bit systems.
  */
 
 int set_bit(int nr,void * addr)
 {
-       int     mask, retval;
-       int     *ADDR = (int *) addr;
+       int             mask, retval;
+       unsigned char   *ADDR = (unsigned char *) addr;
 
-       ADDR += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       cli();
+       ADDR += nr >> 3;
+       mask = 1 << (nr & 0x07);
        retval = (mask & *ADDR) != 0;
        *ADDR |= mask;
-       sti();
        return retval;
 }
 
 int clear_bit(int nr, void * addr)
 {
-       int     mask, retval;
-       int     *ADDR = (int *) addr;
+       int             mask, retval;
+       unsigned char   *ADDR = (unsigned char *) addr;
 
-       ADDR += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       cli();
+       ADDR += nr >> 3;
+       mask = 1 << (nr & 0x07);
        retval = (mask & *ADDR) != 0;
        *ADDR &= ~mask;
-       sti();
        return retval;
 }
 
 int test_bit(int nr, const void * addr)
 {
-       int             mask;
-       const int       *ADDR = (const int *) addr;
+       int                     mask;
+       const unsigned char     *ADDR = (const unsigned char *) addr;
 
-       ADDR += nr >> 5;
-       mask = 1 << (nr & 0x1f);
+       ADDR += nr >> 3;
+       mask = 1 << (nr & 0x07);
        return ((mask & *ADDR) != 0);
 }
+
 #endif /* !_EXT2_HAVE_ASM_BITOPS_ */
 
 void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
index 87e7d79eb08f51ffab7b3c6f4dda2c40c019ec74..4b0fa39a030bc4b0c8f07a10a4a953a2c73fc69c 100644 (file)
@@ -1,7 +1,8 @@
 /*
- * bitops.h --- Bitmap frobbing code.
+ * bitops.h --- Bitmap frobbing code.  The byte swapping routines are
+ *     also included here.
  * 
- * Copyright (C) 1993, 1994 Theodore Ts'o.  This file may be
+ * Copyright (C) 1993, 1994, 1995 Theodore Ts'o.  This file may be
  * redistributed under the terms of the GNU Public License.
  * 
  * Taken from <asm/bitops.h>, Copyright 1992, Linus Torvalds.
@@ -11,6 +12,8 @@
 extern int set_bit(int nr,void * addr);
 extern int clear_bit(int nr, void * addr);
 extern int test_bit(int nr, const void * addr);
+extern __u16 ext2fs_swab16(__u16 val);
+extern __u32 ext2fs_swab32(__u32 val);
 
 /*
  * EXT2FS bitmap manipulation routines.
@@ -35,12 +38,40 @@ extern void ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
                                       ino_t inode);
 extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
 
+extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
+                                         blk_t block);
+extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
+                                           blk_t block);
+extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
+                                        blk_t block);
+
+extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+                                         ino_t inode);
+extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+                                           ino_t inode);
+extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
+                                        ino_t inode);
+extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
+extern blk_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
+extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
+extern blk_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
+
 /*
  * The inline routines themselves...
  * 
  * If NO_INLINE_FUNCS is defined, then we won't try to do inline
- * functions at all!
+ * functions at all; they will be included as normal functions in
+ * inline.c
  */
+#ifdef NO_INLINE_FUNCS
+#if (defined(__i386__) || defined(__i486__) || defined(__i586__) || \
+     defined(__mc68000__) || defined(__sparc__))
+       /* This prevents bitops.c from trying to include the C */
+       /* function version of these functions */
+#define _EXT2_HAVE_ASM_BITOPS_
+#endif
+#endif /* NO_INLINE_FUNCS */
+
 #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
 #ifdef INCLUDE_INLINE_FUNCS
 #define _INLINE_ extern
@@ -137,6 +168,61 @@ _INLINE_ int test_bit(int nr, const void * addr)
 
 #endif /* __mc68000__ */
 
+#ifdef __sparc__
+
+#define _EXT2_HAVE_ASM_BITOPS_
+
+_INLINE_ int set_bit(int nr, void *addr)
+{
+       int             mask, retval;
+       unsigned long   *ADDR = (unsigned long *) addr;
+
+       ADDR += nr >> 5;
+       mask = 1 << (nr & 31);
+       retval = ((mask & *ADDR) != 0);
+       *ADDR |= mask;
+       return retval;
+}
+
+_INLINE_ int clear_bit(int nr, void *addr)
+{
+       int             mask, retval;
+       unsigned long   *ADDR = (unsigned long *) addr;
+
+       ADDR += nr >> 5;
+       mask = 1 << (nr & 31);
+       retval = ((mask & *ADDR) != 0);
+       *ADDR &= ~mask;
+       return retval;
+}
+
+_INLINE_ int test_bit(int nr, const void *addr)
+{
+       int                     mask;
+       const unsigned long     *ADDR = (const unsigned long *) addr;
+
+       ADDR += nr >> 5;
+       mask = 1 << (nr & 31);
+       return ((mask & *ADDR) != 0);
+}
+
+#endif /* __sparc__ */
+
+#ifndef _EXT2_HAVE_ASM_SWAB
+
+_INLINE_ __u16 ext2fs_swab16(__u16 val)
+{
+       return (val >> 8) | (val << 8);
+}
+
+_INLINE_ __u32 ext2fs_swab32(__u32 val)
+{
+       return ((val>>24) | ((val>>8)&0xFF00) |
+               ((val<<8)&0xFF0000) | (val<<24));
+}
+
+#endif /* !_EXT2_HAVE_ASM_SWAB */
+
 _INLINE_ void ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
                                       blk_t block)
 {
@@ -203,5 +289,104 @@ _INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
        return test_bit(inode - bitmap->start, bitmap->bitmap);
 }
 
+_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
+                                           blk_t block)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+       if ((block < bitmap->start) || (block > bitmap->end)) {
+               ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
+                                  bitmap->description);
+               return;
+       }
+#endif 
+       set_bit(block - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
+                                             blk_t block)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+       if ((block < bitmap->start) || (block > bitmap->end)) {
+               ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK,
+                                  block, bitmap->description);
+               return;
+       }
+#endif
+       clear_bit(block - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
+                                           blk_t block)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+       if ((block < bitmap->start) || (block > bitmap->end)) {
+               ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
+                                  block, bitmap->description);
+               return 0;
+       }
+#endif
+       return test_bit(block - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+                                           ino_t inode)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+       if ((inode < bitmap->start) || (inode > bitmap->end)) {
+               ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_MARK,
+                                  inode, bitmap->description);
+               return;
+       }
+#endif
+       set_bit(inode - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
+                                             ino_t inode)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+       if ((inode < bitmap->start) || (inode > bitmap->end)) {
+               ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_UNMARK,
+                                  inode, bitmap->description);
+               return;
+       }
+#endif
+       clear_bit(inode - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
+                                          ino_t inode)
+{
+#ifdef EXT2FS_DEBUG_FAST_OPS
+       if ((inode < bitmap->start) || (inode > bitmap->end)) {
+               ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_TEST,
+                                  inode, bitmap->description);
+               return 0;
+       }
+#endif
+       return test_bit(inode - bitmap->start, bitmap->bitmap);
+}
+
+_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
+{
+       return bitmap->start;
+}
+
+_INLINE_ blk_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
+{
+       return bitmap->start;
+}
+
+_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
+{
+       return bitmap->end;
+}
+
+_INLINE_ blk_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
+{
+       return bitmap->end;
+}
+
 #undef _INLINE_
 #endif
+
index 53c193c2a28bb83aac884139f44bda1ef0f541d5..fe112b31f81509562fe9649555d9d10a1d563c38 100644 (file)
@@ -9,6 +9,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -33,7 +36,7 @@ struct block_context {
 static int block_iterate_ind(blk_t *ind_block, struct block_context *ctx)
 {
        int     ret = 0, changed = 0;
-       int     i, flags;
+       int     i, flags, limit;
        blk_t   *block_nr;
 
        if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE))
@@ -52,19 +55,42 @@ static int block_iterate_ind(blk_t *ind_block, struct block_context *ctx)
                ret |= BLOCK_ERROR;
                return ret;
        }
-       for (i = 0; i < (ctx->fs->blocksize >> 2); i++, ctx->bcount++) {
-               block_nr = (blk_t *) ctx->ind_buf + i;
-               if (*block_nr || (ctx->flags & BLOCK_FLAG_APPEND)) {
+       limit = ctx->fs->blocksize >> 2;
+       if (ctx->fs->flags & EXT2_SWAP_BYTES) {
+               block_nr = (blk_t *) ctx->ind_buf;
+               for (i = 0; i < limit; i++, block_nr++)
+                       *block_nr = ext2fs_swab32(*block_nr);
+       }
+       block_nr = (blk_t *) ctx->ind_buf;
+       if (ctx->flags & BLOCK_FLAG_APPEND) {
+               for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
+                       flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
+                                            ctx->private);
+                       changed |= flags;
+                       if (flags & BLOCK_ABORT) {
+                               ret |= BLOCK_ABORT;
+                               break;
+                       }
+               }
+       } else {
+               for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
+                       if (*block_nr == 0)
+                               continue;
                        flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
                                             ctx->private);
-                       changed |= flags & BLOCK_CHANGED;
+                       changed |= flags;
                        if (flags & BLOCK_ABORT) {
                                ret |= BLOCK_ABORT;
                                break;
                        }
                }
        }
-       if (changed) {
+       if (changed & BLOCK_CHANGED) {
+               if (ctx->fs->flags & EXT2_SWAP_BYTES) {
+                       block_nr = (blk_t *) ctx->ind_buf;
+                       for (i = 0; i < limit; i++, block_nr++)
+                               *block_nr = ext2fs_swab32(*block_nr);
+               }
                ctx->errcode = io_channel_write_blk(ctx->fs->io, *ind_block,
                                                    1, ctx->ind_buf);
                if (ctx->errcode)
@@ -79,7 +105,7 @@ static int block_iterate_ind(blk_t *ind_block, struct block_context *ctx)
 static int block_iterate_dind(blk_t *dind_block, struct block_context *ctx)
 {
        int     ret = 0, changed = 0;
-       int     i, flags;
+       int     i, flags, limit;
        blk_t   *block_nr;
 
        if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE))
@@ -98,18 +124,40 @@ static int block_iterate_dind(blk_t *dind_block, struct block_context *ctx)
                ret |= BLOCK_ERROR;
                return ret;
        }
-       for (i = 0; i < (ctx->fs->blocksize >> 2); i++) {
-               block_nr = (blk_t *) ctx->dind_buf + i;
-               if (*block_nr || (ctx->flags & BLOCK_FLAG_APPEND)) {
+       limit = ctx->fs->blocksize >> 2;
+       if (ctx->fs->flags & EXT2_SWAP_BYTES) {
+               block_nr = (blk_t *) ctx->dind_buf;
+               for (i = 0; i < limit; i++, block_nr++)
+                       *block_nr = ext2fs_swab32(*block_nr);
+       }
+       block_nr = (blk_t *) ctx->dind_buf;
+       if (ctx->flags & BLOCK_FLAG_APPEND) {
+               for (i = 0; i < limit; i++, block_nr++) {
+                       flags = block_iterate_ind(block_nr, ctx);
+                       changed |= flags;
+                       if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
+                               ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
+                               break;
+                       }
+               }
+       } else {
+               for (i = 0; i < limit; i++, block_nr++) {
+                       if (*block_nr == 0)
+                               continue;
                        flags = block_iterate_ind(block_nr, ctx);
-                       changed |= flags & BLOCK_CHANGED;
+                       changed |= flags;
                        if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
                                ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
                                break;
                        }
                }
        }
-       if (changed) {
+       if (changed & BLOCK_CHANGED) {
+               if (ctx->fs->flags & EXT2_SWAP_BYTES) {
+                       block_nr = (blk_t *) ctx->dind_buf;
+                       for (i = 0; i < limit; i++, block_nr++)
+                               *block_nr = ext2fs_swab32(*block_nr);
+               }
                ctx->errcode = io_channel_write_blk(ctx->fs->io, *dind_block,
                                                    1, ctx->dind_buf);
                if (ctx->errcode)
@@ -124,7 +172,7 @@ static int block_iterate_dind(blk_t *dind_block, struct block_context *ctx)
 static int block_iterate_tind(blk_t *tind_block, struct block_context *ctx)
 {
        int     ret = 0, changed = 0;
-       int     i, flags;
+       int     i, flags, limit;
        blk_t   *block_nr;
 
        if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE))
@@ -143,17 +191,40 @@ static int block_iterate_tind(blk_t *tind_block, struct block_context *ctx)
                ret |= BLOCK_ERROR;
                return ret;
        }
-       for (i = 0; i < (ctx->fs->blocksize >> 2); i++) {
-               block_nr = (blk_t *) ctx->tind_buf + i;
-               if (*block_nr || (ctx->flags & BLOCK_FLAG_APPEND)) {
+       limit = ctx->fs->blocksize >> 2;
+       if (ctx->fs->flags & EXT2_SWAP_BYTES) {
+               block_nr = (blk_t *) ctx->tind_buf;
+               for (i = 0; i < limit; i++, block_nr++)
+                       *block_nr = ext2fs_swab32(*block_nr);
+       }
+       block_nr = (blk_t *) ctx->tind_buf;
+       if (ctx->flags & BLOCK_FLAG_APPEND) {
+               for (i = 0; i < limit; i++, block_nr++) {
+                       flags = block_iterate_dind(block_nr, ctx);
+                       changed |= flags;
+                       if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
+                               ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
+                               break;
+                       }
+               }
+       } else {
+               for (i = 0; i < limit; i++, block_nr++) {
+                       if (*block_nr == 0)
+                               continue;
                        flags = block_iterate_dind(block_nr, ctx);
+                       changed |= flags;
                        if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
                                ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
                                break;
                        }
                }
        }
-       if (changed) {
+       if (changed & BLOCK_CHANGED) {
+               if (ctx->fs->flags & EXT2_SWAP_BYTES) {
+                       block_nr = (blk_t *) ctx->tind_buf;
+                       for (i = 0; i < limit; i++, block_nr++)
+                               *block_nr = ext2fs_swab32(*block_nr);
+               }
                ctx->errcode = io_channel_write_blk(ctx->fs->io, *tind_block,
                                                    1, ctx->tind_buf);
                if (ctx->errcode)
index 41a5052c48d139d68c343c9b70e41b75b08e3159..d8b796e369916ec0839203035dddeb4d8a0e86b6 100644 (file)
@@ -9,6 +9,10 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <time.h>
+#include <string.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -21,27 +25,60 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        errcode_t       retval;
        char            *group_ptr;
        unsigned long   fs_state;
+       struct ext2_super_block *super_shadow = 0;
+       struct ext2_group_desc *group_shadow = 0;
+       struct ext2_group_desc *s, *t;
        
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
+       fs_state = fs->super->s_state;
+
+       fs->super->s_wtime = time(NULL);
+       if (fs->flags & EXT2_SWAP_BYTES) {
+               retval = ENOMEM;
+               if (!(super_shadow = malloc(SUPERBLOCK_SIZE)))
+                       goto errout;
+               if (!(group_shadow = malloc(fs->blocksize*fs->desc_blocks)))
+                       goto errout;
+               memset(group_shadow, 0, fs->blocksize*fs->desc_blocks);
+
+               /* swap the superblock */
+               *super_shadow = *fs->super;
+               ext2fs_swap_super(super_shadow);
+
+               /* swap the group descriptors */
+               for (j=0, s=fs->group_desc, t=group_shadow;
+                    j < fs->group_desc_count; j++, t++, s++) {
+                       *t = *s;
+                       ext2fs_swap_group_desc(t);
+               }
+       } else {
+               super_shadow = fs->super;
+               group_shadow = fs->group_desc;
+       }
+       
        /*
         * Write out master superblock.  This has to be done
         * separately, since it is located at a fixed location
         * (SUPERBLOCK_OFFSET).
         */
-       fs->super->s_wtime = time(NULL);
        io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
-       retval = io_channel_write_blk(fs->io, 1, -SUPERBLOCK_SIZE, fs->super);
+       retval = io_channel_write_blk(fs->io, 1, -SUPERBLOCK_SIZE,
+                                     super_shadow);
        if (retval)
-               return retval;
+               goto errout;
        io_channel_set_blksize(fs->io, fs->blocksize);
 
        /*
-        * Save the state of the FS and set it to non valid for the
-        * backup superblocks
+        * Set the state of the FS to be non-valid.  (The state has
+        * already been backed up earlier, and will be restored when
+        * we exit.)
         */
-       fs_state = fs->super->s_state;
        fs->super->s_state &= ~EXT2_VALID_FS;
+       if (fs->flags & EXT2_SWAP_BYTES) {
+               *super_shadow = *fs->super;
+               ext2fs_swap_super(super_shadow);
+       }
 
        /*
         * Write out the master group descriptors, and the backup
@@ -52,28 +89,22 @@ errcode_t ext2fs_flush(ext2_filsys fs)
                if (i !=0 ) {
                        retval = io_channel_write_blk(fs->io, group_block,
                                                      -SUPERBLOCK_SIZE,
-                                                     fs->super);
-                       if (retval) {
-                               fs->super->s_state = fs_state;
-                               return retval;
-                       }
+                                                     super_shadow);
+                       if (retval)
+                               goto errout;
                }
-               group_ptr = (char *) fs->group_desc;
+               group_ptr = (char *) group_shadow;
                for (j=0; j < fs->desc_blocks; j++) {
                        retval = io_channel_write_blk(fs->io,
                                                      group_block+1+j, 1,
                                                      group_ptr);
-                       if (retval) {
-                               fs->super->s_state = fs_state;
-                               return retval;
-                       }
+                       if (retval)
+                               goto errout;
                        group_ptr += fs->blocksize;
                }
                group_block += EXT2_BLOCKS_PER_GROUP(fs->super);
        }
 
-       fs->super->s_state = fs_state;
-
        /*
         * If the write_bitmaps() function is present, call it to
         * flush the bitmaps.  This is done this way so that a simple
@@ -83,10 +114,19 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        if (fs->write_bitmaps) {
                retval = fs->write_bitmaps(fs);
                if (retval)
-                       return retval;
+                       goto errout;
        }
-               
-       return 0;
+
+       retval = 0;
+errout:
+       fs->super->s_state = fs_state;
+       if (fs->flags & EXT2_SWAP_BYTES) {
+               if (super_shadow)
+                       free(super_shadow);
+               if (group_shadow)
+                       free(group_shadow);
+       }
+       return retval;
 }
 
 errcode_t ext2fs_close(ext2_filsys fs)
diff --git a/lib/ext2fs/cmp_bitmaps.c b/lib/ext2fs/cmp_bitmaps.c
new file mode 100644 (file)
index 0000000..cc9eb6d
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * cmp_bitmaps.c --- routines to compare inode and block bitmaps.
+ *
+ * Copyright (C) 1995 Theodore Ts'o.  This file may be redistributed
+ * under the terms of the GNU Public License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include <linux/ext2_fs.h>
+
+#include "ext2fs.h"
+
+errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
+                                     ext2fs_block_bitmap bm2)
+{
+       int     i;
+       
+       EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP);
+       EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP);
+
+       if ((bm1->start != bm2->start) ||
+           (bm1->end != bm2->end) ||
+           (memcmp(bm1->bitmap, bm2->bitmap, (bm1->end - bm1->start)/8)))
+               return EXT2_ET_NEQ_BLOCK_BITMAP;
+
+       for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
+               if (ext2fs_fast_test_block_bitmap(bm1, i) !=
+                   ext2fs_fast_test_block_bitmap(bm2, i))
+                       return EXT2_ET_NEQ_BLOCK_BITMAP;
+
+       return 0;
+}
+
+errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
+                                     ext2fs_inode_bitmap bm2)
+{
+       int     i;
+       
+       EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP);
+       EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP);
+
+       if ((bm1->start != bm2->start) ||
+           (bm1->end != bm2->end) ||
+           (memcmp(bm1->bitmap, bm2->bitmap, (bm1->end - bm1->start)/8)))
+               return EXT2_ET_NEQ_INODE_BITMAP;
+
+       for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
+               if (ext2fs_fast_test_inode_bitmap(bm1, i) !=
+                   ext2fs_fast_test_inode_bitmap(bm2, i))
+                       return EXT2_ET_NEQ_INODE_BITMAP;
+
+       return 0;
+}
+
diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c
new file mode 100644 (file)
index 0000000..bb2f717
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * dirblock.c --- directory block routines.
+ * 
+ * Copyright (C) 1995 Theodore Ts'o.  This file may be redistributed
+ * under the terms of the GNU Public License.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <time.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include <linux/ext2_fs.h>
+
+#include "ext2fs.h"
+
+errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
+                               void *buf)
+{
+       errcode_t       retval;
+       char            *p, *end;
+       struct ext2_dir_entry *dirent;
+
+       retval = io_channel_read_blk(fs->io, block, 1, buf);
+       if (retval)
+               return retval;
+       if ((fs->flags & EXT2_SWAP_BYTES) == 0)
+               return 0;
+       p = buf;
+       end = (char *) buf + fs->blocksize;
+       while (p < end) {
+               dirent = (struct ext2_dir_entry *) p;
+               dirent->inode = ext2fs_swab32(dirent->inode);
+               dirent->rec_len = ext2fs_swab16(dirent->rec_len);
+               dirent->name_len = ext2fs_swab16(dirent->name_len);
+               p += (dirent->rec_len < 8) ? 8 : dirent->rec_len;
+       }
+       return 0;
+}
+
+errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
+                                void *inbuf)
+{
+       errcode_t       retval;
+       char            *p, *end, *write_buf;
+       char            *buf = 0;
+       struct ext2_dir_entry *dirent;
+
+       if (fs->flags & EXT2_SWAP_BYTES) {
+               write_buf = buf = malloc(fs->blocksize);
+               if (!buf)
+                       return ENOMEM;
+               memcpy(buf, inbuf, fs->blocksize);
+               p = buf;
+               end = buf + fs->blocksize;
+               while (p < end) {
+                       dirent = (struct ext2_dir_entry *) p;
+                       p += (dirent->rec_len < 8) ? 8 : dirent->rec_len;
+                       dirent->inode = ext2fs_swab32(dirent->inode);
+                       dirent->rec_len = ext2fs_swab16(dirent->rec_len);
+                       dirent->name_len = ext2fs_swab16(dirent->name_len);
+               }
+       } else
+               write_buf = inbuf;
+       retval = io_channel_write_blk(fs->io, block, 1, write_buf);
+       if (buf)
+               free(buf);
+       return retval;
+}
+
+
similarity index 77%
rename from lib/ext2fs/jump/jump.funcs
rename to lib/ext2fs/dll/jump.funcs
index a8f5674b136b565136aab67448269c1036da8872..730ee31574bf1ea47018f9074f98925c1b56bd5e 100644 (file)
 00000000 T _initialize_ext2_error_table        libext2fs       ext2_err
 00000000 T _ext2_llseek                        libext2fs       llseek
 00000000 T _ext2fs_set_inode_callback          libext2fs       inode
+00000000 T _ext2fs_compare_block_bitmap                libext2fs       cmp_bitmaps
+00000000 T _ext2fs_compare_inode_bitmap                libext2fs       cmp_bitmaps
+00000000 T _ext2fs_read_dir_block              libext2fs       dirblock
+00000000 T _ext2fs_write_dir_block             libext2fs       dirblock
+00000000 T _ext2fs_swab16                      libext2fs       inline
+00000000 T _ext2fs_swab32                      libext2fs       inline
+00000000 T _ext2fs_fast_mark_block_bitmap      libext2fs       inline
+00000000 T _ext2fs_fast_unmark_block_bitmap    libext2fs       inline
+00000000 T _ext2fs_fast_test_block_bitmap      libext2fs       inline
+00000000 T _ext2fs_fast_mark_inode_bitmap      libext2fs       inline
+00000000 T _ext2fs_fast_unmark_inode_bitmap    libext2fs       inline
+00000000 T _ext2fs_fast_test_inode_bitmap      libext2fs       inline
+00000000 T _ext2fs_get_block_bitmap_start      libext2fs       inline
+00000000 T _ext2fs_get_inode_bitmap_start      libext2fs       inline
+00000000 T _ext2fs_get_block_bitmap_end        libext2fs       inline
+00000000 T _ext2fs_get_inode_bitmap_end        libext2fs       inline
+00000000 T _ext2fs_swap_super                  libext2fs       swapfs
+00000000 T _ext2fs_swap_group_desc             libext2fs       swapfs
+00000000 T _ext2fs_get_device_size             libext2fs       getsize
+00000000 T _ext2fs_check_if_mounted            libext2fs       ismounted
diff --git a/lib/ext2fs/dll/jump.ignore b/lib/ext2fs/dll/jump.ignore
new file mode 100644 (file)
index 0000000..e69de29
similarity index 84%
rename from lib/ext2fs/jump/jump.params
rename to lib/ext2fs/dll/jump.params
index ea74d6300beaf8704e62ae1d0ba1542da00fb81e..cc96847c3f25875e75d4b910287251ee66ff63bc 100644 (file)
@@ -3,4 +3,4 @@ Text=0x66900000
 Data=0x00000000
 Jump=0x00001000
 GOT=0x00001000
-Version=1.0.0
+Version=1.1.0
diff --git a/lib/ext2fs/dll/jump.undefs b/lib/ext2fs/dll/jump.undefs
new file mode 100644 (file)
index 0000000..294a0b7
--- /dev/null
@@ -0,0 +1,2 @@
+6690b080 D __NEEDS_SHRLIB_libc_4
+6690b098 D __NEEDS_SHRLIB_libet_1
index 5af9853de80e96ac0a19d77ea5e65422d150cc32..b2597c9fe2c9f2c67649629cac7874002b285fdf 100644 (file)
@@ -9,6 +9,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -55,7 +58,7 @@ static int expand_dir_proc(ext2_filsys fs,
                }
                memset(block, 0, fs->blocksize);
        }       
-       retval = io_channel_write_blk(fs->io, new_blk, 1, block);
+       retval = ext2fs_write_dir_block(fs, new_blk, block);
        if (retval) {
                es->err = retval;
                return BLOCK_ABORT;
diff --git a/lib/ext2fs/ext2_err.c b/lib/ext2fs/ext2_err.c
deleted file mode 100644 (file)
index f975949..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * ext2_err.c:
- * This file is automatically generated; please do not edit it.
- */
-#ifdef __STDC__
-#define NOARGS void
-#else
-#define NOARGS
-#define const
-#endif
-
-static const char * const text[] = {
-               "EXT2FS Library version 0.5b",
-               "Wrong magic number for ext2_filsys structure",
-               "Wrong magic number for badblocks_list structure",
-               "Wrong magic number for badblocks_iterate structure",
-               "Wrong magic number for inode_scan structure",
-               "Wrong magic number for io_channel structure",
-               "Wrong magic number for unix io_channel structure",
-               "Wrong magic number for io_manager structure",
-               "Wrong magic number for block_bitmap structure",
-               "Wrong magic number for inode_bitmap structure",
-               "Wrong magic number --- RESERVED_1",
-               "Wrong magic number --- RESERVED_2",
-               "Wrong magic number --- RESERVED_3",
-               "Wrong magic number --- RESERVED_4",
-               "Wrong magic number --- RESERVED_5",
-               "Wrong magic number --- RESERVED_6",
-               "Wrong magic number --- RESERVED_7",
-               "Wrong magic number --- RESERVED_8",
-               "Wrong magic number --- RESERVED_9",
-               "Bad magic number in super-block",
-               "Filesystem revision too high",
-               "Can't seek to superblock",
-               "Can't read superblock",
-               "Can't write superblock",
-               "Attempt to write to filesystem opened read-only",
-               "Can't read group descriptors",
-               "Can't write group descriptors",
-               "Corrupt group descriptor: bad block for block bitmap",
-               "Corrupt group descriptor: bad block for inode bitmap",
-               "Corrupt group descriptor: bad block for inode table",
-               "Can't write an inode bitmap",
-               "Can't read an inode bitmap",
-               "Can't write an block bitmap",
-               "Can't read an block bitmap",
-               "Can't write an inode table",
-               "Can't read an inode table",
-               "Can't read next inode",
-               "Filesystem has unexpected block size",
-               "EXT2 directory corrupted",
-               "Attempt to read block from filesystem resulted in short read",
-               "Attempt to write block from filesystem resulted in short write",
-               "No free space in the directory",
-               "Inode bitmap not loaded",
-               "BLOCK bitmap not loaded",
-               "Illegal inode number",
-               "Illegal block number",
-               "Internal error in ext2fs_expand_dir",
-               "Not enough space to build proposed filesystem",
-               "Illegal block number passed to ext2fs_mark_block_bitmap",
-               "Illegal block number passed to ext2fs_unmark_block_bitmap",
-               "Illegal block number passed to ext2fs_test_block_bitmap",
-               "Illegal inode number passed to ext2fs_mark_inode_bitmap",
-               "Illegal inode number passed to ext2fs_unmark_inode_bitmap",
-               "Illegal inode number passed to ext2fs_test_inode_bitmap",
-               "Attempt to fudge end of block bitmap past the real end",
-               "Attempt to fudge end of inode bitmap past the real end",
-               "Illegal indirect block found" ,
-               "Illegal doubly indirect block found" ,
-               "Illegal triply indirect block found" ,
-    0
-};
-
-struct error_table {
-    char const * const * msgs;
-    long base;
-    int n_msgs;
-};
-struct et_list {
-    struct et_list *next;
-    const struct error_table * table;
-};
-extern struct et_list *_et_list;
-
-static const struct error_table et = { text, 2133571328L, 59 };
-
-static struct et_list link = { 0, 0 };
-
-void initialize_ext2_error_table (NOARGS);
-
-void initialize_ext2_error_table (NOARGS) {
-    if (!link.table) {
-        link.next = _et_list;
-        link.table = &et;
-        _et_list = &link;
-    }
-}
index f439f5a2be179bb6dceb4af254a7a8810d957e91..71298b81e4921138e200a37cfe0b1ea7335561e5 100644 (file)
@@ -5,7 +5,7 @@
        error_table ext2
 
 ec     EXT2_ET_BASE,
-       "EXT2FS Library version 0.5b"
+       "EXT2FS Library version 0.5c"
 
 ec     EXT2_ET_MAGIC_EXT2FS_FILSYS,
        "Wrong magic number for ext2_filsys structure"
@@ -181,5 +181,14 @@ ec EXT2_ET_BAD_DIND_BLOCK,
 ec     EXT2_ET_BAD_TIND_BLOCK,
        "Illegal triply indirect block found" 
 
+ec     EXT2_ET_NEQ_BLOCK_BITMAP,
+       "Block bitmaps are not the same"
+
+ec     EXT2_ET_NEQ_INODE_BITMAP,
+       "Inode bitmaps are not the same"
+
+ec     EXT2_ET_BAD_DEVICE_NAME,
+       "Illegal or malformed device name"
+
        end
 
diff --git a/lib/ext2fs/ext2_err.h b/lib/ext2fs/ext2_err.h
deleted file mode 100644 (file)
index 0a93b1a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * ext2_err.h:
- * This file is automatically generated; please do not edit it.
- */
-#ifdef __STDC__
-#define NOARGS void
-#else
-#define NOARGS
-#define const
-#endif
-
-#define EXT2_ET_BASE                             (2133571328L)
-#define EXT2_ET_MAGIC_EXT2FS_FILSYS              (2133571329L)
-#define EXT2_ET_MAGIC_BADBLOCKS_LIST             (2133571330L)
-#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE          (2133571331L)
-#define EXT2_ET_MAGIC_INODE_SCAN                 (2133571332L)
-#define EXT2_ET_MAGIC_IO_CHANNEL                 (2133571333L)
-#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL            (2133571334L)
-#define EXT2_ET_MAGIC_IO_MANAGER                 (2133571335L)
-#define EXT2_ET_MAGIC_BLOCK_BITMAP               (2133571336L)
-#define EXT2_ET_MAGIC_INODE_BITMAP               (2133571337L)
-#define EXT2_ET_MAGIC_RESERVED_1                 (2133571338L)
-#define EXT2_ET_MAGIC_RESERVED_2                 (2133571339L)
-#define EXT2_ET_MAGIC_RESERVED_3                 (2133571340L)
-#define EXT2_ET_MAGIC_RESERVED_4                 (2133571341L)
-#define EXT2_ET_MAGIC_RESERVED_5                 (2133571342L)
-#define EXT2_ET_MAGIC_RESERVED_6                 (2133571343L)
-#define EXT2_ET_MAGIC_RESERVED_7                 (2133571344L)
-#define EXT2_ET_MAGIC_RESERVED_8                 (2133571345L)
-#define EXT2_ET_MAGIC_RESERVED_9                 (2133571346L)
-#define EXT2_ET_BAD_MAGIC                        (2133571347L)
-#define EXT2_ET_REV_TOO_HIGH                     (2133571348L)
-#define EXT2_ET_SB_LSEEK                         (2133571349L)
-#define EXT2_ET_SB_READ                          (2133571350L)
-#define EXT2_ET_SB_WRITE                         (2133571351L)
-#define EXT2_ET_RO_FILSYS                        (2133571352L)
-#define EXT2_ET_GDESC_READ                       (2133571353L)
-#define EXT2_ET_GDESC_WRITE                      (2133571354L)
-#define EXT2_ET_GDESC_BAD_BLOCK_MAP              (2133571355L)
-#define EXT2_ET_GDESC_BAD_INODE_MAP              (2133571356L)
-#define EXT2_ET_GDESC_BAD_INODE_TABLE            (2133571357L)
-#define EXT2_ET_INODE_BITMAP_WRITE               (2133571358L)
-#define EXT2_ET_INODE_BITMAP_READ                (2133571359L)
-#define EXT2_ET_BLOCK_BITMAP_WRITE               (2133571360L)
-#define EXT2_ET_BLOCK_BITMAP_READ                (2133571361L)
-#define EXT2_ET_INODE_TABLE_WRITE                (2133571362L)
-#define EXT2_ET_INODE_TABLE_READ                 (2133571363L)
-#define EXT2_ET_NEXT_INODE_READ                  (2133571364L)
-#define EXT2_ET_UNEXPECTED_BLOCK_SIZE            (2133571365L)
-#define EXT2_ET_DIR_CORRUPTED                    (2133571366L)
-#define EXT2_ET_SHORT_READ                       (2133571367L)
-#define EXT2_ET_SHORT_WRITE                      (2133571368L)
-#define EXT2_ET_DIR_NO_SPACE                     (2133571369L)
-#define EXT2_ET_NO_INODE_BITMAP                  (2133571370L)
-#define EXT2_ET_NO_BLOCK_BITMAP                  (2133571371L)
-#define EXT2_ET_BAD_INODE_NUM                    (2133571372L)
-#define EXT2_ET_BAD_BLOCK_NUM                    (2133571373L)
-#define EXT2_ET_EXPAND_DIR_ERR                   (2133571374L)
-#define EXT2_ET_TOOSMALL                         (2133571375L)
-#define EXT2_ET_BAD_BLOCK_MARK                   (2133571376L)
-#define EXT2_ET_BAD_BLOCK_UNMARK                 (2133571377L)
-#define EXT2_ET_BAD_BLOCK_TEST                   (2133571378L)
-#define EXT2_ET_BAD_INODE_MARK                   (2133571379L)
-#define EXT2_ET_BAD_INODE_UNMARK                 (2133571380L)
-#define EXT2_ET_BAD_INODE_TEST                   (2133571381L)
-#define EXT2_ET_FUDGE_BLOCK_BITMAP_END           (2133571382L)
-#define EXT2_ET_FUDGE_INODE_BITMAP_END           (2133571383L)
-#define EXT2_ET_BAD_IND_BLOCK                    (2133571384L)
-#define EXT2_ET_BAD_DIND_BLOCK                   (2133571385L)
-#define EXT2_ET_BAD_TIND_BLOCK                   (2133571386L)
-extern void initialize_ext2_error_table (NOARGS);
-#define ERROR_TABLE_BASE_ext2 (2133571328L)
-
-/* for compatibility with older versions... */
-#define init_ext2_err_tbl initialize_ext2_error_table
-#define ext2_err_base ERROR_TABLE_BASE_ext2
index 672466b3e20bcb2e08becb26055399449d4c1d8d..140c12690682074abcd22d6cbd4d56abd58f8040 100644 (file)
@@ -21,7 +21,9 @@
  */
 #define EXT2_LIB_CURRENT_REV   0
 
-typedef unsigned long  blk_t;
+#include <linux/types.h>
+
+typedef __u32          blk_t;
 typedef unsigned int   dgrp_t;
 
 #include "et/com_err.h"
@@ -64,6 +66,7 @@ typedef struct ext2fs_struct_block_bitmap *ext2fs_block_bitmap;
 #define EXT2_FLAG_VALID                0x08
 #define EXT2_FLAG_IB_DIRTY     0x10
 #define EXT2_FLAG_BB_DIRTY     0x20
+#define EXT2_SWAP_BYTES                0x40
 
 struct struct_ext2_filsys {
        int                             magic;
@@ -128,8 +131,21 @@ struct struct_badblocks_iterate {
 
 /*
  * Block interate flags
+ *
+ * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
+ * function should be called on blocks where the block number is zero.
+ * This is used by ext2fs_expand_dir() to be able to add a new block
+ * to an inode.  It can also be used for programs that want to be able
+ * to deal with files that contain "holes".
+ * 
+ * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the
+ * indirect, doubly indirect, etc. blocks should be called after all
+ * of the blocks containined in the indirect blocks are processed.
+ * This is useful if you are going to be deallocating blocks from an
+ * inode.
  */
 #define BLOCK_FLAG_APPEND      1
+#define BLOCK_FLAG_HOLE                1
 #define BLOCK_FLAG_DEPTH_TRAVERSE      2
 
 /*
@@ -168,6 +184,38 @@ struct ext2_struct_inode_scan {
        int                     reserved[8];
 };
 
+/*
+ * ext2fs_check_if_mounted flags
+ */
+#define EXT2_MF_MOUNTED                1
+#define EXT2_MF_ISROOT         2
+#define EXT2_MF_READONLY       4 
+
+/*
+ * Ext2/linux mode flags.  We define them here so that we don't need
+ * to depend on the OS's sys/stat.h, since we may be compiling on a
+ * non-Linux system.
+ */
+#define LINUX_S_IFMT  00170000
+#define LINUX_S_IFSOCK 0140000
+#define LINUX_S_IFLNK   0120000
+#define LINUX_S_IFREG  0100000
+#define LINUX_S_IFBLK  0060000
+#define LINUX_S_IFDIR  0040000
+#define LINUX_S_IFCHR  0020000
+#define LINUX_S_IFIFO  0010000
+#define LINUX_S_ISUID  0004000
+#define LINUX_S_ISGID  0002000
+#define LINUX_S_ISVTX  0001000
+
+#define LINUX_S_ISLNK(m)       (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
+#define LINUX_S_ISREG(m)       (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
+#define LINUX_S_ISDIR(m)       (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
+#define LINUX_S_ISCHR(m)       (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
+#define LINUX_S_ISBLK(m)       (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
+#define LINUX_S_ISFIFO(m)      (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
+#define LINUX_S_ISSOCK(m)      (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
+
 /*
  * For checking structure magic numbers...
  */
@@ -208,20 +256,18 @@ extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs);
 extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
 extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
 extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
-errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
-                                      const char *descr,
-                                      ext2fs_block_bitmap *ret);
-errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
-                                      const char *descr,
-                                      ext2fs_inode_bitmap *ret);
-errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
-                                       ino_t end, ino_t *oend);
-errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
-                                       blk_t end, blk_t *oend);
-void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
-void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
-void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
-void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
+extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
+                                             const char *descr,
+                                             ext2fs_block_bitmap *ret);
+extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
+                                             const char *descr,
+                                             ext2fs_inode_bitmap *ret);
+extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
+                                              ino_t end, ino_t *oend);
+extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
+                                              blk_t end, blk_t *oend);
+extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
+extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
 extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs);
 extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
 
@@ -243,11 +289,30 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs);
 extern errcode_t ext2fs_close(ext2_filsys fs);
 extern errcode_t ext2fs_flush(ext2_filsys fs);
 
+/* cmp_bitmaps.c */
+extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
+                                            ext2fs_block_bitmap bm2);
+extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
+                                            ext2fs_inode_bitmap bm2);
+
+
+/* dirblock.c */
+extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
+                                      void *buf);
+extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
+                                       void *buf);
+
 /* expanddir.c */
 extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ino_t dir);
 
 /* freefs.c */
 extern void ext2fs_free(ext2_filsys fs);
+extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
+extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
+
+/* getsize.c */
+extern errcode_t ext2fs_get_device_size(const char *file, int blocksize,
+                                       blk_t *retblocks);
 
 /* initialize.c */
 extern errcode_t ext2fs_initialize(const char *name, int flags,
@@ -279,6 +344,9 @@ extern errcode_t ext2fs_write_inode(ext2_filsys fs, unsigned long ino,
 extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks);
 extern errcode_t ext2fs_check_directory(ext2_filsys fs, ino_t ino);
 
+/* ismounted.c */
+extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
+
 /* namei.c */
 extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, 
                              ino_t dir,
@@ -327,6 +395,10 @@ extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
                                     void (*invalid)(ext2_filsys fs,
                                                     blk_t blk));
 
+/* swapfs.c */
+extern void ext2fs_swap_super(struct ext2_super_block * super);
+extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
+
 /* inline functions */
 extern void ext2fs_mark_super_dirty(ext2_filsys fs);
 extern void ext2fs_mark_changed(ext2_filsys fs);
index d9d4fe980fd606e3ab2fa5df015fa0028edd3cf2..63b523566ff703a303cbc22358caa4d8a0c3b418 100644 (file)
@@ -27,9 +27,43 @@ void ext2fs_free(ext2_filsys fs)
        if (fs->group_desc)
                free(fs->group_desc);
        if (fs->block_map)
-               free(fs->block_map);
+               ext2fs_free_block_bitmap(fs->block_map);
        if (fs->inode_map)
-               free(fs->inode_map);
+               ext2fs_free_inode_bitmap(fs->inode_map);
        free(fs);
 }
 
+void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap)
+{
+       if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP))
+               return;
+
+       bitmap->magic = 0;
+       if (bitmap->description) {
+               free(bitmap->description);
+               bitmap->description = 0;
+       }
+       if (bitmap->bitmap) {
+               free(bitmap->bitmap);
+               bitmap->bitmap = 0;
+       }
+       free(bitmap);
+}
+
+void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap)
+{
+       if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP))
+               return;
+
+       bitmap->magic = 0;
+       if (bitmap->description) {
+               free(bitmap->description);
+               bitmap->description = 0;
+       }
+       if (bitmap->bitmap) {
+               free(bitmap->bitmap);
+               bitmap->bitmap = 0;
+       }
+       free(bitmap);
+}
+
index a5db2e09361c60508934ff59ded15b2a8e4c4f3f..da6b249a972d53d6db9e2987520023b32abf50b7 100644 (file)
@@ -9,6 +9,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/getsize.c b/lib/ext2fs/getsize.c
new file mode 100644 (file)
index 0000000..7918624
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * getsize.c --- get the size of a partition.
+ * 
+ * Copyright (C) 1995 Theodore Ts'o.  This file may be
+ * redistributed under the terms of the GNU Public License.
+ */
+
+#include <stdio.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <fcntl.h>
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h>
+#endif
+#ifdef HAVE_LINUX_FD_H
+#include <sys/ioctl.h>
+#include <linux/fd.h>
+#endif
+#ifdef HAVE_SYS_DISKLABEL_H
+#include <sys/ioctl.h>
+#include <sys/disklabel.h>
+#endif /* HAVE_SYS_DISKLABEL_H */
+
+#include <linux/ext2_fs.h>
+#include "ext2fs.h"
+
+static int valid_offset (int fd, ext2_loff_t offset)
+{
+       char ch;
+
+       if (ext2_llseek (fd, offset, 0) < 0)
+               return 0;
+       if (read (fd, &ch, 1) < 1)
+               return 0;
+       return 1;
+}
+
+/*
+ * Returns the number of blocks in a partition
+ */
+errcode_t ext2fs_get_device_size(const char *file, int blocksize,
+                                blk_t *retblocks)
+{
+       int     fd;
+       int     size;
+       ext2_loff_t high, low;
+#ifdef FDGETPRM
+       struct floppy_struct this_floppy;
+#endif
+#ifdef HAVE_SYS_DISKLABEL_H
+       struct disklabel lab;
+       struct partition *pp;
+       char ch;
+#endif /* HAVE_SYS_DISKLABEL_H */
+
+       fd = open(file, O_RDWR);
+       if (fd < 0)
+               return errno;
+
+#ifdef BLKGETSIZE
+       if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
+               close(fd);
+               *retblocks = size / (blocksize / 512);
+               return 0;
+       }
+#endif
+#ifdef FDGETPRM
+       if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) {
+               close(fd);
+               *retblocks = this_floppy.size / (blocksize / 512);
+               return 0;
+       }
+#endif
+#ifdef HAVE_SYS_DISKLABEL_H
+       size = strlen(file) - 1;
+       if (size >= 0) {
+               ch = file[size];
+               if (isdigit(ch))
+                       size = 0;
+               else if (ch >= 'a' && ch <= 'h')
+                       size = ch - 'a';
+               else
+                       size = -1;
+       }
+       if (size >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
+               pp = &lab.d_partitions[size];
+               if (pp->p_size) {
+                       close(fd);
+                       *retblocks = pp->p_size / (blocksize / 512);
+                       return 0;
+               }
+       }
+#endif /* HAVE_SYS_DISKLABEL_H */
+
+       /*
+        * OK, we couldn't figure it out by using a specialized ioctl,
+        * which is generally the besy way.  So do binary search to
+        * find the size of the partition.
+        */
+       low = 0;
+       for (high = 1024; valid_offset (fd, high); high *= 2)
+               low = high;
+       while (low < high - 1)
+       {
+               const ext2_loff_t mid = (low + high) / 2;
+
+               if (valid_offset (fd, mid))
+                       low = mid;
+               else
+                       high = mid;
+       }
+       valid_offset (fd, 0);
+       close(fd);
+       *retblocks = (low + 1) / blocksize;
+       return 0;
+}
index 22e7eaf3ef11f37b872db3f8d8aa9c0f500ab634..7428b0d4747bd4b1b97b72fe13afc81922344b9a 100644 (file)
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
 #include "ext2fs.h"
 
+#if  defined(__linux__)    &&  defined(EXT2_OS_LINUX)
+#define CREATOR_OS EXT2_OS_LINUX
+#elif defined(__gnu__)     &&  defined(EXT2_OS_HURD)
+#define CREATOR_OS EXT2_OS_HURD
+#elif defined(__FreeBSD__) &&  defined(EXT2_OS_FREEBSD)
+#define CREATOR_OS EXT2_OS_FREEBSD
+#elif defined(LITES)      &&   defined(EXT2_OS_LITES)
+#define CREATOR_OS EXT2_OS_LITES
+#else
+#define CREATOR_OS EXT2_OS_LINUX /* by default */
+#endif
+
 errcode_t ext2fs_initialize(const char *name, int flags,
                            struct ext2_super_block *param,
                            io_manager manager, ext2_filsys *ret_fs)
@@ -72,9 +87,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
        set_field(s_checkinterval, EXT2_DFL_CHECKINTERVAL);
        super->s_lastcheck = time(NULL);
 
-#ifdef EXT2_OS_LINUX
-       super->s_creator_os = EXT2_OS_LINUX;
-#endif
+       super->s_creator_os = CREATOR_OS;
 
        fs->blocksize = EXT2_BLOCK_SIZE(super);
        fs->fragsize = EXT2_FRAG_SIZE(super);
@@ -104,11 +117,14 @@ retry:
        /*
         * There should be at least as many inodes as the user
         * requested.  Figure out how many inodes per group that
-        * should be.
+        * should be.  But make sure that we don't allocate more than
+        * one bitmap's worth of inodes
         */
        super->s_inodes_per_group = (super->s_inodes_count +
                                     fs->group_desc_count - 1) /
                                             fs->group_desc_count;
+       if (super->s_inodes_per_group > fs->blocksize*8)
+               super->s_inodes_per_group = fs->blocksize*8;
        
        /*
         * Make sure the number of inodes per group completely fills
index 6a9c1785a1673fe57828bb35aeacd254520fdcf8..ae69bc211863c1f4acc2909a7275329d5680e17c 100644 (file)
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
 #include "ext2fs.h"
 
+static void inocpy_with_swap(struct ext2_inode *t, struct ext2_inode *f);
+
 errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
                                 ext2_inode_scan *ret_scan)
 {
@@ -77,9 +82,6 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
        
        EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN);
 
-       if (!scan->inode_buffer)
-               return EINVAL;
-       
        if (scan->inodes_left <= 0) {
                if (scan->blocks_left <= 0) {
                        if (scan->done_group) {
@@ -120,7 +122,11 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
                        return EXT2_ET_NEXT_INODE_READ;
                scan->inode_scan_ptr = (struct ext2_inode *) scan->inode_buffer;
        }
-       *inode = *scan->inode_scan_ptr++;
+       if (scan->fs->flags & EXT2_SWAP_BYTES)
+               inocpy_with_swap(inode, scan->inode_scan_ptr++);
+       else
+               *inode = *scan->inode_scan_ptr++;
+
        scan->inodes_left--;
        scan->current_inode++;
        *ino = scan->current_inode;
@@ -171,8 +177,12 @@ errcode_t ext2fs_read_inode (ext2_filsys fs, unsigned long ino,
                        return retval;
                inode_buffer_block = block_nr;
        }
-       memcpy (inode, (struct ext2_inode *) inode_buffer + i,
-               sizeof (struct ext2_inode));
+       if (fs->flags & EXT2_SWAP_BYTES)
+               inocpy_with_swap(inode,
+                                (struct ext2_inode *) inode_buffer + i);
+       else
+               memcpy (inode, (struct ext2_inode *) inode_buffer + i,
+                       sizeof (struct ext2_inode));
        return 0;
 }
 
@@ -217,8 +227,12 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, unsigned long ino,
                        return retval;
                inode_buffer_block = block_nr;
        }
-       memcpy ((struct ext2_inode *) inode_buffer + i, inode,
-               sizeof (struct ext2_inode));
+       if (fs->flags & EXT2_SWAP_BYTES)
+               inocpy_with_swap((struct ext2_inode *) inode_buffer + i,
+                                inode);
+       else
+               memcpy ((struct ext2_inode *) inode_buffer + i, inode,
+                       sizeof (struct ext2_inode));
        retval = io_channel_write_blk(fs->io, block_nr, 1, inode_buffer);
        if (retval)
                return retval;
@@ -264,10 +278,33 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ino_t ino)
        retval = ext2fs_read_inode(fs, ino, &inode);
        if (retval)
                return retval;
-       if (!S_ISDIR(inode.i_mode))
+       if (!LINUX_S_ISDIR(inode.i_mode))
                return ENOTDIR;
        return 0;
 }
 
+static void inocpy_with_swap(struct ext2_inode *t, struct ext2_inode *f)
+{
+       unsigned i;
        
-
+       t->i_mode = ext2fs_swab16(f->i_mode);
+       t->i_uid = ext2fs_swab16(f->i_uid);
+       t->i_size = ext2fs_swab32(f->i_size);
+       t->i_atime = ext2fs_swab32(f->i_atime);
+       t->i_ctime = ext2fs_swab32(f->i_ctime);
+       t->i_mtime = ext2fs_swab32(f->i_mtime);
+       t->i_dtime = ext2fs_swab32(f->i_dtime);
+       t->i_gid = ext2fs_swab16(f->i_gid);
+       t->i_links_count = ext2fs_swab16(f->i_links_count);
+       t->i_blocks = ext2fs_swab32(f->i_blocks);
+       t->i_flags = ext2fs_swab32(f->i_flags);
+       for (i = 0; i < EXT2_N_BLOCKS; i++)
+               t->i_block[i] = ext2fs_swab32(f->i_block[i]);
+       t->i_version = ext2fs_swab32(f->i_version);
+       t->i_file_acl = ext2fs_swab32(f->i_file_acl);
+       t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
+       t->i_faddr = ext2fs_swab32(f->i_faddr);
+       t->osd2.linux2.l_i_frag = f->osd2.linux2.l_i_frag;
+       t->osd2.linux2.l_i_fsize = f->osd2.linux2.l_i_fsize;
+       t->osd2.linux2.i_pad1 = ext2fs_swab16(f->osd2.linux2.i_pad1);
+}
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c
new file mode 100644 (file)
index 0000000..58c88fb
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * getsize.c --- get the size of a partition.
+ * 
+ * Copyright (C) 1995 Theodore Ts'o.  This file may be
+ * redistributed under the terms of the GNU Public License.
+ */
+
+#include <stdio.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <fcntl.h>
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h>
+#endif
+#ifdef HAVE_LINUX_FD_H
+#include <linux/fd.h>
+#endif
+#ifdef HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#ifdef HAVE_GETMNTINFO
+#include <paths.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif /* HAVE_GETMNTINFO */
+
+#include <linux/ext2_fs.h>
+#include "ext2fs.h"
+
+#ifdef HAVE_MNTENT_H
+/*
+ * XXX we only check to see if the mount is readonly when it's the
+ * root filesystem EXT2_FS_READONLY.
+ */
+static errcode_t check_mntent(const char *file, int *mount_flags)
+{
+       FILE * f;
+       struct mntent * mnt;
+       int     fd;
+
+       *mount_flags = 0;
+       if ((f = setmntent (MOUNTED, "r")) == NULL)
+               return errno;
+       while ((mnt = getmntent (f)) != NULL)
+               if (strcmp(file, mnt->mnt_fsname) == 0)
+                       break;
+       endmntent (f);
+       if (mnt == 0)
+               return 0;
+       *mount_flags = EXT2_MF_MOUNTED;
+       
+       if (!strcmp(mnt->mnt_dir, "/")) {
+               *mount_flags |= EXT2_MF_ISROOT;
+               fd = open(MOUNTED, O_RDWR);
+               if (fd < 0) {
+                       if (errno == EROFS)
+                               *mount_flags |= EXT2_MF_READONLY;
+               } else
+                       close(fd);
+       }
+       return 0;
+}
+#endif
+
+#ifdef HAVE_GETMNTINFO
+static errcode_t check_getmntinfo(const char *file, int *mount_flags)
+{
+       struct statfs *mp;
+        int    len, n;
+        const  char   *s1;
+       char    *s2;
+
+        n = getmntinfo(&mp, MNT_NOWAIT);
+        if (n == 0)
+               return errno;
+
+        len = sizeof(_PATH_DEV) - 1;
+        s1 = file;
+        if (strncmp(_PATH_DEV, s1, len) == 0)
+                s1 += len;
+       *mount_flags = 0;
+        while (--n >= 0) {
+                s2 = mp->f_mntfromname;
+                if (strncmp(_PATH_DEV, s2, len) == 0) {
+                        s2 += len - 1;
+                        *s2 = 'r';
+                }
+                if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) {
+                       *mount_flags = EXT2_MF_MOUNTED;
+                       break;
+               }
+                ++mp;
+       }
+       return 0;
+}
+#endif /* HAVE_GETMNTINFO */
+
+/*
+ * Is_mounted is set to 1 if the device is mounted, 0 otherwise
+ */
+errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags)
+{
+#ifdef HAVE_MNTENT_H
+       return check_mntent(file, mount_flags);
+#else 
+#ifdef HAVE_GETMNTINFO
+       return check_getmntinfo(file, mount_flags);
+#else
+       *mount_flags = 0;
+       return 0;
+#endif /* HAVE_GETMNTINFO */
+#endif /* HAVE_MNTENT_H */
+}
diff --git a/lib/ext2fs/jump/jump.undefs b/lib/ext2fs/jump/jump.undefs
deleted file mode 100644 (file)
index 9469992..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-66909078 D __NEEDS_SHRLIB_libc_4
-6690908c D __NEEDS_SHRLIB_libet_1
index 00fe3cdca058762a8c92a66d225806a2ebe6c3c4..02e0ede8706168f3ea822f264a8c5e74019d3547 100644 (file)
@@ -9,12 +9,25 @@
 
 #include <errno.h>
 #include <unistd.h>
-#include <linux/unistd.h>
 #include "et/com_err.h"
 #include "ext2fs/io.h"
 
 #ifdef __linux__
 
+#ifdef HAVE_LLSEEK
+#include <unistd.h>
+#include <syscall.h>
+
+#else  /* HAVE_LLSEEK */
+
+#ifdef __alpha__
+
+#define llseek lseek
+
+#else /* !__alpha__ */
+
+#include <linux/unistd.h>
+
 #ifndef __NR__llseek
 #define __NR__llseek            140
 #endif
@@ -26,54 +39,62 @@ static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
                 unsigned long, offset_low,ext2_loff_t *,result,
                 unsigned int, origin)
 
+static ext2_loff_t llseek (unsigned int fd, ext2_loff_t offset,
+               unsigned int origin)
+{
+       ext2_loff_t result;
+       int retval;
+
+       retval = _llseek (fd, ((unsigned long long) offset) >> 32,
+                       ((unsigned long long) offset) & 0xffffffff,
+                       &result, origin);
+       return (retval == -1 ? (ext2_loff_t) retval : result);
+}
+
+#endif /* HAVE_LLSEEK */
+
+#endif /* __alpha__ */
+
 ext2_loff_t ext2_llseek (unsigned int fd, ext2_loff_t offset,
                         unsigned int origin)
 {
-       unsigned long offset_high;
-       unsigned long offset_low;
        ext2_loff_t result;
-       int retval;
        static int do_compat = 0;
 
+       if ((sizeof(off_t) >= sizeof(ext2_loff_t)) ||
+           (offset < ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1))))
+               return lseek(fd, (off_t) offset, origin);
+
        if (do_compat) {
-       compat_lseek:
-               if ((sizeof(off_t) < sizeof(ext2_loff_t)) &&
-                   (offset >= ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))) {
-                       errno = -EINVAL;
-                       return -1;
-               }
-               return lseek (fd, (off_t) offset, origin);
+               errno = EINVAL;
+               return -1;
        }
        
-       offset_high = ((unsigned long long) offset) >> 32;
-       offset_low = ((unsigned long long) offset) & 0xffffffff;
-       retval = _llseek (fd, offset_high, offset_low, &result, origin);
-       if (retval == -1 && errno == ENOSYS) {
+       result = llseek (fd, offset, origin);
+       if (result == -1 && errno == ENOSYS) {
                /*
                 * Just in case this code runs on top of an old kernel
                 * which does not support the llseek system call
                 */
                do_compat++;
-               goto compat_lseek;
+               errno = EINVAL;
        }
-       if (retval == -1)
-               result = -1;
        return result;
 }
 
-#else
+#else /* !linux */
 
 ext2_loff_t ext2_llseek (unsigned int fd, ext2_loff_t offset,
                         unsigned int origin)
 {
        if ((sizeof(off_t) < sizeof(ext2_loff_t)) &&
            (offset >= ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))) {
-               errno = -EINVAL;
+               errno = EINVAL;
                return -1;
        }
        return lseek (fd, (off_t) offset, origin);
 }
 
-#endif
+#endif         /* linux */
 
 
index 8bcb542666aa2de2026768b225b9339beeacfc80..af3b9b7b6583516fc1109a0073aba9a202fc1496 100644 (file)
@@ -13,6 +13,9 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -35,7 +38,8 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
         * Allocate an inode, if necessary
         */
        if (!ino) {
-               retval = ext2fs_new_inode(fs, parent, S_IFDIR | 0755, 0, &ino);
+               retval = ext2fs_new_inode(fs, parent, LINUX_S_IFDIR | 0755,
+                                         0, &ino);
                if (retval)
                        goto cleanup;
        }
@@ -58,7 +62,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
         * Create the inode structure....
         */
        memset(&inode, 0, sizeof(struct ext2_inode));
-       inode.i_mode = S_IFDIR | 0755;
+       inode.i_mode = LINUX_S_IFDIR | 0755;
        inode.i_uid = inode.i_gid = 0;
        inode.i_blocks = fs->blocksize / 512;
        inode.i_block[0] = blk;
@@ -69,7 +73,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
        /*
         * Write out the inode and inode data block
         */
-       retval = io_channel_write_blk(fs->io, blk, 1, block);
+       retval = ext2fs_write_dir_block(fs, blk, block);
        if (retval)
                goto cleanup;
        retval = ext2fs_write_inode(fs, ino, &inode); 
index da382f71a398208e1e78eb47155654866e62ce34..496c7266e0da971c43b683b9c40401759315a267 100644 (file)
@@ -9,6 +9,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -87,7 +90,7 @@ static int process_dir_block(ext2_filsys  fs,
        if (blockcnt < 0)
                return 0;
 
-       ctx->errcode = io_channel_read_blk(fs->io, *blocknr, 1, ctx->buf);
+       ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf);
        if (ctx->errcode)
                return BLOCK_ABORT;
        
@@ -116,8 +119,7 @@ next:
        }
 
        if (changed) {
-               ctx->errcode = io_channel_write_blk(fs->io, *blocknr, 1,
-                                                   ctx->buf);
+               ctx->errcode = ext2fs_write_dir_block(fs, *blocknr, ctx->buf);
                if (ctx->errcode)
                        return BLOCK_ABORT;
        }
index d1018c170e3066f2e331d8bebb0d535fd0a36a39..22547266f4bd6f2ee108a5dbbf13fb5391ffbe38 100644 (file)
@@ -9,6 +9,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
index d6f5432de8cebfe9d6500e35caae23d858fe9057..b674ace014e5b21a26ffaa3b4f17456e1cb8480f 100644 (file)
@@ -1,16 +1,25 @@
 /*
  * openfs.c --- open an ext2 filesystem
  * 
- * Copyright (C) 1993, 1994 Theodore Ts'o.  This file may be redistributed
- * under the terms of the GNU Public License.
+ * Copyright (C) 1993, 1994, 1995 Theodore Ts'o.
+ * 
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
  */
 
 #include <stdio.h>
 #include <string.h>
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#if HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #include <sys/stat.h>
 #include <sys/types.h>
 
@@ -27,8 +36,9 @@ errcode_t ext2fs_open(const char *name, int flags, int superblock,
 {
        ext2_filsys     fs;
        errcode_t       retval;
-       int             i, group_block;
+       int             i, j, group_block, groups_per_block;
        char            *dest;
+       struct ext2_group_desc *gdp;
        
        EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);
        
@@ -77,6 +87,13 @@ errcode_t ext2fs_open(const char *name, int flags, int superblock,
                                     fs->super);
        if (retval)
                goto cleanup;
+
+       if ((fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) ||
+           (fs->flags & EXT2_SWAP_BYTES)) {
+               fs->flags |= EXT2_SWAP_BYTES;
+
+               ext2fs_swap_super(fs->super);
+       }
        
        if (fs->super->s_magic != EXT2_SUPER_MAGIC) {
                retval = EXT2_ET_BAD_MAGIC;
@@ -126,6 +143,13 @@ errcode_t ext2fs_open(const char *name, int flags, int superblock,
                if (retval)
                        goto cleanup;
                group_block++;
+               if (fs->flags & EXT2_SWAP_BYTES) {
+                       gdp = (struct ext2_group_desc *) dest;
+                       groups_per_block = fs->blocksize /
+                               sizeof(struct ext2_group_desc);
+                       for (j=0; j < groups_per_block; j++)
+                               ext2fs_swap_group_desc(gdp++);
+               }
                dest += fs->blocksize;
        }
 
index c24674ba8ea676441bca707606d4cac77fdf9c42..04e15819591f8b8c09ace74b2ec164f191f4716c 100644 (file)
@@ -41,7 +41,7 @@ errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
        while (!feof (f)) {
                if (fgets(buf, sizeof(buf), f) == NULL)
                        break;
-               count = sscanf(buf, "%lu", &blockno);
+               count = sscanf(buf, "%u", &blockno);
                if (count <= 0)
                        continue;
                if ((blockno < fs->super->s_first_data_block) ||
index 9523294027ea41ed1d48beb368d8c3a0ce93dd0d..18b0d3e56d0c053462746eb6c4eab21296995e7f 100644 (file)
@@ -13,6 +13,9 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
@@ -100,7 +103,7 @@ errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
 static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
 {
        int i;
-       char *block_bitmap, *inode_bitmap;
+       char *block_bitmap = 0, *inode_bitmap = 0;
        char *buf;
        errcode_t retval;
        int block_nbytes = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
@@ -130,39 +133,31 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
                inode_bitmap = fs->inode_map->bitmap;
        }
        free(buf);
-       buf = malloc(fs->blocksize);
-       if (!buf) {
-               retval = ENOMEM;
-               goto cleanup;
-       }
 
        for (i = 0; i < fs->group_desc_count; i++) {
-               if (do_block) {
+               if (block_bitmap) {
                        retval = io_channel_read_blk
                                (fs->io,
                                 fs->group_desc[i].bg_block_bitmap,
-                                1, buf);
+                                -block_nbytes, block_bitmap);
                        if (retval) {
                                retval = EXT2_ET_BLOCK_BITMAP_READ;
                                goto cleanup;
                        }
-                       memcpy(block_bitmap, buf, block_nbytes);
                        block_bitmap += block_nbytes;
                }
-               if (do_inode) {
+               if (inode_bitmap) {
                        retval = io_channel_read_blk
                                (fs->io,
                                 fs->group_desc[i].bg_inode_bitmap,
-                                1, buf);
+                                -inode_nbytes, inode_bitmap);
                        if (retval) {
                                retval = EXT2_ET_INODE_BITMAP_READ;
                                goto cleanup;
                        }
-                       memcpy(inode_bitmap, buf, inode_nbytes);
                        inode_bitmap += inode_nbytes;
                }
        }
-       free(buf);
        return 0;
        
 cleanup:
diff --git a/lib/ext2fs/rw_bitmaps.size b/lib/ext2fs/rw_bitmaps.size
deleted file mode 100644 (file)
index 5a3c944..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-text   data    bss     dec     hex
-1720   0       0       1720    6b8
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
new file mode 100644 (file)
index 0000000..371b8f9
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * swapfs.c --- swap ext2 filesystem data structures
+ * 
+ * Copyright (C) 1995 Theodore Ts'o.  This file may be redistributed
+ * under the terms of the GNU Public License.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include <linux/ext2_fs.h>
+
+#include "ext2fs.h"
+
+void ext2fs_swap_super(struct ext2_super_block * super)
+{
+       super->s_inodes_count = ext2fs_swab32(super->s_inodes_count);
+       super->s_blocks_count = ext2fs_swab32(super->s_blocks_count);
+       super->s_r_blocks_count = ext2fs_swab32(super->s_r_blocks_count);
+       super->s_free_blocks_count = ext2fs_swab32(super->s_free_blocks_count);
+       super->s_free_inodes_count = ext2fs_swab32(super->s_free_inodes_count);
+       super->s_first_data_block = ext2fs_swab32(super->s_first_data_block);
+       super->s_log_block_size = ext2fs_swab32(super->s_log_block_size);
+       super->s_log_frag_size = ext2fs_swab32(super->s_log_frag_size);
+       super->s_blocks_per_group = ext2fs_swab32(super->s_blocks_per_group);
+       super->s_frags_per_group = ext2fs_swab32(super->s_frags_per_group);
+       super->s_inodes_per_group = ext2fs_swab32(super->s_inodes_per_group);
+       super->s_mtime = ext2fs_swab32(super->s_mtime);
+       super->s_wtime = ext2fs_swab32(super->s_wtime);
+       super->s_mnt_count = ext2fs_swab16(super->s_mnt_count);
+       super->s_max_mnt_count = ext2fs_swab16(super->s_max_mnt_count);
+       super->s_magic = ext2fs_swab16(super->s_magic);
+       super->s_state = ext2fs_swab16(super->s_state);
+       super->s_errors = ext2fs_swab16(super->s_errors);
+       super->s_lastcheck = ext2fs_swab32(super->s_lastcheck);
+       super->s_checkinterval = ext2fs_swab32(super->s_checkinterval);
+       super->s_creator_os = ext2fs_swab32(super->s_creator_os);
+       super->s_rev_level = ext2fs_swab32(super->s_rev_level);
+#ifdef EXT2_DEF_RESUID
+       super->s_def_resuid = ext2fs_swab16(super->s_def_resuid);
+       super->s_def_resgid = ext2fs_swab16(super->s_def_resgid);
+#endif
+}
+
+void ext2fs_swap_group_desc(struct ext2_group_desc *gdp)
+{
+       gdp->bg_block_bitmap = ext2fs_swab32(gdp->bg_block_bitmap);
+       gdp->bg_inode_bitmap = ext2fs_swab32(gdp->bg_inode_bitmap);
+       gdp->bg_inode_table = ext2fs_swab32(gdp->bg_inode_table);
+       gdp->bg_free_blocks_count = ext2fs_swab16(gdp->bg_free_blocks_count);
+       gdp->bg_free_inodes_count = ext2fs_swab16(gdp->bg_free_inodes_count);
+       gdp->bg_used_dirs_count = ext2fs_swab16(gdp->bg_used_dirs_count);
+}
+
+       
+
index 5126583e7a0a0102f88854be256ffc631e4596a6..b99551504a44f309afe0bb38266a3183726c96db 100644 (file)
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include "et/com_err.h"
-#include "ext2_err.h"
+#include "ext2fs/ext2_err.h"
 #include "io.h"
 
 /*
@@ -63,6 +66,8 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
        struct unix_private_data *data = NULL;
        errcode_t       retval;
 
+       if (name == 0)
+               return EXT2_ET_BAD_DEVICE_NAME;
        io = (io_channel) malloc(sizeof(struct struct_io_channel));
        if (!io)
                return ENOMEM;
index b35a6829dedcda29b0b486630d8414136430bbee..3851e3bdc30b1258299acb6a26afefe254456949 100644 (file)
@@ -1,78 +1,74 @@
-data.o : data.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h ss_internal.h /usr/include/string.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ss.h ../ss/mit-sipb-copyright.h \
-  ../ss/ss_err.h copyright.h 
-error.o : error.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h copyright.h ../et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
-  ss_internal.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h 
-execute_cmd.o : execute_cmd.c /usr/include/stdlib.h /usr/include/features.h \
-  /usr/include/sys/cdefs.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h ss_internal.h /usr/include/stdio.h /usr/include/libio.h \
-  /usr/include/_G_config.h /usr/include/string.h ss.h ../ss/mit-sipb-copyright.h \
-  ../ss/ss_err.h copyright.h 
-help.o : help.c /usr/include/unistd.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
-  /usr/include/alloca.h /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
+data.o : ./data.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/libio.h /usr/include/_G_config.h ./ss_internal.h /usr/include/string.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h ../ss/mit-sipb-copyright.h \
+  ../ss/ss_err.h ./copyright.h 
+error.o : ./error.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/libio.h /usr/include/_G_config.h ./copyright.h ./../et/com_err.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ./ss_internal.h /usr/include/string.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h ../ss/mit-sipb-copyright.h \
+  ../ss/ss_err.h 
+execute_cmd.o : ./execute_cmd.c ./ss_internal.h /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h ../ss/mit-sipb-copyright.h \
+  ../ss/ss_err.h ./copyright.h 
+help.o : ./help.c /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
-  /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
-  /usr/include/linux/param.h /usr/include/asm/param.h /usr/include/sys/file.h \
-  /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/sys/wait.h /usr/include/waitflags.h \
-  /usr/include/linux/wait.h /usr/include/waitstatus.h /usr/include/endian.h /usr/include/bytesex.h \
-  ss_internal.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
-  /usr/include/string.h ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h copyright.h \
-  /usr/include/sys/dir.h /usr/include/dirent.h /usr/include/linux/dirent.h 
-invocation.o : invocation.c /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/errno.h /usr/include/linux/errno.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h ss_internal.h \
-  /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
-  ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h copyright.h 
-list_rqs.o : list_rqs.c copyright.h ss_internal.h /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/posix1_lim.h /usr/include/linux/limits.h \
+  /usr/include/posix2_lim.h /usr/include/linux/param.h /usr/include/asm/param.h \
+  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+  /usr/include/sys/file.h /usr/include/fcntl.h /usr/include/gnu/types.h /usr/include/linux/fcntl.h \
+  /usr/include/sys/wait.h /usr/include/waitflags.h /usr/include/linux/wait.h /usr/include/waitstatus.h \
+  /usr/include/endian.h /usr/include/bytesex.h ./ss_internal.h /usr/include/stdio.h \
+  /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+  ./ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h ./copyright.h /usr/include/sys/dir.h \
+  /usr/include/dirent.h /usr/include/linux/dirent.h 
+invocation.o : ./invocation.c ./ss_internal.h /usr/include/stdio.h /usr/include/features.h \
   /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ss.h ../ss/mit-sipb-copyright.h \
-  ../ss/ss_err.h /usr/include/signal.h /usr/include/sys/types.h /usr/include/linux/types.h \
-  /usr/include/asm/types.h /usr/include/linux/signal.h /usr/include/setjmp.h /usr/include/jmp_buf.h \
-  /usr/include/i386/jmp_buf.h /usr/include/sys/wait.h /usr/include/gnu/types.h \
-  /usr/include/waitflags.h /usr/include/linux/wait.h /usr/include/waitstatus.h \
-  /usr/include/endian.h /usr/include/bytesex.h 
-listen.o : listen.c copyright.h ss_internal.h /usr/include/stdio.h /usr/include/features.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h ../ss/mit-sipb-copyright.h \
+  ../ss/ss_err.h ./copyright.h 
+list_rqs.o : ./list_rqs.c ./copyright.h ./ss_internal.h /usr/include/stdio.h \
+  /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h \
+  /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h \
+  ../ss/mit-sipb-copyright.h ../ss/ss_err.h /usr/include/signal.h /usr/include/sys/types.h \
+  /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/linux/signal.h \
+  /usr/include/setjmp.h /usr/include/jmp_buf.h /usr/include/i386/jmp_buf.h /usr/include/sys/wait.h \
+  /usr/include/gnu/types.h /usr/include/waitflags.h /usr/include/linux/wait.h \
+  /usr/include/waitstatus.h /usr/include/endian.h /usr/include/bytesex.h 
+listen.o : ./listen.c ./copyright.h ./ss_internal.h /usr/include/stdio.h /usr/include/features.h \
   /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ss.h ../ss/mit-sipb-copyright.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h ../ss/mit-sipb-copyright.h \
   ../ss/ss_err.h /usr/include/setjmp.h /usr/include/jmp_buf.h /usr/include/i386/jmp_buf.h \
   /usr/include/signal.h /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
   /usr/include/linux/signal.h /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
   /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
   /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
   /usr/include/linux/param.h /usr/include/asm/param.h 
-pager.o : pager.c /usr/include/unistd.h /usr/include/features.h /usr/include/sys/cdefs.h \
+pager.o : ./pager.c /usr/include/unistd.h /usr/include/features.h /usr/include/sys/cdefs.h \
   /usr/include/posix_opt.h /usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
-  /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
-  ss_internal.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
-  /usr/include/string.h ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h copyright.h \
-  /usr/include/sys/file.h /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/signal.h \
-  /usr/include/linux/signal.h 
-parse.o : parse.c /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/errno.h /usr/include/linux/errno.h \
-  /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h ss_internal.h \
+  /usr/include/confname.h /usr/include/sys/types.h /usr/include/linux/types.h \
+  /usr/include/asm/types.h /usr/include/errno.h /usr/include/linux/errno.h ./ss_internal.h \
   /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
-  ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h copyright.h 
-prompt.o : prompt.c copyright.h /usr/include/stdio.h /usr/include/features.h \
-  /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h ss_internal.h \
-  /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ss.h \
-  ../ss/mit-sipb-copyright.h ../ss/ss_err.h 
-request_tbl.o : request_tbl.c copyright.h ss_internal.h /usr/include/stdio.h \
-  /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h \
-  /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ss.h \
+  ./ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h ./copyright.h /usr/include/sys/file.h \
+  /usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/signal.h /usr/include/linux/signal.h 
+parse.o : ./parse.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/linux/errno.h ./ss_internal.h /usr/include/stdio.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+  ./ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h ./copyright.h 
+prompt.o : ./prompt.c ./copyright.h /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h ./ss_internal.h \
+  /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h \
   ../ss/mit-sipb-copyright.h ../ss/ss_err.h 
-requests.o : requests.c mit-sipb-copyright.h /usr/include/stdio.h /usr/include/features.h \
-  /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h ss_internal.h \
-  /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ss.h \
+request_tbl.o : ./request_tbl.c /usr/include/errno.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/linux/errno.h ./copyright.h ./ss_internal.h \
+  /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
+  /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h ../ss/mit-sipb-copyright.h \
+  ../ss/ss_err.h 
+requests.o : ./requests.c ./mit-sipb-copyright.h /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/libio.h /usr/include/_G_config.h ./ss_internal.h \
+  /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h ./ss.h \
   ../ss/mit-sipb-copyright.h ../ss/ss_err.h 
-ss_err.o : ss_err.c 
-std_rqs.o : std_rqs.c ../ss/ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h 
-test_ss.o : test_ss.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
-  /usr/include/libio.h /usr/include/_G_config.h ss.h ../ss/mit-sipb-copyright.h \
+ss_err.o : ./ss_err.c 
+std_rqs.o : ./std_rqs.c ../ss/ss.h ../ss/mit-sipb-copyright.h ../ss/ss_err.h 
+test_ss.o : ./test_ss.c /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/libio.h /usr/include/_G_config.h ./ss.h ../ss/mit-sipb-copyright.h \
   ../ss/ss_err.h 
index 9c2555381908e71d7f7517eced3091b2fb49912a..21c7df1be0d5ad28a23155208066a065c6030255 100644 (file)
@@ -1,6 +1,72 @@
+Wed Oct 25 11:58:20 1995    <tytso@rsts-11.mit.edu>
+
+       * ss_internal.h: Removed malloc, realloc, free definitions, and
+               #include <stdlib.h> instead.
+
+Mon Sep  4 21:46:00 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for BSD shared libraries.
+               (distclean): Use the -f option when removing files.
+
+Fri Aug 18 15:15:09 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * Makefile.in (mk_cmds): Remove usage of $<, since it's not
+               portable. 
+
+Sat Aug 12 03:11:02 1995  Remy Card  <card@bbj>
+
+       * Makefile.in (install): Install static libraries in $(ulibdir)
+               (/usr/lib on Linux) instead of $(libdir) (/lib on Linux).
+
+Thu Aug 10 14:23:31 1995  Remy Card  <card@bbj>
+
+       * Makefile.in (distclean): Remove mk_cmds.sh.
+
+Sat Aug  5 11:44:29 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * mk_cmds.sh.in: Remove the old .c file before moving the new file
+               into place.
+
+       * Makefile.in (DLL_INSTALL_DIR, ELF_INSTALL_DIR): Set the
+               installation directories correctly.
+
+       * Makefile.in (clean): Don't remove mk_cmds.sh, since it's built
+               from the configure script.
+
+Tue Jul 11 20:47:46 1995    <tytso@rsx-11.mit.edu>
+
+       * help.c (ss_help): Use malloc instead of alloca for maximal
+               portability.  Check return value of malloc before using
+               buffer.  Allocate memory when printing usage message.
+
+Thu Jun 15 23:46:16 1995  Remy Card  <card@bbj>
+
+       * Makefile.in: Added support for ELF shared libraries.
+               Fixed typos in the compilation rules.
+               (distclean): Added mk_cmds.sh.
+
+Sat Jun 10 19:57:07 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+       * mk_cmds.sh.in: Use SS_DIR instead of srcdir to determine the
+               location of the ss directory.
+
+Thu Jun  8 13:18:48 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
+
+       * help.c (ss_help): Use alloca to allocate space for filenames
+       instead of fixed buffers.
+       * error.c (ss_error, & includes): Change the selection of
+       varargs/stdarg to work with configure.
+       * pager.c: Include <errno.h> if possible.
+       * parse.c: Ditto.
+       * request_tbl.c: Ditto.
+
+       * Makefile.in: Rewritten to conform to GNU coding standards and
+       support separate compilation directories.
+       Don't preprocess mk_cmds.sh, as this is now done by configure.
+
 Sat Mar 11 18:14:52 1995  Theodore Y. Ts'o  <tytso@localhost>
 
-       * Makefile (DLL_INSTALL_DIR): Install libss in /lib, since it's
+       * Makefile.in (DLL_INSTALL_DIR): Install libss in /lib, since it's
                needed by debugfs (which is installed in /sbin).
 
 
diff --git a/lib/ss/MAKELOG b/lib/ss/MAKELOG
deleted file mode 100644 (file)
index 5356fcb..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c ss_err.c
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/ss_err.o -c ss_err.c)
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c std_rqs.c
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/std_rqs.o -c std_rqs.c)
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c invocation.c
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/invocation.o -c invocation.c)
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c help.c
-help.c: In function `ss_help':
-help.c:45: warning: implicit declaration of function `ss_list_requests'
-help.c: At top level:
-help.c:101: warning: function declaration isn't a prototype
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/help.o -c help.c)
-help.c: In function `ss_help':
-help.c:45: warning: implicit declaration of function `ss_list_requests'
-help.c: At top level:
-help.c:101: warning: function declaration isn't a prototype
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c execute_cmd.c
-execute_cmd.c:69: warning: function declaration isn't a prototype
-execute_cmd.c:122: warning: function declaration isn't a prototype
-execute_cmd.c:155: warning: return-type defaults to `int'
-execute_cmd.c:155: warning: function declaration isn't a prototype
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/execute_cmd.o -c execute_cmd.c)
-execute_cmd.c:69: warning: function declaration isn't a prototype
-execute_cmd.c:122: warning: function declaration isn't a prototype
-execute_cmd.c:155: warning: return-type defaults to `int'
-execute_cmd.c:155: warning: function declaration isn't a prototype
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c listen.c
-listen.c:33: warning: function declaration isn't a prototype
-listen.c:49: warning: function declaration isn't a prototype
-listen.c: In function `ss_listen':
-listen.c:60: warning: function declaration isn't a prototype
-listen.c:60: warning: function declaration isn't a prototype
-listen.c:60: warning: function declaration isn't a prototype
-listen.c:70: warning: function declaration isn't a prototype
-listen.c:72: warning: implicit declaration of function `sigblock'
-listen.c:72: warning: implicit declaration of function `sigmask'
-listen.c:76: warning: implicit declaration of function `sigsetmask'
-listen.c:60: warning: variable `sig_cont' may be clobbered by `longjmp' or `vfork'
-listen.c:63: warning: variable `end' may be clobbered by `longjmp' or `vfork'
-listen.c: At top level:
-listen.c:132: warning: function declaration isn't a prototype
-listen.c: In function `ss_quit':
-listen.c:138: warning: control reaches end of non-void function
-listen.c: At top level:
-listen.c:23: warning: `rcs_id' defined but not used
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/listen.o -c listen.c)
-listen.c:33: warning: function declaration isn't a prototype
-listen.c:49: warning: function declaration isn't a prototype
-listen.c: In function `ss_listen':
-listen.c:60: warning: function declaration isn't a prototype
-listen.c:60: warning: function declaration isn't a prototype
-listen.c:60: warning: function declaration isn't a prototype
-listen.c:70: warning: function declaration isn't a prototype
-listen.c:72: warning: implicit declaration of function `sigblock'
-listen.c:72: warning: implicit declaration of function `sigmask'
-listen.c:76: warning: implicit declaration of function `sigsetmask'
-listen.c:60: warning: variable `sig_cont' may be clobbered by `longjmp' or `vfork'
-listen.c:63: warning: variable `end' may be clobbered by `longjmp' or `vfork'
-listen.c: At top level:
-listen.c:132: warning: function declaration isn't a prototype
-listen.c: In function `ss_quit':
-listen.c:138: warning: control reaches end of non-void function
-listen.c: At top level:
-listen.c:23: warning: `rcs_id' defined but not used
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c parse.c
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/parse.o -c parse.c)
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c error.c
-error.c:87: warning: no previous prototype for `ss_error'
-error.c: In function `ss_error':
-error.c:103: warning: implicit declaration of function `free'
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/error.o -c error.c)
-error.c:87: warning: no previous prototype for `ss_error'
-error.c: In function `ss_error':
-error.c:103: warning: implicit declaration of function `free'
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c prompt.c
-prompt.c:23: warning: no previous prototype for `ss_set_prompt'
-prompt.c:33: warning: no previous prototype for `ss_get_prompt'
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/prompt.o -c prompt.c)
-prompt.c:23: warning: no previous prototype for `ss_set_prompt'
-prompt.c:33: warning: no previous prototype for `ss_get_prompt'
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c request_tbl.c
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/request_tbl.o -c request_tbl.c)
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c list_rqs.c
-list_rqs.c:25: warning: function declaration isn't a prototype
-list_rqs.c: In function `ss_list_requests':
-list_rqs.c:39: warning: function declaration isn't a prototype
-list_rqs.c:51: warning: implicit declaration of function `sigblock'
-list_rqs.c:51: warning: implicit declaration of function `sigmask'
-list_rqs.c:53: warning: implicit declaration of function `ss_pager_create'
-list_rqs.c:55: warning: implicit declaration of function `sigsetmask'
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/list_rqs.o -c list_rqs.c)
-list_rqs.c:25: warning: function declaration isn't a prototype
-list_rqs.c: In function `ss_list_requests':
-list_rqs.c:39: warning: function declaration isn't a prototype
-list_rqs.c:51: warning: implicit declaration of function `sigblock'
-list_rqs.c:51: warning: implicit declaration of function `sigmask'
-list_rqs.c:53: warning: implicit declaration of function `ss_pager_create'
-list_rqs.c:55: warning: implicit declaration of function `sigsetmask'
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c pager.c
-pager.c:23: warning: function declaration isn't a prototype
-pager.c:36: warning: function declaration isn't a prototype
-pager.c: In function `ss_page_stdin':
-pager.c:77: warning: implicit declaration of function `sigblock'
-pager.c:78: warning: implicit declaration of function `sigmask'
-pager.c:79: warning: implicit declaration of function `sigsetmask'
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/pager.o -c pager.c)
-pager.c:23: warning: function declaration isn't a prototype
-pager.c:36: warning: function declaration isn't a prototype
-pager.c: In function `ss_page_stdin':
-pager.c:77: warning: implicit declaration of function `sigblock'
-pager.c:78: warning: implicit declaration of function `sigmask'
-pager.c:79: warning: implicit declaration of function `sigsetmask'
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c requests.c
-requests.c:23: warning: no previous prototype for `ss_self_identify'
-requests.c:33: warning: no previous prototype for `ss_subsystem_name'
-requests.c:41: warning: no previous prototype for `ss_subsystem_version'
-requests.c:50: warning: no previous prototype for `ss_unimplemented'
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/requests.o -c requests.c)
-requests.c:23: warning: no previous prototype for `ss_self_identify'
-requests.c:33: warning: no previous prototype for `ss_subsystem_name'
-requests.c:41: warning: no previous prototype for `ss_subsystem_version'
-requests.c:50: warning: no previous prototype for `ss_unimplemented'
-gcc -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -c data.c
-data.c:12: warning: `copyright' defined but not used
-(export JUMP_DIR=`pwd`/jump; gcc -B/usr/dll/jump/ -I. -I.. -I../et -O2 -fomit-frame-pointer -ansi -D_POSIX_SOURCE -pedantic -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wenum-clash -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow  -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H \
-       -o jump/data.o -c data.c)
-data.c:12: warning: `copyright' defined but not used
-(cd jump; export JUMP_DIR=`pwd`; \
-       /usr/dll/bin/mkimage -l libss -v 1.0.0 \
-       -a 0x66880000 -j 0x1000 -g 0x1000 -- \
-       ss_err.o std_rqs.o invocation.o help.o execute_cmd.o listen.o parse.o error.o prompt.o request_tbl.o list_rqs.o pager.o requests.o data.o -lc -L../.. -lcom_err "`gcc --print-libgcc-file-name`" -lc)
-Warning - non-absolute pathname specified for library
-listen.o: Undefined symbol _sigmask referenced from text segment
-list_rqs.o: Undefined symbol _sigmask referenced from text segment
-pager.o: Undefined symbol _sigmask referenced from text segment
-system: No such file or directory
-
-/usr/dll/bin/mkimage: error running 'ld -x -T 66880000 -o libss.so.1.0.0 /u3/src/e2fsprogs-0.5b/lib/ss/jump/__jump.o ss_err.o std_rqs.o invocation.o help.o execute_cmd.o listen.o parse.o error.o prompt.o request_tbl.o list_rqs.o pager.o requests.o data.o -lc -L../.. -lcom_err /usr/lib/gcc-lib/i486-linux/2.5.8/libgcc.a -lc'
-
-mkimage v2.11
-Reading configuration files from /u3/src/e2fsprogs-0.5b/lib/ss/jump
-executing:ld -x -T 66880000 -o libss.so.1.0.0 /u3/src/e2fsprogs-0.5b/lib/ss/jump/__jump.o ss_err.o std_rqs.o invocation.o help.o execute_cmd.o listen.o parse.o error.o prompt.o request_tbl.o list_rqs.o pager.o requests.o data.o -lc -L../.. -lcom_err /usr/lib/gcc-lib/i486-linux/2.5.8/libgcc.a -lc
-make: *** [libss.so.1.0.0] Error 1
diff --git a/lib/ss/Makefile b/lib/ss/Makefile
deleted file mode 100644 (file)
index 2f5ae92..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Makefile for lib/ss
-#
-
-include ../../MCONFIG
-
-ifdef BUILD_DLL_SHLIBS
-DLL_ADDRESS = 0x66880000
-DLL_JUMPSIZE = 0x1000
-DLL_GOTSIZE  = 0x1000
-DLL_VERSION = 1.0
-DLL_IMAGE = libss
-DLL_STUB = libss
-DLL_LIBS = -L../.. -lcom_err
-DLL_MYDIR = ss
-DLL_INSTALL_DIR = $(SHLIBDIR)
-endif
-
-RM=rm -f
-MV=mv
-LN=ln -s
-TAGS=etags
-COMPILE_ET=../et/compile_et
-MK_CMDS=../ss/mk_cmds
-
-DEFS= -DWAIT_USES_INT -DHAS_STDLIB_H -DHAS_UNISTD_H -DPOSIX_SIGNALS
-
-# hard coded .. is so that ss/ss_err.h works
-# hard coded ../et is so com_err.h works
-CFLAGS= -I. -I.. -I../et $(OPT) $(WFLAGS) $(DEFS)
-
-# hard coded for target install
-srcdir=        .
-
-# for the library
-
-LIB=   libss.a
-
-# with ss_err.o first, ss_err.h should get rebuilt first too.  should not
-# be relying on this, though.
-OBJS=  ss_err.o \
-       std_rqs.o \
-       invocation.o help.o \
-       execute_cmd.o listen.o parse.o error.o prompt.o \
-       request_tbl.o list_rqs.o pager.o requests.o \
-       data.o
-
-SRCS=  invocation.c help.c \
-       execute_cmd.c listen.c parse.c error.c prompt.c \
-       request_tbl.c list_rqs.c pager.c requests.c \
-       data.c  \
-       ss_err.h
-# ss_err.h here, so that make depend catches it.
-
-ifdef BUILD_DLL_SHLIBS
-include ../Makefile.dll-lib
-endif
-
-CODE= $(SRCS) $(MKCMDSFILES)
-
-MKCMDSOBJS=    mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o
-
-MKCMDSFILES=   mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l
-
-MKCMDSCSRCS=   mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c
-
-
-HFILES=        ss.h ss_internal.h copyright.h
-
-# for 'tags' and dependencies
-
-CFILES=        $(SRCS) $(MKCMDSCSRCS) test_ss.c
-
-# for building archives
-
-FILES= $(SRCS) $(MKCMDSFILES) $(HFILES) \
-       ss_err.et std_rqs.ct Makefile \
-       test_ss.c ss mit-sipb-copyright.h copyright.h
-
-#
-# stuff to build
-#
-
-.c.o:
-       $(CC) $(CFLAGS) -c $*.c
-ifdef BUILD_DLL_SHLIBS
-       (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
-               -o jump/$*.o -c $*.c)
-endif
-
-all::  mk_cmds libss.a # libss_p.a lint
-
-dist:  archives
-
-install::
-
-install-libs:: all
-       $(INSTALLLIB) libss.a $(LIBDIR)/libss.a
-       $(CHMOD) 644 $(LIBDIR)/libss.a
-       $(RANLIB) $(LIBDIR)/libss.a
-       $(CHMOD) $(LIBMODE) $(LIBDIR)/libss.a
-
-install-libs:: $(HFILES) copyright.h
-       @rm -rf $(INCLDIR)/ss
-       @mkdir $(INCLDIR)/ss
-       for i in $(HFILES) copyright.h; do \
-               $(INSTALLINC) $(srcdir)/$$i $(INCLDIR)/ss/$$i; \
-       done
-
-install-libs:: copyright.h
-       $(INSTALLINC) $(srcdir)/copyright.h $(INCLDIR)/ss/mit-sipb-copyright.h
-
-install-tree::
-
-std_rqs.c: std_rqs.ct
-       $(MK_CMDS) std_rqs.ct
-
-ss_err.c ss_err.h: ss_err.et
-       $(COMPILE_ET) ss_err.et
-
-dep depend .depend: ss_err.h
-       $(CPP) -M $(CFLAGS) *.c >.depend
-
-ct.tab.c ct.tab.h: ct.y
-       rm -f ct.tab.* y.*
-       yacc -d $(srcdir)/ct.y
-       mv -f y.tab.c ct.tab.c
-       mv -f y.tab.h ct.tab.h
-
-# install_library_target(ss,$(OBJS),$(SRCS),)
-all:: libss.a
-
-libss.a: $(OBJS)
-       $(RM) $@.bak
-       -$(MV) $@ $@.bak
-       $(ARCHIVE) $@ $(OBJS)
-       $(RANLIB) $@
-       $(RM) ../$@
-       $(LN) ss/$@ ../$@
-
-
-clean::        
-       $(RM) ../libss.a libss.a mk_cmds
-       $(RM) *.o *~ \#* *.bak core 
-
-really-clean:: clean
-       $(RM) .depend ss_err.h ss_err.c
-
-install-libs::
-       $(INSTALLLIB) libss.a $(LIBDIR)/libss.a
-       $(CHMOD) 644 $(LIBDIR)/libss.a
-       $(RANLIB)    $(LIBDIR)/libss.a
-       $(CHMOD) 444 $(LIBDIR)/libss.a
-
-
-libss.o:       $(OBJS)
-       $(LD) -r -s -o $@ $(OBJS)
-       $(CHMOD) -x $@
-
-mk_cmds: mk_cmds.sh
-       ./config_script mk_cmds.sh $(AWK) > mk_cmds
-       chmod +x mk_cmds
-
-include .depend
diff --git a/lib/ss/Makefile.in b/lib/ss/Makefile.in
new file mode 100644 (file)
index 0000000..aaab812
--- /dev/null
@@ -0,0 +1,207 @@
+#
+# Makefile for lib/ss
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ../..
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+LIBRARY= libss
+LIBDIR= ss
+
+DLL_ADDRESS = 0x66880000
+DLL_JUMPSIZE = 0x1000
+DLL_GOTSIZE  = 0x1000
+DLL_VERSION = 1.0
+DLL_IMAGE = libss
+DLL_STUB = libss
+DLL_LIBS = -L../.. -lcom_err
+DLL_MYDIR = ss
+DLL_INSTALL_DIR = $(libdir)
+
+ELF_VERSION = 2.0
+ELF_IMAGE = libss
+ELF_MYDIR = ss
+ELF_INSTALL_DIR = $(libdir)
+
+BSDLIB_VERSION = 1.0
+BSDLIB_IMAGE = libss
+BSDLIB_MYDIR = ss
+BSDLIB_INSTALL_DIR = $(libdir)
+
+TAGS=etags
+COMPILE_ET=../et/compile_et
+MK_CMDS=./mk_cmds
+
+# -I.. is so that ss/ss_err.h works
+# -I$(srcdir)/.. is so that ss/ss.h works
+# -I$(srcdir)/../et is so com_err.h works
+XTRA_CFLAGS=-DPOSIX_SIGNALS -I$(srcdir)/../et
+
+.c.o:
+       $(CC) $(CFLAGS) -c $<
+@PROFILE_CMT@  $(CC) $(CFLAGS) -pg -o profiled/$*.o -c $<
+@CHECKER_CMT@  $(CC) $(CFLAGS) -checker -g -o checker/$*.o -c $<
+@DLL_CMT@      (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(CFLAGS) \
+@DLL_CMT@              -o jump/$*.o -c $<)
+@ELF_CMT@      $(CC) $(CFLAGS) -fPIC -o elfshared/$*.o -c $<
+@BSDLIB_CMT@   $(CC) $(CFLAGS) -fpic -o pic/$*.o -c $<
+
+# for the library
+
+LIB=   libss.a
+
+# with ss_err.o first, ss_err.h should get rebuilt first too.  should not
+# be relying on this, though.
+OBJS=  ss_err.o \
+       std_rqs.o \
+       invocation.o help.o \
+       execute_cmd.o listen.o parse.o error.o prompt.o \
+       request_tbl.o list_rqs.o pager.o requests.o \
+       data.o
+
+SRCS=  $(srcdir)/invocation.c $(srcdir)/help.c \
+       $(srcdir)/execute_cmd.c $(srcdir)/listen.c $(srcdir)/parse.c \
+       $(srcdir)/error.c $(srcdir)/prompt.c $(srcdir)/request_tbl.c \
+       $(srcdir)/list_rqs.c $(srcdir)/pager.c $(srcdir)/requests.c \
+       $(srcdir)/data.c 
+
+all:: mk_cmds
+
+@MAKEFILE_LIBRARY@
+@MAKEFILE_DLL@
+@MAKEFILE_ELF@
+@MAKEFILE_BSDLIB@
+@MAKEFILE_PROFILE@
+@MAKEFILE_CHECKER@
+
+CODE= $(SRCS) $(MKCMDSFILES)
+
+MKCMDSOBJS=    mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o
+
+MKCMDSFILES=   mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l
+
+MKCMDSCSRCS=   mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c
+
+
+HFILES=        ss.h ss_internal.h copyright.h
+
+# for 'tags' and dependencies
+
+CFILES=        $(SRCS) $(MKCMDSCSRCS) test_ss.c
+
+# for building archives
+
+FILES= $(SRCS) $(MKCMDSFILES) $(HFILES) \
+       ss_err.et std_rqs.ct Makefile \
+       test_ss.c ss mit-sipb-copyright.h copyright.h
+
+all::  libss.a # libss_p.a lint
+
+std_rqs.c: std_rqs.ct $(MK_CMDS)
+       $(MK_CMDS) $(srcdir)/std_rqs.ct
+
+ss_err.c ss_err.h: ss_err.et
+       $(COMPILE_ET) $(srcdir)/ss_err.et
+
+ct.tab.c ct.tab.h: ct.y
+       $(RM) -f ct.tab.* y.*
+       $(YACC) -d $(srcdir)/ct.y
+       $(MV) -f y.tab.c ct.tab.c
+       $(MV) -f y.tab.h ct.tab.h
+
+#libss.o:      $(OBJS)
+#      $(LD) -r -s -o $@ $(OBJS)
+#      $(CHMOD) -x $@
+
+mk_cmds: mk_cmds.sh
+       $(CP) mk_cmds.sh $@ && $(CHMOD) +x mk_cmds
+
+installdirs::
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ulibdir) \
+               $(DESTDIR)$(includedir)/ss
+
+install:: libss.a $(HFILES) copyright.h installdirs
+       $(INSTALL_DATA) libss.a $(DESTDIR)$(ulibdir)/libss.a
+       $(CHMOD) 644 $(DESTDIR)$(ulibdir)/libss.a
+       -$(RANLIB) $(DESTDIR)$(ulibdir)/libss.a
+       $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/libss.a
+       $(RM) -f $(includedir)/ss/*
+       for i in $(HFILES) copyright.h; do \
+               $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/ss/$$i; \
+       done
+
+uninstall::
+       $(RM) -f $(ulibdir)/libss.a
+       $(RM) -rf $(includedir)/ss
+
+clean::
+       $(RM) -f ../libss.a libss.a mk_cmds 
+       $(RM) -f *.o *~ \#* *.bak core 
+
+mostlyclean:: clean
+distclean:: clean
+       $(RM) -f .depend ss_err.h ss_err.c mk_cmds.sh Makefile
+
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+invocation.o: $(srcdir)/invocation.c $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h \
+  $(srcdir)/copyright.h
+help.o: $(srcdir)/help.c \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h $(srcdir)/mit-sipb-copyright.h \
+  $(top_builddir)/lib/ss/ss_err.h $(srcdir)/copyright.h 
+execute_cmd.o: $(srcdir)/execute_cmd.c $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h \
+  $(srcdir)/copyright.h
+listen.o: $(srcdir)/listen.c $(srcdir)/copyright.h \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h $(srcdir)/mit-sipb-copyright.h \
+  $(top_builddir)/lib/ss/ss_err.h
+parse.o: $(srcdir)/parse.c \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h \
+  $(srcdir)/copyright.h
+error.o: $(srcdir)/error.c \
+  $(srcdir)/copyright.h \
+  $(srcdir)/../et/com_err.h \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h
+prompt.o: $(srcdir)/prompt.c $(srcdir)/copyright.h \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h
+request_tbl.o: $(srcdir)/request_tbl.c \
+  $(srcdir)/copyright.h $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h $(srcdir)/mit-sipb-copyright.h \
+  $(top_builddir)/lib/ss/ss_err.h
+list_rqs.o: $(srcdir)/list_rqs.c $(srcdir)/copyright.h \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h $(srcdir)/mit-sipb-copyright.h \
+  $(top_builddir)/lib/ss/ss_err.h
+pager.o: $(srcdir)/pager.c \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h \
+  $(srcdir)/copyright.h
+requests.o: $(srcdir)/requests.c $(srcdir)/mit-sipb-copyright.h \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(top_builddir)/lib/ss/ss_err.h
+data.o: $(srcdir)/data.c \
+  $(srcdir)/ss_internal.h \
+  $(srcdir)/ss.h \
+  $(srcdir)/mit-sipb-copyright.h $(top_builddir)/lib/ss/ss_err.h \
+  $(srcdir)/copyright.h
diff --git a/lib/ss/config_script b/lib/ss/config_script
deleted file mode 100644 (file)
index e3de35c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-#
-# This program takes a shell script and configures for the following
-# variables:   @DIR@
-#              @AWK@
-#              @SED@
-#
-# Usage: config_script <filename> [<awk>] [<sed>]
-#
-
-FILE=$1
-AWK=$2
-SED=$3
-
-# Grr.... not all Unix's have the dirname command
-TMP=`echo  $1 | sed -e 's;[^/]*$;;' -e 's/^$/./'`
-DIR=`cd ${TMP}; pwd`
-
-if test "${AWK}x" = "x" ; then
-       AWK=awk
-fi
-if test "${SED}x" = "x" ; then
-       SED=sed
-fi
-sed -e "s;@DIR@;${DIR};" -e "s;@AWK@;${AWK};" -e "s;@SED@;${SED};" $FILE
index 3b7165a72900fe04cc448f5c6e3151b5e79e3a40..80ebc823bf130c8a297c2cb081634ecaa4e21a0e 100644 (file)
 #include <com_err.h>
 #include "ss_internal.h"
 
-#ifdef _STDARG_H_
-#define STDARG
-#endif
-
-#ifdef _STDARG_H
-#define STDARG
-#endif
-
-#ifndef __STDC__
-/* we didn't get it in com_err.h if it wasn't STDC. */
-#ifndef STDARG
-/* and we don't need it, either, if we're using stdarg.h... */
-#include <varargs.h>
-#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <vararg.h>
 #endif
   
 #undef ss_error
@@ -78,7 +68,7 @@ char * ss_name(sci_idx)
     }
 }
 
-#ifdef STDARG
+#ifdef HAVE_STDARG_H
 void ss_error (int sci_idx, long code, const char * fmt, ...)
 #else
 void ss_error (va_alist)
@@ -87,7 +77,7 @@ void ss_error (va_alist)
 {
     register char const *whoami;
     va_list pvar;
-#ifndef STDARG
+#ifndef HAVE_STDARG_H
     int sci_idx;
     long code;
     char * fmt;
index f956ca801013537208773f019d7c6d07e520a8c2..3f3c7f534d5498dd9eccc14fd07a08e01fe63abc 100644 (file)
@@ -4,12 +4,13 @@
  * For copyright info, see copyright.h.
  */
 
-#ifdef HAS_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef HAS_STDLIB_H
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#include <fcntl.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/file.h>
@@ -29,7 +30,7 @@ void ss_help (argc, argv, sci_idx, info_ptr)
     int sci_idx;
     pointer info_ptr;
 {
-    char buffer[MAXPATHLEN];
+    char *buffer;
     char const *request_name;
     int code;
     int fd, child;
@@ -47,9 +48,16 @@ void ss_help (argc, argv, sci_idx, info_ptr)
     }
     else if (argc != 2) {
        /* should do something better than this */
+       buffer = malloc(80+2*strlen(request_name));
+       if (!buffer) {
+               ss_perror(sci_idx, 0,
+                         "couldn't allocate memory to print usage message");
+               return;
+       }
        sprintf(buffer, "usage:\n\t%s [topic|command]\nor\t%s\n",
                request_name, request_name);
        ss_perror(sci_idx, 0, buffer);
+       free(buffer);
        return;
     }
     info = ss_info(sci_idx);
@@ -61,21 +69,32 @@ void ss_help (argc, argv, sci_idx, info_ptr)
        ss_perror(sci_idx, SS_ET_NO_INFO_DIR, (char *)NULL);
        return;
     }
-    for (idx = 0; info->info_dirs[idx] != (char *)NULL; idx++) {
+    for (fd = -1, idx = 0; info->info_dirs[idx] != (char *)NULL; idx++) {
+        buffer = malloc(strlen (info->info_dirs[idx]) + 1 +
+                       strlen (argv[1]) + 6);
+       if (!buffer) {
+           ss_perror(sci_idx, 0,
+                     "couldn't allocate memory for help filename");
+           return;
+       }
        (void) strcpy(buffer, info->info_dirs[idx]);
        (void) strcat(buffer, "/");
        (void) strcat(buffer, argv[1]);
        (void) strcat(buffer, ".info");
-       if ((fd = open(&buffer[0], O_RDONLY)) >= 0) goto got_it;
+       fd = open(buffer, O_RDONLY);
+       free(buffer);
+       if (fd >= 0)
+           break;
     }
-    if ((fd = open(&buffer[0], O_RDONLY)) < 0) {
-       char buf[MAXPATHLEN];
-       strcpy(buf, "No info found for ");
+    if (fd < 0) {
+#define MSG "No info found for "
+        char *buf = malloc(strlen (MSG) + strlen (argv[1]) + 1);
+       strcpy(buf, MSG);
        strcat(buf, argv[1]);
        ss_perror(sci_idx, 0, buf);
+       free(buf);
        return;
     }
-got_it:
     switch (child = fork()) {
     case -1:
        ss_perror(sci_idx, errno, "Can't fork for pager");
@@ -91,7 +110,7 @@ got_it:
     }
 }
 
-#ifndef USE_DIRENT_H
+#ifndef HAVE_DIRENT_H
 #include <sys/dir.h>
 #else
 #include <dirent.h>
index 8c797ad989891d6ded931bc1cfa40c74191623d1..5a9abe50e98476784b07bb30b1dbb4650ddb8423 100644 (file)
@@ -42,11 +42,7 @@ void ss_list_requests(argc, argv, sci_idx, info_ptr)
 #endif
     sigret_t (*func)();
 #ifndef NO_FORK
-#ifndef WAIT_USES_INT
-    union wait waitb;
-#else
     int waitb;
-#endif
 #endif
 
     DONT_USE(argc);
similarity index 91%
rename from lib/ss/mk_cmds.sh
rename to lib/ss/mk_cmds.sh.in
index eda3888a13f535098ac1c4092b59a92e73c38f95..48660815dfca992c9efde59572cb557231272810 100644 (file)
@@ -2,7 +2,7 @@
 #
 #
 
-DIR=@DIR@
+DIR=@SS_DIR@
 AWK=@AWK@
 SED=@SED@
 
@@ -18,6 +18,7 @@ if grep "^#__ERROR_IN_FILE" ${TMP} > /dev/null; then
        rm ${TMP}
        exit 1
 else
+       rm -f ${BASE}.c
        mv ${TMP} ${BASE}.c
        exit 0
 fi
index ff915dac4c84e450f8384b41127a723d292100ac..bc5c9b528e3ac9079cddacada8da12f5343de301 100644 (file)
@@ -7,9 +7,12 @@
  * For copyright information, see copyright.h.
  */
 
-#ifdef HAS_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include "ss_internal.h"
 #include "copyright.h"
index 68a50649b6831617cf9f7014a1b4abe44871b6db..38b8e5bd9d632011fbb7b81011bbecef08a6f77d 100644 (file)
@@ -7,6 +7,9 @@
 #ifdef HAS_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #include "ss_internal.h"
 #include "copyright.h"
index b15ba91fdab6bc1a4d21242edcb87d7a99060843..e1cbfe8027f68e75de0dbe0c3f4628dc5e1e7d96 100644 (file)
@@ -4,6 +4,10 @@
  * For copyright information, see copyright.h.
  */
 
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
 #include "copyright.h"
 #include "ss_internal.h"
 
diff --git a/lib/ss/ss_err.c b/lib/ss/ss_err.c
deleted file mode 100644 (file)
index 7b97a00..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * ss_err.c:
- * This file is automatically generated; please do not edit it.
- */
-#ifdef __STDC__
-#define NOARGS void
-#else
-#define NOARGS
-#define const
-#endif
-
-static const char * const text[] = {
-               "Subsystem aborted",
-               "Version mismatch",
-               "No current invocation",
-               "No info directory",
-               "Command not found",
-               "Command line aborted",
-               "End-of-file reached",
-               "Permission denied",
-               "Request table not found",
-               "No info available",
-               "Shell escapes are disabled",
-               "Sorry, this request is not yet implemented",
-    0
-};
-
-struct error_table {
-    char const * const * msgs;
-    long base;
-    int n_msgs;
-};
-struct et_list {
-    struct et_list *next;
-    const struct error_table * table;
-};
-extern struct et_list *_et_list;
-
-static const struct error_table et = { text, 748800L, 12 };
-
-static struct et_list link = { 0, 0 };
-
-void initialize_ss_error_table (NOARGS);
-
-void initialize_ss_error_table (NOARGS) {
-    if (!link.table) {
-        link.next = _et_list;
-        link.table = &et;
-        _et_list = &link;
-    }
-}
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100644 (file)
index 0000000..0801ec2
--- /dev/null
@@ -0,0 +1,32 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1994-03-25
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do 
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d in ${1+"$@"} ; do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp" 1>&2
+        mkdir "$pathcomp" || errstatus=$?
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
index 8dd466a11a0055402c6060043e2a824885a87665..e88d3020c843fd7c07fb5b3f0e414b2af6fce997 100644 (file)
--- a/version.h
+++ b/version.h
@@ -2,9 +2,10 @@
  * version.h --- controls the version number printed by the e2fs
  * programs.
  *
- * Copyright 1994, Theodore Ts'o.  This file may be redistributed
+ * Copyright 1995, Theodore Ts'o.  This file may be redistributed
  * under the GNU Public License.
  */
 
-#define E2FSPROGS_VERSION "0.5b"
-#define E2FSPROGS_DATE "11-Mar-95"
+#define E2FSPROGS_VERSION "0.5c"
+#define E2FSPROGS_DATE "27-Oct-95"
+