diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1998-07-07 18:32:45 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1998-07-07 18:32:45 +0000 |
commit | 1e8f3723ed42df9b6d3588059cb85ef131e8371b (patch) | |
tree | cc01be1e2636d1715a19f20fb4f34c26f4fc6719 /gnu/usr.sbin | |
parent | d4de693af1086191ff335d68bcd612ffa7d4a7ef (diff) |
old, big, not compiled and not used, die
Diffstat (limited to 'gnu/usr.sbin')
438 files changed, 0 insertions, 55848 deletions
diff --git a/gnu/usr.sbin/e2fsprogs/.fix-Changelog b/gnu/usr.sbin/e2fsprogs/.fix-Changelog deleted file mode 100644 index 9da1ce9d43d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/.fix-Changelog +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -FILES=`find . -name ChangeLog -print` - -header=/tmp/revheader - -for i in $FILES -do - echo $i - cat $header $i > $i.new - mv $i.new $i -done diff --git a/gnu/usr.sbin/e2fsprogs/.head-Changelog b/gnu/usr.sbin/e2fsprogs/.head-Changelog deleted file mode 100644 index d62d0a2e7f8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/.head-Changelog +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -for i in `find . -name ChangeLog -print` -do - echo "==========================================" - echo $i - sed -n '1,/Release/p' $i -done - diff --git a/gnu/usr.sbin/e2fsprogs/.missing-copyright b/gnu/usr.sbin/e2fsprogs/.missing-copyright deleted file mode 100644 index d99cb32e6aa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/.missing-copyright +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -find . -type f \! -name \*~ \! -exec grep -q Begin-Header \{\} \; -print \ - | grep -v ^./build diff --git a/gnu/usr.sbin/e2fsprogs/.release-checklist b/gnu/usr.sbin/e2fsprogs/.release-checklist deleted file mode 100644 index c8304888c50..00000000000 --- a/gnu/usr.sbin/e2fsprogs/.release-checklist +++ /dev/null @@ -1,24 +0,0 @@ -1) Do "make depend" if necessary - -2) "make check"!!! - -3) Use ./.head-Changelog to assemble release notes. - -4) Update files which contain version information - version.h - README - RELEASE-NOTES - e2fsprogs-VER.lsm - e2fsprogs-VER.spec - doc/libext2fs.texinfo (three places) - -5) Update ChangeLog files using ./.fix-ChangeLogs - -6) Make source distribution - -7) Build RPM files - -8) Build ELF binary distribution - -9) Adjust sizes in e2fsprogs-VER.lsm; rebuild source files; rebuild RPM files - diff --git a/gnu/usr.sbin/e2fsprogs/COPYING b/gnu/usr.sbin/e2fsprogs/COPYING deleted file mode 100644 index afc22cd5a42..00000000000 --- a/gnu/usr.sbin/e2fsprogs/COPYING +++ /dev/null @@ -1,23 +0,0 @@ -This package, the EXT2 filesystem utilities, are protected by the GNU -Public License, with the following exception --- - - If the version string in the file version.h contains the - string "pre-", then this package must be distributed in source - form only. You can give a copy of the binary for e2fsck to - help a friend recover his or her filesystem, as the need - arises. However, "pre" indicates that this release is under - development, and availble for ALPHA testing. So for your - protection as much as mine, I'd rather not have it appear in a - some distribution --- especially not a CD-ROM distribution! - -The most recent officially distributed version can be found on -tsx-11.mit.edu, in /pub/linux/packages/ext2fs. If you need to make a -distribution, that's the one you should use. If there is some reason -why you'd like a more recent version that is still in ALPHA testing -for your distribution, please contact me (tytso@mit.edu), and we can -see if we can't come to an arrangement. The release schedules for -this package are flexible, if you give me enough lead time. - - - Theodore Ts'o - 26-Mar-97 diff --git a/gnu/usr.sbin/e2fsprogs/ChangeLog b/gnu/usr.sbin/e2fsprogs/ChangeLog deleted file mode 100644 index d13fc23d4bd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/ChangeLog +++ /dev/null @@ -1,214 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Tue Apr 22 10:48:03 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: Add explicit check to see if linker accepts - -static (since even Linux systems might not work if - libc.a isn't installed). - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Wed Jan 15 11:37:36 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * config.sub (basic_machine): Added i686-* as another name for the - Pentium Pro. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Mon Oct 7 08:22:31 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (all): Don't run "make check" by default. User - should manually run "make check" if they wish to test - things out. - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Sat Aug 31 10:55:45 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in (AC_CHECK_FUNCS): Add fchown to list of functions - that we check. - -Wed Aug 28 14:42:12 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * configure.in (usr_prefix): To be slightly more conformant with - the coding standards, always default to ${prefix} - unless on a linux system with prefix = ''. Allow - --with-usr-prefix option. - -Tue Aug 27 16:53:29 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * configure.in (AC_CHECK_HEADERS): Add net/if.h & netinet/in.h. - Add `--enable-fsck' switch, to allow configuration of - fsck wrapper building (default yes except on the hurd). - Make '' prefix default and LDFLAG_STATIC hacks work on - the hurd as well as linux. - -Tue Aug 27 16:23:56 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: Check to see if sys/types.h defines ino_t. Add - support for checking/sizing "long long". - -Wed Aug 21 00:44:22 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: Added configure flag --enable-old-bitops, which - forces the bitops to use the standard bitmask operations. - -Fri Aug 9 08:29:00 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: Check for existence of sys/utsname.h and - strcasecmp(). Remove check for EXT2 fragment in system - header file. E2fsprogs now deals with the fragment fields - by dispatching off of the OS field. - -Tue Aug 6 14:34:19 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in (AC_OUPUT): Create substitutions for the uuid - library. - - * MCONFIG.in (all): Add new variables for the uuid library. - -Thu May 23 12:39:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: Make the default prefix be '' for Linux. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Thu May 16 09:38:40 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: - MCONFIG.in: Man pages, shell scripts and include files are now - generated using the lib/substitute_sh script. This is - faster than the configure substitution, and it doesn't - change the mod time of the file if it hasn't changed, - which prevents needless compilation of files. - - Define new sets of Makefile variables: LIBSS, LIBCOM_ERR, - LIBEXT2FS, LIBE2P, and their static and profiled variants, - STATIC_* and PROFILED_*, which point to the actual file of - the shared or static library. This way makefiles can link - directly with exactly the library they want. Many ld's - (include GNU ld) have a really broken idea of how -L - works, and will link against an older library in /usr/lib - even though there is a newer on in a specified -L directory. - -Wed May 15 21:40:22 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * configure.in: Add support for --enable-dynamic-e2fsck, for - people who don't want to link e2fsck statically. This - saves space, at the cost of increasing the reliance of - e2fsck other files (3-4 shared libraries). - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -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.in (bin-tree): Add Makefile target which automatically - generates the binary distribution for e2fsprogs. - - diff --git a/gnu/usr.sbin/e2fsprogs/INSTALL b/gnu/usr.sbin/e2fsprogs/INSTALL deleted file mode 100644 index 0c3d4637684..00000000000 --- a/gnu/usr.sbin/e2fsprogs/INSTALL +++ /dev/null @@ -1,65 +0,0 @@ - To install the second extended file system management programs, -just follow the steps: - -1) Change directory into the top of the e2fsprogs source tree - -2) Create a build directory and cd into it: - - mkdir build; cd build - -3) Run the configure script - - ../configure - - 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) Check to make sure the installation built correctly: - - make check - -6) Install the programs - - Run `make install' - -7) 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 -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). - -8) 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. - -9) 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. - diff --git a/gnu/usr.sbin/e2fsprogs/INSTALL.dllbin b/gnu/usr.sbin/e2fsprogs/INSTALL.dllbin deleted file mode 100644 index 234c1f02c15..00000000000 --- a/gnu/usr.sbin/e2fsprogs/INSTALL.dllbin +++ /dev/null @@ -1,51 +0,0 @@ -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-1.04-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-1.04-dllbin.tar.gz | (cd /; tar Sxvpf - ) - -2) Run ldconfig to update the shared library pointers. - - As root, type /sbin/ldconfig. This will update the links to -the shared libraries included in the distribution. You can then remove -the old versions of the libraries from /lib. - -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/gnu/usr.sbin/e2fsprogs/INSTALL.elfbin b/gnu/usr.sbin/e2fsprogs/INSTALL.elfbin deleted file mode 100644 index fab2858de3b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/INSTALL.elfbin +++ /dev/null @@ -1,48 +0,0 @@ -NOTE: This is the ELF version of the binary distribution. If you have -a DLL system, please compile e2fsprogs from sources yourself. - - 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-1.09-elfbin.tar.gz | (cd /; tar Sxvpf - ) - -2) Run ldconfig to update the shared library pointers. - - As root, type /sbin/ldconfig. This will update the links to -the shared libraries included in the distribution. You can then remove -the old versions of the libraries from /lib. - -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/gnu/usr.sbin/e2fsprogs/MCONFIG.in b/gnu/usr.sbin/e2fsprogs/MCONFIG.in deleted file mode 100644 index f01e4e2f83c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/MCONFIG.in +++ /dev/null @@ -1,169 +0,0 @@ -# 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 -infodir = $(usr_prefix)/info - -@SET_MAKE@ - -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -CC = @CC@ -DEFS = @DEFS@ -CFLAGS = @CFLAGS@ -ALL_CFLAGS = $(CPPFLAGS) $(DEFS) $(WFLAGS) $(CFLAGS) $(XTRA_CFLAGS) \ - -I$(top_builddir)/lib -I$(top_srcdir)/lib $(LINUX_INCLUDE) -LDFLAGS = @LDFLAGS@ -ALL_LDFLAGS = $(LDFLAGS) -RM = @RM@ -LN = @LN@ -LN_S = @LN_S@ -MV = @MV@ -CP = @CP@ -CHMOD = @CHMOD@ -AR = @AR@ -AWK = @AWK@ -SED = @SED@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -LD = $(PURE) @CC@ -ARUPD = $(AR) r - -# -# Library definitions -# -LIB = $(top_builddir)/lib -LIBSS = $(LIB)/libss@LIB_EXT@ -LIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@ -LIBE2P = $(LIB)/libe2p@LIB_EXT@ -LIBEXT2FS = $(LIB)/libext2fs@LIB_EXT@ -LIBUUID = $(LIB)/libuuid@LIB_EXT@ @SOCKET_LIB@ - -STATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@ -STATIC_LIBCOM_ERR = $(LIB)/libcom_err@STATIC_LIB_EXT@ -STATIC_LIBE2P = $(LIB)/libe2p@STATIC_LIB_EXT@ -STATIC_LIBEXT2FS = $(LIB)/libext2fs@STATIC_LIB_EXT@ -STATIC_LIBUUID = $(LIB)/libuuid@STATIC_LIB_EXT@ @SOCKET_LIB@ - -PROFILED_LIBSS = $(LIB)/libss@PROFILED_LIB_EXT@ -PROFILED_LIBCOM_ERR = $(LIB)/libcom_err@PROFILED_LIB_EXT@ -PROFILED_LIBE2P = $(LIB)/libe2p@PROFILED_LIB_EXT@ -PROFILED_LIBEXT2FS = $(LIB)/libext2fs@PROFILED_LIB_EXT@ -PROFILED_LIBUUID = $(LIB)/libuuid@PROFILED_LIB_EXT@ @SOCKET_LIB@ - -# -# 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@ - -# -# A fast substitution command for fixing up man pages, shell scripts, etc. -# -SUBSTITUTE= $(top_builddir)/lib/substitute_sh - -# -# 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 -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:: - -# -# Autoconf magic... -# - -$(top_builddir)/config.status: $(top_srcdir)/configure - (cd $(top_builddir); ./config.status --recheck) - -$(top_builddir)/MCONFIG: $(top_srcdir)/MCONFIG.in $(top_builddir)/config.status - (cd $(top_builddir); CONFIG_FILES=MCONFIG ./config.status) - -$(top_builddir)/lib/substitute_sh: $(top_srcdir)/lib/substitute_sh.in \ - $(top_builddir)/config.status - (cd $(top_builddir); CONFIG_FILES=lib/substitute_sh ./config.status) - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/MCONFIG \ - $(top_builddir)/config.status - (cd $(top_builddir); CONFIG_FILES=$(my_dir)/Makefile ./config.status) - -$(top_srcdir)/configure: $(top_srcdir)/configure.in - cd $(top_srcdir) && autoconf - -# -# Make depend magic... -# - -.depend: Makefile $(SRCS) $(top_srcdir)/depfix.sed - if test -n "$(SRCS)" ; then \ - $(CC) -M $(ALL_CFLAGS) $(SRCS) | \ - sed -f $(top_srcdir)/depfix.sed \ - -e 's; $(srcdir)/; $$(srcdir)/;g' \ - -e 's; $(top_srcdir)/; $$(top_srcdir)/;g' \ - -e 's; $(top_builddir)/; $$(top_builddir)/;g' \ - -e 's; \./; ;g' \ - -e '/^ *\\$$/d' > .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/gnu/usr.sbin/e2fsprogs/Makefile.bsd-wrapper b/gnu/usr.sbin/e2fsprogs/Makefile.bsd-wrapper deleted file mode 100644 index 941bb8b06d9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/Makefile.bsd-wrapper +++ /dev/null @@ -1,74 +0,0 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.2 1997/09/05 07:16:25 kstailey Exp $ - -MAN= misc/badblocks.8 misc/chattr.1 misc/dumpe2fs.8 misc/lsattr.1 \ - misc/mklost+found.8 misc/mke2fs.8 misc/tune2fs.8 - -MANLOCALBUILD= yes - -MANALL= ${MAN:S/.1/.cat1/g:S/.8/.cat8/g} - -.SUFFIXES: .1 .cat1 .8 .cat8 - -.1.cat1: .8.cat8: - @echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}" - @${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || (rm -f ${.TARGET}; false) - -CLEANFILES= ${MANALL} - -PROGS= misc/badblocks misc/chattr misc/dumpe2fs misc/lsattr \ - misc/mklost+found misc/mke2fs misc/tune2fs - -all: config.status - ${MAKE} LDFLAGS=${LDSTATIC} - -.FORCE: .IGNORE - -.ifdef GLOBAL_AUTOCONF_CACHE -CF= --cache-file=${GLOBAL_AUTOCONF_CACHE} -.else -CF= -.endif - -config: .FORCE -.ifndef GLOBAL_AUTOCONF_CACHE - -rm -f config.cache -.endif - /bin/sh ${.CURDIR}/configure --prefix=/usr --bindir=/usr/sbin ${CF} - -config.status: - /bin/sh ${.CURDIR}/configure --prefix=/usr --bindir=/usr/sbin ${CF} - -.if !defined(NOMAN) -install: ${MANALL} maninstall - @for i in ${PROGS}; do \ - j="${INSTALL} ${INSTALL_COPY} -s -o ${BINOWN} -g ${BINGRP} -m 555 \ - $$i ${DESTDIR}/usr/sbin"; \ - echo $$j; \ - eval "$$j"; \ - done -.else -install: - @for i in ${PROGS}; do \ - j="${INSTALL} ${INSTALL_COPY} -s -o ${BINOWN} -g ${BINGRP} -m 555 \ - $$i ${DESTDIR}/usr/sbin"; \ - echo $$j; \ - eval "$$j"; \ - done -.endif - -clean cleandir: - rm -f ${CLEANFILES} - -@if [ -e Makefile ]; then ${MAKE} distclean; fi - -depend: - # Nothing here so far... - -lint: - # Nothing here so far... - -tags: - # Nothing here so far... - -.include <bsd.obj.mk> -.include <bsd.subdir.mk> -.include <bsd.man.mk> diff --git a/gnu/usr.sbin/e2fsprogs/Makefile.in b/gnu/usr.sbin/e2fsprogs/Makefile.in deleted file mode 100644 index d0401d4d3d9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/Makefile.in +++ /dev/null @@ -1,110 +0,0 @@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = . -my_dir = . -INSTALL = @INSTALL@ - -@MCONFIG@ - -LIB_SUBDIRS=lib/et lib/ss lib/ext2fs lib/e2p lib/uuid -#PROG_SUBDIRS=e2fsck debugfs misc tests/progs -PROG_SUBDIRS=misc -SUBDIRS=$(LIB_SUBDIRS) $(PROG_SUBDIRS) tests - -SUBS= include/linux/types.h - -TAR=tar - -all:: $(SUBS) libs progs docs - -progs: $(SUBS) all-progs-recursive -libs: $(SUBS) all-libs-recursive - -docs: - (cd doc; make libext2fs.info) - -install-doc-libs: - (cd doc; make install-doc-libs) - -install: all-libs-recursive install-progs-recursive \ - install-shlibs-libs-recursive install-doc-libs - (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 - $(RM) -f $(SUBS) - -distclean: distclean-recursive distclean-local - -realclean: realclean-recursive realclean-local - -include/linux/types.h: $(SUBSTITUTE) $(srcdir)/include/linux/types.h.in - -chmod +x $(SUBSTITUTE) - $(SUBSTITUTE) $(srcdir)/include/linux/types.h.in \ - include/linux/types.h - -mostlyclean-local: - $(RM) -f \#* *~ core MAKELOG -clean-local: mostlyclean-local -distclean-local: clean-local - $(RM) -f include/linux/types.h $(SUBSTITUTE) - $(RM) -f config.status config.log config.cache MCONFIG Makefile -realclean-local: distclean-local - $(RM) -f configure - -check: - (cd tests; make check) - -distribution_tar_file: - rm -rf /tmp/dest - make DESTDIR=/tmp/dest install - cd .. - cp -r $(srcdir)/README $(srcdir)/install-utils /tmp/dest - cp $(srcdir)/INSTALL.@BINARY_TYPE@ /tmp/dest/INSTALL - (cd /tmp/dest; $(TAR) cf - . ) | gzip -9 \ - > e2fsprogs-@E2FSPROGS_VERSION@-@BINARY_TYPE@.tar.gz - -SRCROOT = `echo e2fsprogs-@E2FSPROGS_VERSION@ | sed -e 's/-WIP//' \ - -e 's/pre-//'` - -$(srcdir)/.exclude-file: - (cd $(srcdir)/.. ; find $(SRCROOT) \( -name \*~ -o -name \*.orig \ - -o -name \*.rej \) -print > $(SRCROOT)/.exclude-file) - echo "$(SRCROOT)/build" >> $(srcdir)/.exclude-file - echo "$(SRCROOT)/rpm.log" >> $(srcdir)/.exclude-file - echo "$(SRCROOT)/.exclude-file" >> $(srcdir)/.exclude-file - echo $(SRCROOT)/e2fsprogs-@E2FSPROGS_VERSION@.tar.gz \ - >> $(srcdir)/.exclude-file - - -source_tar_file: $(srcdir)/.exclude-file - (cd $(srcdir) ; $(TAR) -C .. -c -v -f - \ - -X .exclude-file $(SRCROOT) | \ - gzip -9 > e2fsprogs-@E2FSPROGS_VERSION@.tar.gz) - rm -f $(srcdir)/.exclude-file diff --git a/gnu/usr.sbin/e2fsprogs/README b/gnu/usr.sbin/e2fsprogs/README deleted file mode 100644 index 1062056113e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/README +++ /dev/null @@ -1,49 +0,0 @@ - This is the new version (1.10) of the second extended file system -management programs. - - Note: If you are using the RedHat RPM distributions of -e2fsprogs, don't worry about the next paragraph; all others, please -read on! - - See the file INSTALL for instructions on building and -installing e2fsprogs. This is important! Note that your /etc/fstab -file may need modifying before you install the new fsck program. See -the INSTALL file for more details. - - This version contains programs written by Theodore Ts'o and Remy Card. -This distribution was packaged by Ted and Remy with the help of Stephen Tweedie -and Alexy Vovenko. - - The programs written or rewritten by Ted are: - - libext2fs: a new library containing entries to access the control - structures of a second extended file system. - - e2fsck: a new file system checker which uses optimized routines. - This new checker is much more efficient and safer than the old - e2fsck. - - mke2fs: a new file system creator which uses the ext2fs library. - - debugfs: a file system debugger which can be used to examine and - change the state of a file system. Use it with caution since it - can corrupt file systems if you are not careful. - - fsck: a new fsck front-end. This new fsck can run multiple - several file system checks simultanously if they are on different - disks. - - The programs written by Remy are: - - badblocks: a new bad blocks checker. It can be run by the super - user to search for bad blocks on a device and can also be called - by e2fsck and mke2fs. - - dumpe2fs: a new program which displays the control structure of - a file system. To understand the output of this program, one needs - to know the physical structure of a second extended file system. - - mklost+found: re-creates a lost+found directory if it has been - deleted. - - tune2fs: adjusts tunable paramaters on a file system. - - chattr: changes files attributes and version. - - lsattr: lists files attributes and version. - - Manual pages are included in this package. - - In case of bugs in these programs, please contact Ted -<tytso@mit.edu> and Remy <card@masi.ibp.fr>. See the e2fsck man page -for suggestions of what sort of information to include when submitting -bug reports for e2fsck. diff --git a/gnu/usr.sbin/e2fsprogs/RELEASE-NOTES b/gnu/usr.sbin/e2fsprogs/RELEASE-NOTES deleted file mode 100644 index 360f0ecddad..00000000000 --- a/gnu/usr.sbin/e2fsprogs/RELEASE-NOTES +++ /dev/null @@ -1,532 +0,0 @@ -E2fsprogs 1.10 (April 24, 1997) -=============================== - -Mke2fs once again defaults to creating revision #0 filesystems, since -people were complaining about breaking compatibility with 1.2 kernels. -Warning messages were added to the mke2fs and tune2fs man pages that -the sparse superblock option isn't supported by most kernels yet (1.2 -and 2.0 both don't support parse superblocks.) - -Added new flag to mke2fs, -R <raid options>, which allows the user to -tell mke2fs about the RAID configuration of the filesystem. Currently -the only supported raid option is "stride" which specifies the width -of the RAID stripe. - -Fixed bug in e2fsck where pass1b would bomb out if there were any -blocks marked bad in the inode table. - -Fixed rare bug in mke2fs where if the user had a very unlucky number -of blocks in a filesystem (probability less than .002) the resulting -filesystem would be corrupt in the last block group. - -Fixed bug where if e2fsck tried to allocate a block to fix a -filesystem corruption problem and the filesystem had no free blocks, -ext2fs_new_block() would loop forever. - -The configure script now checks explicitly to see if "-static" works, -since that can't be assumed to be true --- RedHat doesn't install -libc-static by default. - -Fixed bug in libext2's block iterator functions where under some -cirmcustances, file with holes would cause the bcount parameter to the -callback function to be incorrect. This bug didn't affect any of -e2fsprogs programs, but it was discovered by Paul Mackerras, the -author of the PPC boot loader. - -Removed use of static variables to store the inode cache in libext2fs. -This caused problems if more than one filesystem was accessed via -libext2fs (static variables in libraries are generally a bad idea). -Again, this didn't affect e2fsprogs programs, but it was discovered by -Paul Mackerras. - -Fixed minor bugs and version code drift to assure that e2fsprogs 1.10 -will compile cleanly with 1.2.13 kernels (even with a.out shared -libraries!) - -Programmer's notes: -------------------- - -Added new functions to duplicate an ext2 filesystem handle, and its -associated substructure. New functions: ext2fs_dup_handle(), -ext2fs_copy_dblist(), ext2fs_badblocks_copy(), ext2fs_copy_bitmap(). -Other structures, such as the io_channel and the inode_cache, now have -a ref count so that they only get freed when they are no longer used -by any filesystem handle. (These functions were added as part of the -development effort for an ext2 resizer). - -E2fsprogs 1.09 (April 14, 1997) -=============================== - -Fixed bug in mke2fs (really in lib/ext2fs/initialize.c) which was -accidentally introduced in the 1.08 release. The overhead calculation -was accidentally removed, which caused ext2fs_initialize() to not -notice when the filesystem size needed to be adjusted down because -there wasn't enough space in the last block group. - -Fixed bug in version parsing library routine; it was always parsing -the library version string, instead of using the passed-in string. - -Clarified chattr man page. - -E2fsprogs 1.08 (April 10, 1997) -=============================== - -E2fsck 1.07 was very slow when checking very large filesystems with a -lot of files that had hard links (i.e., news spools). This was fixed -by seriously revamping the icount abstraction. Added a formal test -suite for the icount abstraction. - -Debugfs now has a "-l" option to the "ls" command, which lists the -inode number, permissions, owner, group, size, and name of the files -in the directory. - -Fix a bug in e2fsck where when a directory had its blocks moved to -another location during the pass 1b processing, the directory block -list wasn't updated, so pass 2 wouldn't check (and correct) the -correct directory block. - -E2fsck will now treat inodes which contain blocks which are claimed by -the filesystem metadata by treating them as multiply claimed blocks. -This way, the data in those blocks can be copied to a new block during -the pass 1b--1d processing. - -E2fsck will attempt to determine the correct superblock number and -display it in the diagnostic and warning messages if possible. - -Add support for a new (incompatible) feature, "sparse_super". This -feature reduces the number of blocks which contain copies of backup -superblocks and block group descriptors. (It is only an incompatible -feature because of a bug in ext2_free_blocks.) mke2fs and tune2fs now -support a new -s option; e2fsck will recognize filesystems built with -this feature turned on. - -E2fsck now checks the library to make sure is the correct version, -using new library functions. (This helps to diagnose incorrectly -installed e2fsprogs distributions.) - -Dumpe2fs now prints more information; its now prints the the -filesystem revision number, the filesystem sparse_super feature (if -present), the block ranges for each block group, and the offset from -the beginning of the block group. - -Mke2fs now distributes the inode and block bitmap blok so that the -won't be concentrated in one or two disks in RAID/striping setups. -Also, if the user chooses a 2k or 4k block group, mke2fs will try to -choose the largest blocks per group that be chosen. (For 2k blocks, -you can have up to 16384 blocks/group; for 4k blocks, you can have up -to 32768 blocks/group.) Previously mke2fs would not allow -specification of more than 8192 blocks per group, even if you were -using a 2k or 4k block group. - -Programmer's notes: -------------------- - -Added a new function ext2fs_create_icount2() which takes a "hint" -argument. This hint argument presets the icount array with the list -of inodes which actually need to be in the icount array. This really -helps to speed up e2fsck. - -Added a new function ext2fs_icount_validate() which checks the rep -invariant for the icount structure. This is used mostly for testing. - -The error mesasage given when a bad inode number is passed to -test_generic_bitmap to reflect EXT2FS_TEST_ERROR (instead of -EXT2FS_UNMARK_ERROR). - -Added a new function ext2fs_set_dir_block which sets the block of a -dblist entry, given the directory inode and blockcnt. - -Added a new function ext2fs_get_library_version() which returns the -current library version, and ext2fs_parse_version_string() which -returns a version number based on a e2fsprogs version string. - -The icount functions will return EINVAL if the passed in inode number -is out of bounds. - -E2fsprogs 1.07 (March 9, 1997) -============================== - -E2fsck is now uses much less memory when checking really large -filesystems (or rather, filesystems with a large number of inodes). -Previously a filesystem with 1 million inodes required 4 megabytes of -memory to store inode count statistics; that storage requirement has -now been reduced to roughly half a megabyte. - -E2fsck can now properly deal with bad blocks appearing inside the -inode table. Instead of trying to relocate the inode table (which -often failed because there wasn't enough space), the inodes in the bad -block are marked as in use. - -E2fsck will automatically try to use the backup superblocks if the -primary superblocks have a bad magic number or have missing meta-data -blocks (or meta-data blocks which are out of range). - -E2fsck's pass 3 has been made more efficient; most noticeable on -filesystems with a very large number of directories. - -Completely revamped e2fsck's system of printing problem reports. It -is now table driven, to make them more easily customizeable and -extendable. Error messages which can be printed out during preen mode -are now one line long. - -Fixed e2fsck's filesystem swapping code so that it won't try to swap -fast symbolic links or deleted files. - -Fixed e2fsck core dumping when fixing a filesystem which has no -directories (not even a root directory). - -Added a check to e2fsck to make sure that the length of every -directory entry is a multiple of 4 (since the kernel complains if it -isn't). - -Added a check to e2fsck to make sure that a directory entry isn't a -link to the root directory, since that isn't allowed. - -Added a check to e2fsk to now make sure the '.' and '..' directory -entries are null terminated, since the 2.0 kernel requires it. - -Added check to write_bitmaps() to make sure the superblock doesn't get -trashed if the inode or block bitmap is marked as being block zero. - -Added checking of the new feature set fields in the superblock, to -avoid dealing with new filesystem features that this package wasn't -set up to handle. - -Fixed a fencepost error in ext2fs_new_block() which would occasionally -try to allocate a block beyond the end of a filesystem. - -When the UUID library picks a random IEEE 802 address (because it -can't find one from a network card), it sets the multicast bit, to -avoid conflicting with a legitimate IEEE 802 address. - -Mke2fs now sets the root directory's owner to be the real uid of the -user running mke2fs. If the real uid is non-zero, it also sets -the group ownership of the root directory to be the real group-id of -the user running mke2fs. - -Mke2fs now has more intelligent error checking when it is given a -non-existent device. - -When badblocks is given the -vv option, it now updates the block that -it is currently testing on every block. - -Fixed a bug in fsck where it wouldn't modify the PATH envirnoment -currently correctly if PATH wasn't already set. - -Shared libraries now built with dependencies. This allows the shared -library files to be used with dlopen(); it also makes the transition -to libc 6 easier, since ld.so can tell which libc a particular shared -library expects to use. - -Programmer's notes: -------------------- - -Added new abstraction (defined in dblist.c) for maintaining a list of -blocks which belongs to directories. This is used in e2fsck and other -programs which need to iterate over all directories. - -Added new functions which test to see if a contiguous range of blocks -(or inodes) are available. (ext2fs_*_bitmap_range). - -Added new function (ext2_inode_has_valid_blocks) which returns true if -an inode has valid blocks. (moved from e2fsck code). - -Added new function (ext2fs_allocate_tables) which allocates the -meta-data blocks as part of initializing a filesystem. (moved from -mke2fs code). - -Added a new I/O manager for testing purposes. It will either allow a -program to intercept I/O requests, or print debugging messages to -trace the activity of a program using the I/O manager. - -The badblocks_list functions now store the bad blocks in a sorted -order, and use a binary search to speed up badblocks_list_test. - -The inode scan function ext2fs_get_next_inode() may now return a soft -error returns: MISSING_INODE_TABLE and BAD_BLOCK_IN_INODE_TABLE in -those cases where part of an inode table is missing or there is a bad -block in the inode table. - -Added a new function (ext2fs_block_iterate2) which adds new arguments to -the callback function to return a pointer (block and offset) to the -reference of the block. - -Added new function (ext2fs_inode_scan_goto_blockgroup) which allows an -application to jump to a particular block group while doing an inode -scan. - -The badblocks list functions were renamed from badblocks_* to -ext2fs_badblocks_*. Backwards compatibility functions are available -for now, but programs should be modified to use the new interface. - -Some of the library functions were reorganized into separate files to -reduce the size of some programs which statically link against the -ext2 library. - -Put in some miscellaneous fixes for the Alpha platform. - - -E2fsprogs 1.06 (October 7, 1996) -================================ - -Fixed serious bug in e2fsck: if the block descriptors are bad, don't -smash the backup copies in ext2fs_close(). (The problem was that when -e2fsck -p discovered the problem, while it was closing the filesystem -and exiting, it was also blowing away the backup superblocks on the -disk, which was less than friendly.) We now make it the case that we -only write out the backup superblock and the back block descriptors if -the filesystem is completely free from problems. - -Fixed a bug in block_interate in the lib/ext2fs library which caused -e2fsck to fail on GNU Hurd-created filesystems. - -Add support for Linux/FT's bootloader, which actually uses -EXT2_BOOT_LOADER, and sets its mode bits which caused e2fsck to want -to clear the inode. - -Add support for the "A" (no atime update) attribute. (Note: this -attribute is not yet in production kernels.) - -The test suite is not automatically run when doing a "make all" from -the top level directory. Users should manually run "make check" if -they wish to run the test suite. - -Upon a preenhalt(), make the printed message more explicit that -running e2fsck "MANAULLY" means without the -p or -a options. - -In e2fsck, if a disconnected inode is zero-length, offer to clear it -instead of offering to connect it to lost+found. - -In e2fsck, if a filesystem was just unmounted uncleanly, and needs -e2fsck to be run over it, change e2fsck to explicitly display this -fact. - -For dumpe2fs and e2fsck, cause the -V option to print out which -version of the ext2fs library is actually getting used. (This will -help detect mismatches of using a 1.06 utility with a 1.05 library, -etc.) - -Programmers' notes: -------------------- - -EXT2_SWAP_BYTES was changed to EXT2_FLAG_SWAP_BYTES, which better fits -the naming convention. - -In ext2fs_initialize(), make sure the description for the inode bitmap -is correctly initialize. - -Fixed minor type typo in ext2fs_allocate_generic_bitmap(); - -E2fsprogs 1.05 (September 7, 1996) -================================== - -Add support for new fields in the ext2 superblock --- volume name, -volume UUID, and last mounted field. Dumpe2fs displays these fields, -tune2fs and mke2fs allows you to set them. E2fsck will automatically -generate a UUID for those volumes that don't have them. - -Put in support for e2fsck to recognize HURD specific ext2 features --- -most notably, the translator block. The e2fsprogs tools will now use -the creator_os field in the superblock to correctly handle different -OS-specific variants of the ext2 filesystem. - -E2fsck now fixes inodes which have a the deletion time set, but which -have a non-zero i_link_count field by offering to clear the deletion -time. Previously e2fsck assumed that the inode was deleted (per 0.3c -ext2 kernel behavior) and offered to unlink the file. - -If e2fsck sets the clean bit, but nothing else, set the exit code -FSCK_NONDESTRUCT. After all, e2fsck did fix a filesystem error --- it -set the filesystem valid bit when it was previously cleared. :-) This -was needed to make the HURD fsck driver happy. - -If the user refuses to attach an unattached inode, e2fsck will no -longer set the inode's link count. Otherwise, the inode would end up -getting marked as unused, which might cause loss of data later. - -Make the message issued by e2fsck when the superblock is corrupt less -confusing for users. It now mentions that another reason for the -"corrupt superblock" message might be that the partition might not be -an ext2 filesystem at all (it might swap, msdos filesystem, ufs, etc.) - -Make the libext2 library more robuest so that e2fsck won't coredump on -an illegal superblock where the blocksize is zero. (f_crashdisk is -the test case). - -By default, create filesystems where the default checkinterval is 6 -months (180 days). Linux servers can be robust enough that 20 reboots -can be a long, long time. - -Added configure flag --enable-old-bitops, which forces the bitops to -use the old (native) bitmask operations. By default on the sparc -platform, the standard ext2 bit ordering is now used. - -Added a new feature to e2fsck to byte-swap filesystems; this can be -used to convert old m68k filesystems to use the standard byte-order -storage for the superblock, inodes, and directory blocks. This -function is invoked by using the '-s' option to e2fsck. - -Debugfs's "dump" command has been enhanced so that it writes out the -exact size of the file so that the nulls at the end of the file are -eliminated. The command also accept a new "-p" option which will -attempt preserve to preserve the ownernship, permissions, and -file modification/access times. - -Debugfs has two new options, -f and -R. The -R option allows the user -to execute a single debugfs command from the command line. The -f -option allows the user to specify a "command file" containing debugfs -commands which will get executed. - -Dumpe2fs now pretty prints the check interval, instead of just -printing the check interval as a number of seconds. - -Fix bugs in debugfs: the params command when no filesystem is opened -no longer causes a core dump. It is now possible to unlink a file -when a pathame containing a '/' is specified. - -Tune2fs has a new -C option which sets the number of times the -filesystem has been mounted. - -Fix the chattr '-v' option so that it actually works. Chattr was -being buggy about the -v option parsing. - -Programmers' notes: -------------------- - -The directory lib/uuid contains a set of library routines to generate -DCE compatible UUIDs. - -Extended ext2fs_namei() to handle symbolic links. Added new function -ext2fs_nami_follow() which will follow last symbolic link in the case -where the pathname points to a sym link. - -The ext2fs_block_iterate function will now return the HURD translator -block, if present. The new flag BLOCK_FLAG_DATA_ONLY will cause the -iterator to return data blocks only. The ext2fs.h file now defines -constants BLOCK_COUNT_IND, BLOCK_COUNT_DIND, BLOCK_COUNT_TIND, and -BLOCK_COUNT_TRANSLATOR, which are the magic values passed in the block -count field of the iterator callback function. - -The test script driver now takes an optional second argument, which is -the test case to be run. This allows you to run a test case without -needing to run the entire test suite. - -On Linux ELF systems, install the .so files in the correct places -(/usr/lib). The .so files must be stored in the same directory as the -.a files. - -Fixed miscellaneous HURD compilation issues with header file being -included in the right order. - -Fixed debugfs so that it resets optind to zero, not one, since setting -optind to zero is more correct. - - -E2fsprogs 1.04 (May 16, 1996) -============================= - -First "official" (1.03 was a limited release only) to support building -e2fsprogs under Linux 2.0 kernels (as well as late model 1.3 and 1.99 -kernels). - -This package includes a RPM specs file, that it can be built using the -RedHat Package Manager. - -E2fsck now prints a hint that if there are lots of incorrectly located -inode bitmaps, block bitmaps, and inode table blocks, the user might -want to try using e2fsck -b 8193 first, to see if that fares any -better. - -For ext2 filesystem written with the hurd, debugfs will now print out -the translator field when printing an inode structure. - -Lots of miscellaneous linking/installation cleanups: - - Libraries are now linked using a relative pathname, instead of - relying on -L working correct. It doesn't, in many cases, including - current versions of GNU ld. This guarantees that the build tree is - linking with the right libraries, instead of the ones installed in - /usr/lib. - - Header files, man pages, and the et/ss shell scripts are now - generated using a custom substitution script, instead of relying on - the configure script. This prevents needless recompilation of - files; in addition, the custom substitution script is much faster. - - e2fsck may now be linked dynamically, by using the - --enable-dynamic-e2fsck flag to configure. This is not recommended, - since it increases e2fsck's dependence on other files, but some - people need to save disk space, and other critical programs on their - systems were being linked dynamically anyway. - - Programs such as fsck which didn't need to be linked against - libext2fs (or mke2fs which didn't need to be linked against libe2p) - only link against libraries they actually need. Otherwise, those - programs would require the presense of libraries that otherwise - could be removed from a rescuse diskette. - - The ss include files are now installed correctly so they can - actually be used by another package. - - If the profiling libraries are built, they are now installed on a - "make install-libs". - - -E2fsprogs 1.03 (March 27, 1996) -=============================== - -Change the m68k bit numbering for bitmasks to match the bit numbering -used by all other ext2 implementations. (This change was requested by -the m68k kernel development team.) - -Support (in-development) filesystem format revision which supports -(among other things) dynamically sized inodes. - -Fixed a bug in the ext2 library so that an intelligent error is -returned if mke2fs is run with a ridiculously small number of blocks -for a partition. - -Fixed a bug in the ext2 library which required that the device be -openable in read/write mode in order to determine its size. This -caused e2fsck -n to require read/write access when it was not -previously necessary. - -Fixed a bug in e2fsck which casued it to occasionally fail the test -suite depending on which version of the floating point library it was -using. - -Fixed a bug in e2fsck so that it now halts with a fatal error when -certain superblock consistency checks fail. Previously it continued -running e2fsck, with some potential confusing/damaging consequences. - -Added new flag to fsck which allows the root to be checked in parallel -with other filesytems. This is not the safest thing in the world to -do, but some system administrators really wanted it. - -Fixed -Wall flames in lib/ss. - - -E2fsprogs 1.02 (January 16, 1996) -================================= - -Fix to allow e2fsprogs to be compiled on recent 1.3 (pl45+) kernels. - -Change e2fsck to print statistics of how many non-contiguous files are -on the system. Note that a file which is larger than 8k blocks, it is -guaranteed to be non-contiguous. - -In mke2fs, print a warning message if a user tries to format a whole -disk (/dev/hda versus /dev/hda1). If a user really wants to format a -whole disk, the -F (force) option forces mke2fs to format a whole disk -as a filesytem. - -Fix a bug in fsck where in some cases it might start checking -partitions in the next pass before it finishes checking partitions in -the current pass. This still won't cause two partitions on the same -disk will be checked, so it's rarely a problem in real life. - -Patch lsattr so that it won't hang when checking a named pipe. - -Minor compilation fixes: - * Fix the order of libraries that were linked in debugfs. - * Allow the sources to be compiled with -ansi turned on. diff --git a/gnu/usr.sbin/e2fsprogs/SHLIBS b/gnu/usr.sbin/e2fsprogs/SHLIBS deleted file mode 100644 index 2fcbbc33ec2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/SHLIBS +++ /dev/null @@ -1,35 +0,0 @@ -Library:libcom_err.o -Description: Common error code library -Maintainer: Theodore Ts'o -Email: tytso@mit.edu -Start: 0x66800000 -End: 0x6687ffff - -Library:libss.o -Description: Generic Subsystem library (Simple tty UI) -Maintainer: Theodore Ts'o -Email: tytso@mit.edu -Start: 0x66880000 -End: 0x668fffff - -Library:libext2fs.so -Description: The ext2fs (raw interface) library -Maintainer: Theodore Ts'o -Email: tytso@mit.edu -Start: 0x66900000 -End: 0x6697ffff - -Library:libe2p.so -Description: The e2p (ext2fs's programmers) library -Maintainer: Theodore Ts'o -Email: tytso@mit.edu -Start: 0x66980000 -End: 0x669fffff - -Library:libuuid.so -Description: DCE Universally Unique ID (UUID) library -Maintainer: Theodore Ts'o -Email: tytso@mit.edu -Start: 0x67900000 -End: 0x679fffff - diff --git a/gnu/usr.sbin/e2fsprogs/config.guess b/gnu/usr.sbin/e2fsprogs/config.guess deleted file mode 100644 index 9fce8ac2005..00000000000 --- a/gnu/usr.sbin/e2fsprogs/config.guess +++ /dev/null @@ -1,737 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 1997 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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:*:*) - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'` - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 - exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-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 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - 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:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - 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 - else echo i586-dg-dgux${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?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 [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - 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?[1679] ) 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?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i?86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - 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*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-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 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo i386-pc-cygwin32 - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin32 - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`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:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then - echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then - echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then - echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then - echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 - elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then - echo "powerpc-unknown-linux-gnu" ; exit 0 - elif test "${UNAME_MACHINE}" = "alpha" ; then - echo alpha-unknown-linux-gnu ; exit 0 - elif test "${UNAME_MACHINE}" = "sparc" ; then - echo sparc-unknown-linux-gnu ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <<EOF -main(argc, argv) -int argc; -char *argv[]; -{ -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\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 - else - # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us - # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. - test ! -d /usr/lib/ldscripts/. \ - && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - # 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-pc-linux-gnu\n", argv[1]); -#else - printf ("%s-pc-linux-gnuaout\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 - fi ;; -# 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?86:DYNIX/ptx:4*:*) - echo i386-sequent-sysv4 - exit 0 ;; - i?86:*:4.*:* | i?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}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i?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}-pc-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 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-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 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i?86:LynxOS:2.*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${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 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - 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 -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -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%d\n", __ARCHITECTURE__, version); - 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-pc-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_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - 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/gnu/usr.sbin/e2fsprogs/config.sub b/gnu/usr.sbin/e2fsprogs/config.sub deleted file mode 100644 index cd38fe44fa2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/config.sub +++ /dev/null @@ -1,871 +0,0 @@ -#! /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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, 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 - ;; - mips-arc-*) - basic_machine=mips-r4kle - ;; - 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* | -openbsd* \ - | -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/gnu/usr.sbin/e2fsprogs/configure b/gnu/usr.sbin/e2fsprogs/configure deleted file mode 100644 index 9b251a7fabf..00000000000 --- a/gnu/usr.sbin/e2fsprogs/configure +++ /dev/null @@ -1,2701 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 -# Copyright (C) 1992, 93, 94, 95, 96 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 - --with-cc=COMPILER select compiler to use" -ac_help="$ac_help - --with-linker=LINKER select linker to use" -ac_help="$ac_help - --with-ccopts=CCOPTS select compiler command line options" -ac_help="$ac_help - --with-ldopts=LDOPTS select linker command line options" -ac_help="$ac_help - --with-usr-prefx=PREFIX specify a prefix corresponding to /usr (default ${prefix})" -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" -ac_help="$ac_help - --enable-dynamic-e2fsck build e2fsck dynamically" -ac_help="$ac_help - --enable-fsck build fsck wrapper program" -ac_help="$ac_help - --enable-old-bitops Use old (non-standard but native) bitmask operations" - -# 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 -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -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 - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - 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" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$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=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --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 -EOF - cat << EOF -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 -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$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 ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -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 ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -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" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$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.12" - 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 these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; 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' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -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 - -BINARY_TYPE=bin -E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \ - | awk '{print $3}' | tr \" " " | awk '{print $1}'` -DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \ - | tr \" " "` -MONTH=`echo $DATE | awk -F- '{print $2}'` -YEAR=`echo $DATE | awk -F- '{print $3}'` - -if expr $YEAR ">" 90 >/dev/null ; then - E2FSPROGS_YEAR=19$YEAR -else - E2FSPROGS_YEAR=20$YEAR -fi - -case $MONTH in -Jan) E2FSPROGS_MONTH="January" ;; -Feb) E2FSPROGS_MONTH="February" ;; -Mar) E2FSPROGS_MONTH="March" ;; -Apr) E2FSPROGS_MONTH="April" ;; -May) E2FSPROGS_MONTH="May" ;; -Jun) E2FSPROGS_MONTH="June" ;; -Jul) E2FSPROGS_MONTH="July" ;; -Aug) E2FSPROGS_MONTH="August" ;; -Sep) E2FSPROGS_MONTH="September" ;; -Oct) E2FSPROGS_MONTH="October" ;; -Nov) E2FSPROGS_MONTH="November" ;; -Dec) E2FSPROGS_MONTH="December" ;; -*) echo "Unknown month $MONTH??" ;; -esac - -unset DATE MONTH YEAR -echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION" -echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}" - - - - -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 /bin/sh $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 -echo "configure:615: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`/bin/sh $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=`/bin/sh $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 - -# Check whether --with-cc or --without-cc was given. -if test "${with_cc+set}" = set; then - withval="$with_cc" - echo "$ac_t""CC=$withval" 1>&6 -CC=$withval -else - if test -z "$CC" ; then CC=cc; fi -echo "$ac_t""CC defaults to $CC" 1>&6 -fi -export CC - -# Check whether --with-linker or --without-linker was given. -if test "${with_linker+set}" = set; then - withval="$with_linker" - echo "$ac_t""LD=$withval" 1>&6 -LD=$withval -else - if test -z "$LD" ; then LD=$CC; fi -echo "$ac_t""LD defaults to $LD" 1>&6 -fi -export LD - -# Check whether --with-ccopts or --without-ccopts was given. -if test "${with_ccopts+set}" = set; then - withval="$with_ccopts" - echo "$ac_t""CCOPTS is $withval" 1>&6 -CCOPTS=$withval -CFLAGS="$CFLAGS $withval" -else - CCOPTS= -fi - -LIB_EXT=.a -STATIC_LIB_EXT=.a -PROFILE_LIB_EXT=.a -# Check whether --with-ldopts or --without-ldopts was given. -if test "${with_ldopts+set}" = set; then - withval="$with_ldopts" - echo "$ac_t""LDFLAGS is $withval" 1>&6 -LDFLAGS=$withval -else - LDFLAGS= -fi - -# Check whether --with-usr-prefix or --without-usr-prefix was given. -if test "${with_usr_prefix+set}" = set; then - withval="$with_usr_prefix" - usr_prefix=$withval -else - usr_prefix=NONE -fi -# Check whether --enable-dll-shlibs or --disable-dll-shlibs was given. -if test "${enable_dll_shlibs+set}" = set; then - enableval="$enable_dll_shlibs" - 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 - BINARY_TYPE=dllbin - LIB_EXT=.sa - 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. -if test "${enable_elf_shlibs+set}" = set; then - enableval="$enable_elf_shlibs" - 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 - BINARY_TYPE=elfbin - LIB_EXT=.so - 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. -if test "${enable_bsd_shlibs+set}" = set; then - enableval="$enable_bsd_shlibs" - 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 - LIB_EXT=.so - 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. -if test "${enable_profile+set}" = set; then - enableval="$enable_profile" - if test "$enableval" = "no" -then - PROFILE_CMT=# - MAKEFILE_PROFILE=/dev/null - echo "Disabling profiling libraries" -else - PROFILE_CMT= - MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile - PROFILED_LIB_EXT=_p.a - 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. -if test "${enable_checker+set}" = set; then - enableval="$enable_checker" - 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. -if test "${enable_gcc_wall+set}" = set; then - enableval="$enable_gcc_wall" - 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 - - -# Check whether --enable-dynamic-e2fsck or --disable-dynamic-e2fsck was given. -if test "${enable_dynamic_e2fsck+set}" = set; then - enableval="$enable_dynamic_e2fsck" - if test "$enableval" = "no" -then - E2FSCK_TYPE=static - echo "Building e2fsck statically" -else - E2FSCK_TYPE=shared - echo "Building e2fsck dynamically" -fi - -else - E2FSCK_TYPE=static -echo "Building e2fsck statically by default" - -fi - - -# Check whether --enable-fsck or --disable-fsck was given. -if test "${enable_fsck+set}" = set; then - enableval="$enable_fsck" - if test "$enableval" = "no" -then - FSCK_PROG='' FSCK_MAN='' - echo "Not building fsck wrapper" -else - FSCK_PROG=fsck FSCK_MAN=fsck.8 - echo "Building fsck wrapper" -fi - -else - case "$host_os" in - gnu*) - FSCK_PROG='' FSCK_MAN='' - echo "Not building fsck wrapper by default" - ;; - *) - FSCK_PROG=fsck FSCK_MAN=fsck.8 - echo "Building fsck wrapper by default" -esac - -fi - - - -MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library - -# Check whether --enable-old-bitops or --disable-old-bitops was given. -if test "${enable_old_bitops+set}" = set; then - enableval="$enable_old_bitops" - if test "$enableval" = "no" -then - echo "Using new (standard) bitmask operations" -else - cat >> confdefs.h <<\EOF -#define EXT2_OLD_BITOPS 1 -EOF - - echo "Using old (native) bitmask operations" - -fi - -else - echo "Using standard bitmask operations by default" - -fi - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:899: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -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 -echo "configure:928: checking for $ac_word" >&5 -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 - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:958: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 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 -echo "configure:981: checking for $ac_word" >&5 -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 -echo "configure:1013: checking for $ac_word" >&5 -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 -echo "configure:1045: checking for $ac_word" >&5 -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 -echo "configure:1077: checking for $ac_word" >&5 -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 -echo "configure:1109: checking for $ac_word" >&5 -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 -echo "configure:1141: checking for $ac_word" >&5 -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 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1171: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`/bin/sh $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 -echo "configure:1197: checking for $ac_word" >&5 -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 -echo "configure:1228: checking for $ac_word" >&5 -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 -echo "configure:1262: checking for $ac_word" >&5 -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 -echo "configure:1293: checking for $ac_word" >&5 -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 -echo "configure:1327: checking for $ac_word" >&5 -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 -echo "configure:1358: checking for $ac_word" >&5 -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 -echo "configure:1392: checking for $ac_word" >&5 -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" -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 - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1421: checking for $ac_word" >&5 -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}:" - ac_prog_rejected=no - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -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 - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1469: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -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' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext <<EOF -#line 1479 "configure" -#include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:1483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1503: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1508: checking whether we are using GNU C" >&5 -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 { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1517: \"$ac_try\") 1>&5; (eval $ac_try) 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 - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1532: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_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_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - 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 -echo "configure:1570: checking for a BSD compatible install" >&5 -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" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -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' - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1621: checking how to run the C preprocessor" >&5 -# 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 1636 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 1653 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&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 linux/major.h sys/disklabel.h sys/sockio.h net/if.h netinet/in.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1685: checking for $ac_hdr" >&5 -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 1690 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -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 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&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 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - 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 -echo "configure:1722: checking for vprintf" >&5 -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 1727 "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. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vprintf(); - -int main() { - -/* 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 echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func_vprintf=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - 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 -echo "configure:1774: checking for _doprnt" >&5 -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 1779 "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. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt(); - -int main() { - -/* 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 echo configure:1802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func__doprnt=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - 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 -echo "configure:1827: checking whether struct dirent has a d_namlen field" >&5 -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 1832 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <dirent.h> -int main() { -struct dirent de; de.d_namlen = 0; -; return 0; } -EOF -if { (eval echo configure:1840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - e2fsprogs_cv_struct_d_namlen=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - 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 - ac_cv_sizeof_long_long=0 - 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 -echo "configure:1868: checking size of short" >&5 -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 1876 "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 -if { (eval echo configure:1887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_short=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_short=0 -fi -rm -fr conftest* -fi - -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 -echo "configure:1907: checking size of int" >&5 -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 1915 "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 -if { (eval echo configure:1926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_int=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_int=0 -fi -rm -fr conftest* -fi - -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 -echo "configure:1946: checking size of long" >&5 -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 1954 "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 -if { (eval echo configure:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long=0 -fi -rm -fr conftest* -fi - -fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >> confdefs.h <<EOF -#define SIZEOF_LONG $ac_cv_sizeof_long -EOF - - -echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:1985: checking size of long long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long_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 1993 "configure" -#include "confdefs.h" -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long long)); - exit(0); -} -EOF -if { (eval echo configure:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long_long=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long_long=0 -fi -rm -fr conftest* -fi - -fi -echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 -cat >> confdefs.h <<EOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -EOF - - -SIZEOF_SHORT=$ac_cv_sizeof_short -SIZEOF_INT=$ac_cv_sizeof_int -SIZEOF_LONG=$ac_cv_sizeof_long -SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long - - - - -echo $ac_n "checking whether struct stat has a st_flags field""... $ac_c" 1>&6 -echo "configure:2032: checking whether struct stat has a st_flags field" >&5 -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 2037 "configure" -#include "confdefs.h" -#include <sys/stat.h> -int main() { -struct stat stat; stat.st_flags = 0; -; return 0; } -EOF -if { (eval echo configure:2044: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - e2fsprogs_cv_struct_st_flags=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - 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 strcasecmp srandom fchown -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2066: checking for $ac_func" >&5 -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 2071 "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. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* 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 echo configure:2094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - 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 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -echo $ac_n "checking ino_t defined by sys/types.h""... $ac_c" 1>&6 -echo "configure:2119: checking ino_t defined by sys/types.h" >&5 -if eval "test \"`echo '$''{'e2fsprogs_cv_ino_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2124 "configure" -#include "confdefs.h" -#include <sys/types.h> -int main() { -ino_t ino; ino = 0; -; return 0; } -EOF -if { (eval echo configure:2131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - e2fsprogs_cv_ino_t=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - e2fsprogs_cv_ino_t=no -fi -rm -f conftest* -fi - -echo "$ac_t""$e2fsprogs_cv_ino_t" 1>&6 -if test "$e2fsprogs_cv_ino_t" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_INO_T 1 -EOF - -fi -ac_safe=`echo "linux/fs.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for linux/fs.h""... $ac_c" 1>&6 -echo "configure:2152: checking for linux/fs.h" >&5 -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 2157 "configure" -#include "confdefs.h" -#include <linux/fs.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -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 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&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 - -SOCKET_LIB='' -echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:2201: checking for socket in -lsocket" >&5 -ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2209 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char socket(); - -int main() { -socket() -; return 0; } -EOF -if { (eval echo configure:2220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SOCKET_LIB=-lsocket -else - echo "$ac_t""no" 1>&6 -fi - - -echo $ac_n "checking for optreset""... $ac_c" 1>&6 -echo "configure:2242: checking for optreset" >&5 -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 2247 "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 the ext2 ioctls compile""... $ac_c" 1>&6 -echo "configure:2270: checking whether the ext2 ioctls compile" >&5 -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 2275 "configure" -#include "confdefs.h" -#include <linux/ext2_fs.h> -#include <sys/ioctl.h> -int main() { -ioctl (0, EXT2_IOC_SETVERSION, 0); -; return 0; } -EOF -if { (eval echo configure:2283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - e2fsprogs_cv_ioctl_ext2=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - 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 - usr_prefix="\${prefix}/usr"; - echo "On $host_os systems, usr_prefix defaults to $usr_prefix" - fi - ;; -esac -if test "$usr_prefix" = NONE ; then - usr_prefix="\${prefix}" -fi - -case "$host_os" in -linux* | gnu*) - if test "$prefix" = NONE ; then - prefix=''; - echo "On $host_os systems, prefix defaults to ''" - fi -;; -esac -echo $ac_n "checking whether linker accepts -static""... $ac_c" 1>&6 -echo "configure:2323: checking whether linker accepts -static" >&5 -if eval "test \"`echo '$''{'ac_cv_e2fsprogs_use_static'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static" -cat > conftest.$ac_ext <<EOF -#line 2329 "configure" -#include "confdefs.h" -#include <stdio.h> -int main() { -fflush(stdout); -; return 0; } -EOF -if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - ac_cv_e2fsprogs_use_static=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_e2fsprogs_use_static=no -fi -rm -f conftest* -LDFLAGS=$SAVE_LDFLAGS -fi - -echo "$ac_t""$ac_cv_e2fsprogs_use_static" 1>&6 -LDFLAG_STATIC= -if test $ac_cv_e2fsprogs_use_static = yes; then - LDFLAG_STATIC=-static -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 - -DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute - -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 -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# 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 | - case `(ac_space=' '; set) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> 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.12" - 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 lib/substitute_sh Makefile lib/et/Makefile - lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile - misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile - tests/progs/Makefile doc/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# 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%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -/@MCONFIG@/r $MCONFIG -s%@MCONFIG@%%g -s%@E2FSPROGS_YEAR@%$E2FSPROGS_YEAR%g -s%@E2FSPROGS_MONTH@%$E2FSPROGS_MONTH%g -s%@E2FSPROGS_VERSION@%$E2FSPROGS_VERSION%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%@CC@%$CC%g -s%@LD@%$LD%g -s%@CCOPTS@%$CCOPTS%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%@LIB_EXT@%$LIB_EXT%g -s%@STATIC_LIB_EXT@%$STATIC_LIB_EXT%g -s%@PROFILED_LIB_EXT@%$PROFILED_LIB_EXT%g -s%@W@%$W%g -s%@E2FSCK_TYPE@%$E2FSCK_TYPE%g -s%@FSCK_PROG@%$FSCK_PROG%g -s%@FSCK_MAN@%$FSCK_MAN%g -/@MAKEFILE_LIBRARY@/r $MAKEFILE_LIBRARY -s%@MAKEFILE_LIBRARY@%%g -s%@BINARY_TYPE@%$BINARY_TYPE%g -s%@SET_MAKE@%$SET_MAKE%g -s%@LN@%$LN%g -s%@LN_S@%$LN_S%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%@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%@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%@SIZEOF_LONG_LONG@%$SIZEOF_LONG_LONG%g -s%@EXTRA_PROGS@%$EXTRA_PROGS%g -s%@LINUX_INCLUDE@%$LINUX_INCLUDE%g -s%@SOCKET_LIB@%$SOCKET_LIB%g -s%@usr_prefix@%$usr_prefix%g -s%@LDFLAG_STATIC@%$LDFLAG_STATIC%g -s%@SS_DIR@%$SS_DIR%g -s%@ET_DIR@%$ET_DIR%g -s%@DO_TEST_SUITE@%$DO_TEST_SUITE%g -/@DO_SUBSTITUTE_SCRIPT@/r $DO_SUBSTITUTE_SCRIPT -s%@DO_SUBSTITUTE_SCRIPT@%%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"MCONFIG lib/substitute_sh Makefile lib/et/Makefile - lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile - misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile - tests/progs/Makefile doc/Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[: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 a relative srcdir, top_srcdir, and INSTALL 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 - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -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/gnu/usr.sbin/e2fsprogs/configure.in b/gnu/usr.sbin/e2fsprogs/configure.in deleted file mode 100644 index d7fcebf2652..00000000000 --- a/gnu/usr.sbin/e2fsprogs/configure.in +++ /dev/null @@ -1,510 +0,0 @@ -AC_INIT(version.h) -MCONFIG=./MCONFIG -AC_SUBST_FILE(MCONFIG) -BINARY_TYPE=bin -dnl -dnl This is to figure out the version number and the date.... -dnl -E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \ - | awk '{print $3}' | tr \" " " | awk '{print $1}'` -DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \ - | tr \" " "` -MONTH=`echo $DATE | awk -F- '{print $2}'` -YEAR=`echo $DATE | awk -F- '{print $3}'` - -if expr $YEAR ">" 90 >/dev/null ; then - E2FSPROGS_YEAR=19$YEAR -else - E2FSPROGS_YEAR=20$YEAR -fi - -case $MONTH in -Jan) E2FSPROGS_MONTH="January" ;; -Feb) E2FSPROGS_MONTH="February" ;; -Mar) E2FSPROGS_MONTH="March" ;; -Apr) E2FSPROGS_MONTH="April" ;; -May) E2FSPROGS_MONTH="May" ;; -Jun) E2FSPROGS_MONTH="June" ;; -Jul) E2FSPROGS_MONTH="July" ;; -Aug) E2FSPROGS_MONTH="August" ;; -Sep) E2FSPROGS_MONTH="September" ;; -Oct) E2FSPROGS_MONTH="October" ;; -Nov) E2FSPROGS_MONTH="November" ;; -Dec) E2FSPROGS_MONTH="December" ;; -*) echo "Unknown month $MONTH??" ;; -esac - -unset DATE MONTH YEAR -echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION" -echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}" -AC_SUBST(E2FSPROGS_YEAR) -AC_SUBST(E2FSPROGS_MONTH) -AC_SUBST(E2FSPROGS_VERSION) -AC_REQUIRE([AC_CANONICAL_HOST]) -dnl -dnl set $(CC) from --with-cc=value -dnl -AC_ARG_WITH([cc], -[ --with-cc=COMPILER select compiler to use], -AC_MSG_RESULT(CC=$withval) -CC=$withval, -if test -z "$CC" ; then CC=cc; fi -[AC_MSG_RESULT(CC defaults to $CC)])dnl -export CC -AC_SUBST([CC]) -dnl -dnl set $(LD) from --with-linker=value -dnl -AC_ARG_WITH([linker], -[ --with-linker=LINKER select linker to use], -AC_MSG_RESULT(LD=$withval) -LD=$withval, -if test -z "$LD" ; then LD=$CC; fi -[AC_MSG_RESULT(LD defaults to $LD)])dnl -export LD -AC_SUBST([LD]) -dnl -dnl set $(CCOPTS) from --with-ccopts=value -dnl -AC_ARG_WITH([ccopts], -[ --with-ccopts=CCOPTS select compiler command line options], -AC_MSG_RESULT(CCOPTS is $withval) -CCOPTS=$withval -CFLAGS="$CFLAGS $withval", -CCOPTS=)dnl -AC_SUBST(CCOPTS) -dnl -dnl Set default values for library extentions. Will be dealt with after -dnl parsing configuration opions, which may modify these -dnl -LIB_EXT=.a -STATIC_LIB_EXT=.a -PROFILE_LIB_EXT=.a -dnl -dnl set $(LDFLAGS) from --with-ldopts=value -dnl -AC_ARG_WITH([ldopts], -[ --with-ldopts=LDOPTS select linker command line options], -AC_MSG_RESULT(LDFLAGS is $withval) -LDFLAGS=$withval, -LDFLAGS=)dnl -AC_SUBST(LDFLAGS) -dnl -dnl Allow separate `usr_prefix' to be specified -dnl -AC_ARG_WITH([usr-prefix], -[ --with-usr-prefx=PREFIX specify a prefix corresponding to /usr (default ${prefix})], -usr_prefix=$withval, -usr_prefix=NONE)dnl -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 - BINARY_TYPE=dllbin - LIB_EXT=.sa - 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 - BINARY_TYPE=elfbin - LIB_EXT=.so - 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 - LIB_EXT=.so - 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 - PROFILED_LIB_EXT=_p.a - 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 Substitute library extensions -dnl -AC_SUBST(LIB_EXT) -AC_SUBST(STATIC_LIB_EXT) -AC_SUBST(PROFILED_LIB_EXT) -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) -AC_ARG_ENABLE([dynamic-e2fsck], -[ --enable-dynamic-e2fsck build e2fsck dynamically], -if test "$enableval" = "no" -then - E2FSCK_TYPE=static - echo "Building e2fsck statically" -else - E2FSCK_TYPE=shared - echo "Building e2fsck dynamically" -fi -, -E2FSCK_TYPE=static -echo "Building e2fsck statically by default" -) -AC_SUBST(E2FSCK_TYPE) -dnl -dnl See whether to install the `fsck' wrapper program (that calls e2fsck) -dnl -AC_ARG_ENABLE([fsck], -[ --enable-fsck build fsck wrapper program], -[if test "$enableval" = "no" -then - FSCK_PROG='' FSCK_MAN='' - echo "Not building fsck wrapper" -else - FSCK_PROG=fsck FSCK_MAN=fsck.8 - echo "Building fsck wrapper" -fi] -, -[case "$host_os" in - gnu*) - FSCK_PROG='' FSCK_MAN='' - echo "Not building fsck wrapper by default" - ;; - *) - FSCK_PROG=fsck FSCK_MAN=fsck.8 - echo "Building fsck wrapper by default" -esac] -) -AC_SUBST(FSCK_PROG) -AC_SUBST(FSCK_MAN) -dnl -dnl -MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library -AC_SUBST_FILE(MAKEFILE_LIBRARY) -dnl -dnl -AC_ARG_ENABLE([old-bitops], -[ --enable-old-bitops Use old (non-standard but native) bitmask operations], -if test "$enableval" = "no" -then - echo "Using new (standard) bitmask operations" -else - AC_DEFINE(EXT2_OLD_BITOPS) - echo "Using old (native) bitmask operations" - -fi -, -echo "Using standard bitmask operations by default" -) -dnl -dnl End of configuration options -dnl -AC_SUBST(BINARY_TYPE) -AC_PROG_MAKE_SET -AC_PATH_PROG(LN, ln, ln) -AC_PROG_LN_S -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 linux/major.h sys/disklabel.h sys/sockio.h net/if.h netinet/in.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_cv_sizeof_long_long=0 - 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) -AC_CHECK_SIZEOF(long long) -SIZEOF_SHORT=$ac_cv_sizeof_short -SIZEOF_INT=$ac_cv_sizeof_int -SIZEOF_LONG=$ac_cv_sizeof_long -SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long -AC_SUBST(SIZEOF_SHORT) -AC_SUBST(SIZEOF_INT) -AC_SUBST(SIZEOF_LONG) -AC_SUBST(SIZEOF_LONG_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 strcasecmp srandom fchown) -dnl -dnl Check to see if ino_t is defined -dnl -AC_MSG_CHECKING(ino_t defined by sys/types.h) -AC_CACHE_VAL(e2fsprogs_cv_ino_t, - AC_TRY_COMPILE([#include <sys/types.h>], - [ino_t ino; ino = 0;], - [e2fsprogs_cv_ino_t=yes], - [e2fsprogs_cv_ino_t=no])) -AC_MSG_RESULT($e2fsprogs_cv_ino_t) -if test "$e2fsprogs_cv_ino_t" = yes; then - AC_DEFINE(HAVE_INO_T) -fi -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 Check to see if -lsocket is required (solaris) to make something -dnl that uses socket() to compile; this is needed for the UUID library -dnl -SOCKET_LIB='' -AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket]) -AC_SUBST(SOCKET_LIB) -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 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 Linux uses a separate usr_prefix by default -dnl -case "$host_os" in -linux*) - if test "$prefix" = NONE ; then - usr_prefix="\${prefix}/usr"; - echo "On $host_os systems, usr_prefix defaults to $usr_prefix" - fi - ;; -esac -if test "$usr_prefix" = NONE ; then - usr_prefix="\${prefix}" -fi -AC_SUBST(usr_prefix) -dnl -dnl On Linux/hurd, force the prefix to be '' -dnl -case "$host_os" in -linux* | gnu*) - if test "$prefix" = NONE ; then - prefix=''; - echo "On $host_os systems, prefix defaults to ''" - fi -;; -esac -dnl -dnl See if -static works. -dnl -AC_MSG_CHECKING([whether linker accepts -static]) -AC_CACHE_VAL(ac_cv_e2fsprogs_use_static, -[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static" -AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);], - ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no) -LDFLAGS=$SAVE_LDFLAGS]) -AC_MSG_RESULT($ac_cv_e2fsprogs_use_static) -LDFLAG_STATIC= -if test $ac_cv_e2fsprogs_use_static = yes; then - LDFLAG_STATIC=-static -fi -AC_SUBST(LDFLAG_STATIC) -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 -dnl -DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute -AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT) -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 lib/substitute_sh Makefile lib/et/Makefile - lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile - misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile - tests/progs/Makefile doc/Makefile) diff --git a/gnu/usr.sbin/e2fsprogs/contrib/dconf b/gnu/usr.sbin/e2fsprogs/contrib/dconf deleted file mode 100644 index b8aca2d6799..00000000000 --- a/gnu/usr.sbin/e2fsprogs/contrib/dconf +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -#$Id: dconf,v 1.1 1997/06/14 07:18:51 downsj Exp $ -# 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 diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/ChangeLog b/gnu/usr.sbin/e2fsprogs/debugfs/ChangeLog deleted file mode 100644 index aa703ab6fcc..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/ChangeLog +++ /dev/null @@ -1,160 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Thu Apr 10 14:36:05 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ls.c: New file which implements the ls command. Added the -l - option. - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Wed Jan 1 23:53:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * lsdel.c (do_lsdel): Use time_to_string() instead of ctime(). - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Mon Sep 9 23:05:11 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * debugfs.c (unlink_file_by_name): If unlinking a file with a - directory path, correctly replace the slash with a NULL. - (do_show_debugfs_params): Don't try to print the open mode - if there's no filesystem opened (since that will cause a - core dump). - (main): Fix usage string; the -w and device elements are - independently optional. - -Tu Sep 3 15:09:39 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * debugfs.c (main): Added -f option to debugfs, which takes a - command file of debugfs commands and executes them. - -Sat Aug 31 01:18:43 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * debugfs.8.in: Heavily edited and improved manual page. - - * dump.c (dump_file): Improve the write function for writing out - the file, so that it is limited to the actual size of the - file, instead of outputing the nulls following the EOF. - Make sure dump_file does the right thing for files with holes. - (do_dump): Add support for the -p option to the dump - command, which attempts to preserve the owner and - permissions field. - -Fri Aug 30 14:56:59 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * debugfs.c (main): Add -R option to debugfs, which allows it to - take a single debugfs command on the command line. - -Fri Aug 9 09:03:31 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * debugfs.c (do_open_filesys): Set optind to 0 to reset getopt(), - to be complete correct. - (do_show_super_stats): Print OS type, volume label, last - mounted directory, and UUID. - (dump_inode): Print the fragment information in a - filesystem independent way. - (do_modify_inode): Modify the fragement information in a - filesystem independent way. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed May 3 20:41:26 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * debugfs.c (dump_inode): Correctly print the translator on the hurd. - (do_modify_inode): Modify the translator block on the hurd. - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Fri Dec 1 22:42:31 1995 <tytso@rsts-11.mit.edu> - - * Makefile.in (LIBS): Rearrange the order of the libraries to be - linked, so that -lext2fs is before -lcom_err. - -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 - the user to dump the contents of an inode to a file or to - stdout, respectively. - - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/Makefile.in b/gnu/usr.sbin/e2fsprogs/debugfs/Makefile.in deleted file mode 100644 index 7cb8ceaabbd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/Makefile.in +++ /dev/null @@ -1,109 +0,0 @@ -# -# Standard e2fsprogs prologue.... -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = .. -my_dir = debugfs -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 ls.o lsdel.o dump.o - -SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c $(srcdir)/ls.c \ - $(srcdir)/ncheck.c $(srcdir)/icheck.c $(srcdir)/lsdel.c \ - $(srcdir)/dump.c - -LIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) $(LIBUUID) -DEPLIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) $(LIBUUID) - -.c.o: - $(CC) -c $(ALL_CFLAGS) $< -o $@ - -all:: $(PROGS) $(MANPAGES) - -debugfs: $(DEBUG_OBJS) $(DEPLIBS) - $(CC) $(ALL_LDFLAGS) -o debugfs $(DEBUG_OBJS) $(LIBS) - -debug_cmds.c debug_cmds.h: debug_cmds.ct - $(MK_CMDS) $(srcdir)/debug_cmds.ct - -debugfs.8: $(SUBSTITUTE) $(srcdir)/debugfs.8.in - -$(CHMOD) +x $(SUBSTITUTE) - $(SUBSTITUTE) $(srcdir)/debugfs.8.in debugfs.8 - -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) $$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 debugfs.8 \#* *.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/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/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 \ - $(top_srcdir)/lib/uuid/uuid.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 -ls.o: $(srcdir)/ls.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 - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/debug_cmds.ct b/gnu/usr.sbin/e2fsprogs/debugfs/debug_cmds.ct deleted file mode 100644 index 00cd6c183da..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/debug_cmds.ct +++ /dev/null @@ -1,116 +0,0 @@ -# -# Copyright (C) 1993 Theodore Ts'o. This file may be redistributed -# under the terms of the GNU Public License. -# -command_table debug_cmds; - -request do_show_debugfs_params, "Show debugfs parameters", - show_debugfs_params, params; - -request do_open_filesys, "Open a filesystem", - open_filesys, open; - -request do_close_filesys, "Close the filesystem", - close_filesys, close; - -request do_dirty_filesys, "Mark the filesystem as dirty", - dirty_filesys, dirty; - -request do_init_filesys, "Initalize a filesystem (DESTROYS DATA)", - init_filesys; - -request do_show_super_stats, "Show superblock statistics", - show_super_stats, stats; - -request do_ncheck, "Do inode->name translation", - ncheck; - -request do_icheck, "Do block->inode translation", - icheck; - -request do_chroot, "Change root directory", - change_root_directory, chroot; - -request do_change_working_dir, "Change working directory", - change_working_directory, cd; - -request do_list_dir, "List directory", - list_directory, ls; - -request do_stat, "Show inode information ", - show_inode_info, stat; - -request do_link, "Create directory link", - link, ln; - -request do_unlink, "Delete a directory link", - unlink; - -request do_mkdir, "Create a directory", - mkdir; - -request do_rmdir, "Remove a directory", - rmdir; - -request do_rm, "Remove a file (unlink and kill_file, if appropriate)", - rm; - -request do_kill_file, "Deallocate an inode and its blocks", - kill_file; - -request do_clri, "Clear an inode's contents", - clri; - -request do_freei, "Clear an inode's in-use flag", - freei; - -request do_seti, "Set an inode's in-use flag", - seti; - -request do_testi, "Test an inode's in-use flag", - testi; - -request do_freeb, "Clear a block's in-use flag", - freeb; - -request do_setb, "Set a block's in-use flag", - setb; - -request do_testb, "Test a block's in-use flag", - testb; - -request do_modify_inode, "Modify an inode by structure", - modify_inode, mi; - -request do_find_free_block, "Find free block(s)", - find_free_block, ffb; - -request do_find_free_inode, "Find free inode(s)", - find_free_inode, ffi; - -request do_print_working_directory, "Print current working directory", - print_working_directory, pwd; - -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; - -request do_cat, "Dump an inode out to stdout", - cat; - -end; - - - - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.8.in b/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.8.in deleted file mode 100644 index 72b12ec6902..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.8.in +++ /dev/null @@ -1,261 +0,0 @@ -.\" -*- nroff -*- -.\" 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 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -debugfs \- ext2 file system debugger -.SH SYNOPSIS -.B debugfs -[ -.B \-w -] -[ -.B \-f -cmd_file -] -[ -.B \-R -request -] -[ -device -] -.SH DESCRIPTION -The -.B debugfs -program -is a file system debugger. It can be used to examine and change the -state of an ext2 file system. -.br -.I device -is the special file corresponding to the device containing the ext2 -file system (e.g /dev/hdXX). -.SH OPTIONS -.TP -.I -w -Specify that the file system should be open in read-write mode. Without this -option, the file system is open in read-only mode. -.TP -.I -f cmd_file -Causes -.B debugfs -to read in commands from -.IR cmd_file , -and execute them. When -.B debugfs -is finsihed executing those commands, it will exit. -.TP -.I -R request -Causes -.B debugfs -to execute the single command -.IR request , -and then exit. -.SH COMMANDS -.B debugfs -is an interactive debugger. It understands a number of commands. -.TP -.I cat filespec -Dump the contents of the inode -.I filespec -to stdout. -.TP -.I cd filespec -Change the current working directory to -.IR filespec . -.TP -.I chroot filespec -Change the root directory to be the directory -.IR filespec . -.TP -.I close -Close the currently open file system. -.TP -.I clri file -Clear the contents of the inode -.IR file . -.TP -.I dump [-p] filspec out_file -Dump the contents of the inode -.I filespec -to the output file -.IR out_file . -If the -.I -p -option is given set the owner, group and permissions information on -.I out_file -to match -.IR filespec . -.TP -.I expand_dir filespec -Expand the directory -.IR filespec . -.TP -.I find_free_block [goal] -Find the first free block, starting from -.I goal -and allocates it. -.TP -.I find_free_inode [dir [mode]] -Find a free inode and allocates it. If present, -.I dir -specifies the inode number of the directory -which the inode is to be located. The second -optional argument -.I mode -specifies the permissions of the new inode. (If the directory bit is set -on the mode, the allocation routine will function differently.) -.TP -.I freeb block -Mark the block number -.I block -as not allocated. -.TP -.I freei filespec -Free the inode specified by -.I filespec -.TP -.I help -Print a list of commands understood by -.BR debugfs (8). -.TP -.I icheck block ... -Print a listing of the inodes which use the one or more block specified -on the command line. -.TP -.I initialize device blocksize -Create an ext2 file system on -.I device -with device size -.IR blocksize . -Note that this does not fully initialize all of the data structures; -to do this, use the -.BR mke2fs (8) -program. This is just a call to the low-level library, which sets up -the superblock and block descriptors. -.TP -.I kill_file filespec -Dellocate the inode -.I filespec -and its blocks. Note that this does not remove any directory -entries (if any) to this inode. See the -.I rm -command if you wish to unlink a file. -.TP -.I ln filespec dest_file -Create a link named -.I dest_file -which is a link to -.IR filespec . -Note this does not adjust the inode reference counts. -.TP -.I ls [-l] filespec -Print a listing of the files in the directory -.IR filespec . -.TP -.I modify_inode filespec -Modify the contents of the inode structure in the inode -.IR filespec . -.TP -.I mkdir filespec -Make a directory. -.TP -.I mknod filespec [p|[[c|b] major minor]] -Create a special device file (a named pipe, character or block device). -If a character or block device is to be made, the -.I major -and -.I minor -device numbers must be specified. -.TP -.I ncheck inode_num ... -Take the requested list of inode numbers, and print a listing of pathnams -to those inodes. -.TP -.I open [-w] device -Open a file system for editing. -.TP -.I pwd -Print the current working directory. -.TP -.I quit -Quit -.B debugfs -.TP -.I rm pathname -Unlink -.IR pathname . -If this cuases the inode pointed to by -.I pathname -to have no other references, deallocate the file. This command functions -as the unlink() system call. -.I -.TP -.I rmdir filespec -Remove the directory -.IR filespec . -This function is currently not implemented. -.TP -.I setb block -Mark the block number -.I block -as allocated. -.TP -.I seti filespec -Mark inode -.I filespec -as in use in the inode bitmap. -.TP -.I show_super_stats -List the contents of the super block. -.TP -.I stat filespec -Display the contents of the inode structure of the inode -.IR filespec . -.TP -.I testb block -Test if the block number -.I block -is marked as allocated in the block bitmap. -.TP -.I testi filespec -Test if the inode -.I filespec -is marked as allocated in the inode bitmap. -.TP -.I unlink pathname -Remove the link specified by -.I pathname -to an inode. Note this does not adjust the inode reference counts. -.TP -.I write source_file out_file -Create a file in the filesystem named -.IR out_file , -and copy the contents of -.I source_file -into the destination file. -.SH SPECIFYING FILES -Many -.B debugfs -commands take a -.I filespec -as an argument to specify an inode (as opposed to a pathname) -in the filesystem which is currently opened by debugfs. The -.I filespec -argument may be specified in two forms. The first form is an inode -number surrounded by angle brackets, e.g., -.IR <2> . -The second form is a pathname; if the pathname is prefixed by a forward slash -('/'), then it is interpreted relative to the root of the filesystem -which is currently opened by debugfs. If not, the pathname is -interpreted relative to the current working directory as maintained -by debugfs. This may be modified by using the debugfs command -.IR cd . -.SH AUTHOR -.B debugfs -was written by Theodore Ts'o <tytso@mit.edu>. -.SH SEE ALSO -.BR dumpe2fs (8), -.BR e2fsck (8), -.BR mke2fs (8) diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.c b/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.c deleted file mode 100644 index ded79cce12d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.c +++ /dev/null @@ -1,1469 +0,0 @@ -/* - * debugfs.c --- a program which allows you to attach an ext2fs - * filesystem and play with it. - * - * Copyright (C) 1993 Theodore Ts'o. This file may be redistributed - * under the terms of the GNU Public License. - * - * Modifications by Robert Sanders <gt8134b@prism.gatech.edu> - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#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> - -#include "et/com_err.h" -#include "ss/ss.h" -#include "debugfs.h" -#include "uuid/uuid.h" - -extern ss_request_table debug_cmds; - -ext2_filsys current_fs = NULL; -ino_t root, cwd; - -static void open_filesystem(char *device, int open_flags) -{ - int retval; - - retval = ext2fs_open(device, open_flags, 0, 0, - unix_io_manager, ¤t_fs); - if (retval) { - com_err(device, retval, "while opening filesystem"); - current_fs = NULL; - return; - } - retval = ext2fs_read_inode_bitmap(current_fs); - if (retval) { - com_err(device, retval, "while reading inode bitmap"); - goto errout; - } - retval = ext2fs_read_block_bitmap(current_fs); - if (retval) { - com_err(device, retval, "while reading block bitmap"); - goto errout; - } - root = cwd = EXT2_ROOT_INO; - return; - -errout: - retval = ext2fs_close(current_fs); - if (retval) - com_err(device, retval, "while trying to close filesystem"); - current_fs = NULL; -} - -void do_open_filesys(int argc, char **argv) -{ - const char *usage = "Usage: open [-w] <device>"; - char c; - int open_flags = 0; - - optind = 0; -#ifdef HAVE_OPTRESET - optreset = 1; /* Makes BSD getopt happy */ -#endif - while ((c = getopt (argc, argv, "w")) != EOF) { - switch (c) { - case 'w': - open_flags = EXT2_FLAG_RW; - break; - default: - com_err(argv[0], 0, usage); - return; - } - } - if (optind != argc-1) { - com_err(argv[0], 0, usage); - return; - } - if (check_fs_not_open(argv[0])) - return; - open_filesystem(argv[optind], open_flags); -} - -static void close_filesystem(NOARGS) -{ - int retval; - - if (current_fs->flags & EXT2_FLAG_IB_DIRTY) { - retval = ext2fs_write_inode_bitmap(current_fs); - if (retval) - com_err("ext2fs_write_inode_bitmap", retval, ""); - } - if (current_fs->flags & EXT2_FLAG_BB_DIRTY) { - retval = ext2fs_write_block_bitmap(current_fs); - if (retval) - com_err("ext2fs_write_block_bitmap", retval, ""); - } - retval = ext2fs_close(current_fs); - if (retval) - com_err("ext2fs_close", retval, ""); - current_fs = NULL; - return; -} - -void do_close_filesys(int argc, char **argv) -{ - if (argc > 1) { - com_err(argv[0], 0, "Usage: close_filesys"); - return; - } - if (check_fs_open(argv[0])) - return; - close_filesystem(); -} - -void do_init_filesys(int argc, char **argv) -{ - const char *usage = "Usage: initialize <device> <blocksize>"; - struct ext2_super_block param; - errcode_t retval; - char *tmp; - - if (argc != 3) { - com_err(argv[0], 0, usage); - return; - } - if (check_fs_not_open(argv[0])) - return; - - memset(¶m, 0, sizeof(struct ext2_super_block)); - param.s_blocks_count = strtoul(argv[2], &tmp, 0); - if (*tmp) { - com_err(argv[0], 0, "Bad blocks count - %s", argv[2]); - return; - } - retval = ext2fs_initialize(argv[1], 0, ¶m, - unix_io_manager, ¤t_fs); - if (retval) { - com_err(argv[1], retval, "while initializing filesystem"); - current_fs = NULL; - return; - } - root = cwd = EXT2_ROOT_INO; - return; -} - -void do_show_super_stats(int argc, char *argv[]) -{ - int i; - FILE *out; - struct ext2fs_sb *sb; - struct ext2_group_desc *gdp; - char buf[80]; - const char *none = "(none)"; - - if (argc > 1) { - com_err(argv[0], 0, "Usage: show_super"); - return; - } - if (check_fs_open(argv[0])) - return; - out = open_pager(); - sb = (struct ext2fs_sb *) current_fs->super; - fprintf(out, "Filesystem is read-%s\n", - current_fs->flags & EXT2_FLAG_RW ? "write" : "only"); - if (sb->s_volume_name[0]) { - memset(buf, 0, sizeof(buf)); - strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name)); - } else - strcpy(buf, none); - fprintf(out, "Volume name = %s\n", buf); - if (sb->s_last_mounted[0]) { - memset(buf, 0, sizeof(buf)); - strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted)); - } else - strcpy(buf, none); - fprintf(out, "Last mounted directory = %s\n", buf); - if (!uuid_is_null(sb->s_uuid)) - uuid_unparse(sb->s_uuid, buf); - else - strcpy(buf, none); - fprintf(out, "Filesystem UUID = %s\n", buf); - fprintf(out, "Last mount time = %s", time_to_string(sb->s_mtime)); - fprintf(out, "Last write time = %s", time_to_string(sb->s_wtime)); - fprintf(out, "Mount counts = %d (maximal = %d)\n", - sb->s_mnt_count, sb->s_max_mnt_count); - fputs ("Filesystem OS type = ", out); - switch (sb->s_creator_os) { - case EXT2_OS_LINUX: fputs ("Linux\n", out); break; - case EXT2_OS_HURD: fputs ("GNU\n", out); break; - case EXT2_OS_MASIX: fputs ("Masix\n", out); break; - default: fputs ("unknown\n", out); - } - fprintf(out, "Superblock size = %d\n", - sizeof(struct ext2_super_block)); - fprintf(out, "Block size = %d, fragment size = %d\n", - EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb)); - fprintf(out, "Inode size = %d\n", EXT2_INODE_SIZE(sb)); - fprintf(out, "%d inodes, %d free\n", sb->s_inodes_count, - sb->s_free_inodes_count); - fprintf(out, "%d blocks, %d free, %d reserved, first block = %d\n", - sb->s_blocks_count, sb->s_free_blocks_count, - sb->s_r_blocks_count, sb->s_first_data_block); - fprintf(out, "%d blocks per group\n", sb->s_blocks_per_group); - fprintf(out, "%d fragments per group\n", sb->s_frags_per_group); - fprintf(out, "%d inodes per group\n", EXT2_INODES_PER_GROUP(sb)); - fprintf(out, "%ld group%s (%ld descriptors block%s)\n", - current_fs->group_desc_count, - (current_fs->group_desc_count != 1) ? "s" : "", - current_fs->desc_blocks, - (current_fs->desc_blocks != 1) ? "s" : ""); - - gdp = ¤t_fs->group_desc[0]; - for (i = 0; i < current_fs->group_desc_count; i++, gdp++) - 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", - i, gdp->bg_block_bitmap, - gdp->bg_inode_bitmap, gdp->bg_inode_table, - gdp->bg_free_blocks_count, - gdp->bg_free_blocks_count != 1 ? "s" : "", - gdp->bg_free_inodes_count, - gdp->bg_free_inodes_count != 1 ? "s" : "", - gdp->bg_used_dirs_count, - gdp->bg_used_dirs_count != 1 ? "ies" : "y"); - close_pager(out); -} - -void do_dirty_filesys(int argc, char *argv[]) -{ - if (check_fs_open(argv[0])) - return; - - ext2fs_mark_super_dirty(current_fs); -} - -struct list_blocks_struct { - FILE *f; - int total; -}; - -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, "%d ", *blocknr); - lb->total++; - return 0; -} - - -static void dump_blocks(FILE *f, ino_t inode) -{ - struct list_blocks_struct lb; - - fprintf(f, "BLOCKS:\n"); - lb.total = 0; - lb.f = f; - ext2fs_block_iterate(current_fs, inode, 0, NULL, - list_blocks_proc, (void *)&lb); - if (lb.total) - fprintf(f, "\nTOTAL: %d\n", lb.total); - fprintf(f,"\n"); -} - - -static void dump_inode(ino_t inode_num, struct ext2_inode inode) -{ - const char *i_type; - FILE *out; - char frag, fsize; - int os = current_fs->super->s_creator_os; - - out = open_pager(); - 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%x Version: %d\n", - inode.i_mode & 0777, inode.i_flags, inode.i_version); - fprintf(out, "User: %5d Group: %5d Size: %d\n", - inode.i_uid, inode.i_gid, inode.i_size); - if (current_fs->super->s_creator_os == EXT2_OS_HURD) - fprintf(out, - "File ACL: %d Directory ACL: %d Translator: %d\n", - inode.i_file_acl, inode.i_dir_acl, - inode.osd1.hurd1.h_i_translator); - else - fprintf(out, "File ACL: %d Directory ACL: %d\n", - inode.i_file_acl, inode.i_dir_acl); - fprintf(out, "Links: %d Blockcount: %d\n", inode.i_links_count, - inode.i_blocks); - switch (os) { - case EXT2_OS_LINUX: - frag = inode.osd2.linux2.l_i_frag; - fsize = inode.osd2.linux2.l_i_fsize; - break; - case EXT2_OS_HURD: - frag = inode.osd2.hurd2.h_i_frag; - fsize = inode.osd2.hurd2.h_i_fsize; - break; - case EXT2_OS_MASIX: - frag = inode.osd2.masix2.m_i_frag; - fsize = inode.osd2.masix2.m_i_fsize; - break; - default: - frag = fsize = 0; - } - fprintf(out, "Fragment: Address: %d Number: %d Size: %d\n", - inode.i_faddr, frag, fsize); - fprintf(out, "ctime: 0x%08x -- %s", inode.i_ctime, - time_to_string(inode.i_ctime)); - fprintf(out, "atime: 0x%08x -- %s", inode.i_atime, - time_to_string(inode.i_atime)); - fprintf(out, "mtime: 0x%08x -- %s", inode.i_mtime, - time_to_string(inode.i_mtime)); - if (inode.i_dtime) - fprintf(out, "dtime: 0x%08x -- %s", inode.i_dtime, - time_to_string(inode.i_dtime)); - 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); - close_pager(out); -} - - -void do_stat(int argc, char *argv[]) -{ - ino_t inode; - struct ext2_inode inode_buf; - int retval; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: stat <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - retval = ext2fs_read_inode(current_fs, inode, &inode_buf); - if (retval) - { - com_err(argv[0], 0, "Reading inode"); - return; - } - - dump_inode(inode,inode_buf); - return; -} - -void do_chroot(int argc, char *argv[]) -{ - ino_t inode; - int retval; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: chroot <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - retval = ext2fs_check_directory(current_fs, inode); - if (retval) { - com_err(argv[1], retval, ""); - return; - } - root = inode; -} - -void do_clri(int argc, char *argv[]) -{ - ino_t inode; - int retval; - struct ext2_inode inode_buf; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: clri <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - if (check_fs_read_write(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - retval = ext2fs_read_inode(current_fs, inode, &inode_buf); - if (retval) { - com_err(argv[0], 0, "while trying to read inode %d", inode); - return; - } - memset(&inode_buf, 0, sizeof(inode_buf)); - retval = ext2fs_write_inode(current_fs, inode, &inode_buf); - if (retval) { - com_err(argv[0], retval, "while trying to write inode %d", - inode); - return; - } -} - -void do_freei(int argc, char *argv[]) -{ - ino_t inode; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: freei <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - if (check_fs_read_write(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - if (!ext2fs_test_inode_bitmap(current_fs->inode_map,inode)) - com_err(argv[0], 0, "Warning: inode already clear"); - ext2fs_unmark_inode_bitmap(current_fs->inode_map,inode); - ext2fs_mark_ib_dirty(current_fs); -} - -void do_seti(int argc, char *argv[]) -{ - ino_t inode; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: seti <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - if (check_fs_read_write(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - if (ext2fs_test_inode_bitmap(current_fs->inode_map,inode)) - com_err(argv[0], 0, "Warning: inode already set"); - ext2fs_mark_inode_bitmap(current_fs->inode_map,inode); - ext2fs_mark_ib_dirty(current_fs); -} - -void do_testi(int argc, char *argv[]) -{ - ino_t inode; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: testi <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - if (ext2fs_test_inode_bitmap(current_fs->inode_map,inode)) - printf("Inode %ld is marked in use\n", inode); - else - printf("Inode %ld is not in use\n", inode); -} - - -void do_freeb(int argc, char *argv[]) -{ - blk_t block; - char *tmp; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: freeb <block>"); - return; - } - if (check_fs_open(argv[0])) - return; - if (check_fs_read_write(argv[0])) - return; - block = strtoul(argv[1], &tmp, 0); - if (!block || *tmp) { - com_err(argv[0], 0, "No block 0"); - return; - } - if (!ext2fs_test_block_bitmap(current_fs->block_map,block)) - com_err(argv[0], 0, "Warning: block already clear"); - ext2fs_unmark_block_bitmap(current_fs->block_map,block); - ext2fs_mark_bb_dirty(current_fs); -} - -void do_setb(int argc, char *argv[]) -{ - blk_t block; - char *tmp; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: setb <block>"); - return; - } - if (check_fs_open(argv[0])) - return; - if (check_fs_read_write(argv[0])) - return; - block = strtoul(argv[1], &tmp, 0); - if (!block || *tmp) { - com_err(argv[0], 0, "No block 0"); - return; - } - if (ext2fs_test_block_bitmap(current_fs->block_map,block)) - com_err(argv[0], 0, "Warning: block already set"); - ext2fs_mark_block_bitmap(current_fs->block_map,block); - ext2fs_mark_bb_dirty(current_fs); -} - -void do_testb(int argc, char *argv[]) -{ - blk_t block; - char *tmp; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: testb <block>"); - return; - } - if (check_fs_open(argv[0])) - return; - block = strtoul(argv[1], &tmp, 0); - if (!block || *tmp) { - com_err(argv[0], 0, "No block 0"); - return; - } - if (ext2fs_test_block_bitmap(current_fs->block_map,block)) - printf("Block %d marked in use\n", block); - else printf("Block %d not in use\n", block); -} - -static void modify_u8(char *com, const char *prompt, - const char *format, __u8 *val) -{ - char buf[200]; - unsigned long v; - char *tmp; - - sprintf(buf, format, *val); - printf("%30s [%s] ", prompt, buf); - fgets(buf, sizeof(buf), stdin); - if (buf[strlen (buf) - 1] == '\n') - buf[strlen (buf) - 1] = '\0'; - if (!buf[0]) - return; - v = strtoul(buf, &tmp, 0); - if (*tmp) - com_err(com, 0, "Bad value - %s", buf); - else - *val = v; -} - -static void modify_u16(char *com, const char *prompt, - const char *format, __u16 *val) -{ - char buf[200]; - unsigned long v; - char *tmp; - - sprintf(buf, format, *val); - printf("%30s [%s] ", prompt, buf); - fgets(buf, sizeof(buf), stdin); - if (buf[strlen (buf) - 1] == '\n') - buf[strlen (buf) - 1] = '\0'; - if (!buf[0]) - return; - v = strtoul(buf, &tmp, 0); - if (*tmp) - com_err(com, 0, "Bad value - %s", buf); - else - *val = v; -} - -static void modify_u32(char *com, const char *prompt, - const char *format, __u32 *val) -{ - char buf[200]; - unsigned long v; - char *tmp; - - sprintf(buf, format, *val); - printf("%30s [%s] ", prompt, buf); - fgets(buf, sizeof(buf), stdin); - if (buf[strlen (buf) - 1] == '\n') - buf[strlen (buf) - 1] = '\0'; - if (!buf[0]) - return; - v = strtoul(buf, &tmp, 0); - if (*tmp) - com_err(com, 0, "Bad value - %s", buf); - else - *val = v; -} - - -void do_modify_inode(int argc, char *argv[]) -{ - struct ext2_inode inode; - ino_t inode_num; - int i; - errcode_t retval; - unsigned char *frag, *fsize; - char buf[80]; - int os = current_fs->super->s_creator_os; - 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>"); - return; - } - if (check_fs_open(argv[0])) - return; - if (check_fs_read_write(argv[0])) - return; - - inode_num = string_to_inode(argv[1]); - if (!inode_num) - return; - - retval = ext2fs_read_inode(current_fs, inode_num, &inode); - if (retval) { - com_err(argv[1], retval, "while trying to read inode %d", - inode_num); - return; - } - - 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); - - if (current_fs->super->s_creator_os == EXT2_OS_HURD) - modify_u32(argv[0], "Translator Block", - decimal_format, &inode.osd1.hurd1.h_i_translator); - - modify_u32(argv[0], "Fragment address", decimal_format, &inode.i_faddr); - switch (os) { - case EXT2_OS_LINUX: - frag = &inode.osd2.linux2.l_i_frag; - fsize = &inode.osd2.linux2.l_i_fsize; - break; - case EXT2_OS_HURD: - frag = &inode.osd2.hurd2.h_i_frag; - fsize = &inode.osd2.hurd2.h_i_fsize; - break; - case EXT2_OS_MASIX: - frag = &inode.osd2.masix2.m_i_frag; - fsize = &inode.osd2.masix2.m_i_fsize; - break; - default: - frag = fsize = 0; - } - if (frag) - modify_u8(argv[0], "Fragment number", decimal_format, frag); - if (fsize) - modify_u8(argv[0], "Fragment size", decimal_format, fsize); - - for (i=0; i < EXT2_NDIR_BLOCKS; i++) { - sprintf(buf, "Direct Block #%d", i); - modify_u32(argv[0], buf, decimal_format, &inode.i_block[i]); - } - modify_u32(argv[0], "Indirect Block", decimal_format, - &inode.i_block[EXT2_IND_BLOCK]); - modify_u32(argv[0], "Double Indirect Block", decimal_format, - &inode.i_block[EXT2_DIND_BLOCK]); - modify_u32(argv[0], "Triple Indirect Block", decimal_format, - &inode.i_block[EXT2_TIND_BLOCK]); - retval = ext2fs_write_inode(current_fs, inode_num, &inode); - if (retval) { - com_err(argv[1], retval, "while trying to write inode %d", - inode_num); - return; - } -} - -void do_change_working_dir(int argc, char *argv[]) -{ - ino_t inode; - int retval; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: cd <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - - inode = string_to_inode(argv[1]); - if (!inode) - return; - - retval = ext2fs_check_directory(current_fs, inode); - if (retval) { - com_err(argv[1], retval, ""); - return; - } - cwd = inode; - return; -} - -void do_print_working_directory(int argc, char *argv[]) -{ - int retval; - char *pathname = NULL; - - if (argc > 1) { - com_err(argv[0], 0, "Usage: print_working_directory"); - return; - } - if (check_fs_open(argv[0])) - return; - - retval = ext2fs_get_pathname(current_fs, cwd, 0, &pathname); - if (retval) { - com_err(argv[0], retval, - "while trying to get pathname of cwd"); - } - printf("[pwd] INODE: %6ld PATH: %s\n", cwd, pathname); - free(pathname); - retval = ext2fs_get_pathname(current_fs, root, 0, &pathname); - if (retval) { - com_err(argv[0], retval, - "while trying to get pathname of root"); - } - printf("[root] INODE: %6ld PATH: %s\n", root, pathname); - free(pathname); - return; -} - -static void make_link(char *sourcename, char *destname) -{ - ino_t inode; - int retval; - ino_t dir; - char *dest, *cp, *basename; - - /* - * Get the source inode - */ - inode = string_to_inode(sourcename); - if (!inode) - return; - basename = strrchr(sourcename, '/'); - if (basename) - basename++; - else - basename = sourcename; - /* - * Figure out the destination. First see if it exists and is - * a directory. - */ - if (! (retval=ext2fs_namei(current_fs, root, cwd, destname, &dir))) - dest = basename; - else { - /* - * OK, it doesn't exist. See if it is - * '<dir>/basename' or 'basename' - */ - cp = strrchr(destname, '/'); - if (cp) { - *cp = 0; - dir = string_to_inode(destname); - if (!dir) - return; - dest = cp+1; - } else { - dir = cwd; - dest = destname; - } - } - - retval = ext2fs_link(current_fs, dir, dest, inode, 0); - if (retval) - com_err("make_link", retval, ""); - return; -} - - -void do_link(int argc, char *argv[]) -{ - if (argc != 3) { - com_err(argv[0], 0, "Usage: link <source_file> <dest_name>"); - return; - } - if (check_fs_open(argv[0])) - return; - - make_link(argv[1], argv[2]); -} - -static void unlink_file_by_name(char *filename) -{ - int retval; - ino_t dir; - char *basename; - - basename = strrchr(filename, '/'); - if (basename) { - *basename++ = '\0'; - dir = string_to_inode(filename); - if (!dir) - return; - } else { - dir = cwd; - basename = filename; - } - retval = ext2fs_unlink(current_fs, dir, basename, 0, 0); - if (retval) - com_err("unlink_file_by_name", retval, ""); - return; -} - -void do_unlink(int argc, char *argv[]) -{ - if (argc != 2) { - com_err(argv[0], 0, "Usage: unlink <pathname>"); - return; - } - if (check_fs_open(argv[0])) - return; - - unlink_file_by_name(argv[1]); -} - -void do_find_free_block(int argc, char *argv[]) -{ - blk_t free_blk, goal; - errcode_t retval; - char *tmp; - - if ((argc > 2) || (argc==2 && *argv[1] == '?')) { - com_err(argv[0], 0, "Usage: find_free_block [goal]"); - return; - } - if (check_fs_open(argv[0])) - return; - - if (argc > 1) { - goal = strtol(argv[1], &tmp, 0); - if (*tmp) { - com_err(argv[0], 0, "Bad goal - %s", argv[1]); - return; - } - } - else - goal = current_fs->super->s_first_data_block; - - retval = ext2fs_new_block(current_fs, goal, 0, &free_blk); - if (retval) - com_err("ext2fs_new_block", retval, ""); - else - printf("Free block found: %d\n", free_blk); - -} - -void do_find_free_inode(int argc, char *argv[]) -{ - ino_t free_inode, dir; - int mode; - int retval; - char *tmp; - - 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])) - return; - - if (argc > 1) { - dir = strtol(argv[1], &tmp, 0); - if (*tmp) { - com_err(argv[0], 0, "Bad dir - %s", argv[1]); - return; - } - } - else - dir = root; - if (argc > 2) { - mode = strtol(argv[2], &tmp, 0); - if (*tmp) { - com_err(argv[0], 0, "Bad mode - %s", argv[2]); - return; - } - } else - mode = 010755; - - retval = ext2fs_new_inode(current_fs, dir, mode, 0, &free_inode); - if (retval) - com_err("ext2fs_new_inode", retval, ""); - else - 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 to_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(to_fs, last_blk, 0, &new_blk); - if (retval) { - cs->err = retval; - return BLOCK_ABORT; - } - } - last_blk = new_blk; - block = malloc(to_fs->blocksize); - if (!block) { - cs->err = ENOMEM; - return BLOCK_ABORT; - } - if (blockcnt >= 0) { - nr = read(cs->fd, block, to_fs->blocksize); - } else { - nr = to_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(to_fs->io, new_blk, 1, block); - if (retval) { - cs->err = retval; - return BLOCK_ABORT; - } - free(block); - if (blockcnt >= 0) - cs->size += nr; - cs->blocks += to_fs->blocksize / 512; - printf("%ld(%d) ", cs->size, blockcnt); - fflush(stdout); - if (nr < to_fs->blocksize) { - cs->done = 1; - printf("\n"); - } - *blocknr = new_blk; - ext2fs_mark_block_bitmap(to_fs->block_map, new_blk); - ext2fs_mark_bb_dirty(to_fs); - group = ext2fs_group_of_blk(to_fs, new_blk); - to_fs->group_desc[group].bg_free_blocks_count--; - to_fs->super->s_free_blocks_count--; - ext2fs_mark_super_dirty(to_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(current_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(current_fs, newfile, &inode); - if (retval) - return retval; - - inode.i_blocks += cs.blocks; - - retval = ext2fs_write_inode(current_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 (check_fs_read_write(argv[0])) - 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(current_fs, cwd, 010755, 0, &newfile); - if (retval) { - com_err(argv[0], retval, ""); - close(fd); - return; - } - printf("Allocated inode: %ld\n", newfile); - retval = ext2fs_link(current_fs, cwd, argv[2], newfile, 0); - if (retval) { - com_err(argv[2], retval, ""); - close(fd); - return; - } - if (ext2fs_test_inode_bitmap(current_fs->inode_map,newfile)) - com_err(argv[0], 0, "Warning: inode already set"); - ext2fs_mark_inode_bitmap(current_fs->inode_map,newfile); - ext2fs_mark_ib_dirty(current_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(current_fs, newfile, &inode); - retval = ext2fs_write_inode(current_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 (check_fs_read_write(argv[0])) - return; - retval = ext2fs_new_inode(current_fs, cwd, 010755, 0, &newfile); - if (retval) { - com_err(argv[0], retval, ""); - return; - } - printf("Allocated inode: %ld\n", newfile); - retval = ext2fs_link(current_fs, cwd, argv[1], newfile, 0); - if (retval) { - if (retval == EXT2_ET_DIR_NO_SPACE) { - retval = ext2fs_expand_dir(current_fs, cwd); - if (!retval) - retval = ext2fs_link(current_fs, cwd, - argv[1], newfile, 0); - } - if (retval) { - com_err(argv[1], retval, ""); - return; - } - } - if (ext2fs_test_inode_bitmap(current_fs->inode_map,newfile)) - com_err(argv[0], 0, "Warning: inode already set"); - ext2fs_mark_inode_bitmap(current_fs->inode_map, newfile); - ext2fs_mark_ib_dirty(current_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(current_fs, newfile, &inode); - retval = ext2fs_write_inode(current_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; - ino_t parent; - char *name; - errcode_t retval; - - if (check_fs_open(argv[0])) - return; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: mkdir <file>"); - return; - } - - cp = strrchr(argv[1], '/'); - if (cp) { - *cp = 0; - parent = string_to_inode(argv[1]); - if (!parent) { - com_err(argv[1], ENOENT, ""); - return; - } - name = cp+1; - } else { - parent = cwd; - name = argv[1]; - } - - - retval = ext2fs_mkdir(current_fs, parent, 0, name); - if (retval) { - com_err("ext2fs_mkdir", retval, ""); - return; - } - -} - -void do_rmdir(int argc, char *argv[]) -{ - printf("Unimplemented\n"); -} - - -static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, - int blockcnt, void *private) -{ - printf("%d ", *blocknr); - ext2fs_unmark_block_bitmap(fs->block_map,*blocknr); - return 0; -} - -static void kill_file_by_inode(ino_t inode) -{ - struct ext2_inode inode_buf; - - ext2fs_read_inode(current_fs, inode, &inode_buf); - inode_buf.i_dtime = time(NULL); - ext2fs_write_inode(current_fs, inode, &inode_buf); - - printf("Kill file by inode %ld\n", inode); - ext2fs_block_iterate(current_fs, inode, 0, NULL, - release_blocks_proc, NULL); - printf("\n"); - ext2fs_unmark_inode_bitmap(current_fs->inode_map, inode); - - ext2fs_mark_bb_dirty(current_fs); - ext2fs_mark_ib_dirty(current_fs); -} - - -void do_kill_file(int argc, char *argv[]) -{ - ino_t inode_num; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: kill_file <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - - inode_num = string_to_inode(argv[1]); - if (!inode_num) { - com_err(argv[0], 0, "Cannot find file"); - return; - } - kill_file_by_inode(inode_num); -} - -void do_rm(int argc, char *argv[]) -{ - int retval; - ino_t inode_num; - struct ext2_inode inode; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: rm <filename>"); - return; - } - if (check_fs_open(argv[0])) - return; - - retval = ext2fs_namei(current_fs, root, cwd, argv[1], &inode_num); - if (retval) { - com_err(argv[0], 0, "Cannot find file"); - return; - } - - retval = ext2fs_read_inode(current_fs,inode_num,&inode); - if (retval) { - com_err(argv[0], retval, "while reading file's inode"); - return; - } - - if (LINUX_S_ISDIR(inode.i_mode)) { - com_err(argv[0], 0, "file is a directory"); - return; - } - - --inode.i_links_count; - retval = ext2fs_write_inode(current_fs,inode_num,&inode); - if (retval) { - com_err(argv[0], retval, "while writing inode"); - return; - } - - unlink_file_by_name(argv[1]); - if (inode.i_links_count == 0) - kill_file_by_inode(inode_num); -} - -void do_show_debugfs_params(int argc, char *argv[]) -{ - FILE *out = stdout; - - if (current_fs) - fprintf(out, "Open mode: read-%s\n", - current_fs->flags & EXT2_FLAG_RW ? "write" : "only"); - fprintf(out, "Filesystem in use: %s\n", - current_fs ? current_fs->device_name : "--none--"); -} - -void do_expand_dir(int argc, char *argv[]) -{ - ino_t inode; - int retval; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: expand_dir <file>"); - return; - } - if (check_fs_open(argv[0])) - return; - inode = string_to_inode(argv[1]); - if (!inode) - return; - - retval = ext2fs_expand_dir(current_fs, inode); - if (retval) - com_err("ext2fs_expand_dir", retval, ""); - return; -} - -static int source_file(const char *cmd_file, int sci_idx) -{ - FILE *f; - char buf[256]; - char *cp; - int exit_status = 0; - int retval; - - if (strcmp(cmd_file, "-") == 0) - f = stdin; - else { - f = fopen(cmd_file, "r"); - if (!f) { - perror(cmd_file); - exit(1); - } - } - setbuf(stdout, NULL); - setbuf(stderr, NULL); - while (!feof(f)) { - if (fgets(buf, sizeof(buf), f) == NULL) - break; - cp = strchr(buf, '\n'); - if (cp) - *cp = 0; - cp = strchr(buf, '\r'); - if (cp) - *cp = 0; - printf("debugfs: %s\n", buf); - retval = ss_execute_line(sci_idx, buf); - if (retval) { - ss_perror(sci_idx, retval, buf); - exit_status++; - } - } - return exit_status; -} - -void main(int argc, char **argv) -{ - int retval; - int sci_idx; - const char *usage = "Usage: debugfs [[-w] device]"; - char c; - int open_flags = 0; - char *request = 0; - int exit_status = 0; - char *cmd_file = 0; - - initialize_ext2_error_table(); - - while ((c = getopt (argc, argv, "wR:f:")) != EOF) { - switch (c) { - case 'R': - request = optarg; - break; - case 'f': - cmd_file = optarg; - break; - case 'w': - open_flags = EXT2_FLAG_RW; - break; - default: - com_err(argv[0], 0, usage); - return; - } - } - if (optind < argc) - open_filesystem(argv[optind], open_flags); - - sci_idx = ss_create_invocation("debugfs", "0.0", (char *) NULL, - &debug_cmds, &retval); - if (retval) { - ss_perror(sci_idx, retval, "creating invocation"); - exit(1); - } - - (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &retval); - if (retval) { - ss_perror(sci_idx, retval, "adding standard requests"); - exit (1); - } - if (request) { - retval = 0; - retval = ss_execute_line(sci_idx, request); - if (retval) { - ss_perror(sci_idx, retval, request); - exit_status++; - } - } else if (cmd_file) { - exit_status = source_file(cmd_file, sci_idx); - } else { - ss_listen(sci_idx); - } - - if (current_fs) - close_filesystem(); - - exit(exit_status); -} - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.h b/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.h deleted file mode 100644 index 0ac71cf2971..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/debugfs.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * debugfs.h --- header file for the debugfs program - */ - -#include <linux/ext2_fs.h> -#include "ext2fs/ext2fs.h" - -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - -extern ext2_filsys current_fs; -extern ino_t root, cwd; - -extern FILE *open_pager(void); -extern void close_pager(FILE *stream); -extern int check_fs_open(char *name); -extern int check_fs_not_open(char *name); -extern int check_fs_read_write(char *name); -extern ino_t string_to_inode(char *str); -extern char *time_to_string(__u32); - -/* 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); - - - - - - - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/dump.c b/gnu/usr.sbin/e2fsprogs/debugfs/dump.c deleted file mode 100644 index 3997dfde7cf..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/dump.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * dump.c --- dump the contents of an inode out to a file - * - * Copyright (C) 1994 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 <ctype.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <utime.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 - -#include "debugfs.h" - -/* - * The mode_xlate function translates a linux mode into a native-OS mode_t. - */ -static struct { - __u16 lmask; - mode_t mask; -} mode_table[] = { - { LINUX_S_IRUSR, S_IRUSR }, - { LINUX_S_IWUSR, S_IWUSR }, - { LINUX_S_IXUSR, S_IXUSR }, - { LINUX_S_IRGRP, S_IRGRP }, - { LINUX_S_IWGRP, S_IWGRP }, - { LINUX_S_IXGRP, S_IXGRP }, - { LINUX_S_IROTH, S_IROTH }, - { LINUX_S_IWOTH, S_IWOTH }, - { LINUX_S_IXOTH, S_IXOTH }, - { 0, 0 } -}; - -static mode_t mode_xlate(__u16 lmode) -{ - mode_t mode = 0; - int i; - - for (i=0; mode_table[i].lmask; i++) { - if (lmode & mode_table[i].lmask) - mode |= mode_table[i].mask; - } - return mode; -} - -struct dump_block_struct { - int fd; - char *buf; - int left; - errcode_t errcode; -}; - -static int dump_block(ext2_filsys fs, blk_t *blocknr, int blockcnt, - void *private) -{ - int nbytes, left; - off_t ret_off; - - struct dump_block_struct *rec = (struct dump_block_struct *) private; - - if (blockcnt < 0) - return 0; - - if (*blocknr) { - rec->errcode = io_channel_read_blk(fs->io, *blocknr, - 1, rec->buf); - if (rec->errcode) - return BLOCK_ABORT; - } else { - /* - * OK, the file has a hole. Let's try to seek past - * the hole in the destination file, so that the - * destination file has a hole too. - */ - ret_off = lseek(rec->fd, fs->blocksize, SEEK_CUR); - if (ret_off >= 0) - return 0; - memset(rec->buf, 0, fs->blocksize); - } - - left = (rec->left > fs->blocksize) ? fs->blocksize : rec->left; - rec->left -= left; - - while (left > 0) { - nbytes = write(rec->fd, rec->buf, left); - if (nbytes == -1) { - if (errno == EINTR) - continue; - rec->errcode = errno; - return BLOCK_ABORT; - } - left -= nbytes; - } - if (rec->left <= 0) - return BLOCK_ABORT; - return 0; -} - -static void dump_file(char *cmdname, ino_t ino, int fd, int preserve, - char *outname) -{ - errcode_t retval; - struct dump_block_struct rec; - struct ext2_inode inode; - struct utimbuf ut; - - retval = ext2fs_read_inode(current_fs, ino, &inode); - if (retval) { - com_err(cmdname, retval, - "while reading inode %u in dump_file", ino); - return; - } - - rec.fd = fd; - rec.errcode = 0; - rec.buf = malloc(current_fs->blocksize); - rec.left = inode.i_size; - - if (rec.buf == 0) { - com_err(cmdname, ENOMEM, - "while allocating block buffer for dump_inode"); - return; - } - - retval = ext2fs_block_iterate(current_fs, ino, - BLOCK_FLAG_HOLE|BLOCK_FLAG_DATA_ONLY, - NULL, dump_block, &rec); - if (retval) { - com_err(cmdname, retval, "while iterating over blocks in %s", - outname); - goto cleanup; - } - if (rec.errcode) { - com_err(cmdname, retval, "in dump_block while dumping %s", - outname); - goto cleanup; - } - -cleanup: - if (preserve) { -#ifdef HAVE_FCHOWN - if (fchown(fd, inode.i_uid, inode.i_gid) < 0) - com_err("dump_file", errno, - "while changing ownership of %s", outname); -#else - if (chown(outname, inode.i_uid, inode.i_gid) < 0) - com_err("dump_file", errno, - "while changing ownership of %s", outname); - -#endif - if (fchmod(fd, mode_xlate(inode.i_mode)) < 0) - com_err("dump_file", errno, - "while setting permissions of %s", outname); - ut.actime = inode.i_atime; - ut.modtime = inode.i_mtime; - close(fd); - if (utime(outname, &ut) < 0) - com_err("dump_file", errno, - "while setting times on %s", outname); - } else if (fd != 1) - close(fd); - - free(rec.buf); - return; -} - -void do_dump(int argc, char **argv) -{ - ino_t inode; - int fd; - char c; - int preserve = 0; - const char *dump_usage = "Usage: dump_inode [-p] <file> <output_file>"; - char *in_fn, *out_fn; - - optind = 0; -#ifdef HAVE_OPTRESET - optreset = 1; /* Makes BSD getopt happy */ -#endif - while ((c = getopt (argc, argv, "p")) != EOF) { - switch (c) { - case 'p': - preserve++; - break; - default: - com_err(argv[0], 0, dump_usage); - return; - } - } - if (optind != argc-2) { - com_err(argv[0], 0, dump_usage); - return; - } - - if (check_fs_open(argv[0])) - return; - - in_fn = argv[optind]; - out_fn = argv[optind+1]; - - inode = string_to_inode(in_fn); - if (!inode) - return; - - fd = open(out_fn, O_CREAT | O_WRONLY | O_TRUNC, 0666); - if (fd < 0) { - com_err(argv[0], errno, "while opening %s for dump_inode", - out_fn); - return; - } - - dump_file(argv[0], inode, fd, preserve, out_fn); - - return; -} - -void do_cat(int argc, char **argv) -{ - ino_t inode; - - if (argc != 2) { - com_err(argv[0], 0, "Usage: cat <file>"); - return; - } - - if (check_fs_open(argv[0])) - return; - - inode = string_to_inode(argv[1]); - if (!inode) - return; - - fflush(stdout); - fflush(stderr); - dump_file(argv[0], inode, 1, 0, argv[2]); - - return; -} - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/icheck.c b/gnu/usr.sbin/e2fsprogs/debugfs/icheck.c deleted file mode 100644 index 9e40611352e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/icheck.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * icheck.c --- given a list of blocks, generate a list of inodes - * - * Copyright (C) 1994 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 <ctype.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/types.h> - -#include "debugfs.h" - -struct block_info { - blk_t blk; - ino_t ino; -}; - -struct block_walk_struct { - struct block_info *barray; - int blocks_left; - int num_blocks; - ino_t inode; -}; - -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; - - for (i=0; i < bw->num_blocks; i++) { - if (bw->barray[i].blk == *block_nr) { - bw->barray[i].ino = bw->inode; - bw->blocks_left--; - } - } - if (!bw->blocks_left) - return BLOCK_ABORT; - - return 0; -} - -void do_icheck(int argc, char **argv) -{ - struct block_walk_struct bw; - struct block_info *binfo; - int i; - ext2_inode_scan scan = 0; - ino_t ino; - struct ext2_inode inode; - errcode_t retval; - char *tmp; - char *block_buf; - - if (argc < 2) { - com_err(argv[0], 0, "Usage: icheck <block number> ..."); - return; - } - if (check_fs_open(argv[0])) - return; - - bw.barray = malloc(sizeof(struct block_info) * argc); - if (!bw.barray) { - com_err("icheck", ENOMEM, - "while allocating inode info array"); - return; - } - memset(bw.barray, 0, sizeof(struct block_info) * argc); - - block_buf = malloc(current_fs->blocksize * 3); - if (!block_buf) { - com_err("icheck", ENOMEM, "while allocating block buffer"); - goto error_out; - } - - for (i=1; i < argc; i++) { - bw.barray[i-1].blk = strtol(argv[i], &tmp, 0); - if (*tmp) { - com_err(argv[0], 0, "Bad block - %s", argv[i]); - return; - } - } - - bw.num_blocks = bw.blocks_left = argc-1; - - retval = ext2fs_open_inode_scan(current_fs, 0, &scan); - if (retval) { - com_err("icheck", retval, "while opening inode scan"); - goto error_out; - } - - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("icheck", retval, "while starting inode scan"); - goto error_out; - } - - while (ino) { - if (!inode.i_links_count) - goto next; - /* - * To handle filesystems touched by 0.3c extfs; can be - * removed later. - */ - if (inode.i_dtime) - goto next; - - bw.inode = ino; - - retval = ext2fs_block_iterate(current_fs, ino, 0, block_buf, - icheck_proc, &bw); - if (retval) { - com_err("icheck", retval, - "while calling ext2_block_iterate"); - goto next; - } - - if (bw.blocks_left == 0) - break; - - next: - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("icheck", retval, - "while doing inode scan"); - goto error_out; - } - } - - printf("Block\tInode number\n"); - for (i=0, binfo = bw.barray; i < bw.num_blocks; i++, binfo++) { - if (binfo->ino == 0) { - printf("%u\t<block not found>\n", binfo->blk); - continue; - } - printf("%u\t%ld\n", binfo->blk, binfo->ino); - } - -error_out: - free(bw.barray); - free(block_buf); - if (scan) - ext2fs_close_inode_scan(scan); - return; -} diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/ls.c b/gnu/usr.sbin/e2fsprogs/debugfs/ls.c deleted file mode 100644 index 98c1d607cfb..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/ls.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * ls.c --- list directories - * - * Copyright (C) 1997 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 <ctype.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/types.h> - -#include "debugfs.h" - -/* - * list directory - */ - -#define LONG_OPT 0x0001 - -struct list_dir_struct { - FILE *f; - int col; - int options; -}; - -static const char *monstr[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - -static void ls_l_file(struct list_dir_struct *ls, char *name, ino_t ino) -{ - struct ext2_inode inode; - errcode_t retval; - struct tm *tm_p; - time_t modtime; - char datestr[80]; - - retval = ext2fs_read_inode(current_fs, ino, &inode); - if (retval) { - fprintf(ls->f, "%5d --- error --- %s\n", name); - return; - } - modtime = inode.i_mtime; - tm_p = localtime(&modtime); - sprintf(datestr, "%2d-%s-%2d %02d:%02d", - tm_p->tm_mday, monstr[tm_p->tm_mon], tm_p->tm_year, - tm_p->tm_hour, tm_p->tm_min); - fprintf(ls->f, "%6d %6o %5d %5d %5d %s %s\n", ino, inode.i_mode, - inode.i_uid, inode.i_gid, inode.i_size, datestr, name); -} - -static void ls_file(struct list_dir_struct *ls, char *name, - ino_t ino, int rec_len) -{ - char tmp[EXT2_NAME_LEN + 16]; - int thislen; - - sprintf(tmp, "%d (%d) %s ", ino, rec_len, name); - thislen = strlen(tmp); - - if (ls->col + thislen > 80) { - fprintf(ls->f, "\n"); - ls->col = 0; - } - fprintf(ls->f, "%s", tmp); - ls->col += thislen; -} - - -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]; - - struct list_dir_struct *ls = (struct list_dir_struct *) private; - int thislen; - - thislen = (dirent->name_len < EXT2_NAME_LEN) ? dirent->name_len : - EXT2_NAME_LEN; - strncpy(name, dirent->name, thislen); - name[thislen] = '\0'; - - if (ls->options & LONG_OPT) - ls_l_file(ls, name, dirent->inode); - else - ls_file(ls, name, dirent->inode, dirent->rec_len); - - return 0; -} - -void do_list_dir(int argc, char *argv[]) -{ - ino_t inode; - int retval; - struct list_dir_struct ls; - int argptr = 1; - - ls.options = 0; - if (check_fs_open(argv[0])) - return; - - if ((argc > argptr) && (argv[argptr][0] == '-')) { - argptr++; - ls.options = LONG_OPT; - } - - if (argc <= argptr) - inode = cwd; - else - inode = string_to_inode(argv[argptr]); - if (!inode) - return; - - ls.f = open_pager(); - ls.col = 0; - retval = ext2fs_dir_iterate(current_fs, inode, - DIRENT_FLAG_INCLUDE_EMPTY, - 0, list_dir_proc, &ls); - fprintf(ls.f, "\n"); - close_pager(ls.f); - if (retval) - com_err(argv[1], retval, ""); - - return; -} - - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/lsdel.c b/gnu/usr.sbin/e2fsprogs/debugfs/lsdel.c deleted file mode 100644 index a307d8befde..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/lsdel.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * undelete.c --- routines to try to help a user recover a deleted file. - * - * Copyright (C) 1994 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 <ctype.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/types.h> -#include <sys/stat.h> - -#include "debugfs.h" - -struct deleted_info { - ino_t ino; - unsigned short mode; - unsigned short uid; - unsigned long size; - time_t dtime; - int num_blocks; - int free_blocks; -}; - -struct lsdel_struct { - ino_t inode; - int num_blocks; - int free_blocks; - int bad_blocks; -}; - -static int deleted_info_compare(const void *a, const void *b) -{ - const struct deleted_info *arg1, *arg2; - - arg1 = (const struct deleted_info *) a; - arg2 = (const struct deleted_info *) b; - - return arg1->dtime - arg2->dtime; -} - -static int lsdel_proc(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - void *private) -{ - struct lsdel_struct *lsd = (struct lsdel_struct *) private; - - lsd->num_blocks++; - - if (*block_nr < fs->super->s_first_data_block || - *block_nr >= fs->super->s_blocks_count) { - lsd->bad_blocks++; - return BLOCK_ABORT; - } - - if (!ext2fs_test_block_bitmap(fs->block_map,*block_nr)) - lsd->free_blocks++; - - return 0; -} - -void do_lsdel(int argc, char **argv) -{ - struct lsdel_struct lsd; - struct deleted_info *delarray; - int num_delarray, max_delarray; - ext2_inode_scan scan = 0; - ino_t ino; - struct ext2_inode inode; - errcode_t retval; - char *block_buf; - int i; - - if (argc > 1) { - com_err(argv[0], 0, "Usage: ls_deleted_inodes\n"); - return; - } - if (check_fs_open(argv[0])) - return; - - max_delarray = 100; - num_delarray = 0; - delarray = malloc(max_delarray * sizeof(struct deleted_info)); - if (!delarray) { - com_err("ls_deleted_inodes", ENOMEM, - "while allocating deleted information storage"); - exit(1); - } - - block_buf = malloc(current_fs->blocksize * 3); - if (!block_buf) { - com_err("ls_deleted_inodes", ENOMEM, "while allocating block buffer"); - goto error_out; - } - - retval = ext2fs_open_inode_scan(current_fs, 0, &scan); - if (retval) { - com_err("ls_deleted_inodes", retval, - "while opening inode scan"); - goto error_out; - } - - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("ls_deleted_inodes", retval, - "while starting inode scan"); - goto error_out; - } - - while (ino) { - if (inode.i_dtime == 0) - goto next; - - lsd.inode = ino; - lsd.num_blocks = 0; - lsd.free_blocks = 0; - lsd.bad_blocks = 0; - - retval = ext2fs_block_iterate(current_fs, ino, 0, block_buf, - lsdel_proc, &lsd); - if (retval) { - com_err("ls_deleted_inodes", retval, - "while calling ext2_block_iterate"); - goto next; - } - if (lsd.free_blocks && !lsd.bad_blocks) { - if (num_delarray >= max_delarray) { - max_delarray += 50; - delarray = realloc(delarray, - max_delarray * sizeof(struct deleted_info)); - if (!delarray) { - com_err("ls_deleted_inodes", - ENOMEM, - "while reallocating array"); - exit(1); - } - } - - delarray[num_delarray].ino = ino; - delarray[num_delarray].mode = inode.i_mode; - delarray[num_delarray].uid = inode.i_uid; - delarray[num_delarray].size = inode.i_size; - delarray[num_delarray].dtime = inode.i_dtime; - delarray[num_delarray].num_blocks = lsd.num_blocks; - delarray[num_delarray].free_blocks = lsd.free_blocks; - num_delarray++; - } - - next: - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("ls_deleted_inodes", retval, - "while doing inode scan"); - goto error_out; - } - } - - printf("%d deleted inodes found.\n", num_delarray); - printf(" Inode Owner Mode Size Blocks Time deleted\n"); - - qsort(delarray, num_delarray, sizeof(struct deleted_info), - deleted_info_compare); - - for (i = 0; i < num_delarray; i++) { - printf("%6lu %6d %6o %6lu %4d/%4d %s", delarray[i].ino, - delarray[i].uid, delarray[i].mode, delarray[i].size, - delarray[i].free_blocks, delarray[i].num_blocks, - time_to_string(delarray[i].dtime)); - } - -error_out: - free(block_buf); - free(delarray); - if (scan) - ext2fs_close_inode_scan(scan); - return; -} - - - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/ncheck.c b/gnu/usr.sbin/e2fsprogs/debugfs/ncheck.c deleted file mode 100644 index 7dec3434042..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/ncheck.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * ncheck.c --- given a list of inodes, generate a list of names - * - * Copyright (C) 1994 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 <ctype.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/types.h> - -#include "debugfs.h" - -struct inode_info { - ino_t ino; - ino_t parent; - char *pathname; -}; - -struct inode_walk_struct { - struct inode_info *iarray; - int inodes_left; - int num_inodes; - int position; - ino_t parent; -}; - -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; - - iw->position++; - if (iw->position <= 2) - return 0; - for (i=0; i < iw->num_inodes; i++) { - if (iw->iarray[i].ino == dirent->inode) { - iw->iarray[i].parent = iw->parent; - iw->inodes_left--; - } - } - if (!iw->inodes_left) - return DIRENT_ABORT; - - return 0; -} - -void do_ncheck(int argc, char **argv) -{ - struct inode_walk_struct iw; - struct inode_info *iinfo; - int i; - ext2_inode_scan scan = 0; - ino_t ino; - struct ext2_inode inode; - errcode_t retval; - char *tmp; - - if (argc < 2) { - com_err(argv[0], 0, "Usage: ncheck <inode number> ..."); - return; - } - if (check_fs_open(argv[0])) - return; - - iw.iarray = malloc(sizeof(struct inode_info) * argc); - if (!iw.iarray) { - com_err("do_ncheck", ENOMEM, - "while allocating inode info array"); - return; - } - memset(iw.iarray, 0, sizeof(struct inode_info) * argc); - - for (i=1; i < argc; i++) { - iw.iarray[i-1].ino = strtol(argv[i], &tmp, 0); - if (*tmp) { - com_err(argv[0], 0, "Bad inode - %s", argv[i]); - return; - } - } - - iw.num_inodes = iw.inodes_left = argc-1; - - retval = ext2fs_open_inode_scan(current_fs, 0, &scan); - if (retval) { - com_err("ncheck", retval, "while opening inode scan"); - goto error_out; - } - - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("ncheck", retval, "while starting inode scan"); - goto error_out; - } - - while (ino) { - if (!inode.i_links_count) - goto next; - /* - * To handle filesystems touched by 0.3c extfs; can be - * removed later. - */ - if (inode.i_dtime) - goto next; - /* Ignore anything that isn't a directory */ - if (!LINUX_S_ISDIR(inode.i_mode)) - goto next; - - iw.position = 0; - iw.parent = ino; - - retval = ext2fs_dir_iterate(current_fs, ino, 0, 0, - ncheck_proc, &iw); - if (retval) { - com_err("ncheck", retval, - "while calling ext2_dir_iterate"); - goto next; - } - - if (iw.inodes_left == 0) - break; - - next: - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("ncheck", retval, - "while doing inode scan"); - goto error_out; - } - } - - for (i=0, iinfo = iw.iarray; i < iw.num_inodes; i++, iinfo++) { - if (iinfo->parent == 0) - continue; - retval = ext2fs_get_pathname(current_fs, iinfo->parent, - iinfo->ino, &iinfo->pathname); - if (retval) - com_err("ncheck", retval, - "while resolving pathname for inode %d (%d)", - iinfo->parent, iinfo->ino); - } - - printf("Inode\tPathname\n"); - for (i=0, iinfo = iw.iarray; i < iw.num_inodes; i++, iinfo++) { - if (iinfo->parent == 0) { - printf("%ld\t<inode not found>\n", iinfo->ino); - continue; - } - printf("%ld\t%s\n", iinfo->ino, iinfo->pathname ? - iinfo->pathname : "<unknown pathname>"); - if (iinfo->pathname) - free(iinfo->pathname); - } - -error_out: - free(iw.iarray); - if (scan) - ext2fs_close_inode_scan(scan); - return; -} - - - diff --git a/gnu/usr.sbin/e2fsprogs/debugfs/util.c b/gnu/usr.sbin/e2fsprogs/debugfs/util.c deleted file mode 100644 index c8eeae171de..00000000000 --- a/gnu/usr.sbin/e2fsprogs/debugfs/util.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * util.c --- utilities for the debugfs program - * - * Copyright (C) 1993, 1994 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 <ctype.h> -#include <string.h> -#include <time.h> - -#include "debugfs.h" - -FILE *open_pager(void) -{ - FILE *outfile; - char *pager = getenv("PAGER"); - - if (!pager) - outfile = stdout; - else { - outfile = popen(pager, "w"); - if (!outfile) outfile = stdout; - } - return (outfile); -} - -void close_pager(FILE *stream) -{ - if (stream && stream != stdout) fclose(stream); -} - -/* - * This routine is used whenever a command needs to turn a string into - * an inode. - */ -ino_t string_to_inode(char *str) -{ - ino_t ino; - int len = strlen(str); - int i; - int retval; - - /* - * If the string is of the form <ino>, then treat it as an - * inode number. - */ - if ((len > 2) && (str[0] == '<') && (str[len-1] == '>')) { - for (i = 1; i < len-1; i++) - if (!isdigit(str[i])) - break; - if (i == len-1) - return(atoi(str+1)); - } - - retval = ext2fs_namei(current_fs, root, cwd, str, &ino); - if (retval) { - com_err(str, retval, ""); - return 0; - } - return ino; -} - -/* - * This routine returns 1 if the filesystem is not open, and prints an - * error message to that effect. - */ -int check_fs_open(char *name) -{ - if (!current_fs) { - com_err(name, 0, "Filesystem not open"); - return 1; - } - return 0; -} - -/* - * This routine returns 1 if a filesystem is open, and prints an - * error message to that effect. - */ -int check_fs_not_open(char *name) -{ - if (current_fs) { - com_err(name, 0, - "Filesystem %s is still open. Close it first.\n", - current_fs->device_name); - return 1; - } - return 0; -} - -/* - * This routine returns 1 if a filesystem is not opened read/write, - * and prints an error message to that effect. - */ -int check_fs_read_write(char *name) -{ - if (!(current_fs->flags & EXT2_FLAG_RW)) { - com_err(name, 0, "Filesystem opened read/only"); - return 1; - } - return 0; -} - -/* - * This function takes a __u32 time value and converts it to a string, - * using ctime - */ -char *time_to_string(__u32 cl) -{ - time_t t = (time_t) cl; - - return ctime(&t); -} - - - - diff --git a/gnu/usr.sbin/e2fsprogs/depfix.sed b/gnu/usr.sbin/e2fsprogs/depfix.sed deleted file mode 100644 index 1bcf1126fb0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/depfix.sed +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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\ - diff --git a/gnu/usr.sbin/e2fsprogs/doc/Makefile.in b/gnu/usr.sbin/e2fsprogs/doc/Makefile.in deleted file mode 100644 index b3588e33dfb..00000000000 --- a/gnu/usr.sbin/e2fsprogs/doc/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# Makefile for the doc directory -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = .. -my_dir = doc -INSTALL = @INSTALL@ - -@MCONFIG@ - -DVI=texi2dvi -DVIPS=dvips -o "$@" -INFO=makeinfo -HTML=texi2html -RM=/bin/rm -rf - -all:: libext2fs.info libext2fs.dvi - -install-doc-libs: - $(RM) $(DESTDIR)$(infodir)/libext2fs.info*.gz - $(top_srcdir)/mkinstalldirs $(DESTDIR)$(infodir) - for i in libext2fs.info* ; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i ; \ - done - gzip -9 $(DESTDIR)$(infodir)/libext2fs.info* - -libext2fs.info: $(srcdir)/libext2fs.texinfo - $(INFO) $(srcdir)/libext2fs.texinfo - -libext2fs.dvi: $(srcdir)/libext2fs.texinfo - $(DVI) $(srcdir)/libext2fs.texinfo - -.PHONY: clean -clean:: clean-all - -.PHONY: clean-all -clean-all:: clean-tex clean-backup clean-final clean-tarfiles - -.PHONY: clean-final -clean-final:: - $(RM) *.ps *.info *.info-? *.html - -.PHONY: clean-tex -clean-tex:: - $(RM) *.aux *.cp *.dvi *.fn *.ky *.log *.pg *.toc *.tp *.vr *.fns - -.PHONY: clean-backup -clean-backup:: - $(RM) *~ #* - -.PHONY: clean-tarfiles -clean-tarfiles:: - $(RM) *.tar *.tar.gz *.tgz - - - diff --git a/gnu/usr.sbin/e2fsprogs/doc/libext2fs.texinfo b/gnu/usr.sbin/e2fsprogs/doc/libext2fs.texinfo deleted file mode 100644 index 8a5b64b0459..00000000000 --- a/gnu/usr.sbin/e2fsprogs/doc/libext2fs.texinfo +++ /dev/null @@ -1,1074 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename libext2fs.info -@settitle The EXT2FS Library (version 1.10) -@synindex tp fn -@comment %**end of header - -@ifinfo -@format -START-INFO-DIR-ENTRY -* libext2fs: (libext2fs.info). The EXT2FS library. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@c smallbook - -@iftex -@finalout -@end iftex - -@c Note: the edition number is listed in *three* places; please update -@c all three. Also, update the month and year where appropriate. - -@c ==> Update edition number for settitle and subtitle, and in the -@c ==> following paragraph; update date, too. - - -@ifinfo -This file documents the ext2fs library, a library for manipulating the -ext2 filesystem. - -Copyright (C) 1997 Theodore Ts'o - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the author. -@end ifinfo - -@setchapternewpage on -@titlepage -@c use the new format for titles - -@title The EXT2FS Library -@subtitle The EXT2FS Library -@subtitle Version 1.10 -@subtitle April 1997 - -@author by Theodore Ts'o - -@c Include the Distribution inside the titlepage so -@c that headings are turned off. - -@tex -\global\parindent=0pt -\global\parskip=8pt -\global\baselineskip=13pt -@end tex - -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1997 Theodore Ts'o - -@sp 2 - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end titlepage -@headings double - -@ifinfo -@node Top, Introduction to the EXT2FS Library, (dir), (dir) - -@top The EXT2FS Library - -This manual documents the EXT2FS Library, version 1.10. - -@end ifinfo - -@menu -* Introduction to the EXT2FS Library:: -* EXT2FS Library Functions:: -* Concept Index:: -* Function Index:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Introduction to the EXT2FS Library, EXT2FS Library Functions, Top, Top -@comment node-name, next, previous, up -@chapter Introduction to the EXT2FS Library - -The EXT2FS library is designed to allow user-level programs to -manipulate an ext2 filesystem. - -@node EXT2FS Library Functions, Concept Index, Introduction to the EXT2FS Library, Top -@comment node-name, next, previous, up -@chapter EXT2FS Library Functions - -@menu -* Filesystem-level functions:: -* Inode Functions:: -* Directory functions:: -* Bitmap Functions:: -* EXT2 data abstractions:: -* Byte-swapping functions:: -* Other functions:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Filesystem-level functions, Inode Functions, EXT2FS Library Functions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section Filesystem-level functions - -The following functions operate on a filesystem handle. Most EXT2FS -Library functions require a filesystem handle as their first argument. -There are two functions which create a filesystem handle, -@code{ext2fs_open} and @code{ext2fs_initialize}. - -The filesystem can also be closed using @code{ext2fs_close}, and any -changes to the superblock and group descripts can be written out to disk -using @code{ext2fs_flush}. - -@menu -* Opening an ext2 filesystem:: -* Closing and flushing out changes:: -* Initializing a filesystem:: -* Filesystem flag functions:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Opening an ext2 filesystem, Closing and flushing out changes, Filesystem-level functions, Filesystem-level functions -@comment node-name, next, previous, up -@subsection Opening an ext2 filesystem - -Most libext2fs functions take a filesystem handle of type -@code{ext2_filsys}. A filesystem handle is created either by opening -an existing function using @code{ext2fs_open}, or by initializing a new -filesystem using @code{ext2fs_initialize}. - -@deftypefun errcode_t ext2fs_open (const char *@var{name}, int @var{flags}, int @var{superblock}, int @var{block_size}, io_manager @var{manager}, ext2_filsys *@var{ret_fs}) - -Opens a filesystem named @var{name}, using the the io_manager -@var{manager} to define the input/output routines needed to read and -write the filesystem. In the case of the @code{unix_io} io_manager, -@var{name} is interpreted as the Unix filename of the filesystem image. -This is often a device file, such as @file{/dev/hda1}. - -The @var{superblock} parameter specifies the block number of the -superblock which should be used when opening the filesystem. -If @var{superblock} is zero, @code{ext2fs_open} will use the primary -superblock located at offset 1024 bytes from the start of the filesystem -image. - -The @var{block_size} parameter specifies the block size used by the -filesystem. Normally this is determined automatically from the -filesystem uperblock. If @var{block_size} is non-zero, it must match -the block size found in the superblock, or the error -@code{EXT2_ET_UNEXPECTED_BLOCK_SIZE} will be returned. The -@var{block_size} parameter is also used to help fund the superblock when -@var{superblock} is non-zero. - -The @var{flags} argument contains a bitmask of flags which control how -the filesystem open should be handled. - -@table @code -@item EXT2_FLAG_RW -Open the filesystem for reading and writing. Without this flag, the -filesystem is opened for reading only. - -@item EXT2_FLAG_FORCE -Open the filesystem regardless of the feature sets listed in the -superblock. - -@end table -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Closing and flushing out changes, Initializing a filesystem, Opening an ext2 filesystem, Filesystem-level functions -@comment node-name, next, previous, up -@subsection Closing and flushing out changes - -@deftypefun errcode_t ext2fs_flush (ext2_filsys @var{fs}) - -Write any changes to the high-level filesystem data structures in the -@var{fs} filesystem. The following data structures will be written out: - -@itemize @bullet -@item The filesystem superblock -@item The filesystem group descriptors -@item The filesystem bitmaps, if read in via @code{ext2fs_read_bitmaps}. -@end itemize - -@end deftypefun - -@deftypefun void ext2fs_free (ext2_filsys @var{fs}) - -Close the io_manager abstraction for @var{fs} and release all memory -associated with the filesystem handle. -@end deftypefun - -@deftypefun errcode_t ext2fs_close (ext2_filsys @var{fs}) - -Flush out any changes to the high-level filesystem data structures using -@code{ext2fs_flush} if the filesystem is marked dirty; then close and -free the filesystem using @code{ext2fs_free}. - -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Initializing a filesystem, Filesystem flag functions, Closing and flushing out changes, Filesystem-level functions -@comment node-name, next, previous, up -@subsection Initializing a filesystem - -An ext2 filesystem is initializing by the @code{mke2fs} program. The -two functions described here, @code{ext2fs_initialize} and -@code{ext2fs_allocate_tables} do much of the initial work for setting up -a filesystem. However, they don't do the whole job. @code{mke2fs} -calls @code{ext2fs_initialize} to set up the filesystem superblock, and -calls @code{ext2fs_allocate_tables} to allocate space for the inode -table, and the inode and block bitmaps. In addition, @code{mke2fs} must -also initialize the inode tables by clearing them with zeros, create the -root and lost+found directories, and reserve the reserved inodes. - -@deftypefun errcode_t ext2fs_initialize (const char *@var{name}, int @var{flags}, struct ext2_super_block *@var{param}, io_manager @var{manager}, ext2_filsys *@var{ret_fs}) - -This function is used by the @code{mke2fs} program to initialize a -filesystem. The @code{ext2fs_initialize} function creates a filesystem -handle which is returned in @var{ret_fs} that has been properly setup -for a filesystem to be located in @var{name}, using the io_manager -@var{manager}. The prototype superblock in @var{param} is used to -supply parameters such as the number of blocks in the filesystem, the -block size, etc. - -The @code{ext2fs_initialize} function does not actually do any I/O; that -will be done when the application program calls @code{ext2fs_close} or -@code{ext2fs_flush}. Also, this function only initializes the -superblock and group descriptor structures. It does not create the -inode table or the root directory. This must be done by the calling -application, such as @code{mke2fs}. - -The following values may be set in the @var{param} prototype superblock; -if a value of 0 is found in a field, @code{ext2fs_initialize} will use a -default value. The calling application should zero out the prototype -entire superblock, and then fill in any appropriate values. - -@table @code - -@item s_blocks_count -The number of blocks in the filesystem. This parameter is mandatory and -must be set by the calling application. - -@item s_inodes_count -The number of inodes in the filesystem. The -default value is determined by calculating the size of the filesystem, -and creating one inode for every 4096 bytes. - -@item s_r_blocks_count -The number of blocks which should be reserved for the superuser. The -default value is zero blocks. - -@item s_log_block_size -The blocksize of the filesystem. Valid values are 0 (1024 bytes), 1 -(2048 bytes), or 2 (4096 bytes). The default blocksize is 1024 bytes. - -@item s_log_frag_size -The size of fragments. The ext2 filesystem does not support fragments -(and may never support fragments). Currently this field must be the -same as @code{s_log_block_size}. - -@item s_first_data_block -The first data block for the filesystem. For filesystem with a -blocksize of 1024 bytes, this value must be at least 1, since the -superblock is located in block number 1. For filesystems with larger -blocksizes, the superblock is still located at an offset of 1024 bytes, -so the superblock is located in block number 0. By default, this value -is set to 1 for filesystems with a block size of 1024 bytes, or 0 for -filesystems with larger blocksizes. - -@item s_max_mnt_count -This field defines the number of times that the filesystem can be -mounted before it should be checked using @code{e2fsck}. When -@code{e2fsck} is run without the @samp{-f} option, @code{e2fsck} will -skip the filesystem check if the number of times that the filesystem has -been mounted is less than @code{s_max_mnt_count} and if the interval -between the last time a filesystem check was performed and the current -time is less than @code{s_checkinterval} (see below). The default value -of @code{s_max_mnt_count} is 20. - -@item s_checkinterval -This field defines the minimal interval between filesystem checks. See -the previous entry for a discussion of how this field is used by -@code{e2fsck}. The default value of this field is 180 days (six -months). - -@item s_errors -This field defines the behavior which should be used by the kernel of -errors are detected in the filesystem. Possible values include: - -@table @samp -@item EXT2_ERRORS_CONTINUE -Continue execution when errors are detected. - -@item EXT2_ERRORS_RO -Remount the filesystem read-only. - -@item EXT2_ERRORS_PANIC -Panic. - -@end table - -The default behavior is @samp{EXT2_ERRORS_CONTINUE}. - -@end table - -@end deftypefun - -@deftypefun errcode_t ext2fs_allocate_tables (ext2_filsys @var{fs}) -Allocate space for the inode table and the block and inode bitmaps. The -inode tables and block and inode bitmaps aren't actually initialized; -this function just allocates the space for them. -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Filesystem flag functions, , Initializing a filesystem, Filesystem-level functions -@comment node-name, next, previous, up -@subsection Filesystem flag functions - -The filesystem handle has a number of flags which can be manipulated -using the following function. Some of these flags affect how the -libext2fs filesystem behaves; others are provided solely for the -application's convenience. - -@deftypefun void ext2fs_mark_changed (ext2_filsys @var{fs}) -@deftypefunx int ext2fs_test_changed (ext2_filsys @var{fs}) -This flag indicates whether or not the filesystem has been changed. -It is not used by the ext2fs library. -@end deftypefun - -@deftypefun void ext2fs_mark_super_dirty (ext2_filsys @var{fs}) -Mark the filesystem @var{fs} as being dirty; this will cause -the superblock information to be flushed out when @code{ext2fs_close} is -called. @code{ext2fs_mark_super_dirty} will also set the filesystem -changed flag. The dirty flag is automatically cleared by -@code{ext2fs_flush} when the superblock is written to disk. -@end deftypefun - -@deftypefun void ext2fs_mark_valid (ext2_filsys @var{fs}) -@deftypefunx void ext2fs_unmark_valid (ext2_filsys @var{fs}) -@deftypefunx int ext2fs_test_valid (ext2_filsys @var{fs}) -This flag indicates whether or not the filesystem is free of errors. -It is not used by libext2fs, and is solely for the application's -convenience. -@end deftypefun - -@deftypefun void ext2fs_mark_ib_dirty (ext2_filsys @var{fs}) -@deftypefunx void ext2fs_mark_bb_dirty (ext2_filsys @var{fs}) -@deftypefunx int ext2fs_test_ib_dirty (ext2_filsys @var{fs}) -@deftypefunx int ext2fs_test_bb_dirty (ext2_filsys @var{fs}) -These flags indicate whether or not the inode or block bitmaps have been -modified. If the flag is set, it will cause the appropriate bitmap -to be written when the filesystem is closed or flushed. -@end deftypefun - - - -@c ---------------------------------------------------------------------- - -@node Inode Functions, Directory functions, Filesystem-level functions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section Inode Functions - -@menu -* Reading and writing inodes:: -* Iterating over inodes in a filesystem:: -* Iterating over blocks in an inode:: -* Inode Convenience Functions:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Reading and writing inodes, Iterating over inodes in a filesystem, Inode Functions, Inode Functions -@comment node-name, next, previous, up -@subsection Reading and writing inodes - -@deftypefun errcode_t ext2fs_read_inode (ext2_filsys @var{fs}, ino_t @var{ino}, struct ext2_inode *@var{inode}) -Read the inode number @var{ino} into @var{inode}. -@end deftypefun - -@deftypefun errcode_t ext2fs_write_inode(ext2_filsys @var{fs}, ino_t @var{ino}, struct ext2_inode *@var{inode}) -Write @var{inode} to inode @var{ino}. -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Iterating over inodes in a filesystem, Iterating over blocks in an inode, Reading and writing inodes, Inode Functions -@comment node-name, next, previous, up -@subsection Iterating over inodes in a filesystem - -The inode_scan abstraction is useful for iterating over all the inodes -in a filesystem. - -@deftypefun errcode_t ext2fs_open_inode_scan (ext2_filsys @var{fs}, int @var{buffer_blocks}, ext2_inode_scan *@var{scan}) -Initialize the iteration variable @var{scan}. This variable is used by -@code{ext2fs_get_next_inode}. The @var{buffer_blocks} parameter -controls how many blocks of the inode table are read in at a time. A -large number of blocks requires more memory, but reduces the overhead in -seeking and reading from the disk. If @var{buffer_blocks} is zero, a -suitable default value will be used. -@end deftypefun - -@deftypefun void ext2fs_close_inode_scan (ext2_inode_scan @var{scan}) -Release the memory associated with @var{scan} and invalidate it. -@end deftypefun - -@deftypefun errcode_t ext2fs_get_next_inode (ext2_inode_scan @var{scan}, ino_t *@var{ino}, struct ext2_inode *@var{inode}) - -This function returns the next inode from the filesystem; the inode -number of the inode is stored in @var{ino}, and the inode is stored in -@var{inode}. - -If the inode is located in a block that has been marked as bad, -@code{ext2fs_get_next_inode} will return the error -@code{EXT2_ET_BAD_BLOCK_IN_INODE_TABLE}. -@end deftypefun - -@deftypefun errcode_t ext2fs_inode_scan_goto_blockgroup (ext2_inode_scan @var{scan}, int @var{group}) -Start the inode scan at a particular ext2 blockgroup, @var{group}. -This function may be safely called at any time while @var{scan} is valid. -@end deftypefun - -@deftypefun void ext2fs_set_inode_callback (ext2_inode_scan @var{scan}, errcode_t (*done_group)(ext2_filsys @var{fs}, ext2_inode_scan @var{scan}, dgrp_t @var{group}, void * @var{private}), void *@var{done_group_data}) -Register a callback function which will be called by -@code{ext2_get_next_inode} when all of the inodes in a block group have -been processed. -@end deftypefun - -@deftypefun int ext2fs_inode_scan_flags (ext2_inode_scan @var{scan}, int @var{set_flags}, int @var{clear_flags}) - -Set the scan_flags @var{set_flags} and clear the scan_flags @var{clear_flags}. -The following flags can be set using this interface: - -@table @samp - -@item EXT2_SF_SKIP_MISSING_ITABLE -When a block group is missing an inode table, skip it. If this flag is -not set @code{ext2fs_get_next_inode} will return the error -EXT2_ET_MISSING_INODE_TABLE. - -@end table - -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Iterating over blocks in an inode, Inode Convenience Functions, Iterating over inodes in a filesystem, Inode Functions -@comment node-name, next, previous, up -@subsection Iterating over blocks in an inode - -@deftypefun errcode_t ext2fs_block_iterate (ext2_filsys @var{fs}, ino_t @var{ino}, int @var{flags}, char *block_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, int @var{blockcnt}, void *@var{private}), void *@var{private}) -@end deftypefun - -@deftypefun errcode_t ext2fs_block_iterate2 (ext2_filsys @var{fs}, ino_t @var{ino}, int @var{flags}, char *@var{block}_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, int @var{blockcnt}, blk_t @var{ref_blk}, int @var{ref_offset}, void *@var{private}), void *@var{private}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Inode Convenience Functions, , Iterating over blocks in an inode, Inode Functions -@comment node-name, next, previous, up -@subsection Convenience functions for Inodes - -@deftypefun errcode_t ext2fs_get_blocks (ext2_filsys @var{fs}, ino_t @var{ino}, blk_t *@var{blocks}) - -Returns an array of blocks corresponding to the direct, -indirect, doubly indirect, and triply indirect blocks as stored in the -inode structure. -@end deftypefun - -@deftypefun errcode_t ext2fs_check_directory (ext2_filsys @var{fs}, ino_t @var{ino}) -Returns 0 if @var{ino} is a directory, and @code{ENOTDIR} if it is not. -@end deftypefun - -@deftypefun int ext2_inode_has_valid_blocks (struct ext2_inode *@var{inode}) - -Returns 1 if the inode's block entries actually valid block entries, and -0 if not. Inodes which represent devices and fast symbolic links do not -contain valid block entries. -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Directory functions, Bitmap Functions, Inode Functions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section Directory functions - -@menu -* Directory block functions:: -* Iterating over a directory:: -* Creating and expanding directories:: -* Creating and removing directory entries:: -* Looking up filenames:: -* Translating inode numbers to filenames:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Directory block functions, Iterating over a directory, Directory functions, Directory functions -@comment node-name, next, previous, up -@subsection Directory block functions - -@deftypefun errcode_t ext2fs_read_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf}) -@end deftypefun - -@deftypefun errcode_t ext2fs_write_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf}) -@end deftypefun - -@deftypefun errcode_t ext2fs_new_dir_block (ext2_filsys @var{fs}, ino_t @var{dir}_ino, ino_t @var{parent_ino}, char **@var{block}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Iterating over a directory, Creating and expanding directories, Directory block functions, Directory functions -@comment node-name, next, previous, up -@subsection Iterating over a directory - -@deftypefun errcode_t ext2fs_dir_iterate (ext2_filsys @var{fs}, ino_t @var{dir}, int @var{flags}, char *@var{block_buf}, int (*@var{func})(struct ext2_dir_entry *@var{dirent}, int @var{offset}, int @var{blocksize}, char *@var{buf}, void *@var{private}), void *@var{private}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Creating and expanding directories, Creating and removing directory entries, Iterating over a directory, Directory functions -@comment node-name, next, previous, up -@subsection Creating and expanding directories - -@deftypefun errcode_t ext2fs_mkdir (ext2_filsys @var{fs}, ino_t @var{parent}, ino_t @var{inum}, const char *@var{name}) -@end deftypefun - -@deftypefun errcode_t ext2fs_expand_dir (ext2_filsys @var{fs}, ino_t @var{dir}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Creating and removing directory entries, Looking up filenames, Creating and expanding directories, Directory functions -@comment node-name, next, previous, up -@subsection Creating and removing directory entries - -@deftypefun errcode_t ext2fs_link (ext2_filsys @var{fs}, ino_t @var{dir}, const char *@var{name}, ino_t @var{ino}, int flags) -@end deftypefun - -@deftypefun errcode_t ext2fs_unlink (ext2_filsys @var{fs}, ino_t @var{dir}, const char *@var{name}, ino_t @var{ino}, int @var{flags}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Looking up filenames, Translating inode numbers to filenames, Creating and removing directory entries, Directory functions -@comment node-name, next, previous, up -@subsection Looking up filenames - -@deftypefun errcode_t ext2fs_lookup (ext2_filsys @var{fs}, ino_t @var{dir}, const char *@var{name}, int @var{namelen}, char *@var{buf}, ino_t *@var{inode}) -@end deftypefun - -@deftypefun errcode_t ext2fs_namei (ext2_filsys @var{fs}, ino_t @var{root}, ino_t @var{cwd}, const char *@var{name}, ino_t *@var{inode}) -@end deftypefun - -@deftypefun errcode_t ext2fs_namei_follow (ext2_filsys @var{fs}, ino_t @var{root}, ino_t @var{cwd}, const char *@var{name}, ino_t *@var{inode}) -@end deftypefun - -@deftypefun errcode_t ext2fs_follow_link (ext2_filsys @var{fs}, ino_t @var{root}, ino_t @var{cwd}, ino_t @var{inode}, ino_t *@var{res}_inode) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Translating inode numbers to filenames, , Looking up filenames, Directory functions -@comment node-name, next, previous, up -@subsection Translating inode numbers to filenames - -@deftypefun errcode_t ext2fs_get_pathname (ext2_filsys @var{fs}, ino_t @var{dir}, ino_t @var{ino}, char **@var{name}) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Bitmap Functions, EXT2 data abstractions, Directory functions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section Bitmap Functions - -@menu -* Reading and Writing Bitmaps:: -* Allocating Bitmaps:: -* Free bitmaps:: -* Bitmap Operations:: -* Comparing bitmaps:: -* Modifying Bitmaps:: -* Resizing Bitmaps:: -* Clearing Bitmaps:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Reading and Writing Bitmaps, Allocating Bitmaps, Bitmap Functions, Bitmap Functions -@comment node-name, next, previous, up -@subsection Reading and Writing Bitmaps - -@deftypefun errcode_t ext2fs_write_inode_bitmap (ext2_filsys @var{fs}) -@end deftypefun - -@deftypefun errcode_t ext2fs_write_block_bitmap (ext2_filsys @var{fs}) -@end deftypefun - -@deftypefun errcode_t ext2fs_read_inode_bitmap (ext2_filsys @var{fs}) -@end deftypefun - -@deftypefun errcode_t ext2fs_read_block_bitmap (ext2_filsys @var{fs}) -@end deftypefun - -@deftypefun errcode_t ext2fs_read_bitmaps (ext2_filsys @var{fs}) -@end deftypefun - -@deftypefun errcode_t ext2fs_write_bitmaps (ext2_filsys @var{fs}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Allocating Bitmaps, Free bitmaps, Reading and Writing Bitmaps, Bitmap Functions -@comment node-name, next, previous, up -@subsection Allocating Bitmaps - -@deftypefun errcode_t ext2fs_allocate_generic_bitmap (__u32 @var{start}, __u32 @var{end}, _u32 @var{real_end}, const char *@var{descr}, ext2fs_generic_bitmap *@var{ret}) -@end deftypefun - -@deftypefun errcode_t ext2fs_allocate_block_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_block_bitmap *@var{ret}) -@end deftypefun - -@deftypefun errcode_t ext2fs_allocate_inode_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_inode_bitmap *@var{ret}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Free bitmaps, Bitmap Operations, Allocating Bitmaps, Bitmap Functions -@comment node-name, next, previous, up -@subsection Freeing bitmaps - - -@deftypefun void ext2fs_free_generic_bitmap (ext2fs_inode_bitmap @var{bitmap}) -@end deftypefun - -@deftypefun void ext2fs_free_block_bitmap (ext2fs_block_bitmap @var{bitmap}) -@end deftypefun - -@deftypefun void ext2fs_free_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Bitmap Operations, Comparing bitmaps, Free bitmaps, Bitmap Functions -@comment node-name, next, previous, up -@subsection Bitmap Operations - -@deftypefun void ext2fs_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) - -@deftypefunx void ext2fs_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) - -@deftypefunx int ext2fs_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) - -These functions set, clear, and test bits in a block bitmap @var{bitmap}. -@end deftypefun - - -@deftypefun void ext2fs_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode}) - -@deftypefunx void ext2fs_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode}) - -@deftypefunx int ext2fs_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode}) - -These functions set, clear, and test bits in an inode bitmap @var{bitmap}. -@end deftypefun - -@deftypefun void ext2fs_fast_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) - -@deftypefunx void ext2fs_fast_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) - -@deftypefunx int ext2fs_fast_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block}) - -@deftypefunx void ext2fs_fast_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode}) - -@deftypefunx void ext2fs_fast_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode}) - -@deftypefunx int ext2fs_fast_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode}) - -These ``fast'' functions are like their normal counterparts; however, -they are implemented as inline functions and do not perform bounds -checks on the inode number or block number; they are assumed to be -correct. They should only be used in speed-critical applications, where -the inode or block number has already been validated by other means. -@end deftypefun - -@deftypefun blk_t ext2fs_get_block_bitmap_start (ext2fs_block_bitmap @var{bitmap}) -@deftypefunx ino_t ext2fs_get_inode_bitmap_start (ext2fs_inode_bitmap @var{bitmap}) -Return the first inode or block which is stored in the bitmap. -@end deftypefun - -@deftypefun blk_t ext2fs_get_block_bitmap_end (ext2fs_block_bitmap @var{bitmap}) -@deftypefunx ino_t ext2fs_get_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap}) - -Return the first inode or block which is stored in the bitmap. -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Comparing bitmaps, Modifying Bitmaps, Bitmap Operations, Bitmap Functions -@comment node-name, next, previous, up -@subsection Comparing bitmaps - -@deftypefun errcode_t ext2fs_compare_block_bitmap (ext2fs_block_bitmap @var{bm1}, ext2fs_block_bitmap @var{bm2}) -@end deftypefun - -@deftypefun errcode_t ext2fs_compare_inode_bitmap (ext2fs_inode_bitmap @var{bm1}, ext2fs_inode_bitmap @var{bm2}) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Modifying Bitmaps, Resizing Bitmaps, Comparing bitmaps, Bitmap Functions -@comment node-name, next, previous, up -@subsection Modifying Bitmaps - -@deftypefun errcode_t ext2fs_fudge_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{end}, ino_t *@var{oend}) -@end deftypefun - -@deftypefun errcode_t ext2fs_fudge_block_bitmap_end (ext2fs_block_bitmap @var{bitmap}, blk_t @var{end}, blk_t *@var{oend}) -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Resizing Bitmaps, Clearing Bitmaps, Modifying Bitmaps, Bitmap Functions -@comment node-name, next, previous, up -@subsection Resizing Bitmaps - -@deftypefun errcode_t ext2fs_resize_generic_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_generic_bitmap @var{bmap}) -@end deftypefun - -@deftypefun errcode_t ext2fs_resize_inode_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_inode_bitmap @var{bmap}) -@end deftypefun - -@deftypefun errcode_t ext2fs_resize_block_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_block_bitmap @var{bmap}) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Clearing Bitmaps, , Resizing Bitmaps, Bitmap Functions -@comment node-name, next, previous, up -@subsection Clearing Bitmaps - -@deftypefun void ext2fs_clear_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}) -@end deftypefun - -@deftypefun void ext2fs_clear_block_bitmap (ext2fs_block_bitmap @var{bitmap}) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node EXT2 data abstractions, Byte-swapping functions, Bitmap Functions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section EXT2 data abstractions - -The ext2 library has a number of abstractions which are useful for ext2 -utility programs. - -@menu -* Badblocks list management:: -* Directory-block list management:: -* Inode count functions:: -@end menu - -@c ---------------------------------------------------------------------- - -@node Badblocks list management, Directory-block list management, EXT2 data abstractions, EXT2 data abstractions -@comment node-name, next, previous, up -@subsection Badblocks list management - - -@deftypefun errcode_t ext2fs_badblocks_list_create (ext2_badblocks_list *@var{ret}, int @var{size}) -@end deftypefun - -@deftypefun void ext2fs_badblocks_list_free (ext2_badblocks_list @var{bb}) -@end deftypefun - -@deftypefun errcode_t ext2fs_badblocks_list_add (ext2_badblocks_list @var{bb}, blk_t @var{blk}) -@end deftypefun - -@deftypefun int ext2fs_badblocks_list_test (ext2_badblocks_list @var{bb}, blk_t @var{blk}) -@end deftypefun - -@deftypefun errcode_t ext2fs_badblocks_list_iterate_begin (ext2_badblocks_list @var{bb}, ext2_badblocks_iterate *@var{ret}) -@end deftypefun - -@deftypefun int ext2fs_badblocks_list_iterate (ext2_badblocks_iterate iter, blk_t *@var{blk}) -@end deftypefun - -@deftypefun void ext2fs_badblocks_list_iterate_end (ext2_badblocks_iterate @var{iter}) -@end deftypefun - -@deftypefun errcode_t ext2fs_update_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list @var{bb_list}) -@end deftypefun - -@deftypefun errcode_t ext2fs_read_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list *@var{bb_list}) -@end deftypefun - -@deftypefun errcode_t ext2fs_read_bb_FILE (ext2_filsys @var{fs}, FILE *f, ext2_badblocks_list *@var{bb_list}, void (*invalid)(ext2_filsys @var{fs}, blk_t @var{blk})) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Directory-block list management, Inode count functions, Badblocks list management, EXT2 data abstractions -@comment node-name, next, previous, up -@subsection Directory-block list management - -The dblist abstraction stores a list of blocks belonging to -directories. This list can be useful when a program needs to interate -over all directory entries in a filesystem; @code{e2fsck} does this in -pass 2 of its operations, and @code{debugfs} needs to do this when it is -trying to turn an inode number into a pathname. - -@deftypefun errcode_t ext2fs_init_dblist (ext2_filsys @var{fs}, ext2_dblist *@var{ret_dblist}) - -Creates a dblist data structure and return it in @var{ret_dblist}. -@end deftypefun - -@deftypefun void ext2fs_free_dblist (ext2_dblist @var{dblist}) - -Free a dblist data structure. -@end deftypefun - -@deftypefun errcode_t ext2fs_add_dir_block (ext2_dblist @var{dblist}, ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt}) - -Add an entry to the dblist data structure. This call records the fact -that block number @var{blockcnt} of directory inode @var{ino} is stored -in block @var{blk}. -@end deftypefun - -@deftypefun errcode_t ext2fs_set_dir_block (ext2_dblist @var{dblist}, ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt}) - -Change an entry in the dblist data structure; this changes the location -of block number @var{blockcnt} of directory indoe @var{ino} to be block -@var{blk}. -@end deftypefun - -@deftypefun errcode_t ext2fs_dblist_iterate (ext2_dblist @var{dblist}, int (*func)(ext2_filsys @var{fs}, struct ext2_db_entry *@var{db_info}, void *@var{private}), void *@var{private}) - -This iterator calls @var{func} for every entry in the dblist data structure. -@end deftypefun - -@deftypefun errcode_t ext2fs_dblist_dir_iterate (ext2_dblist @var{dblist}, int flags, char *@var{block_buf}, int (*func)(ino_t @var{dir}, int @var{entry}, struct ext2_dir_entry *@var{dirent}, int @var{offset}, int @var{blocksize}, char *@var{buf}, void *@var{private}), void *@var{private}) - -This iterator takes reads in the directory block indicated in each -dblist entry, and calls @var{func} for each directory entry in each -directory block. If @var{dblist} contains all the directory blocks in a -filesystem, this function provides a convenient way to iterate over all -directory entries for that filesystem. -@end deftypefun - -@c ---------------------------------------------------------------------- - -@node Inode count functions, , Directory-block list management, EXT2 data abstractions -@comment node-name, next, previous, up -@subsection Inode count functions - -The icount abstraction is a specialized data type used by @code{e2fsck} -to store how many times a particular inode is referenced by the -filesystem. This is used twice; once to store the actual number of times -that the inode is reference; and once to store the claimed number of times -the inode is referenced according to the inode structure. - -This abstraction is designed to be extremely efficient for storing this -sort of information, by taking advantage of the following properties of -inode counts, namely (1) inode counts are very often zero (because -the inode is currrently not in use), and (2) many files have a inode -count of 1 (because they are a file which has no additional hard links). - -@deftypefun errcode_t ext2fs_create_icount2(ext2_filsys @var{fs}, int @var{flags}, int @var{size}, ext2_icount_t @var{hint}, ext2_icount_t *@var{ret}) - -Creates an icount stucture for a filesystem @var{fs}, with initial space -for @var{size} inodes whose count is greater than 1. The @var{flags} -parameter is either 0 or @code{EXT2_ICOUNT_OPT_INCREMENT}, which -indicates that icount structure should be able to increment inode counts -quickly. The icount structure is returned in @var{ret}. The returned -icount structure initially has a count of zero for all inodes. - -The @var{hint} parameter allows the caller to optionally pass in another -icount structure which is used to initialize the array of inodes whose -count is greater than 1. It is used purely as a speed optimization so -that the icount structure can determine in advance which inodes are -likely to contain a count grater than 1. -@end deftypefun - -@deftypefun void ext2fs_free_icount(ext2_icount_t @var{icount}) - -Frees an icount structure. -@end deftypefun - -@deftypefun errcode_t ext2fs_icount_fetch(ext2_icount_t @var{icount}, ino_t @var{ino}, __u16 *@var{ret}) - -Returns in @var{ret} fetches the count for a particular inode @var{ino}. -@end deftypefun - -@deftypefun errcode_t ext2fs_icount_increment(ext2_icount_t @var{icount}, ino_t @var{ino}, __u16 *@var{ret}) - -Increments the ref count for inode @var{ino}. -@end deftypefun - -@deftypefun errcode_t ext2fs_icount_decrement(ext2_icount_t @var{icount}, ino_t @var{ino}, __u16 *@var{ret}) - -Decrements the ref count for inode @var{ino}. -@end deftypefun - -@deftypefun errcode_t ext2fs_icount_store(ext2_icount_t @var{icount}, ino_t @var{ino}, __u16 @var{count}) - -Sets the reference count for inode @var{ino} to be @var{count}. -@end deftypefun - -@deftypefun ino_t ext2fs_get_icount_size(ext2_icount_t @var{icount}) - -Returns the current number of inodes in @var{icount} which has a count -greater than 1. -@end deftypefun - -@deftypefun errcode_t ext2fs_icount_validate(ext2_icount_t @var{icount}, FILE *@var{f}) - -Validates the internal rep invariant of @var{icount}; if there are any -problems, print out debugging information to @var{f}. This function is -intended for debugging and testing use only. -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Byte-swapping functions, Other functions, EXT2 data abstractions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section Byte-swapping functions - -@deftypefun void ext2fs_swap_super (struct ext2_super_block * @var{super}) -@end deftypefun - -@deftypefun void ext2fs_swap_group_desc (struct ext2_group_desc *@var{gdp}) -@end deftypefun - -@deftypefun void ext2fs_swap_inode (ext2_filsys @var{fs}, struct ext2_inode *@var{to}, struct ext2_inode *@var{from}, int @var{hostorder}) -@end deftypefun - -@deftypefun int ext2fs_native_flag (void) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Other functions, , Byte-swapping functions, EXT2FS Library Functions -@comment node-name, next, previous, up -@section Other functions - -/* alloc.c */ -@deftypefun errcode_t ext2fs_new_inode (ext2_filsys @var{fs}, ino_t @var{dir}, int @var{mode}, ext2fs_inode_bitmap @var{map}, ino_t *@var{ret}) -@end deftypefun - -@deftypefun errcode_t ext2fs_new_block (ext2_filsys @var{fs}, blk_t @var{goal}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret}) -@end deftypefun - -@deftypefun errcode_t ext2fs_get_free_blocks (ext2_filsys @var{fs}, blk_t @var{start}, blk_t @var{finish}, int @var{num}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret}) -@end deftypefun - -/* check_desc.c */ -@deftypefun errcode_t ext2fs_check_desc (ext2_filsys @var{fs}) -@end deftypefun - -@deftypefun errcode_t ext2_get_num_dirs (ext2_filsys @var{fs}, ino_t *@var{ret_num_dirs}) -@end deftypefun - - -/* getsize.c */ -@deftypefun errcode_t ext2fs_get_device_size (const char *@var{file}, int @var{blocksize}, blk_t *@var{retblocks}) -@end deftypefun - - -/* ismounted.c */ -@deftypefun errcode_t ext2fs_check_if_mounted (const char *@var{file}, int *@var{mount_flags}) -@end deftypefun - -/* version.c */ - -@deftypefun int ext2fs_get_library_version(const char **@var{ver_string}, const char **@var{date_string}) - -This function returns the current version of the ext2 library. The -return value contains an integer version code, which consists of the -major version number of the library multiplied by 100, plus the minor -version number of the library. Hence, if the library version is 1.08, -the returned value will be 108. - -If @var{ver_string} and/or @var{date_string} are non-NULL, they will be -set to point at a constant string containing the library version and/or -release date, respectively. -@end deftypefun - -@deftypefun int ext2fs_parse_version_string(const char *@var{ver_string}) - -This function takes a version string which may included in an -application and returns a version code using the same algorithm used by -@code{ext2fs_get_library_version}. It can be used by programs included -in the @code{e2fsprogs} distribution to assure that they are using an -up-to-date ext2 shared library. -@end deftypefun - -/* inline functions */ -@deftypefun int ext2fs_group_of_blk (ext2_filsys @var{fs}, blk_t @var{blk}) -@end deftypefun - -@deftypefun int ext2fs_group_of_ino (ext2_filsys @var{fs}, ino_t @var{ino}) -@end deftypefun - - -@c ---------------------------------------------------------------------- - -@node Concept Index, Function Index, EXT2FS Library Functions, Top -@comment node-name, next, previous, up -@unnumbered Concept Index -@printindex cp - -@c ---------------------------------------------------------------------- - -@node Function Index, , Concept Index, Top -@comment node-name, next, previous, up -@unnumbered Function and Type Index -@printindex fn - - -@contents -@bye diff --git a/gnu/usr.sbin/e2fsprogs/doc/texinfo.tex b/gnu/usr.sbin/e2fsprogs/doc/texinfo.tex deleted file mode 100644 index 89b7e21de48..00000000000 --- a/gnu/usr.sbin/e2fsprogs/doc/texinfo.tex +++ /dev/null @@ -1,4761 +0,0 @@ -%% TeX macros to handle Texinfo files. -%% $Id: texinfo.tex,v 1.1 1997/06/14 07:19:01 downsj Exp $ - -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, -% 94, 95, 1996 Free Software Foundation, Inc. - -%This texinfo.tex 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, or (at -%your option) any later version. - -%This texinfo.tex file is distributed in the hope that it will be -%useful, but WITHOUT ANY WARRANTY; without even the implied warranty -%of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%General Public License for more details. - -%You should have received a copy of the GNU General Public License -%along with this texinfo.tex file; see the file COPYING. If not, write -%to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -%Boston, MA 02111-1307, USA. - - -%In other words, you are welcome to use, share and improve this program. -%You are forbidden to forbid anyone else to use, share and improve -%what you give them. Help stamp out software-hoarding! - - -% Send bug reports to bug-texinfo@prep.ai.mit.edu. -% Please include a *precise* test case in each bug report. - - -% Make it possible to create a .fmt file just by loading this file: -% if the underlying format is not loaded, start by loading it now. -% Added by gildea November 1993. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi - -% This automatically updates the version number based on RCS. -\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} -\deftexinfoversion$Revision: 1.1 $ -\message{Loading texinfo package [Version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}\message{} - \catcode`+=\active \catcode`\_=\active} - -% Save some parts of plain tex whose names we will redefine. - -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv = \equiv -\let\ptexi=\i -\let\ptexlbrace=\{ -\let\ptexrbrace=\} -\let\ptexstar=\* -\let\ptext=\t -\let\ptextilde=\~ - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} -\let\~ = \tie % And make it available as @~. - - -\message{Basics,} -\chardef\other=12 - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Set up fixed words for English. -\ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi% -\def\putwordInfo{Info}% -\ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi% -\ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi% -\ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi% -\ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi% -\ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi% -\ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi% -\ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi% -\ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi% -\ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi% - -% Ignore a token. -% -\def\gobble#1{} - -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% - -%---------------------Begin change----------------------- -% -%%%% For @cropmarks command. -% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\cornerlong \newdimen\cornerthick -\newdimen \topandbottommargin -\newdimen \outerhsize \newdimen \outervsize -\cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks -\outerhsize=7in -%\outervsize=9.5in -% Alternative @smallbook page size is 9.25in -\outervsize=9.25in -\topandbottommargin=.75in -% -%---------------------End change----------------------- - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox \newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \hoffset=\normaloffset - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \escapechar = `\\ % use backslash in output files. - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - \shipout\vbox{% - \unvbox\headlinebox - \pagebody{#1}% - \unvbox\footlinebox - }% - }% - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -%%%% For @cropmarks command %%%% - -% Here is a modification of the main output routine for Near East Publications -% This provides right-angle cropmarks at all four corners. -% The contents of the page are centerlined into the cropmarks, -% and any desired binding offset is added as an \hskip on either -% site of the centerlined box. (P. A. MacKay, 12 November, 1986) -% -\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up -{\escapechar=`\\\relax % makes sure backslash is used in output files. - \shipout - \vbox to \outervsize{\hsize=\outerhsize - \vbox{\line{\ewtop\hfill\ewtop}} - \nointerlineskip - \line{\vbox{\moveleft\cornerthick\nstop} - \hfill - \vbox{\moveright\cornerthick\nstop}} - \vskip \topandbottommargin - \centerline{\ifodd\pageno\hskip\bindingoffset\fi - \vbox{ - {\let\hsize=\pagewidth \makeheadline} - \pagebody{#1} - {\let\hsize=\pagewidth \makefootline}} - \ifodd\pageno\else\hskip\bindingoffset\fi} - \vskip \topandbottommargin plus1fill minus1fill - \boxmaxdepth\cornerthick - \line{\vbox{\moveleft\cornerthick\nsbot} - \hfill - \vbox{\moveright\cornerthick\nsbot}} - \nointerlineskip - \vbox{\line{\ewbot\hfill\ewbot}} - }} - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi} -% -% Do @cropmarks to get crop marks -\def\cropmarks{\let\onepageout=\croppageout } - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg#1{% - \let\next = #1% - \begingroup - \obeylines - \futurelet\temp\parseargx -} - -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi -} - -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% - }% -} - -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} - -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., -% @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. -% -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup -} - -% Change the active space to expand to nothing. -% -\begingroup - \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment. Type Return to continue.} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Type <Return> to continue.} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -% @end foo executes the definition of \Efoo. -% -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi - \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname - \fi -} - -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% - \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% -} - -% Define the control sequence \E#1 to give an unmatched @end error. -% -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% -} - - -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip -} - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt \char '100}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt \char '173}} -\def\myrbrace {{\tt \char '175}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @enddots{} is an end-of-sentence ellipsis. -\gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000} - -% @! is an end-of-sentence bang. -\gdef\!{!\spacefactor=3000 } - -% @? is an end-of-sentence query. -\gdef\?{?\spacefactor=3000 } - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -\def\group{\begingroup - \ifnum\catcode13=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - \endgroup % End the \group. - }% - % - \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -\def\need{\parsearg\needx} - -% Old definition--didn't work. -%\def\needx #1{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000 -%\prevdepth=-1000pt -%}} - -\def\needx#1{% - % Go into vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % Don't add any leading before our big empty box, but allow a page - % break, since the best break might be right here. - \allowbreak - \nointerlineskip - \vtop to #1\mil{\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak -} - -% @br forces paragraph break - -\let\br = \par - -% @dots{} output some dots - -\def\dots{$\ldots$} - -% @page forces the start of a new page - -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} - -% This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} - -%\hbox{{\rm#1}}\hfil\break}} - -% @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. - \def\thisfile{#1}% - \input\thisfile -\endgroup} - -\def\thisfile{} - -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} - -% @sp n outputs n lines of vertical space - -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other% -\parsearg \commentxxx} - -\def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 } - -\let\c=\comment - -% @paragraphindent is defined for the Info formatting commands only. -\let\paragraphindent=\comment - -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% -\let\chapter=\relax -\let\unnumbered=\relax -\let\top=\relax -\let\unnumberedsec=\relax -\let\unnumberedsection=\relax -\let\unnumberedsubsec=\relax -\let\unnumberedsubsection=\relax -\let\unnumberedsubsubsec=\relax -\let\unnumberedsubsubsection=\relax -\let\section=\relax -\let\subsec=\relax -\let\subsubsec=\relax -\let\subsection=\relax -\let\subsubsection=\relax -\let\appendix=\relax -\let\appendixsec=\relax -\let\appendixsection=\relax -\let\appendixsubsec=\relax -\let\appendixsubsection=\relax -\let\appendixsubsubsec=\relax -\let\appendixsubsubsection=\relax -\let\contents=\relax -\let\smallbook=\relax -\let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax - \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax - \let\evenheading = \relax - \let\oddheading = \relax - \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax - \let\headings = \relax - \let\include = \relax - \let\lowersections = \relax - \let\down = \relax - \let\raisesections = \relax - \let\up = \relax - \let\set = \relax - \let\clear = \relax - \let\item = \relax -} - -% Ignore @ignore ... @end ignore. -% -\def\ignore{\doignore{ignore}} - -% Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text. -% -\def\ifinfo{\doignore{ifinfo}} -\def\ifhtml{\doignore{ifhtml}} -\def\html{\doignore{html}} -\def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} - -% Also ignore @macro ... @end macro. The user must run texi2dvi, -% which runs makeinfo to do macro expansion. Ignore @unmacro, too. -\def\macro{\doignore{macro}} -\let\unmacro = \comment - - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. -% -\def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - \long\def\doignoretext##1\end #1{\enddoignore}% - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 - % - % And now expand that command. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{***WARNING*** for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi -} - -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. - % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% - % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. - % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont - \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont - \let\tensf = \nullfont - % Similarly for index fonts (mostly for their use in - % smallexample) - \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont - \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont - \let\indsf = \nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex - \def\tex{\doignore{tex}} -} - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. -% -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup -} -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} - -% @value{foo} gets the text saved in variable foo. -% -\def\value{\begingroup - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \valuexxx} -\def\valuexxx#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {\{No value for ``#1''\}}% - \else - \csname SET#1\endcsname - \fi -\endgroup} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail - \else - \expandafter\ifsetsucceed - \fi -} -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed - \else - \expandafter\ifclearfail - \fi -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex always succeeds; we read the text following, through @end -% iftex). But `@end iftex' should be valid only after an @iftex. -% -\def\iftex{\conditionalsucceed{iftex}} -\defineunmatchedend{iftex} - -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. -% -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. -% -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. -% -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} - -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} -\let\nwnode=\node -\let\lastnode=\relax - -\def\donoderef{\ifx\lastnode\relax\else -\expandafter\expandafter\expandafter\setref{\lastnode}\fi -\global\let\lastnode=\relax} - -\def\unnumbnoderef{\ifx\lastnode\relax\else -\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi -\global\let\lastnode=\relax} - -\def\appendixnoderef{\ifx\lastnode\relax\else -\expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi -\global\let\lastnode=\relax} - -% @refill is a no-op. -\let\refill=\relax - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \readauxfile - \opencontents - \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. - \comment % Ignore the actual filename. -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - -% \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx} -% \def\macroxxx#1#2 \end macro{% -% \expandafter\gdef\macrotemp#1{#2}% -% \endgroup} - -%\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx} -%\def\linemacroxxx#1#2 \end linemacro{% -%\let\parsearg=\relax -%\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}% -%\expandafter\xdef\macrotemp{\parsearg\macrotempx}% -%\expandafter\gdef\macrotempx#1{#2}% -%\endgroup} - -%\def\butfirst#1{} - - -\message{fonts,} - -% Font-change commands. - -% Texinfo supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. -\newfam\sffam -\def\sf{\fam=\sffam \tensf} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this one. -\def\ttsl{\tenttsl} - -%% Try out Computer Modern fonts at \magstephalf -\let\mainmagstep=\magstephalf - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -\ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} -\else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\fi -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 -\setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} - -% Fonts for indices and small examples (9pt). -% We actually use the slanted font rather than the italic, -% because texinfo normally uses the slanted fonts for that. -% Do not make many font distinctions in general in the index, since they -% aren't very useful. -\setfont\ninett\ttshape{9}{1000} -\setfont\indrm\rmshape{9}{1000} -\setfont\indit\slshape{9}{1000} -\let\indsl=\indit -\let\indtt=\ninett -\let\indttsl=\ninett -\let\indsf=\indrm -\let\indbf=\indrm -\setfont\indsc\scshape{10}{900} -\font\indi=cmmi9 -\font\indsy=cmsy9 - -% Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{12}{\magstep2} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm - -% Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{\magstep1} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled \magstep1 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. - -% Fonts for title page: -\setfont\titlerm\rmbshape{12}{\magstep3} -\let\authorrm = \secrm - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf -} - - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? -\def\indexfonts{% - \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl - \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc - \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl - \resetmathfonts \setleading{12pt}} - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} -\setfont\shortcontsl\slshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\var=\smartitalic -\let\dfn=\smartitalic -\let\emph=\smartitalic -\let\cite=\smartitalic - -\def\b#1{{\bf #1}} -\let\strong=\b - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -\def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% - \null -} -\let\ttfont=\t -\def\samp #1{`\tclose{#1}'\null} -\setfont\smallrm\rmshape{8}{1000} -\font\smallsy=cmsy9 -\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{% - \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{$\rangle$}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -\let\file=\samp -\let\url=\samp % perhaps include a hypertex \special eventually -\def\email#1{$\langle${\tt #1}$\rangle$} - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \frenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in \code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ -\catcode`\-=\active -\catcode`\_=\active -\catcode`\|=\active -\global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex} -% The following is used by \doprintindex to insure that long function names -% wrap around. It is necessary for - and _ to be active before the index is -% read from the file, as \entry parses the arguments long before \code is -% ever called. -- mycroft -% _ is always active; and it shouldn't be \let = to an _ that is a -% subscript character anyway. Then, @cindex @samp{_} (for example) -% fails. --karl -\global\def\indexbreaks{% - \catcode`\-=\active \let-\realdash -} -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{\normalunderscore\discretionary{}{}{}} -\def\codex #1{\tclose{#1}\endgroup} - -%\let\exp=\tclose %Was temporary - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. -% -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\ttsl\look}}\fi -\else{\tclose{\ttsl\look}}\fi} - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of -% @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -\def\r#1{{\rm #1}} % roman font -% Use of \lowercase was suggested. -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -% @pounds{} is a sterling sign. -\def\pounds{{\it\$}} - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\def\titlefont#1{{\titlerm #1}} - -\newif\ifseenauthor -\newif\iffinishedtitlepage - -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm -% I deinstalled the following change because \cmr12 is undefined. -% This change was not in the ChangeLog anyway. --rms. -% \let\subtitlerm=\cmr12 - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefont{##1}} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \oldpage - \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - \HEADINGSon -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks \evenheadline % Token sequence for heading line of even pages -\newtoks \oddheadline % Token sequence for heading line of odd pages -\newtoks \evenfootline % Token sequence for footing line of even pages -\newtoks \oddfootline % Token sequence for footing line of odd pages - -% Now make Tex use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish} -\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% -\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish} -\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}} -\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -% -}% unbind the catcode of @. - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{ -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% Produces Day Month Year style of output. -\def\today{\number\day\space -\ifcase\month\or -January\or February\or March\or April\or May\or June\or -July\or August\or September\or October\or November\or December\fi -\space\number\year} - -% Use this if you want the Month Day, Year style of output. -%\def\today{\ifcase\month\or -%January\or February\or March\or April\or May\or June\or -%July\or August\or September\or October\or November\or December\fi -%\space\number\day, \number\year} - -% @settitle line... specifies the title of the document, for headings -% It generates no output of its own - -\def\thistitle{No Title} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} - - -\message{tables,} - -% @tabs -- simple alignment - -% These don't work. For one thing, \+ is defined as outer. -% So these macros cannot even be defined. - -%\def\tabs{\parsearg\tabszzz} -%\def\tabszzz #1{\settabs\+#1\cr} -%\def\tabline{\parsearg\tablinezzz} -%\def\tablinezzz #1{\+#1\cr} -%\def\&{&} - -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % Be sure we are not still in the middle of a paragraph. - %{\parskip = 0in - %\par - %}% - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. Since that - % text will be indented by \tableindent, we make the item text be in - % a zero-width box. - \noindent - \rlap{\hskip -\tableindent\box0}\ignorespaces% - \endgroup% - \itemxneedsnegativevskiptrue% - \fi -} - -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -%% Contains a kludge to get @end[description] to work -\def\description{\tablez{\dontindex}{1}{}{}{}{}} - -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % -} - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\def\itemize{\parsearg\itemizezzz} - -\def\itemizezzz #1{% - \begingroup % ended by the @end itemsize - \itemizey {#1}{\Eitemize} -} - -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a <number>. - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call itemizey, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{\in hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. - -%%%% -% Dimensions - -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -%%%% -% Macros used to set up halign preamble: -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -%% 2/1/96, to allow fractions to be given with more than one digit. -\def\pickupwholefraction#1 {\global\advance\colcount by1 % -\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}% -\setuptable} - -\newcount\colcount -\def\setuptable#1{\def\firstarg{#1}% -\ifx\firstarg\xendsetuptable\let\go\relax% -\else - \ifx\firstarg\xcolumnfractions\global\setpercenttrue% - \else - \ifsetpercent - \let\go\pickupwholefraction % In this case arg of setuptable - % is the decimal point before the - % number given in percent of hsize. - % We don't need this so we don't use it. - \else - \global\advance\colcount by1 - \setbox0=\hbox{#1 }% Add a normal word space as a separator; - % typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi% - \fi% -\ifx\go\pickupwholefraction\else\let\go\setuptable\fi% -\fi\go} - -%%%% -% multitable syntax -\def\tab{&\hskip1sp\relax} % 2/2/96 - % tiny skip here makes sure this column space is - % maintained, even if it is never used. - - -%%%% -% @multitable ... @end multitable definitions: - -\def\multitable{\parsearg\dotable} - -\def\dotable#1{\bgroup -\let\item\cr -\tolerance=9500 -\hbadness=9500 -\setmultitablespacing -\parskip=\multitableparskip -\parindent=\multitableparindent -\overfullrule=0pt -\global\colcount=0\relax% -\def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}% - % To parse everything between @multitable and @item : -\setuptable#1 \endsetuptable - % Need to reset this to 0 after \setuptable. -\global\colcount=0\relax% - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. -\halign\bgroup&\global\advance\colcount by 1\relax% -\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % If user has set preamble in terms of percent of \hsize - % we will use that dimension as the width of the column, and - % the \leftskip will keep entries from bumping into each other. - % Table will start at left margin and final column will justify at - % right margin. -\ifnum\colcount=1 -\else - \ifsetpercent - \else - % If user has <not> set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: -\leftskip=\multitablecolspace -\fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighing sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. -\global\everycr{\noalign{% -% \filbreak%% keeps underfull box messages off when table breaks over pages. -% Maybe so, but it also creates really weird page breaks when the table -% breaks over pages Wouldn't \vfil be better? Wait until the problem -% manifests itself, so it can be fixed for real --karl. -\global\colcount=0\relax}} -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. -\ifdim\multitablelinespace=0pt -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\else -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. - -\def\newindex #1{ -\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file -\openout \csname#1indfile\endcsname \jobname.#1 % Open the file -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\doindex {#1}} -} - -% @defindex foo == \newindex{foo} - -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. - -\def\newcodeindex #1{ -\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file -\openout \csname#1indfile\endcsname \jobname.#1 % Open the file -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\docodeindex {#1}} -} - -\def\defcodeindex{\parsearg\newcodeindex} - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -\def\synindex #1 #2 {% -\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname -\expandafter\let\csname#1indfile\endcsname=\synindexfoo -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\doindex {#2}}% -} - -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -\def\syncodeindex #1 #2 {% -\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname -\expandafter\let\csname#1indfile\endcsname=\synindexfoo -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\docodeindex {#2}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -\def\indexdummies{% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -%\let\{ = \lbracecmd -%\let\} = \rbracecmd -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -%\def\char{\realbackslash char}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\copyright{\realbackslash copyright }% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\unsepspaces -} - -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexdummytex{TeX} -\def\indexdummydots{...} - -\def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other -@gdef@realbackslash{\}} - -\let\indexbackslash=0 %overridden during \printindex. - -\let\SETmarginindex=\relax %initialize! -% workhorse for all \fooindexes -% #1 is name of index, #2 is stuff to put there -\def\doind #1#2{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% - \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio=0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % First process the index-string with all font commands turned off - % to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2}}% - % - % Now produce the complete index entry, with both the sort key and the - % original text, including any font commands. - \toks0 = {#2}% - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - \temp - }% - }% - \penalty\count255 - }% -} - -\def\dosubind #1#2#3{% -{\count10=\lastpenalty % -{\indexdummies % Must do this here, since \bf, etc expand at this stage -\escapechar=`\\% -{\let\folio=0% -\def\rawbackslashxx{\indexbackslash}% -% -% Now process the index-string once, with all font commands turned off, -% to get the string to sort the index by. -{\indexnofonts -\xdef\temp1{#2 #3}% -}% -% Now produce the complete index entry. We process the index-string again, -% this time with font commands expanded, to get what to print in the index. -\edef\temp{% -\write \csname#1indfile\endcsname{% -\realbackslash entry {\temp1}{\folio}{#2}{#3}}}% -\temp }% -}\penalty\count10}} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% This is what you call to cause a particular index to get printed. -% Write -% @unnumbered Function Index -% @printindex fn - -\def\printindex{\parsearg\doprintindex} - -\def\doprintindex#1{\begingroup - \dobreak \chapheadingskip{10000}% - % - \indexfonts \rm - \tolerance = 9500 - \indexbreaks - \def\indexbackslash{\rawbackslashxx}% - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \catcode`\\ = 0 - \catcode`\@ = 11 - \escapechar = `\\ - \begindoublecolumns - % - % See if the index file exists and is nonempty. - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - (Index is nonexistent) - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - (Index is empty) - \else - \input \jobname.#1s - \fi - \fi - \closein 1 - \enddoublecolumns -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -% Same as \bigskipamount except no shrink. -% \balancecolumns gets confused if there is any shrink. -\newskip\initialskipamount \initialskipamount 12pt plus4pt - -\def\initial #1{% -{\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt -\ifdim\lastskip<\initialskipamount -\removelastskip \penalty-200 \vskip \initialskipamount\fi -\line{\secbf#1\hfill}\kern 2pt\penalty10000}} - -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. -% -\def\entry #1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent=2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ #2% The page number ends the paragraph. - \fi% - \par -\endgroup} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {\global\setbox\partialpage - =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}% - \eject - % - % Now switch to the double-column output routine. - \output={\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it once. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +- < - % 1pt) as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \vsize = 2\vsize -} -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage - % box0 will be the left-hand column, box1 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 \penalty\outputpenalty -} -\def\pagesofar{% - % The contents of the output page -- any previous material, - % followed by the two boxes we just split. - \unvbox\partialpage - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% -} -\def\enddoublecolumns{% - \output={\balancecolumns}\eject % split what we have - \endgroup - % Back to normal single-column typesetting, but take account of the - % fact that we just accumulated some stuff on the output page. - \pagegoal=\vsize -} -\def\balancecolumns{% - % Called on the last page of the double column material. - \setbox0=\vbox{\unvbox255}% - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {\vbadness=10000 \loop \global\setbox3=\copy0 - \global\setbox1=\vsplit3 to\dimen@ - \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - \pagesofar -} -\catcode `\@=\other - - -\message{sectioning,} -% Define chapters, sections, etc. - -\newcount \chapno -\newcount \secno \secno=0 -\newcount \subsecno \subsecno=0 -\newcount \subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount \appendixno \appendixno = `\@ -\def\appendixletter{\char\the\appendixno} - -\newwrite \contentsfile -% This is called from \setfilename. -\def\opencontents{\openout \contentsfile = \jobname.toc} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise - -\def\thischapter{} \def\thissection{} -\def\seccheck#1{\if \pageno<0 % -\errmessage{@#1 not allowed after generating table of contents}\fi -% -} - -\def\chapternofonts{% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\def\result{\realbackslash result} -\def\equiv{\realbackslash equiv} -\def\expansion{\realbackslash expansion} -\def\print{\realbackslash print} -\def\TeX{\realbackslash TeX} -\def\dots{\realbackslash dots} -\def\copyright{\realbackslash copyright} -\def\tt{\realbackslash tt} -\def\bf{\realbackslash bf } -\def\w{\realbackslash w} -\def\less{\realbackslash less} -\def\gtr{\realbackslash gtr} -\def\hat{\realbackslash hat} -\def\char{\realbackslash char} -\def\tclose##1{\realbackslash tclose {##1}} -\def\code##1{\realbackslash code {##1}} -\def\samp##1{\realbackslash samp {##1}} -\def\r##1{\realbackslash r {##1}} -\def\b##1{\realbackslash b {##1}} -\def\key##1{\realbackslash key {##1}} -\def\file##1{\realbackslash file {##1}} -\def\kbd##1{\realbackslash kbd {##1}} -% These are redefined because @smartitalic wouldn't work inside xdef. -\def\i##1{\realbackslash i {##1}} -\def\cite##1{\realbackslash cite {##1}} -\def\var##1{\realbackslash var {##1}} -\def\emph##1{\realbackslash emph {##1}} -\def\dfn##1{\realbackslash dfn {##1}} -} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} - \else - \numberedsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} - \else - \appendixsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} - \else - \unnumberedsubsubseczzz{#2} - \fi -\fi -} - - -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{\seccheck{chapter}% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -{\chapternofonts% -\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -}} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{\seccheck{appendix}% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 \message{Appendix \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -{\chapternofonts% -\edef\temp{{\realbackslash chapentry - {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\appendixnoderef % -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec -}} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} - -\outer\def\top{\parsearg\unnumberedyyy} -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{\seccheck{unnumbered}% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the<toks register> to achieve this: TeX expands \the<toks> only once, -% simply yielding the contents of the <toks register>. -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -{\chapternofonts% -\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec -}} - -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{\seccheck{section}% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -{\chapternofonts% -\edef\temp{{\realbackslash secentry % -{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\penalty 10000 % -}} - -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{\seccheck{appendixsection}% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -{\chapternofonts% -\edef\temp{{\realbackslash secentry % -{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\appendixnoderef % -\penalty 10000 % -}} - -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{\seccheck{unnumberedsec}% -\plainsecheading {#1}\gdef\thissection{#1}% -{\chapternofonts% -\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -}} - -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{\seccheck{subsection}% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -{\chapternofonts% -\edef\temp{{\realbackslash subsecentry % -{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\penalty 10000 % -}} - -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{\seccheck{appendixsubsec}% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -{\chapternofonts% -\edef\temp{{\realbackslash subsecentry % -{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\appendixnoderef % -\penalty 10000 % -}} - -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}% -\plainsubsecheading {#1}\gdef\thissection{#1}% -{\chapternofonts% -\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -}} - -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{\seccheck{subsubsection}% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -{\chapternofonts% -\edef\temp{{\realbackslash subsubsecentry % - {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno} - {\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\penalty 10000 % -}} - -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -{\chapternofonts% -\edef\temp{{\realbackslash subsubsecentry{#1}% - {\appendixletter} - {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\appendixnoderef % -\penalty 10000 % -}} - -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -{\chapternofonts% -\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -}} - -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and -% such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -% @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{ -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{ -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{ -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% - \pchapsepmacro - {% - \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} - -\CHAPFplain % The default - -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 10000 % -} - -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} - -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 % -} - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} - - -% Section titles. -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} - -% Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} - -% Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} - - -% Print any size section title. -% -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% - {% - % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm - % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% - % - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% - }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak -} - - -\message{toc printing,} -% Finish up the main text and prepare to read what we've written -% to \contentsfile. - -\newskip\contentsrightmargin \contentsrightmargin=1in -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund <tege@matematik.su.se> - \contentsalignmacro - \immediate\closeout \contentsfile - \ifnum \pageno>0 - \pageno = -1 % Request roman numbered pages. - \fi - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. -} - - -% Normal (long) toc. -\outer\def\contents{% - \startcontents{\putwordTableofContents}% - \input \jobname.toc - \endgroup - \vfill \eject -} - -% And just the chapters. -\outer\def\summarycontents{% - \startcontents{\putwordShortContents}% - % - \let\chapentry = \shortchapentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} - \input \jobname.toc - \endgroup - \vfill \eject -} -\let\shortcontents = \summarycontents - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapter-level things, for both the long and short contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}% -} - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -\setbox0 = \hbox{\shortcontrm \putwordAppendix } -\newdimen\shortappendixwidth \shortappendixwidth = \wd0 - -\def\shortchaplabel#1{% - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% -} - -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}} - -% Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} - -% Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} - -% And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} - -% This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno{#2}}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno{#2}}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno{#2}}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno{#2}}% -\endgroup} - -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -% -% \turnoffactive is for the sake of @" used for umlauts. -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - \entry{\turnoffactive #1}{\turnoffactive #2}% -\endgroup} - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts - - -\message{environments,} - -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% Adapted from the TeXbook's \boxit. -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - -\global\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{ - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} - -% The @error{} command. -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\def\tex{\begingroup -\catcode `\\=0 \catcode `\{=1 \catcode `\}=2 -\catcode `\$=3 \catcode `\&=4 \catcode `\#=6 -\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie -\catcode `\%=14 -\catcode 43=12 % plus -\catcode`\"=12 -\catcode`\==12 -\catcode`\|=12 -\catcode`\<=12 -\catcode`\>=12 -\escapechar=`\\ -% -\let\,=\ptexcomma -\let\~=\ptextilde -\let\{=\ptexlbrace -\let\}=\ptexrbrace -\let\.=\ptexdot -\let\*=\ptexstar -\let\dots=\ptexdots -\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}} -\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi} -\def\@{@}% -\let\bullet=\ptexbullet -\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext -% -\let\Etex=\endgroup} - -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip -% -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. -\let\nonarrowing=\relax - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \cartouche: draw rectangle w/rounded corners around argument -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\long\def\cartouche{% -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip -\def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \inENV % This group ends at the end of the body - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax - \fi -} - -% To ending an @example-like environment, we first end the paragraph -% (via \afterenvbreak's vertical glue), and then the group. That way we -% keep the zero \parskip that the environments set -- \parskip glue -% will be inserted at the beginning of the next paragraph in the -% document, after the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup}% - -% This macro is -\def\lisp{\begingroup - \nonfillstart - \let\Elisp = \nonfillfinish - \tt - \rawbackslash % have \ input char produce \ char from current font - \gobble -} - -% Define the \E... control sequence only if we are inside the -% environment, so the error checking in \end will work. -% -% We must call \lisp last in the definition, since it reads the -% return following the @example (or whatever) command. -% -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} -\def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% @smallexample and @smalllisp. This is not used unless the @smallbook -% command is given. Originally contributed by Pavel@xerox. -% -\def\smalllispx{\begingroup - \nonfillstart - \let\Esmalllisp = \nonfillfinish - \let\Esmallexample = \nonfillfinish - % - % Smaller fonts for small examples. - \indexfonts \tt - \rawbackslash % make \ output the \ character from the current font (tt) - \gobble -} - -% This is @display; same as @lisp except use roman font. -% -\def\display{\begingroup - \nonfillstart - \let\Edisplay = \nonfillfinish - \gobble -} - -% This is @format; same as @display except don't narrow margins. -% -\def\format{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eformat = \nonfillfinish - \gobble -} - -% @flushleft (same as @format) and @flushright. -% -\def\flushleft{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eflushleft = \nonfillfinish - \gobble -} -\def\flushright{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eflushright = \nonfillfinish - \advance\leftskip by 0pt plus 1fill - \gobble} - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. -% -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace - \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \let\nonarrowing = \relax - \fi -} - -\message{defuns,} -% Define formatter for defuns -% First, allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt -\newskip\deflastargmargin \deflastargmargin=18pt - -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. -\def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested % -\global\advance\parencount by 1 } -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. -% also in that case restore the outer-level definition of (. -\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi -\global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&} -\def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}} - -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\dimen3=\rightskip -\advance\dimen3 by -\defbodyindent -\noindent % -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 % -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 \advance \hsize by -\dimen3 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} - -\def\defmethparsebody #1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines -} - -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{#3{#4}}% -} - -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{\parsetpheaderline{#3{#4}}}\empty -} - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% - -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} - -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. - -% Define @defun. - -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up - -\def\defunargs #1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -\hyphenchar\tensl=0 -#1% -\hyphenchar\tensl=45 -\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\penalty 10000\vskip -\parskip\penalty 10000% -} - -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\penalty 10000\vskip -\parskip\penalty 10000% -} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Function}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefun int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} - -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}% -\deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$$$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Macro}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Special Form}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% This definition is run if you use @defunx -% anywhere other than immediately after a @defun or @defunx. - -\def\deffnx #1 {\errmessage{@deffnx in invalid context}} -\def\defunx #1 {\errmessage{@defunx in invalid context}} -\def\defmacx #1 {\errmessage{@defmacx in invalid context}} -\def\defspecx #1 {\errmessage{@defspecx in invalid context}} -\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}} - -% @defmethod, and so on - -% @defop {Funny Method} foo-class frobnicate argument - -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} - -\def\defopheader #1#2#3{% -\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype{} on #1}% -\defunargs {#3}\endgroup % -} - -% @defmethod == @defop Method - -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} - -\def\defmethodheader #1#2#3{% -\dosubind {fn}{\code{#2}}{on #1}% entry in function index -\begingroup\defname {#2}{Method on #1}% -\defunargs {#3}\endgroup % -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} - -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype{} of #1}% -\defvarargs {#3}\endgroup % -} - -% @defivar == @defcv {Instance Variable} - -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} - -\def\defivarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index -\begingroup\defname {#2}{Instance Variable of #1}% -\defvarargs {#3}\endgroup % -} - -% These definitions are run if you use @defmethodx, etc., -% anywhere other than immediately after a @defmethod, etc. - -\def\defopx #1 {\errmessage{@defopx in invalid context}} -\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}} -\def\defcvx #1 {\errmessage{@defcvx in invalid context}} -\def\defivarx #1 {\errmessage{@defivarx in invalid context}} - -% Now @defvar - -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\penalty 10000\vskip -\parskip\penalty 10000} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{Variable}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{User Option}% -\defvarargs {#2}\endgroup % -} - -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}% -\interlinepenalty=10000 -\endgraf\penalty 10000\vskip -\parskip\penalty 10000 -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\penalty 10000\vskip -\parskip\penalty 10000 -\endgroup} - -% This definition is run if you use @defvarx -% anywhere other than immediately after a @defvar or @defvarx. - -\def\defvrx #1 {\errmessage{@defvrx in invalid context}} -\def\defvarx #1 {\errmessage{@defvarx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% This definition is run if you use @deftpx, etc -% anywhere other than immediately after a @deftp, etc. - -\def\deftpx #1 {\errmessage{@deftpx in invalid context}} - - -\message{cross reference,} -% Define cross-reference macros -\newwrite \auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% \setref{foo} defines a cross-reference point named foo. - -\def\setref#1{% -\dosetq{#1-title}{Ytitle}% -\dosetq{#1-pg}{Ypagenumber}% -\dosetq{#1-snt}{Ysectionnumberandtype}} - -\def\unnumbsetref#1{% -\dosetq{#1-title}{Ytitle}% -\dosetq{#1-pg}{Ypagenumber}% -\dosetq{#1-snt}{Ynothing}} - -\def\appendixsetref#1{% -\dosetq{#1-title}{Ytitle}% -\dosetq{#1-pg}{Ypagenumber}% -\dosetq{#1-snt}{Yappendixletterandtype}} - -% \xref, \pxref, and \ref generate cross-references to specified points. -% For \xrefX, #1 is the node name, #2 the name of the Info -% cross-reference, #3 the printed node name, #4 the name of the Info -% file, #5 the name of the printed manual. All but the node name can be -% omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1>0pt% - % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' in \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\turnoffactive \refx{#1-snt}{}}% - \space [\printednodename],\space - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi -\endgroup} - -% \dosetq is the interface for calls from other macros - -% Use \turnoffactive so that punctuation chars such as underscore -% work in node names. -\def\dosetq #1#2{{\let\folio=0 \turnoffactive -\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}% -\next}} - -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ytitle{\thissection} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. - -\def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax - % If not defined, say something at least. - $\langle$un\-de\-fined$\rangle$% - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \else - % It's defined, so just use it. - \csname X#1\endcsname - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. -\def\xrdef #1#2{{% - \catcode`\'=\other - \expandafter\gdef\csname X#1\endcsname{#2}% -}} - -% Read the last existing aux file, if any. No error if none exists. -\def\readauxfile{\begingroup - \catcode`\^^@=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\=\other - \catcode`\^^L=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode`\=\other - \catcode26=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - % `\+ does not work, so use 43. - \catcode43=\other - % Make the characters 128-255 be printing characters - {% - \count 1=128 - \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi - }% - }% - % The aux file uses ' as the escape (for now). - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other - % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux -\endgroup} - - -% Footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only.. -\let\footnotestyle=\comment - -\let\ptexfootnote=\footnote - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \footnotezzz -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\long\gdef\footnotezzz{\insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - % Hang the footnote text off the number. - \hang - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\egroup} - -}%end \catcode `\@=11 - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - - -% End of control word definitions. - -\message{and turning on texinfo input format.} - -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% Set some numeric style parameters, for 8.5 x 11 format. - -\hsize = 6in -\hoffset = .25in -\newdimen\defaultparindent \defaultparindent = 15pt -\parindent = \defaultparindent -\parskip 3pt plus 2pt minus 1pt -\setleading{13.2pt} -\advance\topskip by 1.2cm - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness=10000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. This makes it come to about 9pt for the 8.5x11 format. -% -\ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% -\else - \emergencystretch = \hsize - \divide\emergencystretch by 45 -\fi - -% Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25) -\def\smallbook{ - \global\chapheadingskip = 15pt plus 4pt minus 2pt - \global\secheadingskip = 12pt plus 3pt minus 2pt - \global\subsecheadingskip = 9pt plus 2pt minus 2pt - % - \global\lispnarrowing = 0.3in - \setleading{12pt} - \advance\topskip by -1cm - \global\parskip 2pt plus 1pt - \global\hsize = 5in - \global\vsize=7.5in - \global\tolerance=700 - \global\hfuzz=1pt - \global\contentsrightmargin=0pt - \global\deftypemargin=0pt - \global\defbodyindent=.5cm - % - \global\pagewidth=\hsize - \global\pageheight=\vsize - % - \global\let\smalllisp=\smalllispx - \global\let\smallexample=\smalllispx - \global\def\Esmallexample{\Esmalllisp} -} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{ -\global\tolerance=700 -\global\hfuzz=1pt -\setleading{12pt} -\global\parskip 15pt plus 1pt - -\global\vsize= 53\baselineskip -\advance\vsize by \topskip -%\global\hsize= 5.85in % A4 wide 10pt -\global\hsize= 6.5in -\global\outerhsize=\hsize -\global\advance\outerhsize by 0.5in -\global\outervsize=\vsize -\global\advance\outervsize by 0.6in - -\global\pagewidth=\hsize -\global\pageheight=\vsize -} - -\bindingoffset=0pt -\normaloffset=\hoffset -\pagewidth=\hsize -\pageheight=\vsize - -% Allow control of the text dimensions. Parameters in order: textheight; -% textwidth; voffset; hoffset; binding offset; topskip. -% All require a dimension; -% header is additional; added length extends the bottom of the page. - -\def\changepagesizes#1#2#3#4#5#6{ - \global\vsize= #1 - \global\topskip= #6 - \advance\vsize by \topskip - \global\voffset= #3 - \global\hsize= #2 - \global\outerhsize=\hsize - \global\advance\outerhsize by 0.5in - \global\outervsize=\vsize - \global\advance\outervsize by 0.6in - \global\pagewidth=\hsize - \global\pageheight=\vsize - \global\normaloffset= #4 - \global\bindingoffset= #5} - -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. -\def\afourlatex - {\global\tolerance=700 - \global\hfuzz=1pt - \setleading{12pt} - \global\parskip 15pt plus 1pt - \advance\baselineskip by 1.6pt - \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm} - } - -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{\afourpaper -\changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} - -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt \char '042}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt \char '176}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} - -\catcode`\|=\active -\def|{{\tt \char '174}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} - -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -\catcode`\@=0 - -% \rawbackslashxx output one backslash character in current font -\global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} - -% \rawbackslash redefines \ as input to do \rawbackslashxx. -{\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} - -% Say @foo, not \foo, in error messages. -\escapechar=`\@ - -% \catcode 17=0 % Define control-q -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus} - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active @catcode`@_=@active} - -%% These look ok in all fonts, so just make them not special. The @rm below -%% makes sure that the current font starts out as the newly loaded cmr10 -@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other - -@textfonts -@rm - -@c Local variables: -@c page-delimiter: "^\\\\message" -@c End: diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/CHANGES b/gnu/usr.sbin/e2fsprogs/e2fsck/CHANGES deleted file mode 100644 index fa135b6d0a0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/CHANGES +++ /dev/null @@ -1,53 +0,0 @@ -[tytso:19940101.1200EST] - -Add new options -l and -L, to append to and modify the bad-blocks list. - -Fix bugs in bad-block cloning. - -[tytso:19931230.1832EST] - -Clean up e2fsck and library to be clean even when compiling with full -warnings enabled. - -Make e2fsck deal with zero-length directories correctly. - -Deleted inodes from old ext2fs code (inodes with dtime set but -non-zero link count) are detected, and the user is given the -opportunity to clear them. - -The last bit in the last group of the block bitmap badding was not -being checked; now fixed. - -The free_blocks and free_inodes count in the last group weren't being -checked. Now fixed. - -[tytso:19931101.0007EST] - -Fixed bugs with root reallocation; previously the parent pointers in -the dirinfo structure would get corrupted, causing many different '..' -links to be wrong. Also, the inode link count for the root directory -wasn't always being set correctly. (All of this would be fixed on -the second e2fsck, however). - -Fixed to recognize filesystem corruption caused by mke2fs 0.2b (where -/ and /lost+found had non-zero dtime entries). Offers to fix /'s -dtime entry. - -e2fsck will now expand the /lost+found directory if it runs out of room. - -Fixed dependency on BLOCK_SIZE in pass2. e2fsck will now handle 4k -filesystems w/o problems. - -e2fsck will now move bad blocks found in the inode bitmaps, block -bitmaps, and in the inode tables. (Can't handle bad blocks found in -the superblock and the group descriptors.) (Doesn't update alternate -superblocks, group descriptors.) - -e2fsck now supports the -b option, to allow a user to specify an -alternate superblock. - -The -B option now specifies the blocksize of the filesystem. (If not -specified, and the -b option is specified, e2fsck will attempt to -search through various blocksizes to find the correct one.) - -Added manual page. diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/ChangeLog b/gnu/usr.sbin/e2fsprogs/e2fsck/ChangeLog deleted file mode 100644 index 82ec56bfcee..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/ChangeLog +++ /dev/null @@ -1,700 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Mon Apr 21 22:43:08 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1b.c (pass1b): While scanning for inodes, simply skip inodes - where ext2fs_get_next_inode returns the - EXT2_ET_BAD_BLOCK_IN_INODE_TABLE error. - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Thu Apr 10 13:51:16 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1b.c (clone_file_block): If we clone a directory, we need to - update the dblist entry so that we check (and correct) the - right directory block. - -Sun Apr 6 09:13:12 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (process_block): Don't clear blocks references to - filesystem metadata; let pass 1B handle this case. - - * problem.c, problem.h: Add new problem, PR_1B_SHARE_METADATA. - - * pass1b.c (pass1d): Deal with a block which is shared with - filesystem metadata. - - * e2fsck.h: Make block_illegal_map be a global variable - -Sat Apr 5 11:51:58 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c, pass1.c (mark_table_blocks): Support the sparse_super - feature. - (get_backup_sb): New function which attempts to obtain the - correct backup superblock (if possible). - -Fri Apr 4 10:46:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (main): Check the version of the library, and warn if - the library is out of date; this happens generally due to - users who manually install e2fsprogs. - - * pass1.c (pass1_get_blocks): If the passed in inode number for - get_blocks isn't what we're expecting pass back - EXT2_ET_CALLBACK_NOT_HANDLED. - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Tue Mar 11 10:31:47 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * icount.c: New file which implements an inode count abstraction. - This significantly reduces amount of memory needed to - check really large filesystems. - - * pass1.c, pass2.c, pass3.c, pass4.c: Modified to use the icount - abstraction. - -Fri Mar 7 08:28:55 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * dirinfo.c (dir_info_iter): New function which allows iteration - over the directories in the dir_info map. - - * pass3.c (pass3, check_directory): Speed up pass 3 by iterating - over all directories in the dir_info structure, instead of - iterating all inodes looking for directories, and then - looking up the directories using get_dir_info(). - -Sat Feb 1 11:33:43 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (pass1, process_block): - * pass2.c (pass2): Use the ext2_dblist abstraction instead of - manual code to manage the directory block list information. - - * pass1.c (check_blocks), pass1b.c (pass1b), pass2.c - (deallocate_inode): Call the ext2 library routine - ext2_inode_has_valid_blocks() instead of - inode_has_valid_blocks(). - - * swapfs.c (swap_inodes): Add check so that we don't try to call - swap_inode_blocks unless the inode has valid blocks. - (Otherwise a long fast symlink might cause - swap_inode_blocks to erroneously get called.) - -Wed Jan 22 14:42:53 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * problem.c, problem.h: Added entries for PR_2_DOT_NULL_TERM and - PR_2_DOT_DOT_NULL_TERM. - - * pass2.c (check_dot, check_dot_dot): Make sure the new . and - .. entries are null-terminated, since the 2.0 kernel - requires this (for no good reason). - -Mon Jan 20 20:05:11 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (pass1): Set the EXT2_SF_SKIP_MISSING_ITABLE flag so - that we can recover from missing inode tables. - - * dirinfo.c (get_dir_info): If there are no directories in the - dir_info abstraction, don't core dump (because dir_info is - NULL). - - * e2fsck.c (main): Don't try using the backup superblocks if there - aren't any. - (check_super_block): If there are illegal inode table or - bitmaps, set the filesystem as being in error. - -Wed Jan 15 11:32:01 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass2.c (check_dir_block): Added check to make sure that rec_len - is a a multiple of 4 (so that the directory entries are - 4-byte aligned). - -Sat Dec 28 12:16:32 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (uninstall): Uninstall all programs in the PROGS - line. - (PROGS): Don't build and install the extend program by - default. - - -Sat Dec 7 16:41:02 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (process_inodes): Make sure the stashed_ino variable is - saved and restored as well. - (pass1): For fast sym links, skip the check_blocks - processing step altogether. - -Mon Dec 2 09:28:24 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * problem.c, message.c: New files, to completely refurbish how - filesystem problems are reported to the user. The - diagnostic messages are now encoded out in an easily - customizable, extensible format. The messages printed out - in preen mode are all on one line, and contain the device - name. - -Fri Nov 29 20:26:08 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * swapfs.c (swap_inodes): When swapping a filesystem, ignore - deleted files. - - * pass1.c (pass1): Ignore missing inode table errors during the - scan, and just skip past those inodes. - - * pass3.c (check_root): Remove root_ino argument, and assume that - the root inode must be EXT2_ROOT_INO. Move responsibility - of setting the parent of the root inode in the directory - inode structure to pass2(). - - * pass2.c (check_dir_block): Don't allow links to the root - directory. - - * dirinfo.c (add_dir_info): Remove last argument to add_dir_info, - since the inode is no longer used. - -Tue Oct 15 00:06:49 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (main): If the superblock magic number is wrong, or the - block group fails a sanity check, then automatically - restart trying to use the backup superblocks. - - * pass1.c (mark_table_blocks): Make the inode tables ahead of - everything else; in the case where a bitmap block overlays - the inode table, the inode table should take precedence. - - * pass2.c (maybe_clear_entry): Make the deleted/unused error - message fit on one line, since the error can happen during - a preen pass. (We eventually need to revamp the whole - e2fsck error reporting and prompting system, but that's a - job for another day.) - -Mon Oct 14 22:29:49 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (main): Read in the list badblocks into fs->badblocks - for the benefit of the inode scan functions. - - * pass1.c (pass1): If ext2fs_get_next_inode() returns an error - indicating that an inode is in a bad block, mark that - inode as being used, as well as in the inode "bb" map. - - * pass2.c (maybe_clear_entry): New function which generalizes the - error cases when a directory entry needs to be cleared. - (check_dir_block): If an inode is in the "bb" map, offer - to clear the directory entry, since the inode is in a bad - block. - - * pass4.c (pass4): If an inode is marked as used, but is is marked - in the "bb" map, don't process it as a disconnected inode. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Mon Oct 7 00:45:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (main): Print out the version number of the shared - library when using the -V option. - - * swapfs.c (swap_filesys): Change EXT2_SWAP to EXT2_FLAG_SWAP for - consistency's sake. - - * e2fsck.c (main): By setting EXT2_FLAG_MASTER_SB_ONLY, only write - out the backup superblocks when we know we have a valid - filesystem. - -Tue Oct 1 22:00:29 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * util.c (preenhalt): Make it explicit on preenhalt that running - e2fsck manually means without the -a or -p flag. - -Fri Sep 27 14:41:08 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (pass1): Add support for the EXT2_BOOT_LOADER inode. - (Linux/FT actually sets the mode bits, so we have to - handle it specially.) - - * e2fsck.c (check_if_skip): Print a message if the filesystem is - just dirty, so that the user knows that it's about to be - checked (since this will take a while). - -Mon Sep 16 17:00:01 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass4.c: If a disconnected inode is zero-length, prompt to - delete it instead of connecting it to lost+found. - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Fri Aug 30 20:24:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass4.c (pass4): If the user refuses to connect an unattached - inode to lost+found, don't try to set i_links_count. This - is bad, since if the user says yes, the inode will be - marked as unused, which is not necessarily the right - thing, especially since the rest of the cleanup doesn't - happen here. - - * pass2.c (deallocate_inode): Set inode_link_info[ino] when - dellocating an inode. (Not strictly necessary, but...) - - * pass4.c (pass4): Add "bonehead" explanation to the "programming - error" message. - -Tue Aug 27 11:26:32 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (PRS,main): Added new options -s and -S. -s will - byte-swap the filesystem so that it is normalized. -S - will byte-swap the filesystem regardless of its current - byte-order. - - * swapfs.c: New file, which will byte-swap a filesystem. - -Tue Aug 20 09:41:37 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (pass1): Change handling on files with non-zero dtime - and non-zero i_link_count; before we treated them as - deleted file per botched ext2 0.3c kernel behavior. We - now clear dtime instead. - -Mon Aug 19 23:33:57 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (main): If e2fsck sets the clean bit, even if - nothing else is changed, make sure FSCK_NONDESTRUCT is - set (since after all having the filesystem set to - invalid is an error. :-) - -Fri Aug 9 10:25:13 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pass1.c (process_block): Make sure that meta data doesn't get - accidentally set in the dir_blocks array (which could - happen in some error condtions). - - * pass1.c (pass1): - * pass2.c (process_bad_inode): Check for fragments in a - OS-independent fashion. - -Thu Aug 8 15:20:54 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (check_if_skip): Close the filesystem when skipping the - cleanup for the filesystem. - -Mon Jul 22 22:03:28 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c: Improve corrupt_msg, so that it's less confusing. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed May 15 21:41:29 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e2fsck.c (relocate_hint): Issue a hint that the user may wish to - try "e2fsck -b 8193" before allowing e2fsck to relocate - inode table blocks. - - * Makefile.in (e2fsck): Build e2fsck statically or dynamically - depending on the option to configure. Added targets for - e2fsck.static and e2fsck.shared for people who want to - build a static or shared variant manually. - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Tue Mar 26 12:03:42 1996 <tytso@rsts-11.mit.edu> - - * e2fsck.c (show_stats): Don't use floating point to display - percentage of non-contiguous files, as different libc - handle result truncation differently, and this causes the - test suite to bomb out depending on which libc you are - using. - - * util.c (allocate_memory): Fix error message to omit extraneous - %%s. - -Tue Mar 5 03:50:40 1996 <tytso@rsts-11.mit.edu> - - * pass4.c (pass4): - * pass2.c (check_dir_block): - * pass1.c (pass1): Add support for dynamic first inode revision. - -Wed Feb 14 16:27:30 1996 <tytso@rsts-11.mit.edu> - - * pass3.c (check_root): Fix spelling typo - -Mon Feb 5 22:30:30 1996 <tytso@rsts-11.mit.edu> - - * e2fsck.c (check_super_block): If the superblock fails certain - internal consistency checks, exit with a fatal error after - printing the "superblock is corrupt message". - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Wed Dec 15 21:24:26 1996 <tytso@rsts-11.mit.edu> - - * pass1.c (process_block): Check to see if a file is "fragmented". - i.e., non-contiguous. Note that any file which is larger - than the block group is guaranteed to be non-contiguous. - We may want to use a different hueristic for deciding - whether or not a file is "fragmented". - - * e2fsck.c (show_stats): Print statistics of how many - non-contiguous files are on the system. - -Fri Dec 15 19:19:47 1995 <tytso@rsts-11.mit.edu> - - * badblocks.c (read_bad_blocks_file, test_disk): Fold - functionality of test_disk() (which runs badblocks) into - read_bad_blocks_file(); test_disk() now calls - read_bad_blocks_file() with a NULL bad_blocks_file - argument. - -Mon Nov 20 18:30:10 1995 <tytso@rsts-11.mit.edu> - - * e2fsck.c (check_mount): Use #if defined(__linux__) instead of - #if defined(linux). The latter won't work if we're - compiling -ansi. - -Mon Oct 30 20:31:17 1995 <tytso@rsts-11.mit.edu> - - * e2fsck.c (check_mount): For Linux systems, the check to see if - the root is mounted read-only has to be done for all - filesystems, not just for the root filesystem, due to the - way that some /etc/rc scripts are set up. - -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 - when pass 1 needs to be restarted from scratch. - - * pass1.c (handle_fs_bad_blocks): Fix bug where bitmap blocks were - being reallocated to blocks in the next block group, - instead of the current block grup. - - * pass1.c (pass1, check_blocks): Set inode_link_info[ino] whenever - inode.i_links_count is set. - -Tue Feb 14 01:38:04 1995 Theodore Y. Ts'o (tytso@rt-11) - - * pass1.c (process_block): Add checks for if the block is - trepassing on a superblock or group descriptor table. - -Sat Dec 31 00:52:11 1994 <tytso@rsx-11.mit.edu> - - * main.c (corrupt_msg): Extend the message which is printed out - when the superblock is corrupt, to include the suggestion - of using the -b option to specify an alternate superblock. - -Thu Nov 24 09:29:58 1994 Theodore Y. Ts'o (tytso@rt-11) - - * badblocks.c (read_bad_blocks_file): If we are adding or - replacing bad blocks in the bad blocks inode, sanity check - the bad block inode first, and clear out any illegal blocks. - - * pass2.c (check_name): Don't bomb out if the attempt to get the - pathname of the containing directory returns an error; the - directory may be too badly damaged to expect that - ext2fs_get_pathname will always succeed. Use "???" if the - pathname can't be obtained (it's only for a printf to the - user anyway). - - The name of the containing directory and the bad filename - were incorrectly interchanged in the user message. Fixed. - - * pass2.c (check_name, check_dir_block): Use a common static - string for the unknown pathname. - -Mon Nov 7 22:30:54 1994 Remy Card <card@bbj> - - * Fixed lots of printf formats to make sure that block and inode - numbers are printed as unsigned integers. - -Mon Oct 24 14:10:46 1994 (tytso@rsx-11) - - * pass5.c (check_block_end): Fix calculation of how the last block - in the block bitmap should be calculated. - -Wed Sep 7 10:01:13 1994 (tytso@rsx-11) - - * pass1b.c (pass1_dupblocks): Fix declaration of dup_inode_map to - be an ext2fs_inode_bitmap, and free it properly. - - * e2fsck.h - * e2fsck.c (main): Folded in Remy Card's changes to add a revision - level to the superblock. - -Wed Aug 17 22:00:20 1994 Remy Card (card@bbj) - - * e2fsck.c (usage): Fixed bogus usage message. - -Wed Aug 17 11:21:45 1994 Theodore Y. Ts'o (tytso@rt-11) - - * pass1.c (process_bad_block): Fixed bug so that blocks in the - backup superblocks and group descriptors are handled gracefully. - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/Makefile.in b/gnu/usr.sbin/e2fsprogs/e2fsck/Makefile.in deleted file mode 100644 index 24a9efb6209..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/Makefile.in +++ /dev/null @@ -1,200 +0,0 @@ -# -# Makefile for e2fsck -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = .. -my_dir = e2fsck -INSTALL = @INSTALL@ -LDFLAG_STATIC = @LDFLAG_STATIC@ - -@MCONFIG@ - -PROGS= e2fsck @EXTRA_PROGS@ -MANPAGES= e2fsck.8 - -LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBUUID) -DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBUUID) - -STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(STATIC_LIBUUID) -STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(STATIC_LIBUUID) - -PROFILED_LIBS= $(PROFILED_LIBEXT2FS) $(PROFILED_LIBCOM_ERR) $(PROFILED_LIBUUID) -PROFILED_DEPLIBS= $(PROFILED_LIBEXT2FS) $(PROFILED_LIBCOM_ERR) $(PROFILED_LIBUUID) - -.c.o: - $(CC) -c $(ALL_CFLAGS) $< -o $@ -@PROFILE_CMT@ $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< - -# -# Flags for using Checker -# Note: The optimization flags must include -g -# -#MCHECK= -checker -#LIBS= $(LIBCOM_ERR) $(LIB_EXT2FS) $(CHECKLIB) -#DEPLIBS= $(LIBCOM_ERR) $(LIB_EXT2FS) -#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 - -OBJS= e2fsck.o pass1.o pass1b.o pass2.o pass3.o pass4.o pass5.o \ - swapfs.o badblocks.o util.o dirinfo.o ehandler.o problem.o message.o \ - $(MTRACE_OBJ) - -PROFILED_OBJS= profiled/e2fsck.o profiled/pass1.o profiled/pass1b.o \ - profiled/pass2.o profiled/pass3.o profiled/pass4.o profiled/pass5.o \ - profiled/badblocks.o profiled/util.o profiled/dirinfo.o \ - profiled/ehandler.o profiled/message.o profiled/problem.o \ - profiled/swapfs.o - -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 \ - $(srcdir)/problem.c \ - $(MTRACE_SRC) - -all:: profiled $(PROGS) e2fsck.static e2fsck.shared $(MANPAGES) - -@PROFILE_CMT@all:: e2fsck.profiled - -e2fsck: e2fsck.@E2FSCK_TYPE@ - $(CP) e2fsck.@E2FSCK_TYPE@ e2fsck - -e2fsck.static: $(OBJS) $(STATIC_DEPLIBS) - $(LD) $(ALL_LDFLAGS) $(LDFLAG_STATIC) -o e2fsck.static $(OBJS) \ - $(STATIC_LIBS) - -e2fsck.shared: $(OBJS) $(DEPLIBS) - $(LD) $(ALL_LDFLAGS) -o e2fsck.shared $(OBJS) $(LIBS) - -e2fsck.profiled: $(PROFILED_OBJS) $(PROFILED_DEPLIBS) - $(LD) $(ALL_LDFLAGS) -g -pg -o e2fsck.profiled $(PROFILED_OBJS) \ - $(PROFILED_LIBS) - -extend: extend.o - $(LD) $(ALL_LDFLAGS) -o extend extend.o $(CHECKLIB) - -flushb: flushb.o - $(LD) $(ALL_LDFLAGS) -o flushb flushb.o $(CHECKLIB) - -iscan: iscan.o util.o - $(LD) $(ALL_LDFLAGS) -o iscan iscan.o util.o ehandler.o $(LIBS) - -profiled: - mkdir profiled - -e2fsck.8: $(SUBSTITUTE) $(srcdir)/e2fsck.8.in - -$(CHMOD) +x $(SUBSTITUTE) - $(SUBSTITUTE) $(srcdir)/e2fsck.8.in e2fsck.8 - -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) $$i $(DESTDIR)$(man8dir)/$$i; \ - done - -uninstall: - for i in $(PROGS); do \ - $(RM) -f $(sbindir)/$$i; \ - done - $(RM) -f $(sbindir)/fsck.ext2 - for i in $(MANPAGES); do \ - $(RM) -f $(man8dir)/$$i; \ - done - -clean: - $(RM) -f $(PROGS) \#* *\# *.s *.o *.a *~ core e2fsck.static \ - e2fsck.shared e2fsck.profiled e2fsck.8 - $(RM) -rf profiled - -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 \ - $(top_srcdir)/lib/uuid/uuid.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)/problem.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 $(srcdir)/problem.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 $(srcdir)/problem.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 \ - $(srcdir)/problem.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 $(srcdir)/problem.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 $(srcdir)/problem.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 -problem.o: $(srcdir)/problem.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 $(srcdir)/problem.h - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/badblocks.c b/gnu/usr.sbin/e2fsprogs/e2fsck/badblocks.c deleted file mode 100644 index c81baae8065..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/badblocks.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * badblocks.c --- replace/append bad blocks to the bad block inode - * - * Copyright (C) 1993, 1994 Theodore Ts'o. This file may be - * redistributed under the terms of the GNU Public License. - */ - -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <et/com_err.h> -#include "e2fsck.h" - -static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt, - void *private); - - -static void invalid_block(ext2_filsys fs, blk_t blk) -{ - printf("Bad block %u out of range; ignored.\n", blk); - return; -} - -void read_bad_blocks_file(ext2_filsys fs, const char *bad_blocks_file, - int replace_bad_blocks) -{ - errcode_t retval; - badblocks_list bb_list = 0; - FILE *f; - char buf[1024]; - - read_bitmaps(fs); - - /* - * Make sure the bad block inode is sane. If there are any - * illegal blocks, clear them. - */ - retval = ext2fs_block_iterate(fs, EXT2_BAD_INO, 0, 0, - check_bb_inode_blocks, 0); - if (retval) { - com_err("ext2fs_block_iterate", retval, - "while sanity checking the bad blocks inode"); - fatal_error(0); - } - - /* - * If we're appending to the bad blocks inode, read in the - * current bad blocks. - */ - if (!replace_bad_blocks) { - retval = ext2fs_read_bb_inode(fs, &bb_list); - if (retval) { - com_err("ext2fs_read_bb_inode", retval, - "while reading the bad blocks inode"); - fatal_error(0); - } - } - - /* - * Now read in the bad blocks from the file; if - * bad_blocks_file is null, then try to run the badblocks - * command. - */ - if (bad_blocks_file) { - f = fopen(bad_blocks_file, "r"); - if (!f) { - com_err("read_bad_blocks_file", errno, - "while trying to open %s", bad_blocks_file); - fatal_error(0); - } - } else { - sprintf(buf, "badblocks %s%s %d", preen ? "" : "-s ", - fs->device_name, - fs->super->s_blocks_count); - f = popen(buf, "r"); - if (!f) { - com_err("read_bad_blocks_file", errno, - "while trying popen '%s'", buf); - fatal_error(0); - } - } - retval = ext2fs_read_bb_FILE(fs, f, &bb_list, invalid_block); - if (bad_blocks_file) - fclose(f); - else - pclose(f); - if (retval) { - com_err("ext2fs_read_bb_FILE", retval, - "while reading in list of bad blocks from file"); - fatal_error(0); - } - - /* - * Finally, update the bad blocks from the bad_block_map - */ - retval = ext2fs_update_bb_inode(fs, bb_list); - if (retval) { - com_err("ext2fs_update_bb_inode", retval, - "while updating bad block inode"); - fatal_error(0); - } - - badblocks_list_free(bb_list); - return; -} - -void test_disk(ext2_filsys fs) -{ - read_bad_blocks_file(fs, 0, 1); -} - -static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt, - void *private) -{ - if (!*block_nr) - return 0; - - /* - * If the block number is outrageous, clear it and ignore it. - */ - if (*block_nr >= fs->super->s_blocks_count || - *block_nr < fs->super->s_first_data_block) { - printf("Warning illegal block %u found in bad block inode. Cleared.\n", *block_nr); - *block_nr = 0; - return BLOCK_CHANGED; - } - - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/dirinfo.c b/gnu/usr.sbin/e2fsprogs/e2fsck/dirinfo.c deleted file mode 100644 index 5218234cdd6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/dirinfo.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * dirinfo.c --- maintains the directory information table for e2fsck. - * - * Copyright (C) 1993 Theodore Ts'o. This file may be redistributed - * under the terms of the GNU Public License. - */ - -#include <et/com_err.h> -#include "e2fsck.h" - -static int dir_info_count = 0; -static int dir_info_size = 0; -static struct dir_info *dir_info = 0; - -int get_num_dirs(ext2_filsys fs) -{ - int i, num_dirs; - - num_dirs = 0; - for (i = 0; i < fs->group_desc_count; i++) - num_dirs += fs->group_desc[i].bg_used_dirs_count; - - return num_dirs; -} - -/* - * This subroutine is called during pass1 to create a directory info - * entry. During pass1, the passed-in parent is 0; it will get filled - * in during pass2. - */ -void add_dir_info(ext2_filsys fs, ino_t ino, ino_t parent) -{ - struct dir_info *dir; - int i, j; - -#if 0 - printf("add_dir_info for inode %lu...\n", ino); -#endif - if (!dir_info) { - dir_info_count = 0; - dir_info_size = get_num_dirs(fs) + 10; - - dir_info = allocate_memory(dir_info_size * - sizeof (struct dir_info), - "directory map"); - } - - if (dir_info_count >= dir_info_size) { - dir_info_size += 10; - dir_info = realloc(dir_info, - dir_info_size * sizeof(struct dir_info)); - } - - /* - * Normally, add_dir_info is called with each inode in - * sequential order; but once in a while (like when pass 3 - * needs to recreate the root directory or lost+found - * directory) it is called out of order. In those cases, we - * need to move the dir_info entries down to make room, since - * the dir_info array needs to be sorted by inode number for - * get_dir_info()'s sake. - */ - if (dir_info_count && dir_info[dir_info_count-1].ino >= ino) { - for (i = dir_info_count-1; i > 0; i--) - if (dir_info[i-1].ino < ino) - break; - dir = &dir_info[i]; - if (dir->ino != ino) - for (j = dir_info_count++; j > i; j--) - dir_info[j] = dir_info[j-1]; - } else - dir = &dir_info[dir_info_count++]; - - dir->ino = ino; - dir->dotdot = parent; - dir->parent = parent; -} - -/* - * get_dir_info() --- given an inode number, try to find the directory - * information entry for it. - */ -struct dir_info *get_dir_info(ino_t ino) -{ - int low, high, mid; - - low = 0; - high = dir_info_count-1; - if (!dir_info) - return 0; - if (ino == dir_info[low].ino) - return &dir_info[low]; - if (ino == dir_info[high].ino) - return &dir_info[high]; - - while (low < high) { - mid = (low+high)/2; - if (mid == low || mid == high) - break; - if (ino == dir_info[mid].ino) - return &dir_info[mid]; - if (ino < dir_info[mid].ino) - high = mid; - else - low = mid; - } - return 0; -} - -/* - * Free the dir_info structure when it isn't needed any more. - */ -void free_dir_info(ext2_filsys fs) -{ - if (dir_info) { - free(dir_info); - dir_info = 0; - } - dir_info_size = 0; - dir_info_count = 0; -} - -/* - * A simple interator function - */ -struct dir_info *dir_info_iter(int *control) -{ - if (*control >= dir_info_count) - return 0; - - return(dir_info + (*control)++); -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.8.in b/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.8.in deleted file mode 100644 index 7750b189dc0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.8.in +++ /dev/null @@ -1,198 +0,0 @@ -.\" -*- nroff -*- -.\" 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 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -e2fsck \- check a Linux second extended file system -.SH SYNOPSIS -.B e2fsck -[ -.B \-pacnyrdfvstFSV -] -[ -.B \-b -.I superblock -] -[ -.B \-B -.I blocksize -] -[ -.B \-l|-L -.I bad_blocks_file -] -.I device -.SH DESCRIPTION -.B e2fsck -is used to check a Linux second extended file system. -.TP -.I device -is the special file corresponding to the device (e.g /dev/hdXX). -.SH OPTIONS -.TP -.I -a -This option does the same thing as the -.I -p -option. It is provided for backwards compatibility only; it is -suggested that people use -.I -p -option whever possible. -.TP -.I -b superblock -Instead of using the normal superblock, use the alternative superblock -specified by -.IR superblock . -.TP -.I -B blocksize -Normally, e2fsck will search for the superblock at various different -block sizes in an attempt to find the appropriate block size. This -search can be fooled in some cases. This option forces e2fsck to only -try locating the superblock at a particular blocksize. If the -superblock is not found, e2fsck will terminate with a fatal error. -.TP -.I -c -This option causes e2fsck to run the -.BR badblocks (8) -program to find any blocks -which are bad on the filesystem, and then marks them as bad by adding them -to the bad block inode. -.TP -.I -d -Print debugging output (useless unless you are debugging -.B e2fsck -). -.TP -.I -f -Force checking even if the file system seems clean. -.TP -.I -F -Flush the filesystem device's buffer caches before beginning. Only -really useful for doing e2fsck time trials. -.TP -.I -l filename -Add the blocks listed in the file specified by -.I filename -to the list of bad blocks. -.TP -.I -L filename -Set the bad blocks list to be the list of blocks specified by -.IR filename . -(This option is the same as the -.I -l -option, except the bad blocks list is cleared before the blocks listed -in the file are added to the bad blocks list.) -.TP -.I -n -Open the filesystem read-only, and assume an answer of ``no'' to all -questions. Allows -.B e2fsck -to be used non-interactively. (Note: if the -.IR -c , -.IR -l , -or -.I -L -options are specified in addition to the -.I -n -option, then the filesystem will be opened read-write, to permit the -bad-blocks list to be updated. However, no other changes will be made -to the filesystem.) -.TP -.I -p -Automatically repair ("preen") the file system without any questions. -.TP -.I -r -This option does nothing at all; it is provided only for backwards -compatibility. -.IP -.I -s -This option will byte-swap the filesystem so that it is using the normalized, -standard byte-order (which is i386 or little endian). If the filesystem is -already in the standard byte-order, e2fsck will take no action. -.TP -.I -S -This option will byte-swap the filesystem, regardless of its current -byte-order. -.TP -.I -t -Print timing statistics for -.BR e2fsck . -If this option is used twice, additional timing statistics are printed -on a pass by pass basis. -.TP -.I -v -Verbose mode. -.TP -.I -V -Print version information and exit. -.TP -.I -y -Assume an answer of ``yes'' to all questions; allows -.B e2fsck -to be used non-interactively. -.SH EXIT CODE -The exit code returned by -.B e2fsck -is the sum of the following conditions: -.br -\ 0\ \-\ No errors -.br -\ 1\ \-\ File system errors corrected -.br -\ 2\ \-\ File system errors corrected, system should -.br -\ \ \ \ be rebooted if file system was mounted -.br -\ 4\ \-\ File system errors left uncorrected -.br -\ 8\ \-\ Operational error -.br -\ 16\ \-\ Usage or syntax error -.br -\ 128\ \-\ Shared library error -.br -.SH REPORTING BUGS -Almost any piece of software will have bugs. If you manage to find a -filesystem which causes -.B e2fsck -to crash, or which -.B e2fsck -is unable to repair, please report it to the author. -.PP -Please include as much information as possible in your bug report. -Ideally, include a complete transcript of the -.B e2fsck -run, so I can see exactly what error messages are displayed. If you -have a writeable filesystem where the transcript can be stored, the -.BR script (1) -program is a handy way to save the output of -.e2fsck -to a file. -.PP -It is also useful to send the output of -.BR dumpe2fs (8). -If a specific inode or inodes seems to be giving -.B e2fsck -trouble, try running the -.BR debugfs (8) -command and send the output of the -.I stat -command run on the relevant inode(s). If the inode is a directory, -the debugfs -.I dump -command will allow you to extract the contents of the directory inode, -which can sent to me after being first run through -.BR uuencode (1). -.PP -Always include the full version string which -.B e2fsck -displays when it is run, so I know which version you are running. -.SH AUTHOR -This version of -.B e2fsck -is written by Theodore Ts'o <tytso@mit.edu>. -.SH SEE ALSO -.BR mke2fs (8), -.BR tune2fs (8), -.BR dumpe2fs (8), -.BR debugfs (8) diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.c b/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.c deleted file mode 100644 index c40a4426c70..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.c +++ /dev/null @@ -1,847 +0,0 @@ -/* - * e2fsck.c - a consistency checker for the new extended file system. - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* Usage: e2fsck [-dfpnsvy] device - * -d -- debugging this program - * -f -- check the fs even if it is marked valid - * -p -- "preen" the filesystem - * -n -- open the filesystem r/o mode; never try to fix problems - * -v -- verbose (tells how many files) - * -y -- always answer yes to questions - * - * The device may be a block device or a image of one, but this isn't - * enforced (but it's not much fun on a character device :-). - */ - -#include <stdio.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#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 "uuid/uuid.h" -#include "e2fsck.h" -#include "problem.h" -#include "../version.h" - -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; -int yflag = 0; -int tflag = 0; /* Do timing */ -int cflag = 0; /* check disk */ -int preen = 0; -int rwflag = 1; -int swapfs = 0; -int normalize_swapfs = 0; -int inode_buffer_blocks = 0; -blk_t use_superblock; -blk_t superblock; -int blocksize = 0; -int verbose = 0; -int list = 0; -int debug = 0; -int force = 0; -int invalid_bitmaps = 0; -static int show_version_only = 0; - -static int replace_bad_blocks = 0; -static char *bad_blocks_file = 0; - -static int possible_block_sizes[] = { 1024, 2048, 4096, 8192, 0}; - -struct resource_track global_rtrack; - -static int root_filesystem = 0; -static int read_only_root = 0; - -int *invalid_inode_bitmap; -int *invalid_block_bitmap; -int *invalid_inode_table; -int restart_e2fsck = 0; - -static void usage(NOARGS) -{ - fprintf(stderr, - "Usage: %s [-panyrcdfvstFSV] [-b superblock] [-B blocksize]\n" - "\t\t[-I inode_buffer_blocks] [-P process_inode_size]\n" - "\t\t[-l|-L bad_blocks_file] device\n", program_name); - exit(FSCK_USAGE); -} - -static void show_stats(ext2_filsys fs) -{ - int inodes, inodes_used, blocks, blocks_used; - int dir_links; - int num_files, num_links; - int frag_percent; - - dir_links = 2 * fs_directory_count - 1; - num_files = fs_total_count - dir_links; - num_links = fs_links_count - dir_links; - inodes = fs->super->s_inodes_count; - inodes_used = (fs->super->s_inodes_count - - fs->super->s_free_inodes_count); - blocks = fs->super->s_blocks_count; - blocks_used = (fs->super->s_blocks_count - - fs->super->s_free_blocks_count); - - frag_percent = (10000 * fs_fragmented) / inodes_used; - frag_percent = (frag_percent + 5) / 10; - - if (!verbose) { - printf("%s: %d/%d files (%0d.%d%% non-contiguous), %d/%d blocks\n", - device_name, inodes_used, inodes, - frag_percent / 10, frag_percent % 10, - blocks_used, blocks); - return; - } - printf ("\n%8d inode%s used (%d%%)\n", inodes_used, - (inodes_used != 1) ? "s" : "", - 100 * inodes_used / inodes); - printf ("%8d non-contiguous inodes (%0d.%d%%)\n", - fs_fragmented, frag_percent / 10, frag_percent % 10); - 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%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" : "", - fs_blockdev_count, (fs_blockdev_count != 1) ? "s" : "", - fs_fifo_count, (fs_fifo_count != 1) ? "s" : "", - fs_links_count - dir_links, - ((fs_links_count - dir_links) != 1) ? "s" : "", - fs_symlinks_count, (fs_symlinks_count != 1) ? "s" : "", - fs_fast_symlinks_count, (fs_fast_symlinks_count != 1) ? "s" : "", - fs_sockets_count, (fs_sockets_count != 1) ? "s" : "", - fs_total_count - dir_links, - ((fs_total_count - dir_links) != 1) ? "s" : ""); -} - -static void check_mount(NOARGS) -{ - errcode_t retval; - int mount_flags, cont, fd; - - 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; - } - if (!(mount_flags & EXT2_MF_MOUNTED)) - return; - -#if (defined(__linux__) && defined(HAVE_MNTENT_H)) - /* - * 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) - return; - } else - close(fd); -#endif - - if (!rwflag) { - printf("Warning! %s is mounted.\n", device_name); - return; - } - - printf ("%s is mounted. ", device_name); - if (isatty (0) && isatty (1)) - cont = ask_yn("Do you really want to continue", -1); - else - cont = 0; - if (!cont) { - printf ("check aborted.\n"); - exit (0); - } - return; -} - -static void sync_disks(NOARGS) -{ - sync(); - sync(); - sleep(1); - sync(); -} - -static blk_t get_backup_sb(ext2_filsys fs) -{ - if (!fs || !fs->super) - return 8193; - return fs->super->s_blocks_per_group + 1; -} - -#define MIN_CHECK 1 -#define MAX_CHECK 2 - -static const char *corrupt_msg = -"\nThe superblock could not be read or does not describe a correct ext2\n" -"filesystem. If the device is valid and it really contains an ext2\n" -"filesystem (and not swap or ufs or something else), then the superblock\n" -"is corrupt, and you might try running e2fsck with an alternate superblock:\n" -" e2fsck -b %d <device>\n\n"; - -static void check_super_value(ext2_filsys fs, const char *descr, - unsigned long value, int flags, - unsigned long min, unsigned long max) -{ - if (((flags & MIN_CHECK) && (value < min)) || - ((flags & MAX_CHECK) && (value > max))) { - printf("Corruption found in superblock. (%s = %lu).\n", - descr, value); - printf(corrupt_msg, get_backup_sb(fs)); - fatal_error(0); - } -} - -static void relocate_hint(ext2_filsys fs) -{ - static hint_issued = 0; - - /* - * Only issue the hint once, and only if we're using the - * primary superblocks. - */ - if (hint_issued || superblock) - return; - - printf("Note: if there is several inode or block bitmap blocks\n" - "which require relocation, or one part of the inode table\n" - "which must be moved, you may wish to try running e2fsck\n" - "with the '-b %d' option first. The problem may lie only\n" - "with the primary block group descriptor, and the backup\n" - "block group descriptor may be OK.\n\n", get_backup_sb(fs)); - hint_issued = 1; -} - - -static void check_super_block(ext2_filsys fs) -{ - blk_t first_block, last_block; - struct ext2fs_sb *s = (struct ext2fs_sb *) fs->super; - blk_t blocks_per_group = fs->super->s_blocks_per_group; - int i; - blk_t should_be; - errcode_t retval; - struct problem_context pctx; - - clear_problem_context(&pctx); - - /* - * Verify the super block constants... - */ - check_super_value(fs, "inodes_count", s->s_inodes_count, - MIN_CHECK, 1, 0); - check_super_value(fs, "blocks_count", s->s_blocks_count, - MIN_CHECK, 1, 0); - check_super_value(fs, "first_data_block", s->s_first_data_block, - MAX_CHECK, 0, s->s_blocks_count); - check_super_value(fs, "log_frag_size", s->s_log_frag_size, - MAX_CHECK, 0, 2); - check_super_value(fs, "log_block_size", s->s_log_block_size, - MIN_CHECK | MAX_CHECK, s->s_log_frag_size, - 2); - check_super_value(fs, "frags_per_group", s->s_frags_per_group, - MIN_CHECK | MAX_CHECK, 1, 8 * EXT2_BLOCK_SIZE(s)); - check_super_value(fs, "blocks_per_group", s->s_blocks_per_group, - MIN_CHECK | MAX_CHECK, 1, 8 * EXT2_BLOCK_SIZE(s)); - check_super_value(fs, "inodes_per_group", s->s_inodes_per_group, - MIN_CHECK, 1, 0); - check_super_value(fs, "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)); - printf("This version of e2fsck does not support fragment " - "sizes different\n" - "from the block size.\n"); - fatal_error(0); - } - - 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 = %u, should " - "have been %u\n", s->s_blocks_per_group, - should_be); - printf(corrupt_msg, get_backup_sb(fs)); - fatal_error(0); - } - - should_be = (s->s_log_block_size == 0) ? 1 : 0; - if (s->s_first_data_block != should_be) { - printf("Superblock first_data_block = %u, should " - "have been %u\n", s->s_first_data_block, - should_be); - printf(corrupt_msg, get_backup_sb(fs)); - fatal_error(0); - } - - /* - * Verify the group descriptors.... - */ - first_block = fs->super->s_first_data_block; - last_block = first_block + blocks_per_group; - - for (i = 0; i < fs->group_desc_count; i++) { - pctx.group = i; - - if (i == fs->group_desc_count - 1) - 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)) { - relocate_hint(fs); - pctx.blk = fs->group_desc[i].bg_block_bitmap; - if (fix_problem(fs, PR_0_BB_NOT_GROUP, &pctx)) { - fs->group_desc[i].bg_block_bitmap = 0; - invalid_block_bitmap[i]++; - invalid_bitmaps++; - } - } - if ((fs->group_desc[i].bg_inode_bitmap < first_block) || - (fs->group_desc[i].bg_inode_bitmap >= last_block)) { - relocate_hint(fs); - pctx.blk = fs->group_desc[i].bg_inode_bitmap; - if (fix_problem(fs, PR_0_IB_NOT_GROUP, &pctx)) { - fs->group_desc[i].bg_inode_bitmap = 0; - invalid_inode_bitmap[i]++; - invalid_bitmaps++; - } - } - 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)) { - relocate_hint(fs); - pctx.blk = fs->group_desc[i].bg_inode_table; - if (fix_problem(fs, PR_0_ITABLE_NOT_GROUP, &pctx)) { - fs->group_desc[i].bg_inode_table = 0; - invalid_inode_table[i]++; - invalid_bitmaps++; - } - } - first_block += fs->super->s_blocks_per_group; - last_block += fs->super->s_blocks_per_group; - } - /* - * If we have invalid bitmaps, set the error state of the - * filesystem. - */ - if (invalid_bitmaps && rwflag) { - fs->super->s_state &= ~EXT2_VALID_FS; - ext2fs_mark_super_dirty(fs); - } - - /* - * If the UUID field isn't assigned, assign it. - */ - if (rwflag && uuid_is_null(s->s_uuid)) { - if (preen) - printf("%s: Adding UUID to filesystem.\n", - device_name); - else - printf("Filesystem did not have a UUID; " - "generating one.\n\n"); - uuid_generate(s->s_uuid); - ext2fs_mark_super_dirty(fs); - } - return; -} - -/* - * This routine checks to see if a filesystem can be skipped; if so, - * it will exit with E2FSCK_OK. Under some conditions it will print a - * message explaining why a check is being forced. - */ -static void check_if_skip(ext2_filsys fs) -{ - const char *reason = NULL; - - if (force || bad_blocks_file || cflag || swapfs) - return; - - if (fs->super->s_state & EXT2_ERROR_FS) - reason = "contains a file system with errors"; - else if (fs->super->s_mnt_count >= - (unsigned) fs->super->s_max_mnt_count) - reason = "has reached maximal mount count"; - else if (fs->super->s_checkinterval && - time(0) >= (fs->super->s_lastcheck + - fs->super->s_checkinterval)) - reason = "has gone too long without being checked"; - else if ((fs->super->s_state & EXT2_VALID_FS) == 0) - reason = "was not cleanly unmounted"; - if (reason) { - printf("%s %s, check forced.\n", device_name, reason); - return; - } - 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); - ext2fs_close(fs); - exit(FSCK_OK); -} - -#define PATH_SET "PATH=/sbin" - -static void PRS(int argc, char *argv[]) -{ - int flush = 0; - char c; -#ifdef MTRACE - extern void *mallwatch; -#endif - char *oldpath = getenv("PATH"); - - /* Update our PATH to include /sbin */ - 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); - initialize_ext2_error_table(); - - if (argc && *argv) - program_name = *argv; - while ((c = getopt (argc, argv, "panyrcB:dfvtFVM:b:I:P:l:L:N:Ss")) != EOF) - switch (c) { - case 'p': - case 'a': - preen = 1; - yflag = nflag = 0; - break; - case 'n': - nflag = 1; - preen = yflag = 0; - break; - case 'y': - yflag = 1; - preen = nflag = 0; - break; - case 't': - tflag++; - break; - case 'c': - cflag++; - break; - case 'r': - /* What we do by default, anyway! */ - break; - case 'b': - use_superblock = atoi(optarg); - break; - case 'B': - blocksize = atoi(optarg); - break; - case 'I': - inode_buffer_blocks = atoi(optarg); - break; - case 'P': - process_inode_size = atoi(optarg); - break; - case 'L': - replace_bad_blocks++; - case 'l': - bad_blocks_file = malloc(strlen(optarg)+1); - if (!bad_blocks_file) - fatal_error("Couldn't malloc bad_blocks_file"); - strcpy(bad_blocks_file, optarg); - break; - case 'd': - debug = 1; - break; - case 'f': - force = 1; - break; - case 'F': -#ifdef BLKFLSBUF - flush = 1; -#else - fatal_error ("-F not supported"); -#endif - break; - case 'v': - verbose = 1; - break; - case 'V': - show_version_only = 1; - break; -#ifdef MTRACE - case 'M': - mallwatch = (void *) strtol(optarg, NULL, 0); - break; -#endif - case 'N': - device_name = optarg; - break; - case 's': - normalize_swapfs = 1; - case 'S': - swapfs = 1; - break; - default: - usage (); - } - if (show_version_only) - return; - if (optind != argc - 1) - usage (); - if (nflag && !bad_blocks_file && !cflag && !swapfs) - rwflag = 0; - filesystem_name = argv[optind]; - if (device_name == 0) - device_name = filesystem_name; - if (flush) { -#ifdef BLKFLSBUF - int fd = open(filesystem_name, O_RDONLY, 0); - - if (fd < 0) { - com_err("open", errno, "while opening %s for flushing", - filesystem_name); - exit(FSCK_ERROR); - } - if (ioctl(fd, BLKFLSBUF, 0) < 0) { - com_err("BLKFLSBUF", errno, "while trying to flush %s", - filesystem_name); - exit(FSCK_ERROR); - } - close(fd); -#else - fatal_error ("BLKFLSBUF not supported"); -#endif /* BLKFLSBUF */ - } - if (swapfs) { - if (cflag || bad_blocks_file) { - fprintf(stderr, "Incompatible options not " - "allowed when byte-swapping.\n"); - fatal_error(0); - } - } -} - -static const char *my_ver_string = E2FSPROGS_VERSION; -static const char *my_ver_date = E2FSPROGS_DATE; - -int main (int argc, char *argv[]) -{ - errcode_t retval = 0; - int exit_value = FSCK_OK; - int i; - ext2_filsys fs = 0; - io_manager io_ptr; - struct ext2fs_sb *s; - const char *lib_ver_date; - int my_ver, lib_ver; - -#ifdef MTRACE - mtrace(); -#endif -#ifdef MCHECK - mcheck(0); -#endif - my_ver = ext2fs_parse_version_string(my_ver_string); - lib_ver = ext2fs_get_library_version(0, &lib_ver_date); - if (my_ver > lib_ver) { - fprintf( stderr, "Error: ext2fs library version " - "out of date!\n"); - show_version_only++; - } - - init_resource_track(&global_rtrack); - - PRS(argc, argv); - - if (!preen || show_version_only) - fprintf (stderr, "e2fsck %s, %s for EXT2 FS %s, %s\n", - my_ver_string, my_ver_date, EXT2FS_VERSION, - EXT2FS_DATE); - - if (show_version_only) { - fprintf(stderr, "\tUsing %s, %s\n", - error_message(EXT2_ET_BASE), lib_ver_date); - exit(0); - } - - check_mount(); - - if (!preen && !nflag && !yflag) { - if (!isatty (0) || !isatty (1)) - die ("need terminal for interactive repairs"); - } - superblock = use_superblock; -restart: -#if 1 - io_ptr = unix_io_manager; -#else - io_ptr = test_io_manager; - test_io_backing_manager = unix_io_manager; -#endif - sync_disks(); - if (superblock && blocksize) { - retval = ext2fs_open(filesystem_name, - rwflag ? EXT2_FLAG_RW : 0, - superblock, blocksize, io_ptr, &fs); - } else if (superblock) { - for (i=0; possible_block_sizes[i]; i++) { - retval = ext2fs_open(filesystem_name, - rwflag ? EXT2_FLAG_RW : 0, - superblock, - possible_block_sizes[i], - io_ptr, &fs); - if (!retval) - break; - } - } else - retval = ext2fs_open(filesystem_name, - rwflag ? EXT2_FLAG_RW : 0, - 0, 0, io_ptr, &fs); - if (!superblock && !preen && - ((retval == EXT2_ET_BAD_MAGIC) || - ((retval == 0) && ext2fs_check_desc(fs)))) { - if (!fs || (fs->group_desc_count > 1)) { - printf("%s trying backup blocks...\n", - retval ? "Couldn't find ext2 superblock," : - "Group descriptors look bad..."); - superblock = get_backup_sb(fs); - if (fs) - ext2fs_close(fs); - goto restart; - } - } - if (retval) { - com_err(program_name, retval, "while trying to open %s", - filesystem_name); - if (retval == EXT2_ET_REV_TOO_HIGH) - printf ("Get a newer version of e2fsck!\n"); - else if (retval == EXT2_ET_SHORT_READ) - printf ("Could this be a zero-length partition?\n"); - else if ((retval == EPERM) || (retval == EACCES)) - printf("You must have %s access to the " - "filesystem or be root\n", - rwflag ? "r/w" : "r/o"); - else if (retval == ENXIO) - printf("Possibly non-existent or swap device?\n"); - else - printf(corrupt_msg, get_backup_sb(fs)); - fatal_error(0); - } -#ifdef EXT2_CURRENT_REV - if (fs->super->s_rev_level > E2FSCK_CURRENT_REV) { - com_err(program_name, EXT2_ET_REV_TOO_HIGH, - "while trying to open %s", - filesystem_name); - goto get_newer; - } -#endif - /* - * Check for compatibility with the feature sets. We need to - * be more stringent than ext2fs_open(). - */ - s = (struct ext2fs_sb *) fs->super; - if ((s->s_feature_compat & ~EXT2_LIB_FEATURE_COMPAT_SUPP) || - (s->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP)) { - com_err(program_name, EXT2_ET_UNSUPP_FEATURE, - "(%s)", filesystem_name); - get_newer: - printf ("Get a newer version of e2fsck!\n"); - fatal_error(0); - } - if (s->s_feature_ro_compat & ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP) { - com_err(program_name, EXT2_ET_RO_UNSUPP_FEATURE, - "(%s)", filesystem_name); - goto get_newer; - } - - /* - * If the user specified a specific superblock, presumably the - * master superblock has been trashed. So we mark the - * superblock as dirty, so it can be written out. - */ - if (superblock && rwflag) - ext2fs_mark_super_dirty(fs); - - /* - * Don't overwrite the backup superblock and block - * descriptors, until we're sure the filesystem is OK.... - */ - fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; - - ehandler_init(fs->io); - - invalid_inode_bitmap = allocate_memory(sizeof(int) * - fs->group_desc_count, - "invalid_inode_bitmap"); - invalid_block_bitmap = allocate_memory(sizeof(int) * - fs->group_desc_count, - "invalid_block_bitmap"); - invalid_inode_table = allocate_memory(sizeof(int) * - fs->group_desc_count, - "invalid_inode_table"); - - check_super_block(fs); - check_if_skip(fs); - if (bad_blocks_file) - read_bad_blocks_file(fs, bad_blocks_file, replace_bad_blocks); - else if (cflag) - test_disk(fs); - - if (normalize_swapfs) { - if ((fs->flags & EXT2_FLAG_SWAP_BYTES) == - ext2fs_native_flag()) { - fprintf(stderr, "%s: Filesystem byte order " - "already normalized.\n", device_name); - fatal_error(0); - } - } - if (swapfs) - swap_filesys(fs); - - /* - * Mark the system as valid, 'til proven otherwise - */ - ext2fs_mark_valid(fs); - - retval = ext2fs_read_bb_inode(fs, &fs->badblocks); - if (retval) { - com_err(program_name, retval, - "while reading bad blocks inode"); - preenhalt(fs); - printf("This doesn't bode well, but we'll try to go on...\n"); - } - - 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"); - restart_e2fsck = 0; - superblock = use_superblock; - goto restart; - } - pass2(fs); - pass3(fs); - pass4(fs); - pass5(fs); - -#ifdef MTRACE - mtrace_print("Cleanup"); -#endif - if (ext2fs_test_changed(fs)) { - exit_value = FSCK_NONDESTRUCT; - if (!preen) - printf("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n", - device_name); - if (root_filesystem && !read_only_root) { - printf("%s: ***** REBOOT LINUX *****\n", device_name); - exit_value = FSCK_REBOOT; - } - } - if (ext2fs_test_valid(fs)) - fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; - else - exit_value = FSCK_UNCORRECTED; - if (rwflag) { - if (ext2fs_test_valid(fs)) { - if (!(fs->super->s_state & EXT2_VALID_FS)) - exit_value = FSCK_NONDESTRUCT; - fs->super->s_state = EXT2_VALID_FS; - } else - fs->super->s_state &= ~EXT2_VALID_FS; - fs->super->s_mnt_count = 0; - fs->super->s_lastcheck = time(NULL); - ext2fs_mark_super_dirty(fs); - } - show_stats(fs); - - write_bitmaps(fs); - ext2fs_close(fs); - sync_disks(); - - if (tflag) - print_resource_track(&global_rtrack); - - return exit_value; -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.h b/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.h deleted file mode 100644 index 9efefa36cb3..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/e2fsck.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * e2fsck.h - * - * Copyright (C) 1993, 1994 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 <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" - -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - -/* - * Exit codes used by fsck-type programs - */ -#define FSCK_OK 0 /* No errors */ -#define FSCK_NONDESTRUCT 1 /* File system errors corrected */ -#define FSCK_REBOOT 2 /* System should be rebooted */ -#define FSCK_UNCORRECTED 4 /* File system errors left uncorrected */ -#define FSCK_ERROR 8 /* Operational error */ -#define FSCK_USAGE 16 /* Usage or syntax error */ -#define FSCK_LIBRARY 128 /* Shared library error */ - -/* - * The last ext2fs revision level that this version of e2fsck is able to - * support - */ -#define E2FSCK_CURRENT_REV 1 - -/* - * Inode count arrays - */ -extern ext2_icount_t inode_count; -extern ext2_icount_t inode_link_info; - -/* - * The directory information structure; stores directory information - * collected in earlier passes, to avoid disk i/o in fetching the - * directory information. - */ -struct dir_info { - ino_t ino; /* Inode number */ - ino_t dotdot; /* Parent according to '..' */ - ino_t parent; /* Parent according to treewalk */ -}; - -/* - * This structure is used for keeping track of how much resources have - * been used for a particular pass of e2fsck. - */ -struct resource_track { - struct timeval time_start; - struct timeval user_start; - struct timeval system_start; - void *brk_start; -}; - -/* - * Variables - */ -extern const char * program_name; -extern const char * device_name; - -extern ext2fs_inode_bitmap inode_used_map; /* Inodes which are in use */ -extern ext2fs_inode_bitmap inode_bad_map; /* Inodes which are bad somehow */ -extern ext2fs_inode_bitmap inode_dir_map; /* Inodes which are directories */ -extern ext2fs_inode_bitmap inode_bb_map; /* Inodes which are in bad blocks */ - -extern ext2fs_block_bitmap block_found_map; /* Blocks which are in use */ -extern ext2fs_block_bitmap block_dup_map; /* Blocks which are used by more than once */ -extern ext2fs_block_bitmap block_illegal_map; /* Meta-data blocks */ - -extern const char *fix_msg[2]; /* Fixed or ignored! */ -extern const char *clear_msg[2]; /* Cleared or ignored! */ - -extern int *invalid_inode_bitmap; -extern int *invalid_block_bitmap; -extern int *invalid_inode_table; -extern int restart_e2fsck; - -/* Command line options */ -extern int nflag; -extern int yflag; -extern int tflag; -extern int preen; -extern int verbose; -extern int list; -extern int debug; -extern int force; - -extern int rwflag; - -extern int inode_buffer_blocks; -extern int process_inode_size; -extern int directory_blocks; - -extern int no_bad_inode; -extern int no_lpf; -extern int lpf_corrupted; - -/* Files counts */ -extern int fs_directory_count; -extern int fs_regular_count; -extern int fs_blockdev_count; -extern int fs_chardev_count; -extern int fs_links_count; -extern int fs_symlinks_count; -extern int fs_fast_symlinks_count; -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 int fs_fragmented; - -extern struct resource_track global_rtrack; - -extern int invalid_bitmaps; - -/* - * For pass1_check_directory and pass1_get_blocks - */ -extern ino_t stashed_ino; -extern struct ext2_inode *stashed_inode; - -/* - * Procedure declarations - */ - -extern void pass1(ext2_filsys fs); -extern void pass1_dupblocks(ext2_filsys fs, char *block_buf); -extern void pass2(ext2_filsys fs); -extern void pass3(ext2_filsys fs); -extern void pass4(ext2_filsys fs); -extern void pass5(ext2_filsys fs); - -/* pass1.c */ -extern errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino); -extern errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks); -extern errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino, - struct ext2_inode *inode); -extern errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino, - struct ext2_inode *inode); - -/* badblock.c */ -extern void read_bad_blocks_file(ext2_filsys fs, const char *bad_blocks_file, - int replace_bad_blocks); -extern void test_disk(ext2_filsys fs); - -/* dirinfo.c */ -extern void add_dir_info(ext2_filsys fs, ino_t ino, ino_t parent); -extern struct dir_info *get_dir_info(ino_t ino); -extern void free_dir_info(ext2_filsys fs); -extern int get_num_dirs(ext2_filsys fs); -extern struct dir_info *dir_info_iter(int *control); - -/* ehandler.c */ -extern const char *ehandler_operation(const char *op); -extern void ehandler_init(io_channel channel); - -/* swapfs.c */ -void swap_filesys(ext2_filsys fs); - -/* util.c */ -extern void *allocate_memory(int size, const char *description); -extern int ask(const char * string, int def); -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(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); -extern void e2fsck_read_inode(ext2_filsys fs, unsigned long ino, - struct ext2_inode * inode, const char * proc); -extern void e2fsck_write_inode(ext2_filsys fs, unsigned long ino, - struct ext2_inode * inode, const char * proc); -#ifdef MTRACE -extern void mtrace_print(char *mesg); -#endif - -#define die(str) fatal_error(str) - -/* - * pass3.c - */ -extern int reconnect_file(ext2_filsys fs, ino_t inode); diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/ehandler.c b/gnu/usr.sbin/e2fsprogs/e2fsck/ehandler.c deleted file mode 100644 index 131a0abb841..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/ehandler.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * ehandler.c --- handle bad block errors which come up during the - * course of an e2fsck session. - * - * Copyright (C) 1994 Theodore Ts'o. This file may be redistributed - * under the terms of the GNU Public License. - */ - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <ctype.h> -#include <termios.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, - unsigned long block, - int count, - void *data, - size_t size, - int actual, - errcode_t error) -{ - int i; - char *p; - - /* - * If more than one block was read, try reading each block - * separately. We could use the actual bytes read to figure - * out where to start, but we don't bother. - */ - if (count > 1) { - p = (char *) data; - for (i=0; i < count; i++, p += channel->block_size, block++) { - error = io_channel_read_blk(channel, block, - 1, p); - if (error) - return error; - } - return 0; - } - if (operation) - printf("Error reading block %lu (%s) while %s. ", block, - error_message(error), operation); - else - printf("Error reading block %lu (%s). ", block, - error_message(error)); - preenhalt(NULL); - if (ask("Ignore error", 1)) - return 0; - - return error; -} - -static errcode_t e2fsck_handle_write_error(io_channel channel, - unsigned long block, - int count, - const void *data, - size_t size, - int actual, - errcode_t error) -{ - int i; - const char *p; - - /* - * If more than one block was written, try writing each block - * separately. We could use the actual bytes read to figure - * out where to start, but we don't bother. - */ - if (count > 1) { - p = (const char *) data; - for (i=0; i < count; i++, p += channel->block_size, block++) { - error = io_channel_write_blk(channel, block, - 1, p); - if (error) - return error; - } - return 0; - } - - if (operation) - printf("Error writing block %lu (%s) while %s. ", block, - error_message(error), operation); - else - printf("Error writing block %lu (%s). ", block, - error_message(error)); - preenhalt(NULL); - if (ask("Ignore error", 1)) - return 0; - - return error; -} - -const char *ehandler_operation(const char *op) -{ - const char *ret = operation; - - operation = op; - return ret; -} - -void ehandler_init(io_channel channel) -{ - channel->read_error = e2fsck_handle_read_error; - channel->write_error = e2fsck_handle_write_error; -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/extend.c b/gnu/usr.sbin/e2fsprogs/e2fsck/extend.c deleted file mode 100644 index 646348d4a2a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/extend.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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); -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/flushb.c b/gnu/usr.sbin/e2fsprogs/e2fsck/flushb.c deleted file mode 100644 index 20b9917db73..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/flushb.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * flushb.c --- This routine flushes the disk buffers for a disk - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#include <fcntl.h> -#include <sys/ioctl.h> - -#ifdef HAVE_LINUX_FS_H -#include <linux/fs.h> -#endif - -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - -const char *progname; - -static void usage(NOARGS) -{ - fprintf(stderr, "Usage: %s disk\n", progname); - exit(1); -} - -int main(int argc, char **argv) -{ - int fd; - - progname = argv[0]; - if (argc != 2) - usage(); - - fd = open(argv[1], O_RDONLY, 0); - if (fd < 0) { - perror("open"); - exit(1); - } - /* - * Note: to reread the partition table, use the ioctl - * BLKRRPART instead of BLKFSLBUF. - */ -#ifdef BLKFLSBUF - if (ioctl(fd, BLKFLSBUF, 0) < 0) { - 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/gnu/usr.sbin/e2fsprogs/e2fsck/iscan.c b/gnu/usr.sbin/e2fsprogs/e2fsck/iscan.c deleted file mode 100644 index d964b344b23..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/iscan.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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); -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/malloc.h b/gnu/usr.sbin/e2fsprogs/e2fsck/malloc.h deleted file mode 100644 index 3e46718e476..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/malloc.h +++ /dev/null @@ -1,231 +0,0 @@ -/* Declarations for `malloc' and friends. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Written May 1989 by Mike Haertel. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. */ - -#ifndef _MALLOC_H - -#define _MALLOC_H 1 - -#ifdef __cplusplus -extern "C" -{ -#endif - -#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) -#undef __P -#define __P(args) args -#undef __ptr_t -#define __ptr_t void * -#else /* Not C++ or ANSI C. */ -#undef __P -#define __P(args) () -#undef const -#define const -#undef __ptr_t -#define __ptr_t char * -#endif /* C++ or ANSI C. */ - -#ifndef NULL -#define NULL 0 -#endif - -#ifdef __STDC__ -#include <stddef.h> -#else -#undef size_t -#define size_t unsigned int -#undef ptrdiff_t -#define ptrdiff_t int -#endif - - -/* Allocate SIZE bytes of memory. */ -extern __ptr_t malloc __P ((size_t __size)); -/* Re-allocate the previously allocated block - in __ptr_t, making the new block SIZE bytes long. */ -extern __ptr_t realloc __P ((__ptr_t __ptr, size_t __size)); -/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ -extern __ptr_t calloc __P ((size_t __nmemb, size_t __size)); -/* Free a block allocated by `malloc', `realloc' or `calloc'. */ -extern void free __P ((__ptr_t __ptr)); - -/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ -extern __ptr_t memalign __P ((size_t __alignment, size_t __size)); - -/* Allocate SIZE bytes on a page boundary. */ -extern __ptr_t valloc __P ((size_t __size)); - - -#ifdef _MALLOC_INTERNAL - -#include <stdio.h> /* Harmless, gets __GNU_LIBRARY__ defined. */ - -#if defined(__GNU_LIBRARY__) || defined(STDC_HEADERS) || defined(USG) -#include <string.h> -#else -#ifndef memset -#define memset(s, zero, n) bzero ((s), (n)) -#endif -#ifndef memcpy -#define memcpy(d, s, n) bcopy ((s), (d), (n)) -#endif -#endif - - -#if defined(__GNU_LIBRARY__) || defined(__STDC__) -#include <limits.h> -#else -#define CHAR_BIT 8 -#endif - -/* The allocator divides the heap into blocks of fixed size; large - requests receive one or more whole blocks, and small requests - receive a fragment of a block. Fragment sizes are powers of two, - and all fragments of a block are the same size. When all the - fragments in a block have been freed, the block itself is freed. */ -#define INT_BIT (CHAR_BIT * sizeof(int)) -#define BLOCKLOG (INT_BIT > 16 ? 12 : 9) -#define BLOCKSIZE (1 << BLOCKLOG) -#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE) - -/* Determine the amount of memory spanned by the initial heap table - (not an absolute limit). */ -#define HEAP (INT_BIT > 16 ? 4194304 : 65536) - -/* Number of contiguous free blocks allowed to build up at the end of - memory before they will be returned to the system. */ -#define FINAL_FREE_BLOCKS 8 - -/* Data structure giving per-block information. */ -typedef union - { - /* Heap information for a busy block. */ - struct - { - /* Zero for a large block, or positive giving the - logarithm to the base two of the fragment size. */ - int type; - union - { - struct - { - size_t nfree; /* Free fragments in a fragmented block. */ - size_t first; /* First free fragment of the block. */ - } frag; - /* Size (in blocks) of a large cluster. */ - size_t size; - } info; - } busy; - /* Heap information for a free block - (that may be the first of a free cluster). */ - struct - { - size_t size; /* Size (in blocks) of a free cluster. */ - size_t next; /* Index of next free cluster. */ - size_t prev; /* Index of previous free cluster. */ - } free; - } malloc_info; - -/* Pointer to first block of the heap. */ -extern char *_heapbase; - -/* Table indexed by block number giving per-block information. */ -extern malloc_info *_heapinfo; - -/* Address to block number and vice versa. */ -#define BLOCK(A) (((char *) (A) - _heapbase) / BLOCKSIZE + 1) -#define ADDRESS(B) ((__ptr_t) (((B) - 1) * BLOCKSIZE + _heapbase)) - -/* Current search index for the heap table. */ -extern size_t _heapindex; - -/* Limit of valid info table indices. */ -extern size_t _heaplimit; - -/* Doubly linked lists of free fragments. */ -struct list - { - struct list *next; - struct list *prev; - }; - -/* Free list headers for each fragment size. */ -extern struct list _fraghead[]; - -/* List of blocks allocated with `memalign' (or `valloc'). */ -struct alignlist - { - struct alignlist *next; - __ptr_t aligned; /* The address that memaligned returned. */ - __ptr_t exact; /* The address that malloc returned. */ - }; -extern struct alignlist *_aligned_blocks; - -/* Instrumentation. */ -extern size_t _chunks_used; -extern size_t _bytes_used; -extern size_t _chunks_free; -extern size_t _bytes_free; - -/* Internal version of `free' used in `morecore' (malloc.c). */ -extern void _free_internal __P ((__ptr_t __ptr)); - -#endif /* _MALLOC_INTERNAL. */ - -/* Underlying allocation function; successive calls should - return contiguous pieces of memory. */ -extern __ptr_t (*__morecore) __P ((ptrdiff_t __size)); - -/* Default value of `__morecore'. */ -extern __ptr_t __default_morecore __P ((ptrdiff_t __size)); - -/* Nonzero if `malloc' has been called and done its initialization. */ -extern int __malloc_initialized; - -/* Hooks for debugging versions. */ -extern void (*__free_hook) __P ((__ptr_t __ptr)); -extern __ptr_t (*__malloc_hook) __P ((size_t __size)); -extern __ptr_t (*__realloc_hook) __P ((__ptr_t __ptr, size_t __size)); - -/* Activate a standard collection of debugging hooks. */ -extern void mcheck __P ((void (*__func) __P ((void)))); - -/* Activate a standard collection of tracing hooks. */ -extern void mtrace __P ((void)); - -/* Statistics available to the user. */ -struct mstats - { - size_t bytes_total; /* Total size of the heap. */ - size_t chunks_used; /* Chunks allocated by the user. */ - size_t bytes_used; /* Byte total of user-allocated chunks. */ - size_t chunks_free; /* Chunks in the free list. */ - size_t bytes_free; /* Byte total of chunks in the free list. */ - }; - -/* Pick up the current statistics. */ -extern struct mstats mstats __P ((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* malloc.h */ diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/message.c b/gnu/usr.sbin/e2fsprogs/e2fsck/message.c deleted file mode 100644 index c5f2593835b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/message.c +++ /dev/null @@ -1,329 +0,0 @@ -/* - * message.c --- print e2fsck messages (with compression) - * - * Copyright 1996, 1997 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * print_e2fsck_message() prints a message to the user, using - * compression techniques and expansions of abbreviations. - * - * The following % expansions are supported: - * - * %b <blk> block number - * %B <blkcount> integer - * %di <dirent>->ino inode number - * %dn <dirent>->name string - * %D <dir> inode number - * %g <group> integer - * %i <ino> inode number - * %Is <inode> -> i_size - * %Ib <inode> -> i_blocks - * %Il <inode> -> i_links_count - * %Im <inode> -> i_mode - * %IM <inode> -> i_mtime - * %IF <inode> -> i_faddr - * %If <inode> -> i_file_acl - * %Id <inode> -> i_dir_acl - * %j <ino2> inode number - * %N <num> - * %p ext2fs_get_pathname of directory <ino> - * %P ext2fs_get_pathname of <dirent>->ino with <ino2> as - * the containing directory. (If dirent is NULL - * then return the pathname of directory <ino2>) - * %q ext2fs_get_pathname of directory <dir> - * %Q ext2fs_get_pathname of directory <ino> with <dir> as - * the containing directory. - * - * The following '@' expansions are supported: - * - * @b block - * @B bitmap - * @C conflicts with some other fs block - * @i inode - * @D deleted - * @d directory - * @e entry - * @E Entry '%Dn' in %p (%i) - * @F for @i %i (%Q) is - * @g group - * @l lost+found - * @L is a link - * @u unattached - * @r root inode - * @z zero-length - */ - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <ctype.h> -#include <termios.h> - -#include "e2fsck.h" - -#include "problem.h" - -#ifdef __GNUC__ -#define _INLINE_ __inline__ -#else -#define _INLINE_ -#endif - -/* - * This structure defines the abbreviations used by the text strings - * below. The first character in the string is the index letter. An - * abbreviation of the form '@<i>' is expanded by looking up the index - * letter <i> in the table below. - */ -static const char *abbrevs[] = { - "bblock", - "Bbitmap", - "Cconflicts with some other fs @b", - "iinode", - "Ddeleted", - "ddirectory", - "eentry", - "E@e '%Dn' in %p (%i)", - "Ffor @i %i (%Q) is", - "ggroup", - "llost+found", - "Lis a link", - "uunattached", - "rroot @i", - "sshould be", - "zzero-length", - "@@", - 0 - }; - -/* - * Give more user friendly names to the "special" inodes. - */ -#define num_special_inodes 7 -static const char *special_inode_name[] = -{ - "<The NULL inode>", /* 0 */ - "<The bad blocks inode>", /* 1 */ - "/", /* 2 */ - "<The ACL index inode>", /* 3 */ - "<The ACL data inode>", /* 4 */ - "<The boot loader inode>", /* 5 */ - "<The undelete directory inode>" /* 6 */ -}; - -/* - * This function prints a pathname, using the ext2fs_get_pathname - * function - */ -static void print_pathname(ext2_filsys fs, ino_t dir, ino_t ino) -{ - errcode_t retval; - char *path; - - if (!dir && (ino < num_special_inodes)) { - fputs(special_inode_name[ino], stdout); - return; - } - - retval = ext2fs_get_pathname(fs, dir, ino, &path); - if (retval) - fputs("???", stdout); - else { - fputs(path, stdout); - free(path); - } -} - -/* - * This function handles the '@' expansion. We allow recursive - * expansion; an @ expression can contain further '@' and '%' - * expressions. - */ -static _INLINE_ void expand_at_expression(ext2_filsys fs, char ch, - struct problem_context *ctx, - int *first) -{ - const char **cpp, *str; - - /* Search for the abbreviation */ - for (cpp = abbrevs; *cpp; cpp++) { - if (ch == *cpp[0]) - break; - } - if (*cpp) { - str = (*cpp) + 1; - if (*first && islower(*str)) { - *first = 0; - fputc(toupper(*str++), stdout); - } - print_e2fsck_message(fs, str, ctx, *first); - } else - printf("@%c", ch); -} - -/* - * This function expands '%kX' expressions - */ -static _INLINE_ void expand_inode_expression(char ch, - struct problem_context *ctx) -{ - struct ext2_inode *inode; - char * time_str; - time_t t; - - if (!ctx || !ctx->inode) - goto no_inode; - - inode = ctx->inode; - - switch (ch) { - case 's': - printf("%u", inode->i_size); - break; - case 'b': - printf("%u", inode->i_blocks); - break; - case 'l': - printf("%d", inode->i_links_count); - break; - case 'm': - printf("0%o", inode->i_mode); - break; - case 'M': - t = inode->i_mtime; - time_str = ctime(&t); - printf("%.24s", time_str); - break; - case 'F': - printf("%u", inode->i_faddr); - break; - case 'f': - printf("%u", inode->i_file_acl); - break; - case 'd': - printf("%u", inode->i_dir_acl); - break; - default: - no_inode: - printf("%%I%c", ch); - break; - } -} - -/* - * This function expands '%dX' expressions - */ -static _INLINE_ void expand_dirent_expression(char ch, - struct problem_context *ctx) -{ - struct ext2_dir_entry *dirent; - int len; - - if (!ctx || !ctx->dirent) - goto no_dirent; - - dirent = ctx->dirent; - - switch (ch) { - case 'i': - printf("%u", dirent->inode); - break; - case 'n': - len = dirent->name_len; - if (len > EXT2_NAME_LEN) - len = EXT2_NAME_LEN; - if (len > dirent->rec_len) - len = dirent->rec_len; - printf("%.*s", dirent->name_len, dirent->name); - break; - default: - no_dirent: - printf("%%D%c", ch); - break; - } -} - -static _INLINE_ void expand_percent_expression(ext2_filsys fs, char ch, - struct problem_context *ctx) -{ - if (!ctx) - goto no_context; - - switch (ch) { - case '%': - fputc('%', stdout); - break; - case 'b': - printf("%u", ctx->blk); - break; - case 'B': - printf("%d", ctx->blkcount); - break; - case 'd': - printf("%lu", ctx->dir); - break; - case 'g': - printf("%d", ctx->group); - break; - case 'i': - printf("%lu", ctx->ino); - break; - case 'j': - printf("%lu", ctx->ino2); - break; - case 'N': - printf("%u", ctx->num); - break; - case 'p': - print_pathname(fs, ctx->ino, 0); - break; - case 'P': - print_pathname(fs, ctx->ino2, - ctx->dirent ? ctx->dirent->inode : 0); - break; - case 'q': - print_pathname(fs, ctx->dir, 0); - break; - case 'Q': - print_pathname(fs, ctx->dir, ctx->ino); - break; - default: - no_context: - printf("%%%c", ch); - break; - } -} - -void print_e2fsck_message(ext2_filsys fs, const char *msg, - struct problem_context *ctx, int first) -{ - const char * cp; - int i; - - for (cp = msg; *cp; cp++) { - if (cp[0] == '@') { - cp++; - expand_at_expression(fs, *cp, ctx, &first); - } else if (cp[0] == '%' && cp[1] == 'I') { - cp += 2; - expand_inode_expression(*cp, ctx); - } else if (cp[0] == '%' && cp[1] == 'D') { - cp += 2; - expand_dirent_expression(*cp, ctx); - } else if ((cp[0] == '%')) { - cp++; - expand_percent_expression(fs, *cp, ctx); - } else { - for (i=0; cp[i]; i++) - if ((cp[i] == '@') || cp[i] == '%') - break; - printf("%.*s", i, cp); - cp += i-1; - } - first = 0; - } -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/mtrace.awk b/gnu/usr.sbin/e2fsprogs/e2fsck/mtrace.awk deleted file mode 100644 index 7e96b8ace28..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/mtrace.awk +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/awk -f -# -# Awk program to analyze mtrace.c output. -# -$1 == "+" { if (allocated[$2] != "") - print "+", $2, "Alloc", NR, "duplicate:", allocated[$2]; - else - allocated[$2] = $3; - } -$1 == "-" { if (allocated[$2] != "") { - allocated[$2] = ""; - if (allocated[$2] != "") - print "DELETE FAILED", $2, allocated[$2]; - } else - print "-", $2, "Free", NR, "was never alloc'd"; - } -$1 == "<" { if (allocated[$2] != "") - allocated[$2] = ""; - else - print "-", $2, "Realloc", NR, "was never alloc'd"; - } -$1 == ">" { if (allocated[$2] != "") - print "+", $2, "Realloc", NR, "duplicate:", allocated[$2]; - else - allocated[$2] = $3; - } - -# Ignore "= Start" -$1 == "=" { } -# Ignore failed realloc attempts for now -$1 == "!" { } - - -END { for (x in allocated) - if (allocated[x] != "") - print "+", x, allocated[x]; - } diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/mtrace.c b/gnu/usr.sbin/e2fsprogs/e2fsck/mtrace.c deleted file mode 100644 index 8553a64b884..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/mtrace.c +++ /dev/null @@ -1,158 +0,0 @@ -/* More debugging hooks for `malloc'. - Copyright (C) 1991, 1992 Free Software Foundation, Inc. - Written April 2, 1991 by John Gilmore of Cygnus Support. - Based on mcheck.c by Mike Haertel. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This library 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. */ - -#ifndef _MALLOC_INTERNAL -#define _MALLOC_INTERNAL -#include "./malloc.h" -#endif - -#include <stdio.h> - -#ifndef __GNU_LIBRARY__ -extern char *getenv (); -#else -#include <stdlib.h> -#endif - -static FILE *mallstream; -static char mallenv[]= "MALLOC_TRACE"; -static char mallbuf[BUFSIZ]; /* Buffer for the output. */ - -/* Address to breakpoint on accesses to... */ -__ptr_t mallwatch; - -/* Old hook values. */ -static void (*tr_old_free_hook) __P ((__ptr_t ptr)); -static __ptr_t (*tr_old_malloc_hook) __P ((size_t size)); -static __ptr_t (*tr_old_realloc_hook) __P ((__ptr_t ptr, size_t size)); - -/* - * Added by TYT, 10/10/93 --- so that we can print - */ -FILE *malloc_get_mallstream() -{ - return mallstream; -} - -/* This function is called when the block being alloc'd, realloc'd, or - freed has an address matching the variable "mallwatch". In a debugger, - set "mallwatch" to the address of interest, then put a breakpoint on - tr_break. */ - -void tr_break __P ((void)); -void -tr_break () -{ -} - -static void tr_freehook __P ((__ptr_t)); -static void -tr_freehook (ptr) - __ptr_t ptr; -{ - fprintf (mallstream, "- %p\n", ptr); /* Be sure to print it first. */ - if (ptr == mallwatch) - tr_break (); - __free_hook = tr_old_free_hook; - free (ptr); - __free_hook = tr_freehook; -} - -static __ptr_t tr_mallochook __P ((size_t)); -static __ptr_t -tr_mallochook (size) - size_t size; -{ - __ptr_t hdr; - - __malloc_hook = tr_old_malloc_hook; - hdr = (__ptr_t) malloc (size); - __malloc_hook = tr_mallochook; - - /* We could be printing a NULL here; that's OK. */ - fprintf (mallstream, "+ %p %d\n", hdr, size); - - if (hdr == mallwatch) - tr_break (); - - return hdr; -} - -static __ptr_t tr_reallochook __P ((__ptr_t, size_t)); -static __ptr_t -tr_reallochook (ptr, size) - __ptr_t ptr; - size_t size; -{ - __ptr_t hdr; - - if (ptr == mallwatch) - tr_break (); - - __free_hook = tr_old_free_hook; - __malloc_hook = tr_old_malloc_hook; - __realloc_hook = tr_old_realloc_hook; - hdr = (__ptr_t) realloc (ptr, size); - __free_hook = tr_freehook; - __malloc_hook = tr_mallochook; - __realloc_hook = tr_reallochook; - if (hdr == NULL) - /* Failed realloc. */ - fprintf (mallstream, "! %p %d\n", ptr, size); - else - fprintf (mallstream, "< %p\n> %p %d\n", ptr, hdr, size); - - if (hdr == mallwatch) - tr_break (); - - return hdr; -} - -/* We enable tracing if either the environment variable MALLOC_TRACE - is set, or if the variable mallwatch has been patched to an address - that the debugging user wants us to stop on. When patching mallwatch, - don't forget to set a breakpoint on tr_break! */ - -void -mtrace () -{ - char *mallfile; - - mallfile = getenv (mallenv); - if (mallfile != NULL || mallwatch != NULL) - { - mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "w"); - if (mallstream != NULL) - { - /* Be sure it doesn't malloc its buffer! */ - setbuf (mallstream, mallbuf); - fprintf (mallstream, "= Start\n"); - tr_old_free_hook = __free_hook; - __free_hook = tr_freehook; - tr_old_malloc_hook = __malloc_hook; - __malloc_hook = tr_mallochook; - tr_old_realloc_hook = __realloc_hook; - __realloc_hook = tr_reallochook; - } - } -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/pass1.c b/gnu/usr.sbin/e2fsprogs/e2fsck/pass1.c deleted file mode 100644 index 2c760a9c2df..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/pass1.c +++ /dev/null @@ -1,1257 +0,0 @@ -/* - * pass1.c -- pass #1 of e2fsck: sequential scan of the inode table - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * Pass 1 of e2fsck iterates over all the inodes in the filesystems, - * and applies the following tests to each inode: - * - * - The mode field of the inode must be legal. - * - The size and block count fields of the inode are correct. - * - A data block must not be used by another inode - * - * Pass 1 also gathers the collects the following information: - * - * - A bitmap of which inodes are in use. (inode_used_map) - * - A bitmap of which inodes are directories. (inode_dir_map) - * - A bitmap of which inodes have bad fields. (inode_bad_map) - * - A bitmap of which inodes are in bad blocks. (inode_bb_map) - * - A bitmap of which blocks are in use. (block_found_map) - * - A bitmap of which blocks are in use by two inodes (block_dup_map) - * - The data blocks of the directory inodes. (dir_map) - * - * Pass 1 is designed to stash away enough information so that the - * other passes should not need to read in the inode information - * during the normal course of a filesystem check. (Althogh if an - * inconsistency is detected, other passes may need to read in an - * inode to fix it.) - * - * Note that pass 1B will be invoked if there are any duplicate blocks - * found. - */ - -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <et/com_err.h> -#include "e2fsck.h" -#include "problem.h" - -#ifdef NO_INLINE_FUNCS -#define _INLINE_ -#else -#define _INLINE_ inline -#endif - -/* Files counts */ -int fs_directory_count = 0; -int fs_regular_count = 0; -int fs_blockdev_count = 0; -int fs_chardev_count = 0; -int fs_links_count = 0; -int fs_symlinks_count = 0; -int fs_fast_symlinks_count = 0; -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; -int fs_fragmented = 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 */ -ext2fs_inode_bitmap inode_dir_map = 0; /* Inodes which are directories */ -ext2fs_inode_bitmap inode_bb_map = 0; /* Inodes which are in bad blocks */ - -ext2fs_block_bitmap block_found_map = 0; -ext2fs_block_bitmap block_dup_map = 0; -ext2fs_block_bitmap block_illegal_map = 0; - -ext2_icount_t inode_link_info = 0; - -static int process_block(ext2_filsys fs, blk_t *blocknr, - int blockcnt, blk_t ref_blk, - int ref_offset, void *private); -static int process_bad_block(ext2_filsys fs, blk_t *block_nr, - int blockcnt, blk_t ref_blk, - int ref_offset, void *private); -static void check_blocks(ext2_filsys fs, struct problem_context *pctx, - char *block_buf); -static void mark_table_blocks(ext2_filsys fs); -static void alloc_bad_map(ext2_filsys fs); -static void alloc_bb_map(ext2_filsys fs); -static void handle_fs_bad_blocks(ext2_filsys fs); -static void process_inodes(ext2_filsys fs, char *block_buf); -static int process_inode_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; - int is_dir:1, clear:1, suppress:1, fragmented:1; - int num_blocks; - int last_block; - int num_illegal_blocks; - blk_t previous_block; - struct ext2_inode *inode; - struct problem_context *pctx; -}; - -struct process_inode_block { - ino_t ino; - struct ext2_inode inode; -}; - -/* - * For pass1_check_directory and pass1_get_blocks - */ -ino_t stashed_ino; -struct ext2_inode *stashed_inode; - -/* - * For the inodes to process list. - */ -static struct process_inode_block *inodes_to_process; -static int process_inode_count; -int process_inode_size = 256; - -/* - * Free all memory allocated by pass1 in preparation for restarting - * things. - */ -static void unwind_pass1(ext2_filsys fs) -{ - ext2fs_free_inode_bitmap(inode_used_map); inode_used_map = 0; - ext2fs_free_inode_bitmap(inode_dir_map); inode_dir_map = 0; - ext2fs_free_block_bitmap(block_found_map); block_found_map = 0; - ext2fs_free_icount(inode_link_info); inode_link_info = 0; - free(inodes_to_process);inodes_to_process = 0; - ext2fs_free_dblist(fs->dblist); fs->dblist = 0; - free_dir_info(fs); - if (block_dup_map) { - ext2fs_free_block_bitmap(block_dup_map); block_dup_map = 0; - } - if (inode_bb_map) { - ext2fs_free_inode_bitmap(inode_bb_map); inode_bb_map = 0; - } - if (inode_bad_map) { - ext2fs_free_inode_bitmap(inode_bad_map); inode_bad_map = 0; - } - - /* Clear statistic counters */ - fs_directory_count = 0; - fs_regular_count = 0; - fs_blockdev_count = 0; - fs_chardev_count = 0; - fs_links_count = 0; - fs_symlinks_count = 0; - fs_fast_symlinks_count = 0; - fs_fifo_count = 0; - fs_total_count = 0; - fs_badblocks_count = 0; - fs_sockets_count = 0; - fs_ind_count = 0; - fs_dind_count = 0; - fs_tind_count = 0; - fs_fragmented = 0; -} - -void pass1(ext2_filsys fs) -{ - ino_t ino; - struct ext2_inode inode; - ext2_inode_scan scan; - char *block_buf; - errcode_t retval; - struct resource_track rtrack; - unsigned char frag, fsize; - struct problem_context pctx; - - init_resource_track(&rtrack); - - if (!preen) - printf("Pass 1: Checking inodes, blocks, and sizes\n"); - -#ifdef MTRACE - mtrace_print("Pass 1"); -#endif - - /* - * Allocate bitmaps structures - */ - retval = ext2fs_allocate_inode_bitmap(fs, "in-use inode map", - &inode_used_map); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode_used_map"); - fatal_error(0); - } - retval = ext2fs_allocate_inode_bitmap(fs, "directory inode map", - &inode_dir_map); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode_dir_map"); - fatal_error(0); - } - retval = ext2fs_allocate_block_bitmap(fs, "in-use block map", - &block_found_map); - if (retval) { - com_err("ext2fs_allocate_block_bitmap", retval, - "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); - } - retval = ext2fs_create_icount2(fs, 0, 0, 0, &inode_link_info); - if (retval) { - com_err("ext2fs_create_icount", retval, - "while creating inode_link_info"); - fatal_error(0); - } - inodes_to_process = allocate_memory(process_inode_size * - sizeof(struct process_inode_block), - "array of inodes to process"); - process_inode_count = 0; - - retval = ext2fs_init_dblist(fs, 0); - if (retval) { - com_err(program_name, retval, - "while allocating directory block information"); - fatal_error(0); - } - - mark_table_blocks(fs); - block_buf = allocate_memory(fs->blocksize * 3, "block interate buffer"); - fs->get_blocks = pass1_get_blocks; - fs->check_directory = pass1_check_directory; - fs->read_inode = pass1_read_inode; - fs->write_inode = pass1_write_inode; - ehandler_operation("doing inode scan"); - retval = ext2fs_open_inode_scan(fs, inode_buffer_blocks, &scan); - if (retval) { - com_err(program_name, retval, "while opening inode scan"); - fatal_error(0); - } - ext2fs_inode_scan_flags(scan, EXT2_SF_SKIP_MISSING_ITABLE, 0); - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err(program_name, retval, "while starting inode scan"); - fatal_error(0); - } - stashed_inode = &inode; - ext2fs_set_inode_callback(scan, scan_callback, block_buf); - clear_problem_context(&pctx); - while (ino) { - stashed_ino = ino; - if (inode.i_links_count) - retval = ext2fs_icount_store(inode_link_info, ino, - inode.i_links_count); - if (retval) { - com_err("ext2fs_icount_fetch", retval, - "while adding inode %u", ino); - fatal_error(0); - } - pctx.ino = ino; - pctx.inode = &inode; - if (ino == EXT2_BAD_INO) { - struct process_block_struct pb; - - pb.ino = EXT2_BAD_INO; - pb.num_blocks = pb.last_block = 0; - pb.num_illegal_blocks = 0; - pb.suppress = 0; pb.clear = 0; pb.is_dir = 0; - pb.fragmented = 0; - pb.inode = &inode; - pb.pctx = &pctx; - retval = ext2fs_block_iterate2(fs, ino, 0, block_buf, - process_bad_block, &pb); - if (retval) - com_err(program_name, retval, "while calling e2fsc_block_interate in pass 1"); - - ext2fs_mark_inode_bitmap(inode_used_map, ino); - clear_problem_context(&pctx); - goto next; - } - if (ino == EXT2_ROOT_INO) { - /* - * Make sure the root inode is a directory; if - * not, offer to clear it. It will be - * regnerated in pass #3. - */ - if (!LINUX_S_ISDIR(inode.i_mode)) { - if (fix_problem(fs, PR_1_ROOT_NO_DIR, &pctx)) { - inode.i_dtime = time(0); - inode.i_links_count = 0; - ext2fs_icount_store(inode_link_info, - ino, 0); - e2fsck_write_inode(fs, ino, &inode, - "pass1"); - } - } - /* - * If dtime is set, offer to clear it. mke2fs - * version 0.2b created filesystems with the - * dtime field set for the root and lost+found - * directories. We won't worry about - * /lost+found, since that can be regenerated - * easily. But we will fix the root directory - * as a special case. - */ - if (inode.i_dtime && inode.i_links_count) { - if (fix_problem(fs, PR_1_ROOT_DTIME, &pctx)) { - inode.i_dtime = 0; - e2fsck_write_inode(fs, ino, &inode, - "pass1"); - } - } - } - if (ino == EXT2_BOOT_LOADER_INO) { - ext2fs_mark_inode_bitmap(inode_used_map, ino); - check_blocks(fs, &pctx, block_buf); - goto next; - } - if ((ino != EXT2_ROOT_INO) && - (ino < EXT2_FIRST_INODE(fs->super))) { - ext2fs_mark_inode_bitmap(inode_used_map, ino); - if (inode.i_mode != 0) { - if (fix_problem(fs, - PR_1_RESERVED_BAD_MODE, &pctx)) { - inode.i_mode = 0; - e2fsck_write_inode(fs, ino, &inode, - "pass1"); - } - } - check_blocks(fs, &pctx, block_buf); - goto next; - } - /* - * This code assumes that deleted inodes have - * i_links_count set to 0. - */ - if (!inode.i_links_count) { - if (!inode.i_dtime && inode.i_mode) { - if (fix_problem(fs, - PR_1_ZERO_DTIME, &pctx)) { - inode.i_dtime = time(0); - e2fsck_write_inode(fs, ino, &inode, - "pass1"); - } - } - goto next; - } - /* - * n.b. 0.3c ext2fs code didn't clear i_links_count for - * deleted files. Oops. - * - * Since all new ext2 implementations get this right, - * we now assume that the case of non-zero - * i_links_count and non-zero dtime means that we - * should keep the file, not delete it. - * - */ - if (inode.i_dtime) { - if (fix_problem(fs, PR_1_SET_DTIME, &pctx)) { - inode.i_dtime = 0; - e2fsck_write_inode(fs, ino, &inode, "pass1"); - } - } - - ext2fs_mark_inode_bitmap(inode_used_map, ino); - switch (fs->super->s_creator_os) { - case EXT2_OS_LINUX: - frag = inode.osd2.linux2.l_i_frag; - fsize = inode.osd2.linux2.l_i_fsize; - break; - case EXT2_OS_HURD: - frag = inode.osd2.hurd2.h_i_frag; - fsize = inode.osd2.hurd2.h_i_fsize; - break; - case EXT2_OS_MASIX: - frag = inode.osd2.masix2.m_i_frag; - fsize = inode.osd2.masix2.m_i_fsize; - break; - default: - frag = fsize = 0; - } - - if (inode.i_faddr || frag || fsize - || 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 (LINUX_S_ISDIR(inode.i_mode)) { - ext2fs_mark_inode_bitmap(inode_dir_map, ino); - add_dir_info(fs, ino, 0); - fs_directory_count++; - } else if (LINUX_S_ISREG (inode.i_mode)) - fs_regular_count++; - else if (LINUX_S_ISCHR (inode.i_mode)) - fs_chardev_count++; - else if (LINUX_S_ISBLK (inode.i_mode)) - fs_blockdev_count++; - else if (LINUX_S_ISLNK (inode.i_mode)) { - fs_symlinks_count++; - if (!inode.i_blocks) { - fs_fast_symlinks_count++; - goto next; - } - } - else if (LINUX_S_ISFIFO (inode.i_mode)) - fs_fifo_count++; - 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]) { - inodes_to_process[process_inode_count].ino = ino; - inodes_to_process[process_inode_count].inode = inode; - process_inode_count++; - } else - check_blocks(fs, &pctx, block_buf); - - if (process_inode_count >= process_inode_size) - process_inodes(fs, block_buf); - next: - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) { - if (!inode_bb_map) - alloc_bb_map(fs); - ext2fs_mark_inode_bitmap(inode_bb_map, ino); - ext2fs_mark_inode_bitmap(inode_used_map, ino); - goto next; - } - if (retval) { - com_err(program_name, retval, - "while doing inode scan"); - fatal_error(0); - } - } - process_inodes(fs, block_buf); - ext2fs_close_inode_scan(scan); - ehandler_operation(0); - - if (invalid_bitmaps) - handle_fs_bad_blocks(fs); - - if (restart_e2fsck) { - unwind_pass1(fs); - goto endit; - } - - if (block_dup_map) { - if (preen) { - printf("Duplicate or bad blocks in use!\n"); - preenhalt(fs); - } - pass1_dupblocks(fs, block_buf); - } - free(inodes_to_process); -endit: - fs->get_blocks = 0; - fs->check_directory = 0; - fs->read_inode = 0; - fs->write_inode = 0; - - free(block_buf); - ext2fs_free_block_bitmap(block_illegal_map); - block_illegal_map = 0; - - if (tflag > 1) { - printf("Pass 1: "); - print_resource_track(&rtrack); - } -} - -/* - * When the inode_scan routines call this callback at the end of the - * glock group, call process_inodes. - */ -static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan, - dgrp_t group, void * private) -{ - process_inodes(fs, (char *) private); - return 0; -} - -/* - * Process the inodes in the "inodes to process" list. - */ -static void process_inodes(ext2_filsys fs, char *block_buf) -{ - int i; - struct ext2_inode *old_stashed_inode; - ino_t old_stashed_ino; - const char *old_operation; - char buf[80]; - struct problem_context pctx; - -#if 0 - printf("begin process_inodes: "); -#endif - old_operation = ehandler_operation(0); - old_stashed_inode = stashed_inode; - old_stashed_ino = stashed_ino; - qsort(inodes_to_process, process_inode_count, - sizeof(struct process_inode_block), process_inode_cmp); - clear_problem_context(&pctx); - for (i=0; i < process_inode_count; i++) { - pctx.inode = stashed_inode = &inodes_to_process[i].inode; - pctx.ino = stashed_ino = inodes_to_process[i].ino; - -#if 0 - printf("%u ", pctx.ino); -#endif - sprintf(buf, "reading indirect blocks of inode %lu", pctx.ino); - ehandler_operation(buf); - check_blocks(fs, &pctx, block_buf); - } - stashed_inode = old_stashed_inode; - stashed_ino = old_stashed_ino; - process_inode_count = 0; -#if 0 - printf("end process inodes\n"); -#endif - ehandler_operation(old_operation); -} - -static int process_inode_cmp(const void *a, const void *b) -{ - const struct process_inode_block *ib_a = - (const struct process_inode_block *) a; - const struct process_inode_block *ib_b = - (const struct process_inode_block *) b; - - return (ib_a->inode.i_block[EXT2_IND_BLOCK] - - ib_b->inode.i_block[EXT2_IND_BLOCK]); -} - -/* - * This procedure will allocate the inode bad map table - */ -static void alloc_bad_map(ext2_filsys fs) -{ - errcode_t retval; - - retval = ext2fs_allocate_inode_bitmap(fs, "bad inode map", - &inode_bad_map); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode_bad_map"); - fatal_error(0); - } -} - -/* - * This procedure will allocate the inode "bb" (badblock) map table - */ -static void alloc_bb_map(ext2_filsys fs) -{ - errcode_t retval; - - retval = ext2fs_allocate_inode_bitmap(fs, "inode in bad block map", - &inode_bb_map); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode in bad block map"); - fatal_error(0); - } -} - -/* - * 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 _INLINE_ void mark_block_used(ext2_filsys fs, blk_t block) -{ - errcode_t retval; - - 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); - if (retval) { - com_err("ext2fs_allocate_block_bitmap", retval, - "while allocating block_dup_map"); - fatal_error(0); - } - } - ext2fs_fast_mark_block_bitmap(block_dup_map, block); - } else { - ext2fs_fast_mark_block_bitmap(block_found_map, block); - } -} - -/* - * This subroutine is called on each inode to account for all of the - * blocks used by that inode. - */ -static void check_blocks(ext2_filsys fs, struct problem_context *pctx, - char *block_buf) -{ - struct process_block_struct pb; - errcode_t retval; - ino_t ino = pctx->ino; - struct ext2_inode *inode = pctx->inode; - - if (!ext2fs_inode_has_valid_blocks(pctx->inode)) - return; - - pb.ino = ino; - pb.num_blocks = pb.last_block = 0; - pb.num_illegal_blocks = 0; - pb.suppress = 0; pb.clear = 0; - pb.fragmented = 0; - pb.previous_block = 0; - pb.is_dir = LINUX_S_ISDIR(pctx->inode->i_mode); - pb.inode = inode; - pb.pctx = pctx; - retval = ext2fs_block_iterate2(fs, ino, - pb.is_dir ? BLOCK_FLAG_HOLE : 0, - block_buf, process_block, &pb); - reset_problem_latch(PR_LATCH_BLOCK); - if (retval) - com_err(program_name, retval, - "while calling ext2fs_block_iterate in check_blocks"); - - if (pb.fragmented && pb.num_blocks < fs->super->s_blocks_per_group) - fs_fragmented++; - - if (pb.clear) { - e2fsck_read_inode(fs, ino, inode, "check_blocks"); - if (retval) { - com_err("check_blocks", retval, - "while reading to be cleared inode %d", ino); - fatal_error(0); - } - inode->i_links_count = 0; - ext2fs_icount_store(inode_link_info, ino, 0); - inode->i_dtime = time(0); - e2fsck_write_inode(fs, ino, inode, "check_blocks"); - ext2fs_unmark_inode_bitmap(inode_dir_map, ino); - ext2fs_unmark_inode_bitmap(inode_used_map, ino); - /* - * The inode was probably partially accounted for - * before processing was aborted, so we need to - * restart the pass 1 scan. - */ - restart_e2fsck++; - return; - } - - pb.num_blocks *= (fs->blocksize / 512); -#if 0 - 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 - if (!pb.num_blocks && pb.is_dir) { - if (fix_problem(fs, PR_1_ZERO_LENGTH_DIR, pctx)) { - inode->i_links_count = 0; - ext2fs_icount_store(inode_link_info, ino, 0); - inode->i_dtime = time(0); - e2fsck_write_inode(fs, ino, inode, "check_blocks"); - ext2fs_unmark_inode_bitmap(inode_dir_map, ino); - ext2fs_unmark_inode_bitmap(inode_used_map, ino); - fs_directory_count--; - pb.is_dir = 0; - } - } - if ((pb.is_dir && (inode->i_size != - (pb.last_block + 1) * fs->blocksize)) || - (inode->i_size < pb.last_block * fs->blocksize)) { - pctx->num = (pb.last_block+1) * fs->blocksize; - if (fix_problem(fs, PR_1_BAD_I_SIZE, pctx)) { - inode->i_size = pctx->num; - e2fsck_write_inode(fs, ino, inode, "check_blocks"); - } - pctx->num = 0; - } - if (pb.num_blocks != inode->i_blocks) { - pctx->num = pb.num_blocks; - if (fix_problem(fs, PR_1_BAD_I_BLOCKS, pctx)) { - inode->i_blocks = pb.num_blocks; - e2fsck_write_inode(fs, ino, inode, "check_blocks"); - } - pctx->num = 0; - } -} - -#if 0 -/* - * 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); -} -#endif - -/* - * This is a helper function for check_blocks(). - */ -int process_block(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - blk_t ref_block, - int ref_offset, - void *private) -{ - struct process_block_struct *p; - struct problem_context *pctx; - blk_t blk = *block_nr; - int ret_code = 0; - int problem = 0; - errcode_t retval; - - p = (struct process_block_struct *) private; - pctx = p->pctx; - - if (blk == 0) { - if (p->is_dir == 0) { - /* - * Should never happen, since only directories - * get called with BLOCK_FLAG_HOLE - */ - printf("process_block() called with blk == 0, " - "blockcnt=%d, inode %lu???\n", - blockcnt, p->ino); - return 0; - } - if (blockcnt < 0) - return 0; - if (blockcnt * fs->blocksize < p->inode->i_size) { -#if 0 - printf("Missing block (#%d) in directory inode %lu!\n", - blockcnt, p->ino); -#endif - goto mark_dir; - } - return 0; - } - -#if 0 - printf("Process_block, inode %lu, block %u, #%d\n", p->ino, blk, - blockcnt); -#endif - - /* - * Simplistic fragmentation check. We merely require that the - * file be contiguous. (Which can never be true for really - * big files that are greater than a block group.) - */ - if (p->previous_block) { - if (p->previous_block+1 != blk) - p->fragmented = 1; - } - p->previous_block = blk; - - if (blk < fs->super->s_first_data_block || - blk >= fs->super->s_blocks_count) - problem = PR_1_ILLEGAL_BLOCK_NUM; -#if 0 - else - if (ext2fs_test_block_bitmap(block_illegal_map, blk)) - problem = PR_1_BLOCK_OVERLAPS_METADATA; -#endif - - if (problem) { - p->num_illegal_blocks++; - if (!p->suppress && (p->num_illegal_blocks % 12) == 0) { - if (fix_problem(fs, PR_1_TOO_MANY_BAD_BLOCKS, pctx)) { - p->clear = 1; - return BLOCK_ABORT; - } - if (ask("Suppress messages", 0)) { - p->suppress = 1; - suppress_latch_group(PR_LATCH_BLOCK, 1); - } - } - pctx->blk = blk; - pctx->blkcount = blockcnt; - if (fix_problem(fs, problem, pctx)) { - blk = *block_nr = 0; - ret_code = BLOCK_CHANGED; - goto mark_dir; - } else - return 0; - pctx->blk = 0; - pctx->blkcount = -1; - } - - mark_block_used(fs, blk); - p->num_blocks++; - if (blockcnt >= 0) - p->last_block = blockcnt; -mark_dir: - if (p->is_dir && (blockcnt >= 0)) { - retval = ext2fs_add_dir_block(fs->dblist, p->ino, - blk, blockcnt); - if (retval) { - com_err(program_name, retval, - "while adding to directory block list"); - fatal_error(0); - } - } - return ret_code; -} - -static void bad_block_indirect(ext2_filsys fs, blk_t blk) -{ - 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 " - "list and ""e2fsck -L filename""\n" - "to read it back in again.\n"); - if (ask("Continue", 0)) - return; - 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, - blk_t ref_block, - int ref_offset, - void *private) -{ - struct process_block_struct *p; - blk_t blk = *block_nr; - int first_block; - int i; - struct problem_context *pctx; - - if (!blk) - return 0; - - p = (struct process_block_struct *) private; - pctx = p->pctx; - - pctx->blk = blk; - pctx->blkcount = blockcnt; - - - if ((blk < fs->super->s_first_data_block) || - (blk >= fs->super->s_blocks_count)) { - if (fix_problem(fs, PR_1_BB_ILLEGAL_BLOCK_NUM, pctx)) { - *block_nr = 0; - return BLOCK_CHANGED; - } else - return 0; - } - - if (blockcnt < 0) { - if (ext2fs_test_block_bitmap(block_found_map, blk)) - bad_block_indirect(fs, blk); - else - mark_block_used(fs, blk); - return 0; - } -#if 0 - printf ("DEBUG: Marking %u as bad.\n", blk); -#endif - fs_badblocks_count++; - /* - * If the block is not used, then mark it as used and return. - * If it is already marked as found, this must mean that - * there's an overlap between the filesystem table blocks - * (bitmaps and inode table) and the bad block list. - */ - if (!ext2fs_test_block_bitmap(block_found_map, blk)) { - ext2fs_mark_block_bitmap(block_found_map, blk); - return 0; - } - /* - * Try to find the where the filesystem block was used... - */ - first_block = fs->super->s_first_data_block; - - for (i = 0; i < fs->group_desc_count; i++ ) { - pctx->group = i; - if (blk == first_block) { - if (i == 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 " - "(%u) is bad.\n", i, blk); - return 0; - } - if ((blk > first_block) && - (blk <= first_block + fs->desc_blocks)) { - if (i == 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 (%u).\n", i, blk); - return 0; - } - if (blk == fs->group_desc[i].bg_block_bitmap) { - if (fix_problem(fs, PR_1_BB_BAD_BLOCK, pctx)) { - invalid_block_bitmap[i]++; - invalid_bitmaps++; - } - return 0; - } - if (blk == fs->group_desc[i].bg_inode_bitmap) { - if (fix_problem(fs, PR_1_IB_BAD_BLOCK, pctx)) { - invalid_inode_bitmap[i]++; - invalid_bitmaps++; - } - return 0; - } - if ((blk >= fs->group_desc[i].bg_inode_table) && - (blk < (fs->group_desc[i].bg_inode_table + - fs->inode_blocks_per_group))) { - /* - * If there are bad blocks in the inode table, - * the inode scan code will try to do - * something reasonable automatically. - */ - return 0; - } - } - /* - * If we've gotten to this point, then the only - * possibility is that the bad block inode meta data - * is using a bad block. - */ - if ((blk == p->inode->i_block[EXT2_IND_BLOCK]) || - p->inode->i_block[EXT2_DIND_BLOCK]) { - bad_block_indirect(fs, blk); - return 0; - } - - printf("Programming error? block #%u claimed for no reason " - "in process_bad_block.\n", blk); - return 0; -} - -static void new_table_block(ext2_filsys fs, blk_t first_block, int group, - const char *name, int num, blk_t *new_block) -{ - errcode_t retval; - blk_t old_block = *new_block; - int i; - char *buf; - - retval = ext2fs_get_free_blocks(fs, first_block, - first_block + fs->super->s_blocks_per_group, - num, block_found_map, new_block); - if (retval) { - printf("Could not allocate %d block(s) for %s: %s\n", - num, name, error_message(retval)); - ext2fs_unmark_valid(fs); - return; - } - buf = malloc(fs->blocksize); - if (!buf) { - printf("Could not allocate block buffer for relocating %s\n", - name); - ext2fs_unmark_valid(fs); - return; - } - ext2fs_mark_super_dirty(fs); - printf("Relocating group %d's %s ", group, name); - if (old_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 %u " - "of %s: %s\n", - old_block + i, name, - error_message(retval)); - } else - memset(buf, 0, fs->blocksize); - - retval = io_channel_write_blk(fs->io, (*new_block) + i, - 1, buf); - if (retval) - printf("Warning: could not write block %u for %s: %s\n", - (*new_block) + i, name, error_message(retval)); - } - free(buf); -} - -/* - * This routine gets called at the end of pass 1 if bad blocks are - * detected in the superblock, group descriptors, inode_bitmaps, or - * block bitmaps. At this point, all of the blocks have been mapped - * out, so we can try to allocate new block(s) to replace the bad - * blocks. - */ -static void handle_fs_bad_blocks(ext2_filsys fs) -{ - int i; - int first_block = fs->super->s_first_data_block; - - for (i = 0; i < fs->group_desc_count; i++) { - if (invalid_block_bitmap[i]) { - new_table_block(fs, first_block, i, "block bitmap", 1, - &fs->group_desc[i].bg_block_bitmap); - } - if (invalid_inode_bitmap[i]) { - new_table_block(fs, first_block, i, "inode bitmap", 1, - &fs->group_desc[i].bg_inode_bitmap); - } - if (invalid_inode_table[i]) { - new_table_block(fs, first_block, i, "inode table", - fs->inode_blocks_per_group, - &fs->group_desc[i].bg_inode_table); - restart_e2fsck++; - } - first_block += fs->super->s_blocks_per_group; - } - invalid_bitmaps = 0; -} - -/* - * This routine marks all blocks which are used by the superblock, - * group descriptors, inode bitmaps, and block bitmaps. - */ -static void mark_table_blocks(ext2_filsys fs) -{ - blk_t block, b; - int i,j; - struct problem_context pctx; - - clear_problem_context(&pctx); - - block = fs->super->s_first_data_block; - for (i = 0; i < fs->group_desc_count; i++) { - pctx.group = i; - /* - * Mark the blocks used for the inode table - */ - if (fs->group_desc[i].bg_inode_table) { - for (j = 0, b = fs->group_desc[i].bg_inode_table; - j < fs->inode_blocks_per_group; - j++, b++) { - if (ext2fs_test_block_bitmap(block_found_map, - b)) { - pctx.blk = b; - if (fix_problem(fs, - PR_1_ITABLE_CONFLICT, &pctx)) { - invalid_inode_table[i]++; - invalid_bitmaps++; - } - } else { - ext2fs_mark_block_bitmap(block_found_map, - b); - ext2fs_mark_block_bitmap(block_illegal_map, - b); - } - } - } - - /* - * Mark block used for the block bitmap - */ - if (fs->group_desc[i].bg_block_bitmap) { - if (ext2fs_test_block_bitmap(block_found_map, - fs->group_desc[i].bg_block_bitmap)) { - pctx.blk = fs->group_desc[i].bg_block_bitmap; - if (fix_problem(fs, PR_1_BB_CONFLICT, &pctx)) { - invalid_block_bitmap[i]++; - invalid_bitmaps++; - } - } 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 - */ - if (fs->group_desc[i].bg_inode_bitmap) { - if (ext2fs_test_block_bitmap(block_found_map, - fs->group_desc[i].bg_inode_bitmap)) { - pctx.blk = fs->group_desc[i].bg_inode_bitmap; - if (fix_problem(fs, PR_1_IB_CONFLICT, &pctx)) { - invalid_inode_bitmap[i]++; - invalid_bitmaps++; - } - } 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); - } - } - - if (ext2fs_bg_has_super(fs, i)) { - /* - * 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++) { - 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; - } -} - -/* - * This subroutines short circuits ext2fs_get_blocks and - * ext2fs_check_directory; we use them since we already have the inode - * structure, so there's no point in letting the ext2fs library read - * the inode again. - */ -errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks) -{ - int i; - - if (ino != stashed_ino) - return EXT2_ET_CALLBACK_NOTHANDLED; - - for (i=0; i < EXT2_N_BLOCKS; i++) - blocks[i] = stashed_inode->i_block[i]; - return 0; -} - -errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino, struct ext2_inode *inode) -{ - if (ino != stashed_ino) - return EXT2_ET_CALLBACK_NOTHANDLED; - *inode = *stashed_inode; - return 0; -} - -errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino, - struct ext2_inode *inode) -{ - if (ino == stashed_ino) - *stashed_inode = *inode; - return EXT2_ET_CALLBACK_NOTHANDLED; -} - -errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino) -{ - if (ino == stashed_ino) { - if (!LINUX_S_ISDIR(stashed_inode->i_mode)) - return ENOTDIR; - return 0; - } - printf("INTERNAL ERROR: pass1_check_directory: unexpected inode #%lu\n", - ino); - printf("\t(was expecting %lu)\n", stashed_ino); - exit(FSCK_ERROR); -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/pass1b.c b/gnu/usr.sbin/e2fsprogs/e2fsck/pass1b.c deleted file mode 100644 index 0edefdea9bc..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/pass1b.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * pass1b.c --- Pass #1b of e2fsck - * - * This file contains pass1B, pass1C, and pass1D of e2fsck. They are - * only invoked if pass 1 discovered blocks which are in use by more - * than one inode. - * - * Pass1B scans the data blocks of all the inodes again, generating a - * complete list of duplicate blocks and which inodes have claimed - * them. - * - * Pass1C does a tree-traversal of the filesystem, to determine the - * parent directories of these inodes. This step is necessary so that - * e2fsck can print out the pathnames of affected inodes. - * - * Pass1D is a reconciliation pass. For each inode with duplicate - * blocks, the user is prompted if s/he would like to clone the file - * (so that the file gets a fresh copy of the duplicated blocks) or - * simply to delete the file. - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <et/com_err.h> -#include "e2fsck.h" - -#include "problem.h" - -/* - * This is structure is allocated for each time that a block is - * claimed by more than one file. So if a particular block is claimed - * by 3 files, then three copies of this structure will be allocated, - * one for each conflict. - * - * The linked list structure is as follows: - * - * dup_blk --> block #34 --> block #35 --> block #47 - * inode #12 inode #14 inode #17 - * num_bad = 3 num_bad = 2 num_bad = 2 - * | | | - * V V V - * block #34 block #35 block #47 - * inode #14 inode #15 inode #23 - * | - * V - * block #34 - * inode #15 - * - * The num_bad field indicates how many inodes are sharing a - * particular block, and is only stored in the first element of the - * linked list for a particular block. As the block conflicts are - * resolved, num_bad is decremented; when it reaches 1, then we no - * longer need to worry about that block. - */ -struct dup_block { - blk_t block; /* Block number */ - ino_t ino; /* Inode number */ - int num_bad; - /* Pointer to next dup record with different block */ - struct dup_block *next_block; - /* Pointer to next dup record with different inode */ - struct dup_block *next_inode; -}; - -/* - * This structure stores information about a particular inode which - * is sharing blocks with other inodes. This information is collected - * to display to the user, so that the user knows what files he or she - * is dealing with, when trying to decide how to resolve the conflict - * of multiply-claimed blocks. - */ -struct dup_inode { - ino_t ino, dir; - int num_dupblocks; - struct ext2_inode inode; - struct dup_inode *next; -}; - -static int process_pass1b_block(ext2_filsys fs, blk_t *blocknr, - int blockcnt, void *private); -static void delete_file(ext2_filsys fs, struct dup_inode *dp, - char *block_buf); -static int clone_file(ext2_filsys fs, struct dup_inode *dp, char* block_buf); -static void pass1b(ext2_filsys fs, char *block_buf); -static void pass1c(ext2_filsys fs, char *block_buf); -static void pass1d(ext2_filsys fs, char *block_buf); - -static struct dup_block *dup_blk = 0; -static struct dup_inode *dup_ino = 0; -static int dup_inode_count = 0; - -static ext2fs_inode_bitmap inode_dup_map; - -/* - * Main procedure for handling duplicate blocks - */ -void pass1_dupblocks(ext2_filsys fs, char *block_buf) -{ - errcode_t retval; - struct dup_block *p, *q, *next_p, *next_q; - struct dup_inode *r, *next_r; - - retval = ext2fs_allocate_inode_bitmap(fs, - "multiply claimed inode map", &inode_dup_map); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode_dup_map"); - fatal_error(0); - } - - pass1b(fs, block_buf); - pass1c(fs, block_buf); - pass1d(fs, block_buf); - - /* - * Time to free all of the accumulated data structures that we - * don't need anymore. - */ - ext2fs_free_inode_bitmap(inode_dup_map); inode_dup_map = 0; - ext2fs_free_block_bitmap(block_dup_map); block_dup_map = 0; - for (p = dup_blk; p; p = next_p) { - next_p = p->next_block; - for (q = p; q; q = next_q) { - next_q = q->next_inode; - free(q); - } - } - for (r = dup_ino; r; r = next_r) { - next_r = r->next; - free(r); - } -} - -/* - * Scan the inodes looking for inodes that contain duplicate blocks. - */ -struct process_block_struct { - ino_t ino; - int dup_blocks; -}; - -void pass1b(ext2_filsys fs, char *block_buf) -{ - ino_t ino; - struct ext2_inode inode; - ext2_inode_scan scan; - errcode_t retval; - struct process_block_struct pb; - struct dup_inode *dp; - - printf("Duplicate blocks found... invoking duplicate block passes.\n"); - printf("Pass 1B: Rescan for duplicate/bad blocks\n"); - retval = ext2fs_open_inode_scan(fs, inode_buffer_blocks, &scan); - if (retval) { - com_err(program_name, retval, "while opening inode scan"); - fatal_error(0); - } - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err(program_name, retval, "while starting inode scan"); - fatal_error(0); - } - stashed_inode = &inode; - while (ino) { - stashed_ino = ino; - if ((ino != EXT2_BAD_INO) && - (!ext2fs_test_inode_bitmap(inode_used_map, ino) || - !ext2fs_inode_has_valid_blocks(&inode))) - goto next; - - pb.ino = ino; - pb.dup_blocks = 0; - retval = ext2fs_block_iterate(fs, ino, 0, block_buf, - process_pass1b_block, &pb); - if (pb.dup_blocks) { - if (ino != EXT2_BAD_INO) - printf("\n"); - dp = allocate_memory(sizeof(struct dup_inode), - "duplicate inode record"); - dp->ino = ino; - dp->dir = 0; - dp->inode = inode; - dp->num_dupblocks = pb.dup_blocks; - dp->next = dup_ino; - dup_ino = dp; - if (ino != EXT2_BAD_INO) - dup_inode_count++; - } - if (retval) - com_err(program_name, retval, - "while calling ext2fs_block_iterate in pass1b"); - - next: - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) - goto next; - if (retval) { - com_err(program_name, retval, - "while doing inode scan"); - fatal_error(0); - } - } - ext2fs_close_inode_scan(scan); - fs->get_blocks = 0; - fs->check_directory = 0; -} - -int process_pass1b_block(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - void *private) -{ - struct process_block_struct *p; - struct dup_block *dp, *q, *r; - int i; - - if (!*block_nr) - return 0; - p = (struct process_block_struct *) private; - - if (ext2fs_test_block_bitmap(block_dup_map, *block_nr)) { - /* OK, this is a duplicate block */ - if (p->ino != EXT2_BAD_INO) { - if (!p->dup_blocks) - printf("Duplicate/bad block(s) in inode %lu:", - p->ino); - printf(" %u", *block_nr); - } - p->dup_blocks++; - ext2fs_mark_block_bitmap(block_dup_map, *block_nr); - ext2fs_mark_inode_bitmap(inode_dup_map, p->ino); - dp = allocate_memory(sizeof(struct dup_block), - "duplicate block record"); - dp->block = *block_nr; - dp->ino = p->ino; - dp->num_bad = 0; - q = dup_blk; - while (q) { - if (q->block == *block_nr) - break; - q = q->next_block; - } - if (q) { - dp->next_inode = q->next_inode; - q->next_inode = dp; - } else { - dp->next_block = dup_blk; - dup_blk = dp; - } - } - /* - * Set the num_bad field - */ - for (q = dup_blk; q; q = q->next_block) { - i = 0; - for (r = q; r; r = r->next_inode) - i++; - q->num_bad = i; - } - return 0; -} - -/* - * Pass 1c: Scan directories for inodes with duplicate blocks. This - * is used so that we can print pathnames when prompting the user for - * what to do. - */ -struct search_dir_struct { - int count; - ino_t first_inode; - ino_t max_inode; -}; - -static int search_dirent_proc(ino_t dir, int entry, - struct ext2_dir_entry *dirent, - int offset, int blocksize, - char *buf, void *private) -{ - struct search_dir_struct *sd = private; - struct dup_inode *p; - - if (dirent->inode > sd->max_inode) - /* Should abort this inode, but not everything */ - return 0; - - if (!dirent->inode || (entry < DIRENT_OTHER_FILE) || - !ext2fs_test_inode_bitmap(inode_dup_map, dirent->inode)) - return 0; - - for (p = dup_ino; p; p = p->next) { - if ((p->ino >= sd->first_inode) && - (p->ino == dirent->inode)) - break; - } - - if (!p || p->dir) - return 0; - - p->dir = dir; - sd->count--; - - return(sd->count ? 0 : DIRENT_ABORT); -} - - -void pass1c(ext2_filsys fs, char *block_buf) -{ - struct dup_inode *p; - int inodes_left = dup_inode_count; - struct search_dir_struct sd; - - printf("Pass 1C: Scan directories for inodes with dup blocks.\n"); - - /* - * First check to see if any of the inodes with dup blocks is - * a special inode. (Note that the bad block inode isn't - * counted.) - */ - for (p = dup_ino; p; p = p->next) { - if ((p->ino < EXT2_FIRST_INODE(fs->super)) && - (p->ino != EXT2_BAD_INO)) - inodes_left--; - } - - /* - * Search through all directories to translate inodes to names - * (by searching for the containing directory for that inode.) - */ - sd.count = inodes_left; - sd.first_inode = EXT2_FIRST_INODE(fs->super); - sd.max_inode = fs->super->s_inodes_count; - ext2fs_dblist_dir_iterate(fs->dblist, 0, block_buf, - search_dirent_proc, &sd); -} - -static void pass1d(ext2_filsys fs, char *block_buf) -{ - struct dup_inode *p, *s; - struct dup_block *q, *r; - ino_t *shared; - int shared_len; - int i; - errcode_t retval; - int file_ok; - int meta_data = 0; - struct problem_context pctx; - - printf("Pass 1D: Reconciling duplicate blocks\n"); - read_bitmaps(fs); - - printf("(There are %d inodes containing duplicate/bad blocks.)\n\n", - dup_inode_count); - shared = allocate_memory(sizeof(ino_t) * dup_inode_count, - "Shared inode list"); - for (p = dup_ino; p; p = p->next) { - shared_len = 0; - file_ok = 1; - if (p->ino == EXT2_BAD_INO) - continue; - - /* - * Search through the duplicate records to see which - * inodes share blocks with this one - */ - for (q = dup_blk; q; q = q->next_block) { - /* - * See if this block is used by this inode. - * If it isn't, continue. - */ - for (r = q; r; r = r->next_inode) - if (r->ino == p->ino) - break; - if (!r) - continue; - if (q->num_bad > 1) - file_ok = 0; - if (ext2fs_test_block_bitmap(block_illegal_map, - q->block)) { - file_ok = 0; - meta_data = 1; - } - - /* - * Add all inodes used by this block to the - * shared[] --- which is a unique list, so - * if an inode is already in shared[], don't - * add it again. - */ - for (r = q; r; r = r->next_inode) { - if (r->ino == p->ino) - continue; - for (i = 0; i < shared_len; i++) - if (shared[i] == r->ino) - break; - if (i == shared_len) { - shared[shared_len++] = r->ino; - } - } - } - - /* - * Report the inode that we are working on - */ - clear_problem_context(&pctx); - pctx.inode = &p->inode; - pctx.ino = p->ino; - pctx.dir = p->dir; - pctx.blkcount = p->num_dupblocks; - pctx.num = meta_data ? shared_len+1 : shared_len; - fix_problem(fs, PR_1B_DUP_FILE, &pctx); - pctx.blkcount = 0; - pctx.num = 0; - - if (meta_data) - fix_problem(fs, PR_1B_SHARE_METADATA, &pctx); - - for (i = 0; i < shared_len; i++) { - for (s = dup_ino; s; s = s->next) - if (s->ino == shared[i]) - break; - if (!s) - continue; - /* - * Report the inode that we are sharing with - */ - pctx.inode = &s->inode; - pctx.ino = s->ino; - pctx.dir = s->dir; - fix_problem(fs, PR_1B_DUP_FILE_LIST, &pctx); - } - if (file_ok) { - printf("Duplicated blocks already reassigned or cloned.\n\n"); - continue; - } - - if (ask("Clone duplicate/bad blocks", 1)) { - retval = clone_file(fs, p, block_buf); - if (retval) - printf("Couldn't clone file: %s\n", - error_message(retval)); - else { - printf("\n"); - continue; - } - } - if (ask("Delete file", 1)) - delete_file(fs, p, block_buf); - else - ext2fs_unmark_valid(fs); - printf("\n"); - } - free(shared); -} - -static int delete_file_block(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - void *private) -{ - struct dup_block *p; - - if (!*block_nr) - return 0; - - if (ext2fs_test_block_bitmap(block_dup_map, *block_nr)) { - for (p = dup_blk; p; p = p->next_block) - if (p->block == *block_nr) - break; - if (p) { - p->num_bad--; - if (p->num_bad == 1) - ext2fs_unmark_block_bitmap(block_dup_map, - *block_nr); - } else - com_err("delete_file_block", 0, - "internal error; can't find dup_blk for %d\n", - *block_nr); - } else { - ext2fs_unmark_block_bitmap(block_found_map, *block_nr); - ext2fs_unmark_block_bitmap(fs->block_map, *block_nr); - } - - return 0; -} - -static void delete_file(ext2_filsys fs, struct dup_inode *dp, char* block_buf) -{ - errcode_t retval; - struct process_block_struct pb; - struct ext2_inode inode; - - pb.ino = dp->ino; - pb.dup_blocks = dp->num_dupblocks; - - retval = ext2fs_block_iterate(fs, dp->ino, 0, block_buf, - delete_file_block, &pb); - if (retval) - com_err("delete_file", retval, - "while calling ext2fs_block_iterate for inode %d", - dp->ino); - ext2fs_unmark_inode_bitmap(inode_used_map, dp->ino); - ext2fs_unmark_inode_bitmap(inode_dir_map, dp->ino); - if (inode_bad_map) - ext2fs_unmark_inode_bitmap(inode_bad_map, dp->ino); - ext2fs_unmark_inode_bitmap(fs->inode_map, dp->ino); - ext2fs_mark_ib_dirty(fs); - ext2fs_mark_bb_dirty(fs); - e2fsck_read_inode(fs, dp->ino, &inode, "delete_file"); - inode.i_links_count = 0; - inode.i_dtime = time(0); - e2fsck_write_inode(fs, dp->ino, &inode, "delete_file"); -} - -struct clone_struct { - errcode_t errcode; - ino_t dir; - char *buf; -}; - -static int clone_file_block(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - void *private) -{ - struct dup_block *p; - blk_t new_block; - errcode_t retval; - struct clone_struct *cs = (struct clone_struct *) private; - - if (!*block_nr) - return 0; - - if (ext2fs_test_block_bitmap(block_dup_map, *block_nr)) { - for (p = dup_blk; p; p = p->next_block) - if (p->block == *block_nr) - break; - if (p) { - retval = ext2fs_new_block(fs, 0, block_found_map, - &new_block); - if (retval) { - cs->errcode = retval; - return BLOCK_ABORT; - } - if (cs->dir) { - retval = ext2fs_set_dir_block(fs->dblist, - cs->dir, new_block, blockcnt); - if (retval) { - cs->errcode = retval; - return BLOCK_ABORT; - } - } - retval = io_channel_read_blk(fs->io, *block_nr, 1, - cs->buf); - if (retval) { - cs->errcode = retval; - return BLOCK_ABORT; - } - retval = io_channel_write_blk(fs->io, new_block, 1, - cs->buf); - if (retval) { - cs->errcode = retval; - return BLOCK_ABORT; - } - p->num_bad--; - if (p->num_bad == 1) - ext2fs_unmark_block_bitmap(block_dup_map, - *block_nr); - *block_nr = new_block; - ext2fs_mark_block_bitmap(block_found_map, - new_block); - ext2fs_mark_block_bitmap(fs->block_map, new_block); - return BLOCK_CHANGED; - } else - com_err("clone_file_block", 0, - "internal error; can't find dup_blk for %d\n", - *block_nr); - } - return 0; -} - -static int clone_file(ext2_filsys fs, struct dup_inode *dp, char* block_buf) -{ - errcode_t retval; - struct clone_struct cs; - - cs.errcode = 0; - cs.buf = malloc(fs->blocksize); - cs.dir = 0; - if (!cs.buf) - return ENOMEM; - - if (ext2fs_test_inode_bitmap(inode_dir_map, dp->ino)) - cs.dir = dp->ino; - - retval = ext2fs_block_iterate(fs, dp->ino, 0, block_buf, - clone_file_block, &cs); - ext2fs_mark_bb_dirty(fs); - free(cs.buf); - if (retval) { - com_err("clone_file", retval, - "while calling ext2fs_block_iterate for inode %d", - dp->ino); - return retval; - } - if (cs.errcode) { - com_err("clone_file", retval, - "returned from clone_file_block"); - return retval; - } - return 0; -} - - - - - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/pass2.c b/gnu/usr.sbin/e2fsprogs/e2fsck/pass2.c deleted file mode 100644 index 8822e8f5cc2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/pass2.c +++ /dev/null @@ -1,709 +0,0 @@ -/* - * pass2.c --- check directory structure - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * Pass 2 of e2fsck iterates through all active directory inodes, and - * applies to following tests to each directory entry in the directory - * blocks in the inodes: - * - * - The length of the directory entry (rec_len) should be at - * least 8 bytes, and no more than the remaining space - * left in the directory block. - * - The length of the name in the directory entry (name_len) - * should be less than (rec_len - 8). - * - The inode number in the directory entry should be within - * legal bounds. - * - The inode number should refer to a in-use inode. - * - The first entry should be '.', and its inode should be - * the inode of the directory. - * - The second entry should be '..'. - * - * To minimize disk seek time, the directory blocks are processed in - * sorted order of block numbers. - * - * Pass 2 also collects the following information: - * - The inode numbers of the subdirectories for each directory. - * - * Pass 2 relies on the following information from previous passes: - * - The directory information collected in pass 1. - * - The inode_used_map bitmap - * - The inode_bad_map bitmap - * - The inode_dir_map bitmap - * - * Pass 2 frees the following data structures - * - The inode_bad_map bitmap - */ - -#include "et/com_err.h" - -#include "e2fsck.h" -#include "problem.h" - -/* - * Keeps track of how many times an inode is referenced. - */ -ext2_icount_t inode_count = 0; - -static void deallocate_inode(ext2_filsys fs, ino_t ino, - char* block_buf); -static int process_bad_inode(ext2_filsys fs, ino_t dir, ino_t ino); -static int check_dir_block(ext2_filsys fs, - struct ext2_db_entry *dir_blocks_info, - void *private); -static int allocate_dir_block(ext2_filsys fs, - struct ext2_db_entry *dir_blocks_info, - char *buf, struct problem_context *pctx); -static int update_dir_block(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - void *private); - -struct check_dir_struct { - char *buf; - struct problem_context pctx; -}; - -void pass2(ext2_filsys fs) -{ - char *buf; - struct resource_track rtrack; - struct dir_info *dir; - errcode_t retval; - ino_t size; - struct check_dir_struct cd; - - init_resource_track(&rtrack); - -#ifdef MTRACE - mtrace_print("Pass 2"); -#endif - - if (!preen) - printf("Pass 2: Checking directory structure\n"); - retval = ext2fs_create_icount2(fs, EXT2_ICOUNT_OPT_INCREMENT, - 0, inode_link_info, &inode_count); - if (retval) { - com_err("ext2fs_create_icount", retval, - "while creating inode_count"); - fatal_error(0); - } - buf = allocate_memory(fs->blocksize, "directory scan buffer"); - - /* - * Set up the parent pointer for the root directory, if - * present. (If the root directory is not present, we will - * create it in pass 3.) - */ - dir = get_dir_info(EXT2_ROOT_INO); - if (dir) - dir->parent = EXT2_ROOT_INO; - - cd.buf = buf; - clear_problem_context(&cd.pctx); - - retval = ext2fs_dblist_iterate(fs->dblist, check_dir_block, &cd); - - free(buf); - ext2fs_free_dblist(fs->dblist); - - if (inode_bad_map) { - ext2fs_free_inode_bitmap(inode_bad_map); - inode_bad_map = 0; - } - if (tflag > 1) { - printf("Pass 2: "); - print_resource_track(&rtrack); - } -} - -/* - * Make sure the first entry in the directory is '.', and that the - * directory entry is sane. - */ -static int check_dot(ext2_filsys fs, - struct ext2_dir_entry *dirent, - ino_t ino, struct problem_context *pctx) -{ - struct ext2_dir_entry *nextdir; - int status = 0; - int created = 0; - int new_len; - int problem = 0; - - if (!dirent->inode) - problem = PR_2_MISSING_DOT; - else if ((dirent->name_len != 1) || - (dirent->name[0] != '.')) - problem = PR_2_1ST_NOT_DOT; - else if (dirent->name[1] != '\0') - problem = PR_2_DOT_NULL_TERM; - - if (problem) { - if (fix_problem(fs, problem, pctx)) { - if (dirent->rec_len < 12) - dirent->rec_len = 12; - dirent->inode = ino; - dirent->name_len = 1; - dirent->name[0] = '.'; - dirent->name[1] = '\0'; - status = 1; - created = 1; - } - } - if (dirent->inode != ino) { - if (fix_problem(fs, PR_2_BAD_INODE_DOT, pctx)) { - dirent->inode = ino; - status = 1; - } - } - if (dirent->rec_len > 12) { - new_len = dirent->rec_len - 12; - if (new_len > 12) { - preenhalt(fs); - if (created || - ask("Directory entry for '.' is big. Split", 1)) { - nextdir = (struct ext2_dir_entry *) - ((char *) dirent + 12); - dirent->rec_len = 12; - nextdir->rec_len = new_len; - nextdir->inode = 0; - nextdir->name_len = 0; - status = 1; - } - } - } - return status; -} - -/* - * Make sure the second entry in the directory is '..', and that the - * directory entry is sane. We do not check the inode number of '..' - * here; this gets done in pass 3. - */ -static int check_dotdot(ext2_filsys fs, - struct ext2_dir_entry *dirent, - struct dir_info *dir, struct problem_context *pctx) -{ - int problem = 0; - - if (!dirent->inode) - problem = PR_2_MISSING_DOT_DOT; - else if ((dirent->name_len != 2) || - (dirent->name[0] != '.') || - (dirent->name[1] != '.')) - problem = PR_2_2ND_NOT_DOT_DOT; - else if (dirent->name[2] != '\0') - problem = PR_2_DOT_DOT_NULL_TERM; - - if (problem) { - if (fix_problem(fs, problem, pctx)) { - if (dirent->rec_len < 12) - dirent->rec_len = 12; - /* - * Note: we don't have the parent inode just - * yet, so we will fill it in with the root - * inode. This will get fixed in pass 3. - */ - dirent->inode = EXT2_ROOT_INO; - dirent->name_len = 2; - dirent->name[0] = '.'; - dirent->name[1] = '.'; - dirent->name[2] = '\0'; - return 1; - } - return 0; - } - dir->dotdot = dirent->inode; - return 0; -} - -/* - * Check to make sure a directory entry doesn't contain any illegal - * characters. - */ -static int check_name(ext2_filsys fs, - struct ext2_dir_entry *dirent, - ino_t dir_ino, struct problem_context *pctx) -{ - int i; - int fixup = -1; - int ret = 0; - - for ( i = 0; i < dirent->name_len; i++) { - if (dirent->name[i] == '/' || dirent->name[i] == '\0') { - if (fixup < 0) { - fixup = fix_problem(fs, PR_2_BAD_NAME, pctx); - } - if (fixup) { - dirent->name[i] = '.'; - ret = 1; - } - } - } - return ret; -} - -static int check_dir_block(ext2_filsys fs, - struct ext2_db_entry *db, - void *private) -{ - struct dir_info *subdir, *dir; - struct ext2_dir_entry *dirent; - int offset = 0; - int dir_modified = 0; - errcode_t retval; - int dot_state; - blk_t block_nr = db->blk; - ino_t ino = db->ino; - __u16 links; - struct check_dir_struct *cd = private; - char *buf = cd->buf; - - /* - * Make sure the inode is still in use (could have been - * deleted in the duplicate/bad blocks pass. - */ - if (!(ext2fs_test_inode_bitmap(inode_used_map, ino))) - return 0; - - cd->pctx.ino = ino; - cd->pctx.blk = block_nr; - cd->pctx.blkcount = db->blockcnt; - cd->pctx.ino2 = 0; - cd->pctx.dirent = 0; - cd->pctx.num = 0; - - if (db->blk == 0) { - if (allocate_dir_block(fs, db, buf, &cd->pctx)) - return 0; - block_nr = db->blk; - } - - if (db->blockcnt) - dot_state = 2; - else - dot_state = 0; - -#if 0 - printf("In process_dir_block block %lu, #%d, inode %lu\n", block_nr, - db->blockcnt, ino); -#endif - - retval = ext2fs_read_dir_block(fs, block_nr, buf); - if (retval) { - com_err(program_name, retval, - "while reading directory block %d", block_nr); - } - - do { - dot_state++; - dirent = (struct ext2_dir_entry *) (buf + offset); - cd->pctx.dirent = dirent; - cd->pctx.num = offset; - if (((offset + dirent->rec_len) > fs->blocksize) || - (dirent->rec_len < 8) || - ((dirent->rec_len % 4) != 0) || - ((dirent->name_len+8) > dirent->rec_len)) { - if (fix_problem(fs, PR_2_DIR_CORRUPTED, &cd->pctx)) { - dirent->rec_len = fs->blocksize - offset; - dirent->name_len = 0; - dirent->inode = 0; - dir_modified++; - } else - return DIRENT_ABORT; - } - - if (dirent->name_len > EXT2_NAME_LEN) { - if (fix_problem(fs, PR_2_FILENAME_LONG, &cd->pctx)) { - dirent->name_len = EXT2_NAME_LEN; - dir_modified++; - } - } - - if (dot_state == 1) { - if (check_dot(fs, dirent, ino, &cd->pctx)) - dir_modified++; - } else if (dot_state == 2) { - dir = get_dir_info(ino); - if (!dir) { - printf("Internal error: couldn't find dir_info for %lu\n", - ino); - fatal_error(0); - } - if (check_dotdot(fs, dirent, dir, &cd->pctx)) - dir_modified++; - } else if (dirent->inode == ino) { - if (fix_problem(fs, PR_2_LINK_DOT, &cd->pctx)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - } - if (!dirent->inode) - goto next; - - if (check_name(fs, dirent, ino, &cd->pctx)) - dir_modified++; - - /* - * Make sure the inode listed is a legal one. - */ - if (((dirent->inode != EXT2_ROOT_INO) && - (dirent->inode < EXT2_FIRST_INODE(fs->super))) || - (dirent->inode > fs->super->s_inodes_count)) { - if (fix_problem(fs, PR_2_BAD_INO, &cd->pctx)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - } - - /* - * If the inode is unused, offer to clear it. - */ - if (!(ext2fs_test_inode_bitmap(inode_used_map, - dirent->inode))) { - if (fix_problem(fs, PR_2_UNUSED_INODE, &cd->pctx)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - } - - /* - * If the inode is in a bad block, offer to clear it. - */ - if (inode_bb_map && - (ext2fs_test_inode_bitmap(inode_bb_map, - dirent->inode))) { - if (fix_problem(fs, PR_2_BB_INODE, &cd->pctx)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - } - - /* - * If the inode was marked as having bad fields in - * pass1, process it and offer to fix/clear it. - * (We wait until now so that we can display the - * pathname to the user.) - */ - if (inode_bad_map && - ext2fs_test_inode_bitmap(inode_bad_map, - dirent->inode)) { - if (process_bad_inode(fs, ino, dirent->inode)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - } - - /* - * Don't allow links to the root directory. We check - * this specially to make sure we catch this error - * case even if the root directory hasn't been created - * yet. - */ - if ((dot_state > 2) && (dirent->inode == EXT2_ROOT_INO)) { - if (fix_problem(fs, PR_2_LINK_ROOT, &cd->pctx)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - } - - /* - * If this is a directory, then mark its parent in its - * dir_info structure. If the parent field is already - * filled in, then this directory has more than one - * hard link. We assume the first link is correct, - * and ask the user if he/she wants to clear this one. - */ - if ((dot_state > 2) && - (ext2fs_test_inode_bitmap(inode_dir_map, - dirent->inode))) { - subdir = get_dir_info(dirent->inode); - if (!subdir) { - printf("INTERNAL ERROR: missing dir %u\n", - dirent->inode); - fatal_error(0); - } - if (subdir->parent) { - cd->pctx.ino2 = subdir->parent; - if (fix_problem(fs, PR_2_LINK_DIR, - &cd->pctx)) { - dirent->inode = 0; - dir_modified++; - goto next; - } - cd->pctx.ino2 = 0; - } else - subdir->parent = ino; - } - - ext2fs_icount_increment(inode_count, dirent->inode, &links); - if (links > 1) - fs_links_count++; - fs_total_count++; - next: - offset += dirent->rec_len; - } while (offset < fs->blocksize); -#if 0 - printf("\n"); -#endif - if (offset != fs->blocksize) { - printf("Final rec_len is %d, should be %d\n", - dirent->rec_len, - dirent->rec_len - fs->blocksize + offset); - } - if (dir_modified) { - retval = ext2fs_write_dir_block(fs, block_nr, buf); - if (retval) { - com_err(program_name, retval, - "while writing directory block %d", block_nr); - } - ext2fs_mark_changed(fs); - } - return 0; -} - -/* - * This function is called to deallocate a block, and is an interator - * functioned called by deallocate inode via ext2fs_iterate_block(). - */ -static int deallocate_inode_block(ext2_filsys fs, - blk_t *block_nr, - int blockcnt, - void *private) -{ - if (!*block_nr) - return 0; - ext2fs_unmark_block_bitmap(block_found_map, *block_nr); - ext2fs_unmark_block_bitmap(fs->block_map, *block_nr); - return 0; -} - -/* - * This fuction deallocates an inode - */ -static void deallocate_inode(ext2_filsys fs, ino_t ino, - char* block_buf) -{ - errcode_t retval; - struct ext2_inode inode; - - ext2fs_icount_store(inode_link_info, ino, 0); - e2fsck_read_inode(fs, ino, &inode, "deallocate_inode"); - inode.i_links_count = 0; - inode.i_dtime = time(0); - e2fsck_write_inode(fs, ino, &inode, "deallocate_inode"); - - /* - * Fix up the bitmaps... - */ - read_bitmaps(fs); - ext2fs_unmark_inode_bitmap(inode_used_map, ino); - ext2fs_unmark_inode_bitmap(inode_dir_map, ino); - if (inode_bad_map) - ext2fs_unmark_inode_bitmap(inode_bad_map, ino); - ext2fs_unmark_inode_bitmap(fs->inode_map, ino); - ext2fs_mark_ib_dirty(fs); - - if (!ext2fs_inode_has_valid_blocks(&inode)) - return; - - ext2fs_mark_bb_dirty(fs); - retval = ext2fs_block_iterate(fs, ino, 0, block_buf, - deallocate_inode_block, 0); - if (retval) - com_err("deallocate_inode", retval, - "while calling ext2fs_block_iterate for inode %d", - ino); -} - -static int process_bad_inode(ext2_filsys fs, ino_t dir, ino_t ino) -{ - struct ext2_inode inode; - int inode_modified = 0; - unsigned char *frag, *fsize; - struct problem_context pctx; - - e2fsck_read_inode(fs, ino, &inode, "process_bad_inode"); - - clear_problem_context(&pctx); - pctx.ino = ino; - pctx.dir = dir; - pctx.inode = &inode; - - 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))) { - if (fix_problem(fs, PR_2_BAD_MODE, &pctx)) { - deallocate_inode(fs, ino, 0); - return 1; - } - } - if (inode.i_faddr && - fix_problem(fs, PR_2_FADDR_ZERO, &pctx)) { - inode.i_faddr = 0; - inode_modified++; - } - - switch (fs->super->s_creator_os) { - case EXT2_OS_LINUX: - frag = &inode.osd2.linux2.l_i_frag; - fsize = &inode.osd2.linux2.l_i_fsize; - break; - case EXT2_OS_HURD: - frag = &inode.osd2.hurd2.h_i_frag; - fsize = &inode.osd2.hurd2.h_i_fsize; - break; - case EXT2_OS_MASIX: - frag = &inode.osd2.masix2.m_i_frag; - fsize = &inode.osd2.masix2.m_i_fsize; - break; - default: - frag = fsize = 0; - } - if (frag && *frag) { - pctx.num = *frag; - if (fix_problem(fs, PR_2_FRAG_ZERO, &pctx)) { - *frag = 0; - inode_modified++; - } - pctx.num = 0; - } - if (fsize && *fsize) { - pctx.num = *fsize; - if (fix_problem(fs, PR_2_FSIZE_ZERO, &pctx)) { - *fsize = 0; - inode_modified++; - } - pctx.num = 0; - } - - if (inode.i_file_acl && - fix_problem(fs, PR_2_FILE_ACL_ZERO, &pctx)) { - inode.i_file_acl = 0; - inode_modified++; - } - if (inode.i_dir_acl && - fix_problem(fs, PR_2_DIR_ACL_ZERO, &pctx)) { - inode.i_dir_acl = 0; - inode_modified++; - } - if (inode_modified) - e2fsck_write_inode(fs, ino, &inode, "process_bad_inode"); - 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 ext2_db_entry *db, - char *buf, struct problem_context *pctx) -{ - blk_t blk; - char *block; - struct ext2_inode inode; - errcode_t retval; - - if (fix_problem(fs, PR_2_DIRECTORY_HOLE, pctx) == 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 ext2_db_entry *db = private; - - if (db->blockcnt == blockcnt) { - *block_nr = db->blk; - return BLOCK_CHANGED; - } - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/pass3.c b/gnu/usr.sbin/e2fsprogs/e2fsck/pass3.c deleted file mode 100644 index 2f97aa4cb1b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/pass3.c +++ /dev/null @@ -1,648 +0,0 @@ -/* - * pass3.c -- pass #3 of e2fsck: Check for directory connectivity - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * Pass #3 assures that all directories are connected to the - * filesystem tree, using the following algorithm: - * - * First, the root directory is checked to make sure it exists; if - * not, e2fsck will offer to create a new one. It is then marked as - * "done". - * - * Then, pass3 interates over all directory inodes; for each directory - * it attempts to trace up the filesystem tree, using dirinfo.parent - * until it reaches a directory which has been marked "done". If it - * can not do so, then the directory must be disconnected, and e2fsck - * will offer to reconnect it to /lost+found. While it is chasing - * parent pointers up the filesystem tree, if pass3 sees a directory - * twice, then it has detected a filesystem loop, and it will again - * offer to reconnect the directory to /lost+found in to break the - * filesystem loop. - * - * Pass 3 also contains the subroutine, reconnect_file() to reconnect - * inodes to /lost+found; this subroutine is also used by pass 4. - * reconnect_file() calls get_lost_and_found(), which is responsible - * for creating /lost+found if it does not exist. - * - * Pass 3 frees the following data structures: - * - The dirinfo directory information cache. - */ - -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include "et/com_err.h" - -#include "e2fsck.h" -#include "problem.h" - -static void check_root(ext2_filsys fs); -static void check_directory(ext2_filsys fs, struct dir_info *dir, - struct problem_context *pctx); -static ino_t get_lost_and_found(ext2_filsys fs); -static void fix_dotdot(ext2_filsys fs, struct dir_info *dir, ino_t parent); -static errcode_t adjust_inode_count(ext2_filsys fs, ino_t ino, int adj); -static errcode_t expand_directory(ext2_filsys fs, ino_t dir); - -static ino_t lost_and_found = 0; -static int bad_lost_and_found = 0; - -static ext2fs_inode_bitmap inode_loop_detect; -static ext2fs_inode_bitmap inode_done_map; - -void pass3(ext2_filsys fs) -{ - int i; - errcode_t retval; - struct resource_track rtrack; - struct problem_context pctx; - struct dir_info *dir; - - init_resource_track(&rtrack); - -#ifdef MTRACE - mtrace_print("Pass 3"); -#endif - - if (!preen) - printf("Pass 3: Checking directory connectivity\n"); - - /* - * Allocate some bitmaps to do loop detection. - */ - retval = ext2fs_allocate_inode_bitmap(fs, - "inode loop detection bitmap", - &inode_loop_detect); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode_loop_detect"); - fatal_error(0); - } - retval = ext2fs_allocate_inode_bitmap(fs, "inode done bitmap", - &inode_done_map); - if (retval) { - com_err("ext2fs_allocate_inode_bitmap", retval, - "while allocating inode_done_map"); - fatal_error(0); - } - if (tflag) { - printf("Peak memory: "); - print_resource_track(&global_rtrack); - } - - check_root(fs); - ext2fs_mark_inode_bitmap(inode_done_map, EXT2_ROOT_INO); - - clear_problem_context(&pctx); - for (i=0; (dir = dir_info_iter(&i)) != 0;) { - if (ext2fs_test_inode_bitmap(inode_dir_map, dir->ino)) - check_directory(fs, dir, &pctx); - } - - - free_dir_info(fs); - ext2fs_free_inode_bitmap(inode_loop_detect); - ext2fs_free_inode_bitmap(inode_done_map); - if (tflag > 1) { - printf("Pass 3: "); - print_resource_track(&rtrack); - } -} - -/* - * This makes sure the root inode is present; if not, we ask if the - * user wants us to create it. Not creating it is a fatal error. - */ -static void check_root(ext2_filsys fs) -{ - blk_t blk; - errcode_t retval; - struct ext2_inode inode; - char * block; - - if (ext2fs_test_inode_bitmap(inode_used_map, EXT2_ROOT_INO)) { - /* - * If the root inode is a directory, die here. The - * user must have answered 'no' in pass1 when we - * offered to clear it. - */ - if (!(ext2fs_test_inode_bitmap(inode_dir_map, EXT2_ROOT_INO))) - fatal_error("Root inode not directory"); - return; - } - - if (!fix_problem(fs, PR_3_NO_ROOT_INODE, 0)) - fatal_error("Cannot proceed without a root inode."); - - read_bitmaps(fs); - - /* - * First, find a free block - */ - retval = ext2fs_new_block(fs, 0, block_found_map, &blk); - if (retval) { - com_err("ext2fs_new_block", retval, - "while trying to create root directory"); - fatal_error(0); - } - 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 - */ - retval = ext2fs_new_dir_block(fs, EXT2_ROOT_INO, EXT2_ROOT_INO, - &block); - if (retval) { - com_err("ext2fs_new_dir_block", retval, - "while creating new root directory"); - fatal_error(0); - } - - retval = ext2fs_write_dir_block(fs, blk, block); - if (retval) { - com_err("ext2fs_write_dir_block", retval, - "while writing the root directory block"); - fatal_error(0); - } - free(block); - - /* - * Set up the inode structure - */ - memset(&inode, 0, sizeof(inode)); - inode.i_mode = 040755; - inode.i_size = fs->blocksize; - inode.i_atime = inode.i_ctime = inode.i_mtime = time(0); - inode.i_links_count = 2; - inode.i_blocks = fs->blocksize / 512; - inode.i_block[0] = blk; - - /* - * Write out the inode. - */ - retval = ext2fs_write_inode(fs, EXT2_ROOT_INO, &inode); - if (retval) { - com_err("ext2fs_write_inode", retval, - "While trying to create /lost+found"); - fatal_error(0); - } - - /* - * Miscellaneous bookkeeping... - */ - add_dir_info(fs, EXT2_ROOT_INO, EXT2_ROOT_INO); - ext2fs_icount_store(inode_count, EXT2_ROOT_INO, 2); - ext2fs_icount_store(inode_link_info, EXT2_ROOT_INO, 2); - - ext2fs_mark_inode_bitmap(inode_used_map, EXT2_ROOT_INO); - ext2fs_mark_inode_bitmap(inode_dir_map, EXT2_ROOT_INO); - ext2fs_mark_inode_bitmap(fs->inode_map, EXT2_ROOT_INO); - ext2fs_mark_ib_dirty(fs); -} - -/* - * This subroutine is responsible for making sure that a particular - * directory is connected to the root; if it isn't we trace it up as - * far as we can go, and then offer to connect the resulting parent to - * the lost+found. We have to do loop detection; if we ever discover - * a loop, we treat that as a disconnected directory and offer to - * reparent it to lost+found. - */ -static void check_directory(ext2_filsys fs, struct dir_info *dir, - struct problem_context *pctx) -{ - struct dir_info *p = dir; - - ext2fs_clear_inode_bitmap(inode_loop_detect); - while (p) { - /* - * If we find a parent which we've already checked, - * then stop; we know it's either already connected to - * the directory tree, or it isn't but the user has - * already told us he doesn't want us to reconnect the - * disconnected subtree. - */ - if (ext2fs_test_inode_bitmap(inode_done_map, p->ino)) - goto check_dot_dot; - /* - * Mark this inode as being "done"; by the time we - * return from this function, the inode we either be - * verified as being connected to the directory tree, - * or we will have offered to reconnect this to - * lost+found. - */ - ext2fs_mark_inode_bitmap(inode_done_map, p->ino); - /* - * If this directory doesn't have a parent, or we've - * seen the parent once already, then offer to - * reparent it to lost+found - */ - if (!p->parent || - (ext2fs_test_inode_bitmap(inode_loop_detect, - p->parent))) - break; - ext2fs_mark_inode_bitmap(inode_loop_detect, - p->parent); - p = get_dir_info(p->parent); - } - /* - * If we've reached here, we've hit a detached directory - * inode; offer to reconnect it to lost+found. - */ - pctx->ino = p->ino; - if (fix_problem(fs, PR_3_UNCONNECTED_DIR, pctx)) { - if (reconnect_file(fs, p->ino)) - ext2fs_unmark_valid(fs); - else { - p->parent = lost_and_found; - fix_dotdot(fs, p, lost_and_found); - } - } - - /* - * Make sure that .. and the parent directory are the same; - * offer to fix it if not. - */ -check_dot_dot: - if (dir->parent != dir->dotdot) { - pctx->ino = dir->ino; - pctx->ino2 = dir->dotdot; - pctx->dir = dir->parent; - if (fix_problem(fs, PR_3_BAD_DOT_DOT, pctx)) - fix_dotdot(fs, dir, dir->parent); - } -} - -/* - * This routine gets the lost_and_found inode, making it a directory - * if necessary - */ -ino_t get_lost_and_found(ext2_filsys fs) -{ - ino_t ino; - blk_t blk; - errcode_t retval; - struct ext2_inode inode; - char * block; - const char name[] = "lost+found"; - - retval = ext2fs_lookup(fs, EXT2_ROOT_INO, name, - sizeof(name)-1, 0, &ino); - if (!retval) - return ino; - if (retval != ENOENT) - printf("Error while trying to find /lost+found: %s", - error_message(retval)); - if (!fix_problem(fs, PR_3_NO_LF_DIR, 0)) - return 0; - - /* - * 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("ext2fs_new_block", retval, - "while trying to create /lost+found directory"); - return 0; - } - ext2fs_mark_block_bitmap(block_found_map, blk); - ext2fs_mark_block_bitmap(fs->block_map, blk); - ext2fs_mark_bb_dirty(fs); - - /* - * Next find a free inode. - */ - retval = ext2fs_new_inode(fs, EXT2_ROOT_INO, 040755, inode_used_map, - &ino); - if (retval) { - com_err("ext2fs_new_inode", retval, - "while trying to create /lost+found directory"); - return 0; - } - ext2fs_mark_inode_bitmap(inode_used_map, ino); - ext2fs_mark_inode_bitmap(inode_dir_map, ino); - ext2fs_mark_inode_bitmap(fs->inode_map, ino); - ext2fs_mark_ib_dirty(fs); - - /* - * Now let's create the actual data block for the inode - */ - retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block); - if (retval) { - com_err("ext2fs_new_dir_block", retval, - "while creating new directory block"); - return 0; - } - - retval = ext2fs_write_dir_block(fs, blk, block); - free(block); - if (retval) { - com_err("ext2fs_write_dir_block", retval, - "while writing the directory block for /lost+found"); - return 0; - } - - /* - * Set up the inode structure - */ - memset(&inode, 0, sizeof(inode)); - inode.i_mode = 040755; - inode.i_size = fs->blocksize; - inode.i_atime = inode.i_ctime = inode.i_mtime = time(0); - inode.i_links_count = 2; - inode.i_blocks = fs->blocksize / 512; - inode.i_block[0] = blk; - - /* - * Next, write out the inode. - */ - retval = ext2fs_write_inode(fs, ino, &inode); - if (retval) { - com_err("ext2fs_write_inode", retval, - "While trying to create /lost+found"); - return 0; - } - /* - * Finally, create the directory link - */ - retval = ext2fs_link(fs, EXT2_ROOT_INO, name, ino, 0); - if (retval) { - com_err("ext2fs_link", retval, "While creating /lost+found"); - return 0; - } - - /* - * Miscellaneous bookkeeping that needs to be kept straight. - */ - add_dir_info(fs, ino, EXT2_ROOT_INO); - adjust_inode_count(fs, EXT2_ROOT_INO, +1); - ext2fs_icount_store(inode_count, ino, 2); - ext2fs_icount_store(inode_link_info, ino, 2); -#if 0 - printf("/lost+found created; inode #%lu\n", ino); -#endif - return ino; -} - -/* - * This routine will connect a file to lost+found - */ -int reconnect_file(ext2_filsys fs, ino_t inode) -{ - errcode_t retval; - char name[80]; - - if (bad_lost_and_found) { - printf("Bad or nonexistent /lost+found. Cannot reconnect.\n"); - return 1; - } - if (!lost_and_found) { - lost_and_found = get_lost_and_found(fs); - if (!lost_and_found) { - printf("Bad or nonexistent /lost+found. Cannot reconnect.\n"); - bad_lost_and_found++; - return 1; - } - } - - sprintf(name, "#%lu", inode); - retval = ext2fs_link(fs, lost_and_found, name, inode, 0); - if (retval == EXT2_ET_DIR_NO_SPACE) { - if (!fix_problem(fs, PR_3_EXPAND_LF_DIR, 0)) - return 1; - retval = expand_directory(fs, lost_and_found); - if (retval) { - printf("Could not expand /lost+found: %s\n", - error_message(retval)); - return 1; - } - retval = ext2fs_link(fs, lost_and_found, name, inode, 0); - } - if (retval) { - printf("Could not reconnect %lu: %s\n", inode, - error_message(retval)); - return 1; - } - - adjust_inode_count(fs, inode, +1); - - return 0; -} - -/* - * Utility routine to adjust the inode counts on an inode. - */ -static errcode_t adjust_inode_count(ext2_filsys fs, ino_t ino, int adj) -{ - errcode_t retval; - struct ext2_inode inode; - - if (!ino) - return 0; - - retval = ext2fs_read_inode(fs, ino, &inode); - if (retval) - return retval; - -#if 0 - printf("Adjusting link count for inode %lu by %d (from %d)\n", ino, adj, - inode.i_links_count); -#endif - - inode.i_links_count += adj; - if (adj == 1) { - ext2fs_icount_increment(inode_count, ino, 0); - ext2fs_icount_increment(inode_link_info, ino, 0); - } else { - ext2fs_icount_decrement(inode_count, ino, 0); - ext2fs_icount_decrement(inode_link_info, ino, 0); - } - - - retval = ext2fs_write_inode(fs, ino, &inode); - if (retval) - return retval; - - return 0; -} - -/* - * Fix parent --- this routine fixes up the parent of a directory. - */ -struct fix_dotdot_struct { - ext2_filsys fs; - ino_t parent; - int done; -}; - -static int fix_dotdot_proc(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private) -{ - struct fix_dotdot_struct *fp = (struct fix_dotdot_struct *) private; - errcode_t retval; - - if (dirent->name_len != 2) - return 0; - if (strncmp(dirent->name, "..", 2)) - return 0; - - retval = adjust_inode_count(fp->fs, dirent->inode, -1); - if (retval) - printf("Error while adjusting inode count on inode %u\n", - dirent->inode); - retval = adjust_inode_count(fp->fs, fp->parent, 1); - if (retval) - printf("Error while adjusting inode count on inode %lu\n", - fp->parent); - - dirent->inode = fp->parent; - - fp->done++; - return DIRENT_ABORT | DIRENT_CHANGED; -} - -static void fix_dotdot(ext2_filsys fs, struct dir_info *dir, ino_t parent) -{ - errcode_t retval; - struct fix_dotdot_struct fp; - - fp.fs = fs; - fp.parent = parent; - fp.done = 0; - -#if 0 - printf("Fixing '..' of inode %lu to be %lu...\n", dir->ino, parent); -#endif - - retval = ext2fs_dir_iterate(fs, dir->ino, DIRENT_FLAG_INCLUDE_EMPTY, - 0, fix_dotdot_proc, &fp); - if (retval || !fp.done) { - printf("Couldn't fix parent of inode %lu: %s\n\n", - dir->ino, retval ? error_message(retval) : - "Couldn't find parent direntory entry"); - ext2fs_unmark_valid(fs); - } - dir->dotdot = parent; - - return; -} - -/* - * These routines are responsible for expanding a /lost+found if it is - * too small. - */ - -struct expand_dir_struct { - int done; - errcode_t err; -}; - -static int expand_dir_proc(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private) -{ - struct expand_dir_struct *es = (struct expand_dir_struct *) private; - blk_t new_blk; - static blk_t last_blk = 0; - char *block; - errcode_t retval; - - if (*blocknr) { - last_blk = *blocknr; - return 0; - } - retval = ext2fs_new_block(fs, last_blk, block_found_map, &new_blk); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - if (blockcnt > 0) { - retval = ext2fs_new_dir_block(fs, 0, 0, &block); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - es->done = 1; - } else { - block = malloc(fs->blocksize); - if (!block) { - es->err = ENOMEM; - return BLOCK_ABORT; - } - memset(block, 0, fs->blocksize); - } - retval = ext2fs_write_dir_block(fs, new_blk, block); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - free(block); - *blocknr = new_blk; - ext2fs_mark_block_bitmap(block_found_map, new_blk); - ext2fs_mark_block_bitmap(fs->block_map, new_blk); - ext2fs_mark_bb_dirty(fs); - if (es->done) - return (BLOCK_CHANGED | BLOCK_ABORT); - else - return BLOCK_CHANGED; -} - -static errcode_t expand_directory(ext2_filsys fs, ino_t dir) -{ - errcode_t retval; - struct expand_dir_struct es; - struct ext2_inode inode; - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - - retval = ext2fs_check_directory(fs, dir); - if (retval) - return retval; - - es.done = 0; - es.err = 0; - - retval = ext2fs_block_iterate(fs, dir, BLOCK_FLAG_APPEND, - 0, expand_dir_proc, &es); - - if (es.err) - return es.err; - if (!es.done) - return EXT2_ET_EXPAND_DIR_ERR; - - /* - * Update the size and block count fields in the inode. - */ - retval = ext2fs_read_inode(fs, dir, &inode); - if (retval) - return retval; - - inode.i_size += fs->blocksize; - inode.i_blocks += fs->blocksize / 512; - - e2fsck_write_inode(fs, dir, &inode, "expand_directory"); - - return 0; -} - - - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/pass4.c b/gnu/usr.sbin/e2fsprogs/e2fsck/pass4.c deleted file mode 100644 index 627b55488bf..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/pass4.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * pass4.c -- pass #4 of e2fsck: Check reference counts - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * Pass 4 frees the following data structures: - * - A bitmap of which inodes are in bad blocks. (inode_bb_map) - */ - -#include "e2fsck.h" -#include "problem.h" - -/* - * This routine is called when an inode is not connected to the - * directory tree. - * - * This subroutine returns 1 then the caller shouldn't bother with the - * rest of the pass 4 tests. - */ -static int disconnect_inode(ext2_filsys fs, ino_t i) -{ - struct ext2_inode inode; - struct problem_context pctx; - - e2fsck_read_inode(fs, i, &inode, "pass4: disconnect_inode"); - clear_problem_context(&pctx); - pctx.ino = i; - pctx.inode = &inode; - - if (!inode.i_blocks && (LINUX_S_ISREG(inode.i_mode) || - LINUX_S_ISDIR(inode.i_mode))) { - /* - * This is a zero-length file; prompt to delete it... - */ - if (fix_problem(fs, PR_4_ZERO_LEN_INODE, &pctx)) { - ext2fs_icount_store(inode_link_info, i, 0); - inode.i_links_count = 0; - inode.i_dtime = time(0); - e2fsck_write_inode(fs, i, &inode, - "disconnect_inode"); - /* - * Fix up the bitmaps... - */ - read_bitmaps(fs); - ext2fs_unmark_inode_bitmap(inode_used_map, i); - ext2fs_unmark_inode_bitmap(inode_dir_map, i); - ext2fs_unmark_inode_bitmap(fs->inode_map, i); - ext2fs_mark_ib_dirty(fs); - return 0; - } - } - - /* - * Prompt to reconnect. - */ - if (fix_problem(fs, PR_4_UNATTACHED_INODE, &pctx)) { - if (reconnect_file(fs, i)) - ext2fs_unmark_valid(fs); - } else { - /* - * If we don't attach the inode, then skip the - * i_links_test since there's no point in trying to - * force i_links_count to zero. - */ - ext2fs_unmark_valid(fs); - return 1; - } - return 0; -} - - -void pass4(ext2_filsys fs) -{ - ino_t i; - struct ext2_inode inode; - struct resource_track rtrack; - struct problem_context pctx; - __u16 link_count, link_counted; - - init_resource_track(&rtrack); - -#ifdef MTRACE - mtrace_print("Pass 4"); -#endif - - if (!preen) - printf("Pass 4: Checking reference counts\n"); - clear_problem_context(&pctx); - for (i=1; i <= fs->super->s_inodes_count; i++) { - if (i == EXT2_BAD_INO || - (i > EXT2_ROOT_INO && i < EXT2_FIRST_INODE(fs->super))) - continue; - if (!(ext2fs_test_inode_bitmap(inode_used_map, i)) || - (inode_bb_map && - ext2fs_test_inode_bitmap(inode_bb_map, i))) - continue; - ext2fs_icount_fetch(inode_link_info, i, &link_count); - ext2fs_icount_fetch(inode_count, i, &link_counted); - if (link_counted == 0) { - if (disconnect_inode(fs, i)) - continue; - ext2fs_icount_fetch(inode_link_info, i, &link_count); - ext2fs_icount_fetch(inode_count, i, &link_counted); - } - if (link_counted != link_count) { - e2fsck_read_inode(fs, i, &inode, "pass4"); - pctx.ino = i; - pctx.inode = &inode; - if (link_count != inode.i_links_count) { - printf("WARNING: PROGRAMMING BUG IN E2FSCK!\n"); - printf("\tOR SOME BONEHEAD (YOU) IS CHECKING " - "A MOUNTED (LIVE) FILESYSTEM.\n"); - printf("inode_link_info[%ld] is %u, " - "inode.i_links_count is %d. " - "They should be the same!\n", - i, link_count, - inode.i_links_count); - } - pctx.num = link_counted; - if (fix_problem(fs, PR_4_BAD_REF_COUNT, &pctx)) { - inode.i_links_count = link_counted; - e2fsck_write_inode(fs, i, &inode, "pass4"); - } - } - } - ext2fs_free_icount(inode_link_info); inode_link_info = 0; - ext2fs_free_icount(inode_count); inode_count = 0; - ext2fs_free_inode_bitmap(inode_bb_map); - if (tflag > 1) { - printf("Pass 4: "); - print_resource_track(&rtrack); - } -} - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/pass5.c b/gnu/usr.sbin/e2fsprogs/e2fsck/pass5.c deleted file mode 100644 index def492a9fd6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/pass5.c +++ /dev/null @@ -1,413 +0,0 @@ -/* - * pass5.c --- check block and inode bitmaps against on-disk bitmaps - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#include "et/com_err.h" - -#include "e2fsck.h" - -static void check_block_bitmaps(ext2_filsys fs); -static void check_inode_bitmaps(ext2_filsys fs); -static void check_inode_end(ext2_filsys fs); -static void check_block_end(ext2_filsys fs); - -static int do_fix = -1; -static const char *fix_question = "Fix summary information"; - -void pass5(ext2_filsys fs) -{ - struct resource_track rtrack; - -#ifdef MTRACE - mtrace_print("Pass 5"); -#endif - - init_resource_track(&rtrack); - - if (!preen) - printf("Pass 5: Checking group summary information\n"); - - read_bitmaps(fs); - - check_block_bitmaps(fs); - check_inode_bitmaps(fs); - check_inode_end(fs); - check_block_end(fs); - - ext2fs_free_inode_bitmap(inode_used_map); - ext2fs_free_inode_bitmap(inode_dir_map); - ext2fs_free_block_bitmap(block_found_map); - - if (tflag > 1) { - printf("Pass 5: "); - print_resource_track(&rtrack); - } -} - -static void check_block_bitmaps(ext2_filsys fs) -{ - blk_t i; - int *free_array; - int group = 0; - int blocks = 0; - int free_blocks = 0; - int group_free = 0; - int actual, bitmap; - const char *print_header = "Block bitmap differences:"; - - 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_fast_test_block_bitmap(block_found_map, i); - bitmap = ext2fs_fast_test_block_bitmap(fs->block_map, i); - - if (actual == bitmap) - goto do_counts; - - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen && print_header) { - printf(print_header); - print_header = 0; - } - if (!actual && bitmap) { - /* - * Block not used, but marked in use in the bitmap. - */ - if (!preen) - printf(" -%u", i); - if (do_fix) - ext2fs_unmark_block_bitmap(fs->block_map, - i); - } else { - /* - * Block used, but not marked in use in the bitmap. - */ - if (!preen) - printf(" +%u", i); - if (do_fix) - ext2fs_mark_block_bitmap(fs->block_map, - i); - } - if (do_fix) { - ext2fs_mark_bb_dirty(fs); - bitmap = actual; - } else - ext2fs_unmark_valid(fs); - - do_counts: - if (!bitmap) { - group_free++; - free_blocks++; - } - blocks ++; - if ((blocks == fs->super->s_blocks_per_group) || - (i == fs->super->s_blocks_count-1)) { - free_array[group] = group_free; - group ++; - blocks = 0; - group_free = 0; - } - } - if (!print_header) - printf(". %s\n", fix_msg[do_fix]); - for (i = 0; i < fs->group_desc_count; i++) { - if (free_array[i] != fs->group_desc[i].bg_free_blocks_count) { - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen) - printf("Free blocks count wrong for " - "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) { - fs->group_desc[i].bg_free_blocks_count = - free_array[i]; - ext2fs_mark_super_dirty(fs); - } else - ext2fs_unmark_valid(fs); - } - } - if (free_blocks != fs->super->s_free_blocks_count) { - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen) - printf("Free blocks count wrong " - "(%u, counted=%d). %s\n", - fs->super->s_free_blocks_count, free_blocks, - fix_msg[do_fix]); - if (do_fix) { - fs->super->s_free_blocks_count = free_blocks; - ext2fs_mark_super_dirty(fs); - } else - ext2fs_unmark_valid(fs); - } - free(free_array); -} - -static void check_inode_bitmaps(ext2_filsys fs) -{ - ino_t i; - int free_inodes = 0; - int group_free = 0; - int dirs_count = 0; - int group = 0; - int inodes = 0; - int *free_array; - int *dir_array; - int actual, bitmap; - const char *print_header = "Inode bitmap differences:"; - - free_array = allocate_memory(fs->group_desc_count * sizeof(int), - "free inode count array"); - - 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_fast_test_inode_bitmap(inode_used_map, i); - bitmap = ext2fs_fast_test_inode_bitmap(fs->inode_map, i); - - if (actual == bitmap) - goto do_counts; - - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen && print_header) { - printf(print_header); - print_header = 0; - } - if (!actual && bitmap) { - /* - * Inode wasn't used, but marked in bitmap - */ - if (!preen) - printf(" -%lu", i); - if (do_fix) - ext2fs_unmark_inode_bitmap(fs->inode_map, i); - } else if (actual && !bitmap) { - /* - * Inode used, but not in bitmap - */ - if (!preen) - printf (" +%lu", i); - if (do_fix) - ext2fs_mark_inode_bitmap(fs->inode_map, i); - } - if (do_fix) { - ext2fs_mark_ib_dirty(fs); - bitmap = actual; - } else - ext2fs_unmark_valid(fs); - -do_counts: - if (!bitmap) { - group_free++; - free_inodes++; - } else { - if (ext2fs_test_inode_bitmap(inode_dir_map, i)) - dirs_count++; - } - inodes++; - if ((inodes == fs->super->s_inodes_per_group) || - (i == fs->super->s_inodes_count)) { - free_array[group] = group_free; - dir_array[group] = dirs_count; - group ++; - inodes = 0; - group_free = 0; - dirs_count = 0; - } - } - if (!print_header) - printf(". %s\n", fix_msg[do_fix]); - - for (i = 0; i < fs->group_desc_count; i++) { - if (free_array[i] != fs->group_desc[i].bg_free_inodes_count) { - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen) - printf ("Free inodes count wrong for " - "group #%lu (%u, counted=%d). %s\n", i, - fs->group_desc[i].bg_free_inodes_count, - free_array[i], fix_msg[do_fix]); - if (do_fix) { - fs->group_desc[i].bg_free_inodes_count = - free_array[i]; - ext2fs_mark_super_dirty(fs); - } else - ext2fs_unmark_valid(fs); - } - if (dir_array[i] != fs->group_desc[i].bg_used_dirs_count) { - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen) - printf ("Directories count wrong for " - "group #%lu (%u, counted=%d). %s\n", i, - fs->group_desc[i].bg_used_dirs_count, - dir_array[i], fix_msg[do_fix]); - if (do_fix) { - fs->group_desc[i].bg_used_dirs_count = - dir_array[i]; - ext2fs_mark_super_dirty(fs); - } else - ext2fs_unmark_valid(fs); - } - } - if (free_inodes != fs->super->s_free_inodes_count) { - if (do_fix < 0) - do_fix = ask(fix_question, 1); - if (!preen) - printf("Free inodes count wrong " - "(%u, counted=%d). %s\n", - fs->super->s_free_inodes_count, free_inodes, - fix_msg[do_fix]); - if (do_fix) { - fs->super->s_free_inodes_count = free_inodes; - ext2fs_mark_super_dirty(fs); - } else - ext2fs_unmark_valid(fs); - } - free(free_array); - free(dir_array); -} - -static void check_inode_end(ext2_filsys fs) -{ - ino_t end, save_inodes_count, i; - errcode_t retval; - - end = EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count; - retval = ext2fs_fudge_inode_bitmap_end(fs->inode_map, end, - &save_inodes_count); - if (retval) { - com_err("check_inode_end", retval, - "while trying to fudge end of inode bitmap"); - fatal_error(0); - } - if (save_inodes_count == end) - return; - - for (i = save_inodes_count + 1; i <= end; i++) { - if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) { - printf("Padding at end of inode bitmap is not set. "); - if (ask("Fix", 1)) { - for (i = save_inodes_count + 1; i <= end; i++) - ext2fs_mark_inode_bitmap(fs->inode_map, - i); - ext2fs_mark_ib_dirty(fs); - } else - ext2fs_unmark_valid(fs); - break; - } - } - - retval = ext2fs_fudge_inode_bitmap_end(fs->inode_map, - save_inodes_count, 0); - if (retval) { - com_err("check_inode_end", retval, - "while trying to fudge end of inode bitmap back"); - fatal_error(0); - } -} - -static void check_block_end(ext2_filsys fs) -{ - blk_t end, save_blocks_count, i; - errcode_t retval; - - end = fs->block_map->start + - (EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count) - 1; - retval = ext2fs_fudge_block_bitmap_end(fs->block_map, end, - &save_blocks_count); - if (retval) { - com_err("check_block_end", retval, - "while trying to fudge end of block bitmap"); - fatal_error(0); - } - if (save_blocks_count == end) - return; - - for (i = save_blocks_count + 1; i <= end; i++) { - if (!ext2fs_test_block_bitmap(fs->block_map, i)) { - printf("Padding at end of block bitmap is not set. "); - - if (ask("Fix", 1)) { - for (i = save_blocks_count + 1; i < end; i++) - ext2fs_mark_block_bitmap(fs->block_map, - i); - ext2fs_mark_bb_dirty(fs); - } else - ext2fs_unmark_valid(fs); - break; - } - } - - retval = ext2fs_fudge_block_bitmap_end(fs->block_map, - save_blocks_count, 0); - if (retval) { - com_err("check_block_end", retval, - "while trying to fudge end of block bitmap back"); - fatal_error(0); - } -} - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/problem.c b/gnu/usr.sbin/e2fsprogs/e2fsck/problem.c deleted file mode 100644 index 2752633119f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/problem.c +++ /dev/null @@ -1,466 +0,0 @@ -/* - * problem.c --- report filesystem problems to the user - * - * Copyright 1996, 1997 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <ctype.h> -#include <termios.h> - -#include "e2fsck.h" - -#include "problem.h" - -#define PROMPT_FIX 0 -#define PROMPT_CLEAR 1 -#define PROMPT_RELOCATE 2 -#define PROMPT_ALLOCATE 3 -#define PROMPT_EXPAND 4 -#define PROMPT_CONNECT 5 -#define PROMPT_CREATE 6 -#define PROMPT_SALVAGE 7 -#define PROMPT_TRUNCATE 8 -#define PROMPT_CLEAR_INODE 9 - -/* - * These are the prompts which are used to ask the user if they want - * to fix a problem. - */ -static const char *prompt[] = { - "Fix", /* 0 */ - "Clear", /* 1 */ - "Relocate", /* 2 */ - "Allocate", /* 3 */ - "Expand", /* 4 */ - "Connect to /lost+found", /* 5 */ - "Create", /* 6 */ - "Salvage", /* 7 */ - "Truncate", /* 8 */ - "Clear inode" /* 9 */ - }; - -/* - * These messages are printed when we are preen mode and we will be - * automatically fixing the problem. - */ -static const char *preen_msg[] = { - "FIXED", /* 0 */ - "CLEARED", /* 1 */ - "RELOCATED", /* 2 */ - "ALLOCATED", /* 3 */ - "EXPANDED", /* 4 */ - "RECONNECTED", /* 5 */ - "CREATED", /* 6 */ - "SALVAGED", /* 7 */ - "TRUNCATED", /* 8 */ - "INODE CLEARED" /* 9 */ -}; - -static struct e2fsck_problem problem_table[] = { - - /* Pre-Pass 1 errors */ - - /* Block bitmap not in group */ - { PR_0_BB_NOT_GROUP, "@b @B for @g %g is not in @g. (@b %b)\n", - PROMPT_RELOCATE, 0 }, - - /* Inode bitmap not in group */ - { PR_0_IB_NOT_GROUP, "@i @B for @g %g is not in @g. (@b %b)\n", - PROMPT_RELOCATE, 0 }, - - /* Inode table not in group */ - { PR_0_ITABLE_NOT_GROUP, - "@i table for @g %g is not in @g. (@b %b)\n" - "WARNING: SEVERE DATA LOSS POSSIBLE.\n", - PROMPT_RELOCATE, 0 }, - - /* Pass 1 errors */ - - /* Root directory is not an inode */ - { PR_1_ROOT_NO_DIR, "@r is not a @d. ", - PROMPT_CLEAR, 0 }, - - /* Root directory has dtime set */ - { PR_1_ROOT_DTIME, - "@r has dtime set (probably due to old mke2fs). ", - PROMPT_FIX, PR_PREEN_OK }, - - /* Reserved inode has bad mode */ - { PR_1_RESERVED_BAD_MODE, - "Reserved @i %i has bad mode. ", - PROMPT_CLEAR, PR_PREEN_OK }, - - /* Deleted inode has zero dtime */ - { PR_1_ZERO_DTIME, - "@D @i %i has zero dtime. ", - PROMPT_FIX, PR_PREEN_OK }, - - /* Inode in use, but dtime set */ - { PR_1_SET_DTIME, - "@i %i is in use, but has dtime set. ", - PROMPT_FIX, PR_PREEN_OK }, - - /* Zero-length directory */ - { PR_1_ZERO_LENGTH_DIR, - "@i %i is a @z @d. ", - PROMPT_CLEAR, PR_PREEN_OK }, - - /* Block bitmap conflicts with some other fs block */ - { PR_1_BB_CONFLICT, - "@g %N's @b @B at %b @C.\n", - PROMPT_RELOCATE, 0 }, - - /* Inode bitmap conflicts with some other fs block */ - { PR_1_IB_CONFLICT, - "@g %N's @i @B at %b @C.\n", - PROMPT_RELOCATE, 0 }, - - /* Inode table conflicts with some other fs block */ - { PR_1_ITABLE_CONFLICT, - "@g %g's @i table at %b @C.\n", - PROMPT_RELOCATE, 0 }, - - /* Block bitmap is on a bad block */ - { PR_1_BB_BAD_BLOCK, - "@g %g's @b @B (%b) is bad. ", - PROMPT_RELOCATE, 0 }, - - /* Inode bitmap is on a bad block */ - { PR_1_IB_BAD_BLOCK, - "@g %g's @i @B (%b) is bad. ", - PROMPT_RELOCATE, 0 }, - - /* Inode has incorrect i_size */ - { PR_1_BAD_I_SIZE, - "@i %i, i_size is %Is, @s %N. ", - PROMPT_FIX, PR_PREEN_OK }, - - /* Inode has incorrect i_blocks */ - { PR_1_BAD_I_BLOCKS, - "@i %i, i_blocks is %Ib, @s %N. ", - PROMPT_FIX, PR_PREEN_OK }, - - /* Illegal block number in inode */ - { PR_1_ILLEGAL_BLOCK_NUM, - "Illegal @b #%B (%b) in @i %i. ", - PROMPT_CLEAR, PR_LATCH_BLOCK }, - - /* Block number overlaps fs metadata */ - { PR_1_BLOCK_OVERLAPS_METADATA, - "@b #%B (%b) overlaps filesystem metadata in @i %i. ", - PROMPT_CLEAR, PR_LATCH_BLOCK }, - - /* Inode has illegal blocks (latch question) */ - { PR_1_INODE_BLOCK_LATCH, - "@i %i has illegal @b(s). ", - PROMPT_CLEAR, 0 }, - - /* Too many bad blocks in inode */ - { PR_1_TOO_MANY_BAD_BLOCKS, - "Too many illegal @bs in @i %i.\n", - PROMPT_CLEAR_INODE, PR_NO_OK }, - - /* Illegal block number in bad block inode */ - { PR_1_BB_ILLEGAL_BLOCK_NUM, - "Illegal @b #%B (%b) in bad @b @i. ", - PROMPT_CLEAR, PR_LATCH_BBLOCK }, - - /* Bad block inode has illegal blocks (latch question) */ - { PR_1_INODE_BBLOCK_LATCH, - "Bad @b @i has illegal @b(s). ", - PROMPT_CLEAR, 0 }, - - /* Pass 1b errors */ - - /* File has duplicate blocks */ - { PR_1B_DUP_FILE, - "File %Q (@i #%i, mod time %IM) \n" - " has %B duplicate @b(s), shared with %N file(s):\n", - PROMPT_FIX, PR_MSG_ONLY }, - - /* List of files sharing duplicate blocks */ - { PR_1B_DUP_FILE_LIST, - "\t%Q (@i #%i, mod time %IM)\n", - PROMPT_FIX, PR_MSG_ONLY }, - - /* File sharing blocks with filesystem metadata */ - { PR_1B_SHARE_METADATA, - "\t<filesystem metadata>\n", - PROMPT_FIX, PR_MSG_ONLY }, - - /* Pass 2 errors */ - - /* Bad inode number for '.' */ - { PR_2_BAD_INODE_DOT, - "Bad @i number for '.' in @d @i %i.\n", - PROMPT_FIX, 0 }, - - /* Directory entry has bad inode number */ - { PR_2_BAD_INO, - "@E has bad @i #: %Di.\n", - PROMPT_CLEAR, 0 }, - - /* Directory entry has deleted or unused inode */ - { PR_2_UNUSED_INODE, - "@E has @D/unused @i %Di. ", - PROMPT_CLEAR, PR_PREEN_OK }, - - /* Directry entry is link to '.' */ - { PR_2_LINK_DOT, - "@E @L to '.' ", - PROMPT_CLEAR, 0 }, - - /* Directory entry points to inode now located in a bad block */ - { PR_2_BB_INODE, - "@E points to @i (%Di) located in a bad @b.\n", - PROMPT_CLEAR, 0 }, - - /* Directory entry contains a link to a directory */ - { PR_2_LINK_DIR, - "@E @L to @d %P (%Di).\n", - PROMPT_CLEAR, 0 }, - - /* Directory entry contains a link to the root directry */ - { PR_2_LINK_ROOT, - "@E @L to the @r.\n", - PROMPT_CLEAR, 0 }, - - /* Directory entry has illegal characters in its name */ - { PR_2_BAD_NAME, - "@E has illegal characters in its name.\n", - PROMPT_FIX, 0 }, - - /* Missing '.' in directory inode */ - { PR_2_MISSING_DOT, - "Missing '.' in @d @i %i.\n", - PROMPT_FIX, 0 }, - - /* Missing '..' in directory inode */ - { PR_2_MISSING_DOT_DOT, - "Missing '..' in @d @i %i.\n", - PROMPT_FIX, 0 }, - - /* First entry in directory inode doesn't contain '.' */ - { PR_2_1ST_NOT_DOT, - "First @e '%Dn' (inode=%Di) in @d @i %i (%p) @s '.'\n", - PROMPT_FIX, 0 }, - - /* Second entry in directory inode doesn't contain '..' */ - { PR_2_2ND_NOT_DOT_DOT, - "Second @e '%Dn' (inode=%Di) in @d @i %i @s '..'\n", - PROMPT_FIX, 0 }, - - /* i_faddr should be zero */ - { PR_2_FADDR_ZERO, - "i_faddr @F %IF, @s zero.\n", - PROMPT_CLEAR, 0 }, - - /* i_file_acl should be zero */ - { PR_2_FILE_ACL_ZERO, - "i_file_acl @F %If, @s zero.\n", - PROMPT_CLEAR, 0 }, - - /* i_dir_acl should be zero */ - { PR_2_DIR_ACL_ZERO, - "i_dir_acl @F %Id, @s zero.\n", - PROMPT_CLEAR, 0 }, - - /* i_frag should be zero */ - { PR_2_FRAG_ZERO, - "i_frag @F %N, @s zero.\n", - PROMPT_CLEAR, 0 }, - - /* i_fsize should be zero */ - { PR_2_FSIZE_ZERO, - "i_fsize @F %N, @s zero.\n", - PROMPT_CLEAR, 0 }, - - /* inode has bad mode */ - { PR_2_BAD_MODE, - "@i %i (%Q) has a bad mode (%Im).\n", - PROMPT_CLEAR, 0 }, - - /* directory corrupted */ - { PR_2_DIR_CORRUPTED, - "@d @i %i, @b %B, offset %N: @d corrupted\n", - PROMPT_SALVAGE, 0 }, - - /* filename too long */ - { PR_2_FILENAME_LONG, - "@d @i %i, @b %B, offset %N: filename too long\n", - PROMPT_TRUNCATE, 0 }, - - /* Directory inode has a missing block (hole) */ - { PR_2_DIRECTORY_HOLE, - "@d @i %i has an unallocated @b #%B. ", - PROMPT_ALLOCATE, 0 }, - - /* '.' is not NULL terminated */ - { PR_2_DOT_NULL_TERM, - "'.' directory entry in @d @i %i is not NULL terminated\n", - PROMPT_FIX, 0 }, - - /* '..' is not NULL terminated */ - { PR_2_DOT_DOT_NULL_TERM, - "'..' directory entry in @d @i %i is not NULL terminated\n", - PROMPT_FIX, 0 }, - - /* Pass 3 errors */ - - /* Root inode not allocated */ - { PR_3_NO_ROOT_INODE, - "@r not allocated. ", - PROMPT_ALLOCATE, 0 }, - - /* No room in lost+found */ - { PR_3_EXPAND_LF_DIR, - "No room in @l @d. ", - PROMPT_EXPAND, 0 }, - - /* Unconnected directory inode */ - { PR_3_UNCONNECTED_DIR, - "Unconnected @d @i %i (%p)\n", - PROMPT_CONNECT, 0 }, - - /* /lost+found not found */ - { PR_3_NO_LF_DIR, - "/@l not found. ", - PROMPT_CREATE, 0 }, - - /* .. entry is incorrect */ - { PR_3_BAD_DOT_DOT, - "'..' in %Q (%i) is %P (%j), @s %q (%d).\n", - PROMPT_FIX, 0 }, - - /* Pass 4 errors */ - - /* Unattached zero-length inode */ - { PR_4_ZERO_LEN_INODE, - "@u @z @i %i. ", - PROMPT_CLEAR, PR_PREEN_OK|PR_NO_OK }, - - /* Unattached inode */ - { PR_4_UNATTACHED_INODE, - "@u @i %i\n", - PROMPT_CONNECT, 0 }, - - /* Inode ref count wrong */ - { PR_4_BAD_REF_COUNT, - "@i %i ref count is %Il, @s %N. ", - PROMPT_FIX, PR_PREEN_OK }, - - { 0 } -}; - -/* - * This is the latch flags register. It allows several problems to be - * "latched" together. This means that the user has to answer but one - * question for the set of problems, and all of the associated - * problems will be either fixed or not fixed. - */ -char pr_latch[7]; /* Latch flags register */ -char pr_suppress[7]; /* Latch groups which are suppressed */ -int latch_question[7] = { - PR_1_INODE_BLOCK_LATCH, - PR_1_INODE_BBLOCK_LATCH -}; - -static struct e2fsck_problem *find_problem(int code) -{ - int i; - - for (i=0; problem_table[i].e2p_code; i++) { - if (problem_table[i].e2p_code == code) - return &problem_table[i]; - } - return 0; -} - -void reset_problem_latch(int mask) -{ - pr_latch[PR_LATCH(mask)] = 0; - pr_suppress[PR_LATCH(mask)] = 0; -} - -void suppress_latch_group(int mask, int value) -{ - pr_suppress[PR_LATCH(mask)] = value; -} - -void clear_problem_context(struct problem_context *ctx) -{ - memset(ctx, 0, sizeof(struct problem_context)); - ctx->blkcount = -1; - ctx->group = -1; -} - -int fix_problem(ext2_filsys fs, int code, struct problem_context *ctx) -{ - struct e2fsck_problem *ptr; - int def_yn, answer; - int latch; - int print_answer = 0; - int suppress = 0; - - ptr = find_problem(code); - if (!ptr) { - printf("Unhandled error code (%d)!\n", code); - return 0; - } - def_yn = (ptr->flags & PR_NO_DEFAULT) ? 0 : 1; - - /* - * Do special latch processing. This is where we ask the - * latch question, if it exists - */ - if (ptr->flags & PR_LATCH_MASK) { - latch = PR_LATCH(ptr->flags); - if (latch_question[latch] && !pr_latch[latch]) - pr_latch[latch] = fix_problem(fs, - latch_question[latch], - ctx) + 1; - if (pr_suppress[latch]) - suppress++; - } - - if (!suppress) { - if (preen) - printf("%s: ", device_name); - print_e2fsck_message(fs, ptr->e2p_description, ctx, 1); - } - if (!(ptr->flags & PR_PREEN_OK)) - preenhalt(fs); - - if (ptr->flags & PR_MSG_ONLY) - return 1; - - if (preen) { - answer = def_yn; - print_answer = 1; - } else if (ptr->flags & PR_LATCH_MASK) { - latch = PR_LATCH(ptr->flags); - if (!pr_latch[latch]) - pr_latch[latch] = - ask(prompt[(int) ptr->prompt], def_yn) + 1; - else - print_answer = 1; - answer = pr_latch[latch] - 1; - } else - answer = ask(prompt[(int) ptr->prompt], def_yn); - if (!answer && !(ptr->flags & PR_NO_OK)) - ext2fs_unmark_valid(fs); - - if (print_answer) - printf("%s.\n", - answer ? preen_msg[(int) ptr->prompt] : "IGNORED"); - - return answer; -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/problem.h b/gnu/usr.sbin/e2fsprogs/e2fsck/problem.h deleted file mode 100644 index e41cee15037..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/problem.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * problem.h --- e2fsck problem error codes - * - * Copyright 1996 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -struct problem_context { - ino_t ino, ino2, dir; - struct ext2_inode *inode; - struct ext2_dir_entry *dirent; - blk_t blk; - int blkcount, group; - __u32 num; -}; - -struct e2fsck_problem { - int e2p_code; - const char * e2p_description; - char prompt; - short flags; -}; - -#define PR_PREEN_OK 0x0001 /* Don't need to do preenhalt */ -#define PR_NO_OK 0x0002 /* If user answers no, don't make fs invalid */ -#define PR_NO_DEFAULT 0x0004 /* Default to no */ -#define PR_MSG_ONLY 0x0008 /* Print message only */ - -/* - * We define a set of "latch groups"; these are problems which are - * handled as a set. The user answers once for a particular latch - * group. - */ -#define PR_LATCH_MASK 0x0070 /* Latch mask */ -#define PR_LATCH_BLOCK 0x0010 /* Latch for illegal blocks (pass 1) */ -#define PR_LATCH_BBLOCK 0x0020 /* Latch for bad block inode blocks (pass 1) */ - -#define PR_LATCH(x) ((((x) & PR_LATCH_MASK) >> 4) - 1) - -/* - * Pre-Pass 1 errors - */ - -/* Block bitmap not in group */ -#define PR_0_BB_NOT_GROUP 0x000001 - -/* Inode bitmap not in group */ -#define PR_0_IB_NOT_GROUP 0x000002 - -/* Inode table not in group */ -#define PR_0_ITABLE_NOT_GROUP 0x000003 - -/* - * Pass 1 errors - */ - -/* Root directory is not an inode */ -#define PR_1_ROOT_NO_DIR 0x010001 - -/* Root directory has dtime set */ -#define PR_1_ROOT_DTIME 0x010002 - -/* Reserved inode has bad mode */ -#define PR_1_RESERVED_BAD_MODE 0x010003 - -/* Deleted inode has zero dtime */ -#define PR_1_ZERO_DTIME 0x010004 - -/* Inode in use, but dtime set */ -#define PR_1_SET_DTIME 0x010005 - -/* Zero-length directory */ -#define PR_1_ZERO_LENGTH_DIR 0x010006 - -/* Block bitmap conflicts with some other fs block */ -#define PR_1_BB_CONFLICT 0x010007 - -/* Inode bitmap conflicts with some other fs block */ -#define PR_1_IB_CONFLICT 0x010008 - -/* Inode table conflicts with some other fs block */ -#define PR_1_ITABLE_CONFLICT 0x010009 - -/* Block bitmap is on a bad block */ -#define PR_1_BB_BAD_BLOCK 0x01000A - -/* Inode bitmap is on a bad block */ -#define PR_1_IB_BAD_BLOCK 0x01000B - -/* Inode has incorrect i_size */ -#define PR_1_BAD_I_SIZE 0x01000C - -/* Inode has incorrect i_blocks */ -#define PR_1_BAD_I_BLOCKS 0x01000D - -/* Illegal block number in inode */ -#define PR_1_ILLEGAL_BLOCK_NUM 0x01000E - -/* Block number overlaps fs metadata */ -#define PR_1_BLOCK_OVERLAPS_METADATA 0x01000F - -/* Inode has illegal blocks (latch question) */ -#define PR_1_INODE_BLOCK_LATCH 0x010010 - -/* Too many bad blocks in inode */ -#define PR_1_TOO_MANY_BAD_BLOCKS 0x010011 - -/* Illegal block number in bad block inode */ -#define PR_1_BB_ILLEGAL_BLOCK_NUM 0x010012 - -/* Bad block inode has illegal blocks (latch question) */ -#define PR_1_INODE_BBLOCK_LATCH 0x010013 - -/* - * Pass 1b errors - */ - -/* File has duplicate blocks */ -#define PR_1B_DUP_FILE 0x011001 - -/* List of files sharing duplicate blocks */ -#define PR_1B_DUP_FILE_LIST 0x011002 - -/* File sharing blocks with filesystem metadata */ -#define PR_1B_SHARE_METADATA 0x011003 - -/* - * Pass 2 errors - */ - -/* Bad inode number for '.' */ -#define PR_2_BAD_INODE_DOT 0x020001 - -/* Directory entry has bad inode number */ -#define PR_2_BAD_INO 0x020002 - -/* Directory entry has deleted or unused inode */ -#define PR_2_UNUSED_INODE 0x020003 - -/* Directry entry is link to '.' */ -#define PR_2_LINK_DOT 0x020004 - -/* Directory entry points to inode now located in a bad block */ -#define PR_2_BB_INODE 0x020005 - -/* Directory entry contains a link to a directory */ -#define PR_2_LINK_DIR 0x020006 - -/* Directory entry contains a link to the root directry */ -#define PR_2_LINK_ROOT 0x020007 - -/* Directory entry has illegal characters in its name */ -#define PR_2_BAD_NAME 0x020008 - -/* Missing '.' in directory inode */ -#define PR_2_MISSING_DOT 0x020009 - -/* Missing '..' in directory inode */ -#define PR_2_MISSING_DOT_DOT 0x02000A - -/* First entry in directory inode doesn't contain '.' */ -#define PR_2_1ST_NOT_DOT 0x02000B - -/* Second entry in directory inode doesn't contain '..' */ -#define PR_2_2ND_NOT_DOT_DOT 0x02000C - -/* i_faddr should be zero */ -#define PR_2_FADDR_ZERO 0x02000D - -/* i_file_acl should be zero */ -#define PR_2_FILE_ACL_ZERO 0x02000E - -/* i_dir_acl should be zero */ -#define PR_2_DIR_ACL_ZERO 0x02000F - -/* i_frag should be zero */ -#define PR_2_FRAG_ZERO 0x020010 - -/* i_fsize should be zero */ -#define PR_2_FSIZE_ZERO 0x020011 - -/* inode has bad mode */ -#define PR_2_BAD_MODE 0x020012 - -/* directory corrupted */ -#define PR_2_DIR_CORRUPTED 0x020013 - -/* filename too long */ -#define PR_2_FILENAME_LONG 0x020014 - -/* Directory inode has a missing block (hole) */ -#define PR_2_DIRECTORY_HOLE 0x020015 - -/* '.' is not NULL terminated */ -#define PR_2_DOT_NULL_TERM 0x020016 - -/* '..' is not NULL terminated */ -#define PR_2_DOT_DOT_NULL_TERM 0x020017 - -/* - * Pass 3 errors - */ - -/* Root inode not allocated */ -#define PR_3_NO_ROOT_INODE 0x030001 - -/* No room in lost+found */ -#define PR_3_EXPAND_LF_DIR 0x030002 - -/* Unconnected directory inode */ -#define PR_3_UNCONNECTED_DIR 0x030003 - -/* /lost+found not found */ -#define PR_3_NO_LF_DIR 0x030004 - -/* .. entry is incorrect */ -#define PR_3_BAD_DOT_DOT 0x030005 - - -/* - * Pass 4 errors - */ - -/* Unattached zero-length inode */ -#define PR_4_ZERO_LEN_INODE 0x040001 - -/* Unattached inode */ -#define PR_4_UNATTACHED_INODE 0x040002 - -/* Inode ref count wrong */ -#define PR_4_BAD_REF_COUNT 0x040003 - -/* - * Pass 5 errors - */ - -/* - * Function declarations - */ -int fix_problem(ext2_filsys fs, int code, struct problem_context *ctx); -void reset_problem_latch(int mask); -void suppress_latch_group(int mask, int value); -void clear_problem_context(struct problem_context *ctx); - -/* message.c */ -void print_e2fsck_message(ext2_filsys fs, const char *msg, - struct problem_context *ctx, int first); - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/scantest.c b/gnu/usr.sbin/e2fsprogs/e2fsck/scantest.c deleted file mode 100644 index 29d1e888537..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/scantest.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * scantest.c - test the speed of the inode scan routine - */ - -#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_MNTENT_H -#include <mntent.h> -#endif -#include <sys/ioctl.h> -#include <malloc.h> -#include <sys/resource.h> - -#include "et/com_err.h" -#include "../version.h" - -#include <stdio.h> -#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" - - -extern int isatty(int); - -const char * device_name = NULL; - -/* - * This structure is used for keeping track of how much resources have - * been used for a particular pass of e2fsck. - */ -struct resource_track { - struct timeval time_start; - struct timeval user_start; - struct timeval system_start; - void *brk_start; -}; - -struct resource_track global_rtrack; - -void init_resource_track(struct resource_track *track) -{ - struct rusage r; - - track->brk_start = sbrk(0); - gettimeofday(&track->time_start, 0); - getrusage(RUSAGE_SELF, &r); - track->user_start = r.ru_utime; - track->system_start = r.ru_stime; -} - -static __inline__ float timeval_subtract(struct timeval *tv1, - struct timeval *tv2) -{ - return ((tv1->tv_sec - tv2->tv_sec) + - ((float) (tv1->tv_usec - tv2->tv_usec)) / 1000000); -} - -void print_resource_track(struct resource_track *track) -{ - struct rusage r; - struct timeval time_end; - - gettimeofday(&time_end, 0); - getrusage(RUSAGE_SELF, &r); - - printf("Memory used: %d, elapsed time: %6.3f/%6.3f/%6.3f\n", - (int) (((char *) sbrk(0)) - ((char *) track->brk_start)), - timeval_subtract(&time_end, &track->time_start), - timeval_subtract(&r.ru_utime, &track->user_start), - timeval_subtract(&r.ru_stime, &track->system_start)); -} - - - -int main (int argc, char *argv[]) -{ - errcode_t retval = 0; - int exit_value = 0; - int i; - ext2_filsys fs; - ext2_inode_scan scan; - ino_t ino; - struct ext2_inode inode; - - printf("size of inode=%d\n", sizeof(inode)); - - device_name = "/dev/hda3"; - - init_resource_track(&global_rtrack); - - retval = ext2fs_open(device_name, 0, - 0, 0, unix_io_manager, &fs); - if (retval) { - com_err(argv[0], retval, "while trying to open %s", - device_name); - exit(1); - } - - retval = ext2fs_open_inode_scan(fs, 0, &scan); - if (retval) { - com_err(argv[0], retval, "while opening inode scan"); - exit(1); - } - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err(argv[0], retval, "while starting inode scan"); - exit(1); - } - while (ino) { - if (!inode.i_links_count) - goto next; - printf("%lu\n", inode.i_blocks); - next: - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err(argv[0], retval, - "while doing inode scan"); - exit(1); - } - } - - - ext2fs_close(fs); - - print_resource_track(&global_rtrack); - - return exit_value; -} diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/swapfs.c b/gnu/usr.sbin/e2fsprogs/e2fsck/swapfs.c deleted file mode 100644 index a317cc789f7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/swapfs.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * swapfs.c --- byte-swap an ext2 filesystem - * - * Copyright 1996, 1997 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <et/com_err.h> -#include "e2fsck.h" - -struct swap_block_struct { - ino_t ino; - int isdir; - errcode_t errcode; - char *dir_buf; - struct ext2_inode *inode; -}; - -/* - * This is a helper function for block_iterate. We mark all of the - * indirect and direct blocks as changed, so that block_iterate will - * write them out. - */ -static int swap_block(ext2_filsys fs, blk_t *block_nr, int blockcnt, - void *private) -{ - errcode_t retval; - - struct swap_block_struct *sb = (struct swap_block_struct *) private; - - if (sb->isdir && (blockcnt >= 0) && *block_nr) { - retval = ext2fs_read_dir_block(fs, *block_nr, sb->dir_buf); - if (retval) { - sb->errcode = retval; - return BLOCK_ABORT; - } - retval = ext2fs_write_dir_block(fs, *block_nr, sb->dir_buf); - if (retval) { - sb->errcode = retval; - return BLOCK_ABORT; - } - } - if (blockcnt >= 0) { - if (blockcnt < EXT2_NDIR_BLOCKS) - return 0; - return BLOCK_CHANGED; - } - if (blockcnt == BLOCK_COUNT_IND) { - if (*block_nr == sb->inode->i_block[EXT2_IND_BLOCK]) - return 0; - return BLOCK_CHANGED; - } - if (blockcnt == BLOCK_COUNT_DIND) { - if (*block_nr == sb->inode->i_block[EXT2_DIND_BLOCK]) - return 0; - return BLOCK_CHANGED; - } - if (blockcnt == BLOCK_COUNT_TIND) { - if (*block_nr == sb->inode->i_block[EXT2_TIND_BLOCK]) - return 0; - return BLOCK_CHANGED; - } - return BLOCK_CHANGED; -} - -/* - * This function is responsible for byte-swapping all of the indirect, - * block pointers. It is also responsible for byte-swapping directories. - */ -static void swap_inode_blocks(ext2_filsys fs, ino_t ino, char *block_buf, - struct ext2_inode *inode) -{ - errcode_t retval; - struct swap_block_struct sb; - - sb.ino = ino; - sb.inode = inode; - sb.dir_buf = block_buf + fs->blocksize*3; - sb.errcode = 0; - sb.isdir = 0; - if (LINUX_S_ISDIR(inode->i_mode)) - sb.isdir = 1; - - retval = ext2fs_block_iterate(fs, ino, 0, block_buf, swap_block, &sb); - if (retval) { - com_err("swap_inode_blocks", retval, - "while calling ext2fs_block_iterate"); - fatal_error(0); - } - if (sb.errcode) { - com_err("swap_inode_blocks", sb.errcode, - "while calling iterator function"); - fatal_error(0); - } -} - -static void swap_inodes(ext2_filsys fs) -{ - int i, group; - ino_t ino = 1; - char *buf, *block_buf; - errcode_t retval; - struct ext2_inode * inode; - - fs->read_inode = pass1_read_inode; - fs->get_blocks = pass1_get_blocks; - - - buf = malloc(fs->blocksize * fs->inode_blocks_per_group); - if (!buf) { - com_err("swap_inodes", ENOMEM, - "while allocating inode buffer"); - fatal_error(0); - } - block_buf = allocate_memory(fs->blocksize * 4, - "block interate buffer"); - for (group = 0; group < fs->group_desc_count; group++) { - retval = io_channel_read_blk(fs->io, - fs->group_desc[group].bg_inode_table, - fs->inode_blocks_per_group, buf); - if (retval) { - com_err("swap_inodes", retval, - "while reading inode table (group %d)", - group); - fatal_error(0); - } - inode = (struct ext2_inode *) buf; - for (i=0; i < fs->super->s_inodes_per_group; - i++, ino++, inode++) { - stashed_ino = ino; - stashed_inode = inode; - - if (fs->flags & EXT2_FLAG_SWAP_BYTES_READ) - ext2fs_swap_inode(fs, inode, inode, 0); - - /* - * Skip deleted files. - */ - if (inode->i_links_count == 0) - continue; - - if (LINUX_S_ISDIR(inode->i_mode) || - ((inode->i_block[EXT2_IND_BLOCK] || - inode->i_block[EXT2_DIND_BLOCK] || - inode->i_block[EXT2_TIND_BLOCK]) && - ext2fs_inode_has_valid_blocks(inode))) - swap_inode_blocks(fs, ino, block_buf, inode); - - if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE) - ext2fs_swap_inode(fs, inode, inode, 1); - } - retval = io_channel_write_blk(fs->io, - fs->group_desc[group].bg_inode_table, - fs->inode_blocks_per_group, buf); - if (retval) { - com_err("swap_inodes", retval, - "while writing inode table (group %d)", - group); - fatal_error(0); - } - } - free(buf); - free(block_buf); - fs->read_inode = 0; - fs->get_blocks = 0; -} - -void swap_filesys(ext2_filsys fs) -{ - struct resource_track rtrack; - - init_resource_track(&rtrack); - - if (!preen) - printf("Pass 0: Doing byte-swap of filesystem\n"); - -#ifdef MTRACE - mtrace_print("Byte swap"); -#endif - - if (fs->super->s_mnt_count) { - fprintf(stderr, "%s: the filesystem must be freshly " - "checked using fsck\n" - "and not mounted before trying to " - "byte-swap it.\n", device_name); - fatal_error(0); - } - if (fs->flags & EXT2_FLAG_SWAP_BYTES) { - fs->flags &= ~(EXT2_FLAG_SWAP_BYTES| - EXT2_FLAG_SWAP_BYTES_WRITE); - fs->flags |= EXT2_FLAG_SWAP_BYTES_READ; - } else { - fs->flags &= ~EXT2_FLAG_SWAP_BYTES_READ; - fs->flags |= EXT2_FLAG_SWAP_BYTES_WRITE; - } - swap_inodes(fs); - if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE) - fs->flags |= EXT2_FLAG_SWAP_BYTES; - fs->flags &= ~(EXT2_FLAG_SWAP_BYTES_READ| - EXT2_FLAG_SWAP_BYTES_WRITE); - ext2fs_flush(fs); - - if (tflag > 1) { - printf("Byte swap: "); - print_resource_track(&rtrack); - } -} - - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsck/util.c b/gnu/usr.sbin/e2fsprogs/e2fsck/util.c deleted file mode 100644 index 24f77d26815..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsck/util.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * util.c --- miscellaneous utilities - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <ctype.h> -#include <termios.h> - -#include "e2fsck.h" - -#include <sys/time.h> -#include <sys/resource.h> - -const char * fix_msg[2] = { "IGNORED", "FIXED" }; - -void fatal_error (const char *msg) -{ - if (msg) - fprintf (stderr, "%s: %s\n", program_name, msg); - exit(FSCK_ERROR); -} - -void *allocate_memory(int size, const char *description) -{ - void *ret; - char buf[256]; - -#ifdef DEBUG_ALLOCATE_MEMORY - printf("Allocating %d bytes for %s...\n", size, description); -#endif - ret = malloc(size); - if (!ret) { - sprintf(buf, "Can't allocate %s\n", description); - fatal_error(buf); - } - memset(ret, 0, size); - return ret; -} - - -int ask_yn(const char * string, int def) -{ - int c; - struct termios termios, tmp; - const char *defstr; - - 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) - defstr = "<y>"; - else if (def == 0) - defstr = "<n>"; - else - defstr = " (y/n)"; - printf("%s%s? ", string, defstr); - while (1) { - fflush (stdout); - if ((c = getchar()) == EOF) - break; - c = toupper(c); - if (c == 'Y') { - def = 1; - break; - } - else if (c == 'N') { - def = 0; - break; - } - else if ((c == ' ' || c == '\n') && (def != -1)) - break; - } - if (def) - printf ("yes\n\n"); - else - printf ("no\n\n"); - tcsetattr (0, TCSANOW, &termios); - return def; -} - -int ask (const char * string, int def) -{ - if (nflag) { - printf ("%s? no\n\n", string); - return 0; - } - if (yflag) { - printf ("%s? yes\n\n", string); - return 1; - } - if (preen) { - printf ("%s? %s\n\n", string, def ? "yes" : "no"); - return def; - } - return ask_yn(string, def); -} - -void read_bitmaps(ext2_filsys fs) -{ - errcode_t retval; - - if (invalid_bitmaps) { - com_err(program_name, 0, - "read_bitmaps: illegal bitmap block(s) for %s", - device_name); - fatal_error(0); - } - - ehandler_operation("reading inode and block bitmaps"); - retval = ext2fs_read_bitmaps(fs); - ehandler_operation(0); - if (retval) { - com_err(program_name, retval, - "while retrying to read bitmaps for %s", - device_name); - fatal_error(0); - } -} - -void write_bitmaps(ext2_filsys fs) -{ - errcode_t retval; - - if (ext2fs_test_bb_dirty(fs)) { - ehandler_operation("writing block bitmaps"); - retval = ext2fs_write_block_bitmap(fs); - ehandler_operation(0); - if (retval) { - com_err(program_name, retval, - "while retrying to write block bitmaps for %s", - device_name); - fatal_error(0); - } - } - - if (ext2fs_test_ib_dirty(fs)) { - ehandler_operation("writing inode bitmaps"); - retval = ext2fs_write_inode_bitmap(fs); - ehandler_operation(0); - if (retval) { - com_err(program_name, retval, - "while retrying to write inode bitmaps for %s", - device_name); - fatal_error(0); - } - } -} - -void preenhalt(ext2_filsys fs) -{ - if (!preen) - return; - fprintf(stderr, "\n\n%s: UNEXPECTED INCONSISTENCY; " - "RUN fsck MANUALLY.\n\t(i.e., without -a or -p options)\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 -} - -#ifdef __GNUC__ -#define _INLINE_ __inline__ -#else -#define _INLINE_ -#endif - -static _INLINE_ float timeval_subtract(struct timeval *tv1, - struct timeval *tv2) -{ - return ((tv1->tv_sec - tv2->tv_sec) + - ((float) (tv1->tv_usec - tv2->tv_usec)) / 1000000); -} - -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", - (int) (((char *) sbrk(0)) - ((char *) track->brk_start)), - 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, - struct ext2_inode * inode, const char *proc) -{ - int retval; - - retval = ext2fs_read_inode(fs, ino, inode); - if (retval) { - com_err("ext2fs_read_inode", retval, - "while reading inode %ld in %s", ino, proc); - fatal_error(0); - } -} - -extern void e2fsck_write_inode(ext2_filsys fs, unsigned long ino, - struct ext2_inode * inode, const char *proc) -{ - int retval; - - retval = ext2fs_write_inode(fs, ino, inode); - if (retval) { - com_err("ext2fs_write_inode", retval, - "while writing inode %ld in %s", ino, proc); - fatal_error(0); - } -} - -#ifdef MTRACE -void mtrace_print(char *mesg) -{ - FILE *malloc_get_mallstream(); - FILE *f = malloc_get_mallstream(); - - if (f) - fprintf(f, "============= %s\n", mesg); -} -#endif - - diff --git a/gnu/usr.sbin/e2fsprogs/e2fsprogs-1.10.lsm b/gnu/usr.sbin/e2fsprogs/e2fsprogs-1.10.lsm deleted file mode 100644 index 42387a1f220..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsprogs-1.10.lsm +++ /dev/null @@ -1,21 +0,0 @@ -Begin3 -Title: EXT2 Filesystem utilities -Version: 1.10 -Entered-date: 24Apr97 -Description: The filesystem utilities for the EXT2 filesystem, including - e2fsck, mke2fs, dumpe2fs, fsck, and others. -Keywords: utilities, fsck, filesystem, Ext2fs -Author: tytso@mit.edu (Theodore Tso) -Maintained-by: tytso@mit.edu (Theodore Tso) -Primary-site: tsx-11.mit.edu /pub/linux/packages/ext2fs - 639kB e2fsprogs-1.10.tar.gz - 234kB e2fsprogs-1.10-elfbin.tar.gz - 176kB e2fsprogs-1.10-dllbin.tar.gz - 213kB e2fsprogs-1.10-0.i386.rpm - 72kB e2fsprogs-devel-1.10-0.i386.rpm - 641kB e2fsprogs-1.10-0.src.rpm - 1kB e2fsprogs-1.10.lsm -Alternate-site: -Platforms: linux 1.2.x/1.3.x/2.0.x/2.1.x -Copying-policy: GPL -End diff --git a/gnu/usr.sbin/e2fsprogs/e2fsprogs-1.10.spec b/gnu/usr.sbin/e2fsprogs/e2fsprogs-1.10.spec deleted file mode 100644 index 8dad93c2af9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/e2fsprogs-1.10.spec +++ /dev/null @@ -1,94 +0,0 @@ -Summary: Tools for the second extended (ext2) filesystem -Name: e2fsprogs -Version: 1.10 -Release: 0 -Copyright: GPL -Group: Utilities/System -Source: tsx-11.mit.edu:/pub/linux/packages/ext2fs/e2fsprogs-1.10.tar.gz -BuildRoot: /tmp/e2fsprogs-root - -%description -This package includes a number of utilities for creating, checking, -and repairing ext2 filesystems. - -%package devel -Summary: e2fs static libs and headers -Group: Development/Libraries - -%description devel -Libraries and header files needed to develop ext2 filesystem-specific -programs. - -%prep -%setup - -%build -CFLAGS="$RPM_OPT_FLAGS" ./configure --enable-elf-shlibs - -make libs progs docs - -%install -export PATH=/sbin:$PATH -make install DESTDIR="$RPM_BUILD_ROOT" -make install-libs DESTDIR="$RPM_BUILD_ROOT" - -mv $RPM_BUILD_ROOT/usr/sbin/debugfs $RPM_BUILD_ROOT/sbin/debugfs - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -/sbin/ldconfig - -%postun -/sbin/ldconfig - -%files -%doc README RELEASE-NOTES -%attr(-, root, root) /sbin/e2fsck -%attr(-, root, root) /sbin/fsck.ext2 -%attr(-, root, root) /sbin/debugfs -%attr(-, root, root) /sbin/mke2fs -%attr(-, root, root) /sbin/badblocks -%attr(-, root, root) /sbin/tune2fs -%attr(-, root, root) /sbin/dumpe2fs -%attr(-, root, root) /sbin/fsck -%attr(-, root, root) /usr/sbin/mklost+found -%attr(-, root, root) /sbin/mkfs.ext2 - -%attr(-, root, root) /lib/libe2p.so.2.3 -%attr(-, root, root) /lib/libext2fs.so.2.3 -%attr(-, root, root) /lib/libss.so.2.0 -%attr(-, root, root) /lib/libcom_err.so.2.0 -%attr(-, root, root) /lib/libuuid.so.1.1 - -%attr(-, root, root) /usr/bin/chattr -%attr(-, root, root) /usr/bin/lsattr -%attr(-, root, root) /usr/man/man8/e2fsck.8 -%attr(-, root, root) /usr/man/man8/debugfs.8 -%attr(-, root, root) /usr/man/man8/tune2fs.8 -%attr(-, root, root) /usr/man/man8/mklost+found.8 -%attr(-, root, root) /usr/man/man8/mke2fs.8 -%attr(-, root, root) /usr/man/man8/dumpe2fs.8 -%attr(-, root, root) /usr/man/man8/badblocks.8 -%attr(-, root, root) /usr/man/man8/fsck.8 -%attr(-, root, root) /usr/man/man1/chattr.1 -%attr(-, root, root) /usr/man/man1/lsattr.1 - -%files devel -%attr(-, root, root) /usr/info/libext2fs.info* -%attr(-, root, root) /usr/lib/libe2p.a -%attr(-, root, root) /usr/lib/libext2fs.a -%attr(-, root, root) /usr/lib/libss.a -%attr(-, root, root) /usr/lib/libcom_err.a -%attr(-, root, root) /usr/lib/libuuid.a -%attr(-, root, root) /usr/include/ss -%attr(-, root, root) /usr/include/ext2fs -%attr(-, root, root) /usr/include/et -%attr(-, root, root) /usr/include/uuid -%attr(-, root, root) /usr/lib/libe2p.so -%attr(-, root, root) /usr/lib/libext2fs.so -%attr(-, root, root) /usr/lib/libss.so -%attr(-, root, root) /usr/lib/libcom_err.so -%attr(-, root, root) /usr/lib/libuuid.so - diff --git a/gnu/usr.sbin/e2fsprogs/include/linux/ChangeLog b/gnu/usr.sbin/e2fsprogs/include/linux/ChangeLog deleted file mode 100644 index 36bac493434..00000000000 --- a/gnu/usr.sbin/e2fsprogs/include/linux/ChangeLog +++ /dev/null @@ -1,40 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Mon Sep 4 21:50:12 1995 Remy Card <card@bbj> - - * ext2_fs.h: Updated to latest version. - diff --git a/gnu/usr.sbin/e2fsprogs/include/linux/ext2_fs.h b/gnu/usr.sbin/e2fsprogs/include/linux/ext2_fs.h deleted file mode 100644 index a0454253aaa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/include/linux/ext2_fs.h +++ /dev/null @@ -1,546 +0,0 @@ -/* - * 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 */ - -/* First non-reserved inode for old ext2 filesystems */ -#define EXT2_GOOD_OLD_FIRST_INO 11 - -/* - * 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 -#ifdef __KERNEL__ -#define EXT2_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_addr_per_block_bits) -#define EXT2_INODE_SIZE(s) ((s)->u.ext2_sb.s_inode_size) -#define EXT2_FIRST_INO(s) ((s)->u.ext2_sb.s_first_ino) -#else -#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ - EXT2_GOOD_OLD_INODE_SIZE : \ - (s)->s_inode_size) -#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ - EXT2_GOOD_OLD_FIRST_INO : \ - (s)->s_first_ino) -#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 */ -#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */ -#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ - -/* - * 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_minor_rev_level; /* minor revision level */ - __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 */ - /* - * These fields are for EXT2_DYNAMIC_REV superblocks only. - * - * Note: the difference between the compatible feature set and - * the incompatible feature set is that if there is a bit set - * in the incompatible feature set that the kernel doesn't - * know about, it should refuse to mount the filesystem. - * - * e2fsck's requirements are more strict; if it doesn't know - * about a feature in either the compatible or incompatible - * feature set, it must abort and not try to meddle with - * things it doesn't understand... - */ - __u32 s_first_ino; /* First non-reserved inode */ - __u16 s_inode_size; /* size of inode structure */ - __u16 s_block_group_nr; /* block group # of this superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ - __u8 s_uuid[16]; /* 128-bit uuid for volume */ - char s_volume_name[16]; /* volume name */ - char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_reserved[206]; /* 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_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ - -#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV -#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV - -#define EXT2_GOOD_OLD_INODE_SIZE 128 - -/* - * Feature set definitions - */ - -#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 - -#define EXT2_FEATURE_COMPAT_SUPP 0 -#define EXT2_FEATURE_INCOMPAT_SUPP 0 -#define EXT2_FEATURE_RO_COMPAT_SUPP EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER - -/* - * 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 (const struct inode *, unsigned long, - __u32 *, __u32 *, int *); -extern void ext2_free_blocks (const struct inode *, 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, 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, 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 int init_ext2_fs(void); -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/gnu/usr.sbin/e2fsprogs/include/linux/types.h.in b/gnu/usr.sbin/e2fsprogs/include/linux/types.h.in deleted file mode 100644 index cd0feab847e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/include/linux/types.h.in +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _LINUX_TYPES_H -#define _LINUX_TYPES_H - -typedef unsigned char __u8; -typedef signed char __s8; - -#if (@SIZEOF_INT@ == 8) -typedef int __s64; -typedef unsigned int __u64; -#elif (@SIZEOF_LONG@ == 8) -typedef long __s64; -typedef unsigned long __u64; -#elif (@SIZEOF_LONG_LONG@ == 8) -typedef long __s64; -typedef unsigned long __u64; -#endif - -#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 - -#ifndef HAVE_INO_T -typedef __u32 ino_t; -#endif - -#endif /* LINUX_TYPES_H */ diff --git a/gnu/usr.sbin/e2fsprogs/install-sh b/gnu/usr.sbin/e2fsprogs/install-sh deleted file mode 100644 index 89fc9b098b8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /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/gnu/usr.sbin/e2fsprogs/install-utils/ChangeLog b/gnu/usr.sbin/e2fsprogs/install-utils/ChangeLog deleted file mode 100644 index 0cd8cb186b1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/install-utils/ChangeLog +++ /dev/null @@ -1,40 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Sat Mar 11 18:26:33 1995 Theodore Y. Ts'o <tytso@localhost> - - * compile_manpages: Include an exit 0 at the end because some - implementations of man exit with a status of 1. diff --git a/gnu/usr.sbin/e2fsprogs/install-utils/compile_manpages b/gnu/usr.sbin/e2fsprogs/install-utils/compile_manpages deleted file mode 100644 index fb3bbdbf804..00000000000 --- a/gnu/usr.sbin/e2fsprogs/install-utils/compile_manpages +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -MAN8="debugfs badblocks e2fsck mke2fs dumpe2fs mklost+found \ - fsck tune2fs" -MAN1="lsattr chattr" - -for i in $MAN8 -do - man -S 8 $i > /dev/null -done - - -for i in $MAN1 -do - man -S 1 $i > /dev/null -done - -exit 0 diff --git a/gnu/usr.sbin/e2fsprogs/install-utils/convfstab b/gnu/usr.sbin/e2fsprogs/install-utils/convfstab deleted file mode 100644 index 01938d63aba..00000000000 --- a/gnu/usr.sbin/e2fsprogs/install-utils/convfstab +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# Make /etc/fstab standard compliant. -# M.Weller (eowmob@exp-math.uni-essen.de) 13.11.1994. -# This script is public domain. Still if only slightly -# modified a credit to me might be nice. - -ROOT_PASS=1 # Pass for root file system -NON_ROOT_PASS=2 # Pass for non root file systems -DEF_FLAGS="defaults" # Default filesysflags -DEF_DUMP=0 # Default dumpfreq. - -while read LINE -do - set -- $LINE - if [ $# != 0 ] - then - case $1 in - \#* | !* ) - echo "$LINE" - # Actually there are no comments allowed in /etc/fstab - echo "Warning: comment in /etc/fstab detected." >&2 - echo "Please remove it by hand." >&2 - ;; - * ) - if [ $# -gt 6 -o $# -lt 3 ] - then - echo "Don't have a clue about \"$LINE\"." >&2 - echo "$LINE" - else - case $2 in - / ) - PASS=$ROOT_PASS - ;; - none ) - PASS=0 - ;; - * ) - PASS=$NON_ROOT_PASS - ;; - esac - DUMP=$DEF_DUMP - case $3 in - ignore | iso9660 | msdos | hpfs | sysv | \ - xenix | coherent | nfs | proc | sw | swap ) - DUMP=0; - PASS=0; - ;; - esac - case $# in - 3 ) - echo "$LINE $DEF_FLAGS $DUMP $PASS" - ;; - 4 ) - echo "$LINE $DUMP $PASS" - ;; - 5 ) - echo "$LINE $PASS" - ;; - 6) - echo "$LINE" - ;; - esac - fi - ;; - esac - else - echo "Warning: One empty line removed." >&2 - fi -done </etc/fstab >/tmp/newfstab.$$ -mv -f /etc/fstab /etc/fstab.bak -mv -f /tmp/newfstab.$$ /etc/fstab -if [ $? != 0 ] -then - echo "Installation of patched /etc/fstab failed." - echo "It would have been:" - cat /tmp/newfstab.$$ - rm -f /tmp/newfstab.$$ -fi diff --git a/gnu/usr.sbin/e2fsprogs/install-utils/remove_preformat_manpages b/gnu/usr.sbin/e2fsprogs/install-utils/remove_preformat_manpages deleted file mode 100644 index 3532adfe6c1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/install-utils/remove_preformat_manpages +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -PREFORMAT_ROOT=/usr/man/preformat -COMPILED_ROOT=/usr/man - -MAN8="debugfs.8 badblocks.8 e2fsck.8 mke2fs.8 dumpe2fs.8 mklost+found.8 \ - fsck.8 tune2fs.8" -MAN1="lsattr.1 chattr.1" - -for i in $MAN8 -do - rm -f $PREFORMAT_ROOT/cat8/$i $COMPILED_ROOT/cat8/$i \ - $PREFORMAT_ROOT/cat8/$i.gz $COMPILED_ROOT/cat8/$i.gz -done - - -for i in $MAN1 -do - rm -f $PREFORMAT_ROOT/cat1/$i $COMPILED_ROOT/cat1/$i \ - $PREFORMAT_ROOT/cat1/$i.gz $COMPILED_ROOT/cat1/$i.gz -done diff --git a/gnu/usr.sbin/e2fsprogs/lib/ChangeLog b/gnu/usr.sbin/e2fsprogs/lib/ChangeLog deleted file mode 100644 index 6d23efd45d7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ChangeLog +++ /dev/null @@ -1,92 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Sat Mar 8 13:23:43 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.elf-lib (image): Allow Makefile.in files to specify - a list of libraries which the shared library depends upon. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 -Wed Aug 28 15:20:26 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * Makefile.elf-lib (installdirs-elf-lib): Renamed from installdirs - to avoid making random directories only neeeded when installing - normal libraries. - (install-shlibs): Use installdirs-elf-lib instead of installdirs. - -Thu May 23 12:40:12 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.elf-lib: Install the .so files in /usr/lib, since the - .a files are stored there. (We were installing the .so - files in the wrong place before.) - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed May 15 22:59:06 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.profile (install): Add an install production so that - the profiling libraries are installed. - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Mon Oct 30 21:11:47 1995 <tytso@rsts-11.mit.edu> - - * Makefile.elf-lib: Changes to pass -soname to the linker, so that - ld.so knows which version of the library to load when - there's more than one major version of the shared library. - -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/gnu/usr.sbin/e2fsprogs/lib/Makefile.bsd-lib b/gnu/usr.sbin/e2fsprogs/lib/Makefile.bsd-lib deleted file mode 100644 index e0227a2635f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/Makefile.bsd-lib +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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/gnu/usr.sbin/e2fsprogs/lib/Makefile.checker b/gnu/usr.sbin/e2fsprogs/lib/Makefile.checker deleted file mode 100644 index 6064494aae9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/Makefile.checker +++ /dev/null @@ -1,16 +0,0 @@ -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) $@ ../$@ diff --git a/gnu/usr.sbin/e2fsprogs/lib/Makefile.dll-lib b/gnu/usr.sbin/e2fsprogs/lib/Makefile.dll-lib deleted file mode 100644 index 8bcf121d2d2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/Makefile.dll-lib +++ /dev/null @@ -1,98 +0,0 @@ -# -# This is a Makefile stub which handles the creation of Linux DLL-style shared -# libraries. -# -# In order to use this stub, the following makefile variables must be defined. -# -# DLL_ADDRESS = 0x80000000 -# DLL_JUMPSIZE = 0x1000 -# DLL_GOTSIZE = 0x1000 -# DLL_VERSION = 1.0 -# DLL_IMAGE = libce -# DLL_STUB = libcom_err -# DLL_MYDIR = et -# DLL_INSTALL_DIR = $(SHLIBDIR) -# - -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 -# states that you should just be able to do -lgcc, but modern gcc -# installation packages don't install /usr/lib/libgcc.a --- as well they -# shouldn't since libgcc.a can be gcc version dependent. -# If this hack doesn't work, try replacing it with a hardcoded path to -# libgcc.a, or -lgcc. -# -#DLL_LIBGCC ="`$(CC) -v 2>&1 | head -1 | \ -# sed -e 's;[^/]*;;' -e 's/specs/libgcc.a/'`" -DLL_LIBGCC ="`$(CC) --print-libgcc-file-name`" - -image: $(DLL_IMAGE).so.$(DLL_VERSION) - -stubs: $(DLL_STUB).sa $(OBJS) - -$(DLL_IMAGE).so.$(DLL_VERSION): $(OBJS) - (cd jump; export JUMP_DIR=`pwd`; \ - $(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) . - $(LN) -f $(DLL_IMAGE).so.$(DLL_VERSION) \ - `echo ../$(DLL_IMAGE).so.$(DLL_VERSION) | \ - sed -e 's/\.[0-9]*\$$//'` - -$(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) -f ../$@ - $(LN) $@ ../$@ - -installdirs:: - $(top_srcdir)/mkinstalldirs $(DESTDIR)$(DLL_INSTALL_DIR) - -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) - $(STRIP) $(DESTDIR)$(DLL_INSTALL_DIR)/$(DLL_IMAGE).so.$(DLL_VERSION) - -ldconfig - -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:: - $(RM) -f ../$(DLL_STUB).sa $(DLL_STUB).sa \ - $(DLL_IMAGE).so.$(DLL_VERSION) ../$(DLL_IMAGE).so.* - $(RM) -rf jump - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/Makefile.elf-lib b/gnu/usr.sbin/e2fsprogs/lib/Makefile.elf-lib deleted file mode 100644 index 4804d486675..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/Makefile.elf-lib +++ /dev/null @@ -1,53 +0,0 @@ -# -# 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_SO_VERSION = 1 -# ELF_IMAGE = libce -# ELF_MYDIR = et -# ELF_INSTALL_DIR = $(SHLIBDIR) -# ELF_OTHER_LIBS = -lc - -all:: elfshared image - -subdirs:: elfshared - -elfshared: - mkdir elfshared - -ELF_LIB = $(ELF_IMAGE).so.$(ELF_VERSION) -ELF_SONAME = $(ELF_IMAGE).so.$(ELF_SO_VERSION) - -image: $(ELF_LIB) - -$(ELF_LIB): $(OBJS) - (cd elfshared; $(CC) --shared -o $(ELF_LIB) -Wl,-soname,$(ELF_SONAME) \ - $(OBJS) $(ELF_OTHER_LIBS)) - $(MV) elfshared/$(ELF_LIB) . - $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) - $(LN) $(ELF_LIB) ../$(ELF_LIB) - $(LN) ../$(ELF_LIB) ../$(ELF_IMAGE).so - $(LN) ../$(ELF_LIB) ../$(ELF_SONAME) - -installdirs-elf-lib:: - $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ELF_INSTALL_DIR) \ - $(DESTDIR)$(ulibdir) - -installdirs:: installdirs-elf-lib - -install-shlibs install:: $(ELF_LIB) installdirs-elf-lib - $(INSTALL_PROGRAM) $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) - $(STRIP) --strip-debug \ - $(DESTDIR)$(DLL_INSTALL_DIR)/$(ELF_LIB) - $(LN_S) -f $(ELF_LIB) $(DESTDIR)$(DLL_INSTALL_DIR)/$(ELF_SONAME) - $(LN_S) -f $(DLL_INSTALL_DIR)/$(ELF_SONAME) \ - $(DESTDIR)$(ulibdir)/$(ELF_IMAGE).so - -ldconfig - -clean:: - $(RM) -rf elfshared - $(RM) -f $(ELF_LIB) - $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) diff --git a/gnu/usr.sbin/e2fsprogs/lib/Makefile.library b/gnu/usr.sbin/e2fsprogs/lib/Makefile.library deleted file mode 100644 index 2ea95c1112b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/Makefile.library +++ /dev/null @@ -1,13 +0,0 @@ -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/gnu/usr.sbin/e2fsprogs/lib/Makefile.profile b/gnu/usr.sbin/e2fsprogs/lib/Makefile.profile deleted file mode 100644 index 0864facc0e0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/Makefile.profile +++ /dev/null @@ -1,23 +0,0 @@ -all:: profiled $(LIBRARY)_p.a - -subdirs:: profiled - -profiled: - mkdir profiled - -clean:: - $(RM) -rf profiled - $(RM) -f $(LIBRARY)_p.a ../$(LIBRARY)_p.a - -$(LIBRARY)_p.a: $(OBJS) - (if test -r $@; then $(RM) -f $@.bak && $(MV) $@ $@.bak; fi) - (cd profiled; $(ARUPD) ../$@ $(OBJS)) - -$(RANLIB) $@ - $(RM) -f ../$@ - $(LN) $@ ../$@ - -install:: $(LIBRARY)_p.a installdirs - $(INSTALL_DATA) $(LIBRARY)_p.a $(DESTDIR)$(ulibdir)/$(LIBRARY)_p.a - $(CHMOD) 644 $(DESTDIR)$(ulibdir)/$(LIBRARY)_p.a - -$(RANLIB) $(DESTDIR)$(ulibdir)/$(LIBRARY)_p.a - $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/$(LIBRARY)_p.a diff --git a/gnu/usr.sbin/e2fsprogs/lib/do_substitute b/gnu/usr.sbin/e2fsprogs/lib/do_substitute deleted file mode 100644 index e18c3f4b2aa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/do_substitute +++ /dev/null @@ -1,29 +0,0 @@ -# -# This is the actual gots of substitute_sh. It is in a separate file to -# protect it from autoconf substitutions -# - -$SED -e "s%@AWK@%$AWK%g" \ - -e "s%@SED@%$SED%g" \ - -e "s%@ET_DIR@%$ET_DIR%g" \ - -e "s%@SS_DIR@%$SS_DIR%g" \ - -e "s%@E2FSPROGS_MONTH@%$E2FSPROGS_MONTH%g" \ - -e "s%@E2FSPROGS_YEAR@%$E2FSPROGS_YEAR%g" \ - -e "s%@E2FSPROGS_VERSION@%$E2FSPROGS_VERSION%g" \ - -e "s%@SIZEOF_LONG_LONG@%$SIZEOF_LONG_LONG%g" \ - -e "s%@SIZEOF_LONG@%$SIZEOF_LONG%g" \ - -e "s%@SIZEOF_INT@%$SIZEOF_INT%g" \ - -e "s%@SIZEOF_SHORT@%$SIZEOF_SHORT%g" \ - $1 > $2.tmp - -if [ -f $2 ]; then - if cmp $2 $2.tmp > /dev/null 2>&1 ; then - $RM $2.tmp - else - echo "substitute_sh: Replacing $2" - $MV $2.tmp $2 - fi -else - echo "substitute_sh: Creating $2" - $MV $2.tmp $2 -fi diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/ChangeLog b/gnu/usr.sbin/e2fsprogs/lib/e2p/ChangeLog deleted file mode 100644 index 9bb5ae5273f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/ChangeLog +++ /dev/null @@ -1,163 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Wed Apr 23 22:41:55 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * ls.c (list_super): Add #ifdef's so it will compile under 1.2.13 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Sat Apr 5 11:48:03 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ls.c (list_super): Display the filesystem revision and any - features that might be implemented. - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Thu Jan 2 00:06:29 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * uuid.c: Include string.h, since we use memcpy(). - -Wed Jan 1 23:47:22 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ls.c (list_super): Copy times from the superblock to a time_t - variable. (The alpha has different sizes for time_t and - the time in the superblock.) - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Sun Sep 22 16:20:12 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * pf.c: Add support for the 'A' (no atime) flag. - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Sat Sep 7 14:48:35 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ls.c (interval_string): Pretty print the check interval. - -Tue Aug 6 14:12:36 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ls.c (list_super): Display the OS, volume label, last mounted, - and UUID field if present. - -Mon Jun 24 09:55:58 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ps.c, pf.c, pe.c, ls.c, setversion.c, setflags.c, getversion.c, - fsetversion.c, fsetflags.c, fgetversion.c, fgetflags.c, - getflags.c: Remove include of ext2_fs.h, since it's - included by e2p.h; this also solves a sys/types.h vs - linux/types.h inclusion ordering problem with the GNU libc. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Tue Jan 2 20:50:44 1996 <tytso@rsts-11.mit.edu> - - * fgetflags.c (fgetflags): - * fsetflags.c (fsetflags): - * fgetversion.c (fgetversion): - * fsetversion.c (fsetversion): Add the O_NONBLOCK flag to open - call, so that we don't hang trying to open things like - named pipes. - -Mon Oct 30 17:44:07 1995 <tytso@rsts-11.mit.edu> - - * ls.c (list_super): Use the correct field (s_def_resgid) when - printing the reserved group gid. - -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 - s_def_resgid. - - (print_user): New function which prints the uid and the user name. - - (print_group): New function which prints the gid and the group name. - -Wed Aug 17 21:50:39 1994 Remy Card (card@bbj) - - * pf.c (print_flags): New attributes are recognized and a long - format can be used. - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/Makefile.in b/gnu/usr.sbin/e2fsprogs/lib/e2p/Makefile.in deleted file mode 100644 index b51fb8899f6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/Makefile.in +++ /dev/null @@ -1,108 +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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = ../.. -my_dir = lib/e2p -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 uuid.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 \ - $(srcdir)/uuid.c - -LIBRARY= libe2p -LIBDIR= e2p - -DLL_ADDRESS = 0x66980000 -DLL_JUMPSIZE = 0x1000 -DLL_GOTSIZE = 0x1000 -DLL_VERSION = 1.3 -DLL_IMAGE = libe2p -DLL_STUB = libe2p -DLL_MYDIR = e2p -DLL_INSTALL_DIR = $(libdir) - -ELF_VERSION = 2.3 -ELF_SO_VERSION = 2 -ELF_IMAGE = libe2p -ELF_MYDIR = e2p -ELF_INSTALL_DIR = $(libdir) -ELF_OTHER_LIBS = -lc - -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) $(ALL_CFLAGS) -c $< -o $@ -@PROFILE_CMT@ $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< -@CHECKER_CMT@ $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $< -@DLL_CMT@ (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(ALL_CFLAGS) \ -@DLL_CMT@ -o jump/$*.o -c $<) -@ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< -@BSDLIB_CMT@ $(CC) $(ALL_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 -uuid.o: $(srcdir)/uuid.c diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/configure b/gnu/usr.sbin/e2fsprogs/lib/e2p/configure deleted file mode 100644 index db75368bdc4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/configure +++ /dev/null @@ -1,613 +0,0 @@ -#!/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/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.funcs b/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.funcs deleted file mode 100644 index 6173ddc25e2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.funcs +++ /dev/null @@ -1,15 +0,0 @@ -00000000 T _fgetflags libe2p fgetflags -00000000 T _fsetflags libe2p fsetflags -00000000 T _fgetversion libe2p fgetversion -00000000 T _fsetversion libe2p fsetversion -00000000 T _getflags libe2p getflags -00000000 T _getversion libe2p getversion -00000000 T _iterate_on_dir libe2p iod -00000000 T _list_super libe2p ls -00000000 T _print_fs_errors libe2p pe -00000000 T _print_flags libe2p pf -00000000 T _print_fs_state libe2p ps -00000000 T _setflags libe2p setflags -00000000 T _setversion libe2p setversion -00000000 T _e2p_is_null_uuid libe2p uuid -00000000 T _e2p_uuid_to_str libe2p uuid diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.ignore b/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.ignore deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.ignore +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.import b/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.import deleted file mode 100644 index 51b1fd88d2b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.import +++ /dev/null @@ -1,164 +0,0 @@ -/usr/lib/libc.sa(__libc.o):00001000 a __GOT_SIZE -/usr/lib/libc.sa(__libc.o):6008f0b0 A _AL -/usr/lib/libc.sa(__libc.o):6008f198 A _AL_PARM -/usr/lib/libc.sa(__libc.o):6008f060 A _AM -/usr/lib/libc.sa(__libc.o):6008f0b4 A _BC -/usr/lib/libc.sa(__libc.o):6008f064 A _BS -/usr/lib/libc.sa(__libc.o):6008f0bc A _BT -/usr/lib/libc.sa(__libc.o):6008f068 A _CA -/usr/lib/libc.sa(__libc.o):6008f0c0 A _CD -/usr/lib/libc.sa(__libc.o):6008f0c4 A _CE -/usr/lib/libc.sa(__libc.o):6008f0c8 A _CL -/usr/lib/libc.sa(__libc.o):6008f0cc A _CM -/usr/lib/libc.sa(__libc.o):6008f048 A _COLS -/usr/lib/libc.sa(__libc.o):6008f0d0 A _CR -/usr/lib/libc.sa(__libc.o):6008f0d4 A _CS -/usr/lib/libc.sa(__libc.o):6008f06c A _DA -/usr/lib/libc.sa(__libc.o):6008f070 A _DB -/usr/lib/libc.sa(__libc.o):6008f0d8 A _DC -/usr/lib/libc.sa(__libc.o):6008f0dc A _DL -/usr/lib/libc.sa(__libc.o):6008f19c A _DL_PARM -/usr/lib/libc.sa(__libc.o):6008f0e0 A _DM -/usr/lib/libc.sa(__libc.o):6008f0e4 A _DO -/usr/lib/libc.sa(__libc.o):6008f1a4 A _DOWN_PARM -/usr/lib/libc.sa(__libc.o):6008f03c A _Def_term -/usr/lib/libc.sa(__libc.o):6008f0e8 A _ED -/usr/lib/libc.sa(__libc.o):6008f0ec A _EI -/usr/lib/libc.sa(__libc.o):6008f074 A _EO -/usr/lib/libc.sa(__libc.o):6008f1b8 A _GT -/usr/lib/libc.sa(__libc.o):6008f078 A _HC -/usr/lib/libc.sa(__libc.o):6008f118 A _HO -/usr/lib/libc.sa(__libc.o):6008f07c A _HZ -/usr/lib/libc.sa(__libc.o):6008f11c A _IC -/usr/lib/libc.sa(__libc.o):6008f120 A _IM -/usr/lib/libc.sa(__libc.o):6008f080 A _IN -/usr/lib/libc.sa(__libc.o):6008f124 A _IP -/usr/lib/libc.sa(__libc.o):6008f0f0 A _K0 -/usr/lib/libc.sa(__libc.o):6008f0f4 A _K1 -/usr/lib/libc.sa(__libc.o):6008f0f8 A _K2 -/usr/lib/libc.sa(__libc.o):6008f0fc A _K3 -/usr/lib/libc.sa(__libc.o):6008f100 A _K4 -/usr/lib/libc.sa(__libc.o):6008f104 A _K5 -/usr/lib/libc.sa(__libc.o):6008f108 A _K6 -/usr/lib/libc.sa(__libc.o):6008f10c A _K7 -/usr/lib/libc.sa(__libc.o):6008f110 A _K8 -/usr/lib/libc.sa(__libc.o):6008f114 A _K9 -/usr/lib/libc.sa(__libc.o):6008f128 A _KD -/usr/lib/libc.sa(__libc.o):6008f12c A _KE -/usr/lib/libc.sa(__libc.o):6008f130 A _KH -/usr/lib/libc.sa(__libc.o):6008f134 A _KL -/usr/lib/libc.sa(__libc.o):6008f138 A _KR -/usr/lib/libc.sa(__libc.o):6008f13c A _KS -/usr/lib/libc.sa(__libc.o):6008f140 A _KU -/usr/lib/libc.sa(__libc.o):6008f1a8 A _LEFT_PARM -/usr/lib/libc.sa(__libc.o):6008f044 A _LINES -/usr/lib/libc.sa(__libc.o):6008f144 A _LL -/usr/lib/libc.sa(__libc.o):6008f148 A _MA -/usr/lib/libc.sa(__libc.o):6008f300 A _MCAppPath -/usr/lib/libc.sa(__libc.o):6008f084 A _MI -/usr/lib/libc.sa(__libc.o):6008f088 A _MS -/usr/lib/libc.sa(__libc.o):6008f030 A _My_term -/usr/lib/libc.sa(__libc.o):6008f08c A _NC -/usr/lib/libc.sa(__libc.o):6008f14c A _ND -/usr/lib/libc.sa(__libc.o):6008f150 A _NL -/usr/lib/libc.sa(__libc.o):6008f1bc A _NONL -/usr/lib/libc.sa(__libc.o):6008f090 A _NS -/usr/lib/libc.sa(__libc.o):6008f094 A _OS -/usr/lib/libc.sa(__libc.o):6008f1b0 A _PC -/usr/lib/libc.sa(__libc.o):6008f154 A _RC -/usr/lib/libc.sa(__libc.o):6008f1ac A _RIGHT_PARM -/usr/lib/libc.sa(__libc.o):6008f158 A _SC -/usr/lib/libc.sa(__libc.o):6008f15c A _SE -/usr/lib/libc.sa(__libc.o):6008f160 A _SF -/usr/lib/libc.sa(__libc.o):6008f164 A _SO -/usr/lib/libc.sa(__libc.o):6008f168 A _SR -/usr/lib/libc.sa(__libc.o):6008f16c A _TA -/usr/lib/libc.sa(__libc.o):6008f170 A _TE -/usr/lib/libc.sa(__libc.o):6008f174 A _TI -/usr/lib/libc.sa(__libc.o):6008f178 A _UC -/usr/lib/libc.sa(__libc.o):6008f17c A _UE -/usr/lib/libc.sa(__libc.o):6008f098 A _UL -/usr/lib/libc.sa(__libc.o):6008f180 A _UP -/usr/lib/libc.sa(__libc.o):6008f1c0 A _UPPERCASE -/usr/lib/libc.sa(__libc.o):6008f1a0 A _UP_PARM -/usr/lib/libc.sa(__libc.o):6008f188 A _US -/usr/lib/libc.sa(__libc.o):6008f18c A _VB -/usr/lib/libc.sa(__libc.o):6008f194 A _VE -/usr/lib/libc.sa(__libc.o):6008f190 A _VS -/usr/lib/libc.sa(__libc.o):6008f09c A _XB -/usr/lib/libc.sa(__libc.o):6008f0a0 A _XN -/usr/lib/libc.sa(__libc.o):6008f0a8 A _XS -/usr/lib/libc.sa(__libc.o):6008f0a4 A _XT -/usr/lib/libc.sa(__libc.o):6008f0ac A _XX -/usr/lib/libc.sa(__libc.o):6008f2a4 A __IO_file_jumps -/usr/lib/libc.sa(__libc.o):6008f1f4 A __IO_list_all -/usr/lib/libc.sa(__libc.o):6008f2a8 A __IO_proc_jumps -/usr/lib/libc.sa(__libc.o):6008f1ec A __IO_stderr_ -/usr/lib/libc.sa(__libc.o):6008f1e4 A __IO_stdin_ -/usr/lib/libc.sa(__libc.o):6008f1e8 A __IO_stdout_ -/usr/lib/libc.sa(__libc.o):6008f2ac A __IO_str_jumps -/usr/lib/libc.sa(__libc.o):6008f214 A ____brk_addr -/usr/lib/libc.sa(__libc.o):6008f01c A ___ctype_b -/usr/lib/libc.sa(__libc.o):6008f020 A ___ctype_tolower -/usr/lib/libc.sa(__libc.o):6008f024 A ___ctype_toupper -/usr/lib/libc.sa(__libc.o):6008f1fc A ___environ -/usr/lib/libc.sa(__libc.o):6008f250 A ___exit_funcs -/usr/lib/libc.sa(__libc.o):6008f2f0 A ___glob_closedir_hook -/usr/lib/libc.sa(__libc.o):6008f2f4 A ___glob_opendir_hook -/usr/lib/libc.sa(__libc.o):6008f2f8 A ___glob_readdir_hook -/usr/lib/libc.sa(__libc.o):6008f278 A ___ttyname -/usr/lib/libc.sa(__libc.o):6008f238 A __collate_info -/usr/lib/libc.sa(__libc.o):6008f23c A __ctype_info -/usr/lib/libc.sa(__libc.o):6008f028 A __echoit -/usr/lib/libc.sa(__libc.o):6008f034 A __endwin -/usr/lib/libc.sa(__libc.o):6008f288 A __gdbm_fetch_val -/usr/lib/libc.sa(__libc.o):6008f280 A __gdbm_file -/usr/lib/libc.sa(__libc.o):6008f284 A __gdbm_memory -/usr/lib/libc.sa(__libc.o):6008f240 A __monetary_info -/usr/lib/libc.sa(__libc.o):6008f234 A __null_auth -/usr/lib/libc.sa(__libc.o):6008f244 A __numeric_info -/usr/lib/libc.sa(__libc.o):6008f2ec A __obstack -/usr/lib/libc.sa(__libc.o):6008f1c8 A __pfast -/usr/lib/libc.sa(__libc.o):6008f02c A __rawmode -/usr/lib/libc.sa(__libc.o):6008f1dc A __res -/usr/lib/libc.sa(__libc.o):6008f04c A __res_iflg -/usr/lib/libc.sa(__libc.o):6008f050 A __res_lflg -/usr/lib/libc.sa(__libc.o):6008f270 A __res_opcodes -/usr/lib/libc.sa(__libc.o):6008f274 A __res_resultcodes -/usr/lib/libc.sa(__libc.o):6008f248 A __response_info -/usr/lib/libc.sa(__libc.o):6008f2fc A __sigintr -/usr/lib/libc.sa(__libc.o):6008f00c A __sys_errlist -/usr/lib/libc.sa(__libc.o):6008f010 A __sys_nerr -/usr/lib/libc.sa(__libc.o):6008f014 A __sys_siglist -/usr/lib/libc.sa(__libc.o):6008f24c A __time_info -/usr/lib/libc.sa(__libc.o):6008f05c A __tty -/usr/lib/libc.sa(__libc.o):6008f040 A __tty_ch -/usr/lib/libc.sa(__libc.o):6008f1cc A __unctrl -/usr/lib/libc.sa(__libc.o):6008f27c A __win -/usr/lib/libc.sa(__libc.o):6008f058 A _curscr -/usr/lib/libc.sa(__libc.o):6008f228 A _daylight -/usr/lib/libc.sa(__libc.o):6008f200 A _errno -/usr/lib/libc.sa(__libc.o):6008f1d0 A _gdbm_errno -/usr/lib/libc.sa(__libc.o):6008f28c A _gdbm_version -/usr/lib/libc.sa(__libc.o):6008f008 A _h_errlist -/usr/lib/libc.sa(__libc.o):6008f1d8 A _h_errno -/usr/lib/libc.sa(__libc.o):6008f2a0 A _h_nerr -/usr/lib/libc.sa(__libc.o):6008f1c4 A _normtty -/usr/lib/libc.sa(__libc.o):6008f204 A _optarg -/usr/lib/libc.sa(__libc.o):6008f20c A _opterr -/usr/lib/libc.sa(__libc.o):6008f208 A _optind -/usr/lib/libc.sa(__libc.o):6008f2e4 A _optopt -/usr/lib/libc.sa(__libc.o):6008f218 A _ospeed -/usr/lib/libc.sa(__libc.o):6008f26c A _re_max_failures -/usr/lib/libc.sa(__libc.o):6008f210 A _re_syntax_options -/usr/lib/libc.sa(__libc.o):6008f1e0 A _rexecoptions -/usr/lib/libc.sa(__libc.o):6008f230 A _rpc_createerr -/usr/lib/libc.sa(__libc.o):6008f25c A _stderr -/usr/lib/libc.sa(__libc.o):6008f254 A _stdin -/usr/lib/libc.sa(__libc.o):6008f258 A _stdout -/usr/lib/libc.sa(__libc.o):6008f054 A _stdscr -/usr/lib/libc.sa(__libc.o):6008f2e8 A _svc_fdset -/usr/lib/libc.sa(__libc.o):6008f224 A _timezone -/usr/lib/libc.sa(__libc.o):6008f21c A _tputs_baud_rate -/usr/lib/libc.sa(__libc.o):6008f038 A _ttytype -/usr/lib/libc.sa(__libc.o):6008f220 A _tzname diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.params b/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.params deleted file mode 100644 index f35d02cc220..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.params +++ /dev/null @@ -1,6 +0,0 @@ -Name=libe2p -Text=0x66980000 -Data=0x00000000 -Jump=0x00001000 -GOT=0x00001000 -Version=1.3.0 diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.undefs b/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.undefs deleted file mode 100644 index 48d61eaf9c4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.undefs +++ /dev/null @@ -1 +0,0 @@ -66982040 D __NEEDS_SHRLIB_libc_4 diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.vars b/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.vars deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/dll/jump.vars +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/e2p.h b/gnu/usr.sbin/e2fsprogs/lib/e2p/e2p.h deleted file mode 100644 index fa4a03bdb62..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/e2p.h +++ /dev/null @@ -1,24 +0,0 @@ -#include <sys/types.h> /* Needed by dirent.h on netbsd */ -#include <stdio.h> -#include <dirent.h> - -#include <linux/ext2_fs.h> - -int fgetflags (const char * name, unsigned long * flags); -int fgetversion (const char * name, unsigned long * version); -int fsetflags (const char * name, unsigned long flags); -int fsetversion (const char * name, unsigned long version); -int getflags (int fd, unsigned long * flags); -int getversion (int fd, unsigned long * version); -int iterate_on_dir (const char * dir_name, - int (*func) (const char *, struct dirent *, void *), - void * private); -void list_super (struct ext2_super_block * s); -void print_fs_errors (FILE * f, unsigned short errors); -void print_flags (FILE * f, unsigned long flags, int long_format); -void print_fs_state (FILE * f, unsigned short state); -int setflags (int fd, unsigned long flags); -int setversion (int fd, unsigned long version); - -int e2p_is_null_uuid(void *uu); -void e2p_uuid_to_str(void *uu, char *out); diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/fgetflags.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/fgetflags.c deleted file mode 100644 index f01de269c51..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/fgetflags.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * fgetflags.c - Get a file flags on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#if HAVE_ERRNO_H -#include <errno.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 "e2p.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; - - fd = open (name, O_RDONLY|O_NONBLOCK); - 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 -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/fgetversion.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/fgetversion.c deleted file mode 100644 index fea376b0b4c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/fgetversion.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * fgetversion.c - Get a file version on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <fcntl.h> -#include <sys/ioctl.h> - -#include "e2p.h" - -int fgetversion (const char * name, unsigned long * version) -{ -#if HAVE_EXT2_IOCTLS - int fd; - int r; - - fd = open (name, O_RDONLY|O_NONBLOCK); - if (fd == -1) - return - 1; - 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 */ -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/fsetflags.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/fsetflags.c deleted file mode 100644 index 92e558be2ef..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/fsetflags.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * fsetflags.c - Set a file flags on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#if HAVE_ERRNO_H -#include <errno.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 "e2p.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; - - fd = open (name, O_RDONLY|O_NONBLOCK); - if (fd == -1) - return -1; - 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 -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/fsetversion.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/fsetversion.c deleted file mode 100644 index 49c7c364a78..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/fsetversion.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * fsetversion.c - Set a file version on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <fcntl.h> -#include <sys/ioctl.h> - -#include "e2p.h" - -int fsetversion (const char * name, unsigned long version) -{ -#if HAVE_EXT2_IOCTLS - int fd; - int r; - - fd = open (name, O_RDONLY|O_NONBLOCK); - if (fd == -1) - return -1; - 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 */ -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/getflags.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/getflags.c deleted file mode 100644 index 8c476a37496..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/getflags.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * getflags.c - Get a file flags on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 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 "e2p.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 -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/getversion.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/getversion.c deleted file mode 100644 index be76b60a040..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/getversion.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * getversion.c - Get a file version on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/ioctl.h> - -#include "e2p.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 */ -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/iod.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/iod.c deleted file mode 100644 index 7b02a7f3ef4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/iod.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * iod.c - Iterate a function on each entry of a directory - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#include "e2p.h" - -int iterate_on_dir (const char * dir_name, - int (*func) (const char *, struct dirent *, void *), - void * private) -{ - DIR * dir; -#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); - if (dir == NULL) - return -1; - while ((dep = readdir (dir))) - { -#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/gnu/usr.sbin/e2fsprogs/lib/e2p/ls.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/ls.c deleted file mode 100644 index 31695b8d5f2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/ls.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * ls.c - List the contents of an ext2fs superblock - * - * Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu> - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -#include <stdio.h> -#include <sys/types.h> -#include <string.h> -#include <grp.h> -#include <pwd.h> -#include <time.h> - -#include "e2p.h" - -/* - * The ext2fs library private definition of the ext2 superblock, so we - * don't have to depend on the kernel's definition of the superblock, - * which might not have the latest features. - */ -struct ext2fs_sb { - __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_minor_rev_level; /* minor revision level */ - __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 */ - /* - * These fields are for EXT2_DYNAMIC_REV superblocks only. - * - * Note: the difference between the compatible feature set and - * the incompatible feature set is that if there is a bit set - * in the incompatible feature set that the kernel doesn't - * know about, it should refuse to mount the filesystem. - * - * e2fsck's requirements are more strict; if it doesn't know - * about a feature in either the compatible or incompatible - * feature set, it must abort and not try to meddle with - * things it doesn't understand... - */ - __u32 s_first_ino; /* First non-reserved inode */ - __u16 s_inode_size; /* size of inode structure */ - __u16 s_block_group_nr; /* block group # of this superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ - __u8 s_uuid[16]; /* 128-bit uuid for volume */ - char s_volume_name[16]; /* volume name */ - char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_reserved[206]; /* Padding to the end of the block */ -}; - -#ifndef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER -#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 -#endif - -static void print_user (unsigned short uid) -{ - struct passwd *pw; - - printf ("%u ", uid); - pw = getpwuid (uid); - if (pw == NULL) - printf ("(user unknown)\n"); - else - printf ("(user %s)\n", pw->pw_name); -} - -static void print_group (unsigned short gid) -{ - struct group *gr; - - printf ("%u ", gid); - gr = getgrgid (gid); - if (gr == NULL) - printf ("(group unknown)\n"); - else - printf ("(group %s)\n", gr->gr_name); -} - -#define MONTH_INT (86400 * 30) -#define WEEK_INT (86400 * 7) -#define DAY_INT (86400) -#define HOUR_INT (60 * 60) -#define MINUTE_INT (60) - -static const char *interval_string(unsigned int secs) -{ - static char buf[256], tmp[80]; - int hr, min, num; - - buf[0] = 0; - - if (secs == 0) - return "<none>"; - - if (secs >= MONTH_INT) { - num = secs / MONTH_INT; - secs -= num*MONTH_INT; - sprintf(buf, "%d month%s", num, (num>1) ? "s" : ""); - } - if (secs >= WEEK_INT) { - num = secs / WEEK_INT; - secs -= num*WEEK_INT; - sprintf(tmp, "%s%d week%s", buf[0] ? ", " : "", - num, (num>1) ? "s" : ""); - strcat(buf, tmp); - } - if (secs >= DAY_INT) { - num = secs / DAY_INT; - secs -= num*DAY_INT; - sprintf(tmp, "%s%d day%s", buf[0] ? ", " : "", - num, (num>1) ? "s" : ""); - strcat(buf, tmp); - } - if (secs > 0) { - hr = secs / HOUR_INT; - secs -= hr*HOUR_INT; - min = secs / MINUTE_INT; - secs -= min*MINUTE_INT; - sprintf(tmp, "%s%d:%02d:%02d", buf[0] ? ", " : "", - hr, min, secs); - strcat(buf, tmp); - } - return buf; -} - - -#ifndef EXT2_INODE_SIZE -#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode) -#endif - -#ifndef EXT2_GOOD_OLD_REV -#define EXT2_GOOD_OLD_REV 0 -#endif - -void list_super (struct ext2_super_block * s) -{ - int inode_blocks_per_group; - struct ext2fs_sb *sb = (struct ext2fs_sb *) s; - char buf[80]; - const char *os; - time_t tm; - - inode_blocks_per_group = (((s->s_inodes_per_group * - EXT2_INODE_SIZE(s)) + - EXT2_BLOCK_SIZE(s) - 1) / - EXT2_BLOCK_SIZE(s)); - if (sb->s_volume_name[0]) { - memset(buf, 0, sizeof(buf)); - strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name)); - } else - strcpy(buf, "<none>"); - printf("Filesystem volume name: %s\n", buf); - if (sb->s_last_mounted[0]) { - memset(buf, 0, sizeof(buf)); - strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted)); - } else - strcpy(buf, "<not available>"); - printf("Last mounted on: %s\n", buf); - if (!e2p_is_null_uuid(sb->s_uuid)) { - e2p_uuid_to_str(sb->s_uuid, buf); - } else - strcpy(buf, "<none>"); - printf("Filesystem UUID: %s\n", buf); - printf ("Filesystem magic number: 0x%04X\n", s->s_magic); - printf ("Filesystem revision #: %d", s->s_rev_level); - if (s->s_rev_level == EXT2_GOOD_OLD_REV) { - printf(" (original)\n"); -#ifdef EXT2_DYNAMIC_REV - } else if (s->s_rev_level == EXT2_DYNAMIC_REV) { - printf(" (dynamic)\n"); -#endif - } else - printf("\n"); -#ifdef EXT2_DYNAMIC_REV - printf ("Filesystem features: "); - if (s->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) - printf("sparse_super"); - else - printf("(none)"); - printf("\n"); -#endif - printf ("Filesystem state: "); - print_fs_state (stdout, s->s_state); - printf ("\n"); - printf ("Errors behavior: "); - print_fs_errors (stdout, s->s_errors); - printf ("\n"); - switch (s->s_creator_os) { - case EXT2_OS_LINUX: os = "Linux"; break; - case EXT2_OS_HURD: os = "GNU"; break; - case EXT2_OS_MASIX: os = "Masix"; break; - default: os = "unknown"; break; - } - printf("Filesystem OS type: %s\n", os); - 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: %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("Inode blocks per group: %u\n", inode_blocks_per_group); - tm = s->s_mtime; - printf("Last mount time: %s", ctime(&tm)); - tm = s->s_wtime; - printf("Last write time: %s", ctime(&tm)); - printf("Mount count: %u\n", s->s_mnt_count); - printf("Maximum mount count: %d\n", s->s_max_mnt_count); - tm = s->s_lastcheck; - printf("Last checked: %s", ctime(&tm)); - printf("Check interval: %u (%s)\n", s->s_checkinterval, - interval_string(s->s_checkinterval)); - if (s->s_checkinterval) - { - time_t next; - - next = s->s_lastcheck + s->s_checkinterval; - printf("Next check after: %s", ctime(&next)); - } -#ifdef EXT2_DEF_RESUID - printf("Reserved blocks uid: "); - print_user(s->s_def_resuid); - printf("Reserved blocks gid: "); - print_group(s->s_def_resgid); -#endif -#ifdef EXT2_DYNAMIC_REV - if (s->s_rev_level >= EXT2_DYNAMIC_REV) { - printf("First inode: %d\n", s->s_first_ino); - printf("Inode size: %d\n", s->s_inode_size); - } -#endif -} - - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/pe.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/pe.c deleted file mode 100644 index 4cce6911701..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/pe.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * pe.c - Print a second extended filesystem errors behavior - * - * Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 94/01/09 - Creation - */ - -#include <stdio.h> - -#include "e2p.h" - -void print_fs_errors (FILE * f, unsigned short errors) -{ - switch (errors) - { - case EXT2_ERRORS_CONTINUE: - fprintf (f, "Continue"); - break; - case EXT2_ERRORS_RO: - fprintf (f, "Remount read-only"); - break; - case EXT2_ERRORS_PANIC: - fprintf (f, "Panic"); - break; - default: - fprintf (f, "Unknown (continue)"); - } -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/pf.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/pf.c deleted file mode 100644 index 8ef00b8255a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/pf.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * pf.c - Print file attributes on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#include <stdio.h> - -#include "e2p.h" - -static const unsigned long flags_array[] = { - EXT2_SECRM_FL, - EXT2_UNRM_FL, - EXT2_COMPR_FL, - EXT2_SYNC_FL, -#ifdef EXT2_IMMUTABLE_FL - EXT2_IMMUTABLE_FL, -#endif -#ifdef EXT2_APPEND_FL - EXT2_APPEND_FL, -#endif -#ifdef EXT2_NODUMP_FL - EXT2_NODUMP_FL, -#endif -#ifdef EXT2_NOATIME_FL - EXT2_NOATIME_FL, -#endif - 0}; - -static const char * short_flags[] = { - "s", - "u", - "c", - "S", -#ifdef EXT2_IMMUTABLE_FL - "i", -#endif -#ifdef EXT2_APPEND_FL - "a", -#endif -#ifdef EXT2_NODUMP_FL - "d", -#endif -#ifdef EXT2_NOATIME_FL - "A", -#endif - NULL}; - -static const char * long_flags[] = { - "Secure_Deletion, ", - "Undelete, ", - "Compressed_File, ", - "Synchronous_Updates, ", -#ifdef EXT2_IMMUTABLE_FL - "Immutable, ", -#endif -#ifdef EXT2_NODUMP_FL - "Append_Only, ", -#endif -#ifdef EXT2_NODUMP_FL - "No_Dump, ", -#endif -#ifdef EXT2_NOATIME_FL - "No_Atime, ", -#endif - NULL}; - -void print_flags (FILE * f, unsigned long flags, int long_format) -{ - int i; - const char ** flags_names; - - if (long_format) - flags_names = long_flags; - else - flags_names = short_flags; - - for (i = 0; flags_array[i] != 0; i++) - { - if (flags & flags_array[i]) - fprintf (f, flags_names[i]); - else - fprintf (f, "-"); - } -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/ps.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/ps.c deleted file mode 100644 index bec8b41959c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/ps.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * ps.c - Print filesystem state - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/12/22 - Creation - */ - -#include <stdio.h> - -#include "e2p.h" - -void print_fs_state (FILE * f, unsigned short state) -{ - if (state & EXT2_VALID_FS) - fprintf (f, " clean"); - else - fprintf (f, " not clean"); - if (state & EXT2_ERROR_FS) - fprintf (f, " with errors"); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/setflags.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/setflags.c deleted file mode 100644 index 654ec9dcc24..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/setflags.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * setflags.c - Set a file flags on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 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 "e2p.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 -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/setversion.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/setversion.c deleted file mode 100644 index 3210f514d4f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/setversion.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * setversion.c - Set a file version on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU Library General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - */ - -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/ioctl.h> - -#include "e2p.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 */ -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/e2p/uuid.c b/gnu/usr.sbin/e2fsprogs/lib/e2p/uuid.c deleted file mode 100644 index 39082a6817e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/e2p/uuid.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * uuid.c -- utility routines for manipulating UUID's. - */ - -#include <stdio.h> -#include <string.h> -#include <linux/types.h> - -#include "e2p.h" - -struct uuid { - __u32 time_low; - __u16 time_mid; - __u16 time_hi_and_version; - __u16 clock_seq; - __u8 node[6]; -}; - -/* Returns 1 if the uuid is the NULL uuid */ -int e2p_is_null_uuid(void *uu) -{ - __u8 *cp; - int i; - - for (i=0, cp = uu; i < 16; i++) - if (*cp) - return 0; - return 1; -} - -static void e2p_unpack_uuid(void *in, struct uuid *uu) -{ - __u8 *ptr = in; - __u32 tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - tmp = (tmp << 8) | *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->time_low = tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->time_mid = tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->time_hi_and_version = tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->clock_seq = tmp; - - memcpy(uu->node, ptr, 6); -} - -void e2p_uuid_to_str(void *uu, char *out) -{ - struct uuid uuid; - - e2p_unpack_uuid(uu, &uuid); - sprintf(out, - "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, - uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, - uuid.node[0], uuid.node[1], uuid.node[2], - uuid.node[3], uuid.node[4], uuid.node[5]); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/ChangeLog b/gnu/usr.sbin/e2fsprogs/lib/et/ChangeLog deleted file mode 100644 index 3ffe363d95f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/ChangeLog +++ /dev/null @@ -1,81 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -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 - are not built. - -Thu Sep 8 22:33:33 1994 (tytso@rsx-11) - - * com_err.c (default_com_err_proc): Reversed order of \n\r to make - jik happy. diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/Makefile.in b/gnu/usr.sbin/e2fsprogs/lib/et/Makefile.in deleted file mode 100644 index a0b05b39844..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/Makefile.in +++ /dev/null @@ -1,118 +0,0 @@ -# -# Makefile for lib/et -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = ../.. -my_dir = lib/ss -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_SO_VERSION = 2 -ELF_IMAGE = libcom_err -ELF_MYDIR = et -ELF_INSTALL_DIR = $(libdir) -ELF_OTHER_LIBS = -lc - -BSDLIB_VERSION = 1.0 -BSDLIB_IMAGE = libcom_err -BSDLIB_MYDIR = et -BSDLIB_INSTALL_DIR = $(libdir) - -# -# what to build... -# -.c.o: - $(CC) $(ALL_CFLAGS) -c $< -o $@ -@PROFILE_CMT@ $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< -@CHECKER_CMT@ $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $< -@DLL_CMT@ (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(ALL_CFLAGS) \ -@DLL_CMT@ -o jump/$*.o -c $<) -@ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< -@BSDLIB_CMT@ $(CC) $(ALL_CFLAGS) -fpic -o pic/$*.o -c $< - -@MAKEFILE_LIBRARY@ -@MAKEFILE_DLL@ -@MAKEFILE_ELF@ -@MAKEFILE_BSDLIB@ -@MAKEFILE_PROFILE@ -@MAKEFILE_CHECKER@ - -compile_et: $(SUBSTITUTE) $(srcdir)/compile_et.sh.in - -$(CHMOD) +x $(SUBSTITUTE) - $(SUBSTITUTE) $(srcdir)/compile_et.sh.in compile_et - $(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 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 diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.3 b/gnu/usr.sbin/e2fsprogs/lib/et/com_err.3 deleted file mode 100644 index cc9decb2f6c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.3 +++ /dev/null @@ -1,96 +0,0 @@ -.\" Copyright (c) 1988 Massachusetts Institute of Technology, -.\" Student Information Processing Board. All rights reserved. -.\" -.\" $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/com_err.3,v 1.1 1997/06/14 07:18:43 downsj Exp $ -.\" -.TH COM_ERR 3 "22 Nov 1988" SIPB -.SH NAME -com_err \- common error display routine -.SH SYNOPSIS -.nf - #include <com_err.h> -.PP -void com_err (whoami, code, format, ...); - const char *whoami; - long code; - const char *format; -.PP -proc = set_com_err_hook (proc); -.fi -void (* -.I proc -) (const char *, long, const char *, va_list); -.nf -.PP -proc = reset_com_err_hook (); -.PP -void initialize_XXXX_error_table (); -.fi -.SH DESCRIPTION -.I Com_err -displays an error message on the standard error stream -.I stderr -(see -.IR stdio (3S)) -composed of the -.I whoami -string, which should specify the program name or some subportion of -a program, followed by an error message generated from the -.I code -value (derived from -.IR compile_et (1)), -and a string produced using the -.I format -string and any following arguments, in the same style as -.IR fprintf (3). - -The behavior of -.I com_err -can be modified using -.I set_com_err_hook; -this defines a procedure which is called with the arguments passed to -.I com_err, -instead of the default internal procedure which sends the formatted -text to error output. Thus the error messages from a program can all -easily be diverted to another form of diagnostic logging, such as -.IR syslog (3). -.I Reset_com_err_hook -may be used to restore the behavior of -.I com_err -to its default form. Both procedures return the previous ``hook'' -value. These ``hook'' procedures must have the declaration given for -.I proc -above in the synopsis. - -The -.I initialize_XXXX_error_table -routine is generated mechanically by -.IR compile_et (1) -from a source file containing names and associated strings. Each -table has a name of up to four characters, which is used in place of -the -.B XXXX -in the name of the routine. These routines should be called before -any of the corresponding error codes are used, so that the -.I com_err -library will recognize error codes from these tables when they are -used. - -The -.B com_err.h -header file should be included in any source file that uses routines -from the -.I com_err -library; executable files must be linked using -.I ``-lcom_err'' -in order to cause the -.I com_err -library to be included. - -.\" .IR for manual entries -.\" .PP for paragraph breaks - -.SH "SEE ALSO" -compile_et (1), syslog (3). - -Ken Raeburn, "A Common Error Description Library for UNIX". diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.c b/gnu/usr.sbin/e2fsprogs/lib/et/com_err.c deleted file mode 100644 index 8ee332a312c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include <stdio.h> -#include "com_err.h" -#include "mit-sipb-copyright.h" -#include "error_table.h" -#include "internal.h" - -#if !defined(__STDC__) && !defined(STDARG_PROTOTYPES) -#include <varargs.h> -#define VARARGS -#endif - -static void -#ifdef __STDC__ - default_com_err_proc (const char *whoami, errcode_t code, const - char *fmt, va_list args) -#else - default_com_err_proc (whoami, code, fmt, args) - const char *whoami; - errcode_t code; - const char *fmt; - va_list args; -#endif -{ - if (whoami) { - fputs(whoami, stderr); - fputs(": ", stderr); - } - if (code) { - fputs(error_message(code), stderr); - fputs(" ", stderr); - } - if (fmt) { - vfprintf (stderr, fmt, args); - } - /* should do this only on a tty in raw mode */ - putc('\r', stderr); - putc('\n', stderr); - fflush(stderr); -} - -#ifdef __STDC__ -typedef void (*errf) (const char *, errcode_t, const char *, va_list); -#else -typedef void (*errf) (); -#endif - -errf com_err_hook = default_com_err_proc; - -#ifdef __STDC__ -void com_err_va (const char *whoami, errcode_t code, const char *fmt, - va_list args) -#else -void com_err_va (whoami, code, fmt, args) - const char *whoami; - errcode_t code; - const char *fmt; - va_list args; -#endif -{ - (*com_err_hook) (whoami, code, fmt, args); -} - -#ifndef VARARGS -void com_err (const char *whoami, - errcode_t code, - const char *fmt, ...) -{ -#else -void com_err (va_alist) - va_dcl -{ - const char *whoami, *fmt; - errcode_t code; -#endif - va_list pvar; - - if (!com_err_hook) - com_err_hook = default_com_err_proc; -#ifdef VARARGS - va_start (pvar); - whoami = va_arg (pvar, const char *); - code = va_arg (pvar, errcode_t); - fmt = va_arg (pvar, const char *); -#else - va_start(pvar, fmt); -#endif - com_err_va (whoami, code, fmt, pvar); - va_end(pvar); -} - -errf set_com_err_hook (new_proc) - errf new_proc; -{ - errf x = com_err_hook; - - if (new_proc) - com_err_hook = new_proc; - else - com_err_hook = default_com_err_proc; - - return x; -} - -errf reset_com_err_hook () { - errf x = com_err_hook; - com_err_hook = default_com_err_proc; - return x; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.h b/gnu/usr.sbin/e2fsprogs/lib/et/com_err.h deleted file mode 100644 index f28dce88a6c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Header file for common error description library. - * - * Copyright 1988, Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright and distribution info, see the documentation supplied - * with this package. - */ - -#ifndef __COM_ERR_H - -typedef long errcode_t; - -#ifdef __STDC__ -#include <stdarg.h> - -/* ANSI C -- use prototypes etc */ -void com_err (const char *, long, const char *, ...); -void com_err_va (const char *whoami, errcode_t code, const char *fmt, - va_list args); -char const *error_message (long); -extern void (*com_err_hook) (const char *, long, const char *, va_list); -void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list))) - (const char *, long, const char *, va_list); -void (*reset_com_err_hook (void)) (const char *, long, const char *, va_list); -int init_error_table(const char * const *msgs, int base, int count); -#else -/* no prototypes */ -void com_err (); -void com_err_va (); -char *error_message (); -extern void (*com_err_hook) (); -void (*set_com_err_hook ()) (); -void (*reset_com_err_hook ()) (); -int init_error_table(); -#endif - -#define __COM_ERR_H -#endif /* ! defined(__COM_ERR_H) */ diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.texinfo b/gnu/usr.sbin/e2fsprogs/lib/et/com_err.texinfo deleted file mode 100644 index 5fd4a95ff8d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/com_err.texinfo +++ /dev/null @@ -1,554 +0,0 @@ -\input texinfo @c -*-texinfo-*- - -@c $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/com_err.texinfo,v 1.1 1997/06/14 07:18:44 downsj Exp $ -@c $Source: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/com_err.texinfo,v $ -@c $Locker: $ - -@c Note that although this source file is in texinfo format (more -@c or less), it is not yet suitable for turning into an ``info'' -@c file. Sorry, maybe next time. -@c -@c In order to produce hardcopy documentation from a texinfo file, -@c run ``tex com_err.texinfo'' which will load in texinfo.tex, -@c provided in this distribution. (texinfo.tex is from the Free -@c Software Foundation, and is under different copyright restrictions -@c from the rest of this package.) - -@ifinfo -@barfo -@end ifinfo - -@iftex -@tolerance 10000 - -@c Mutate section headers... -@begingroup - @catcode#=6 - @gdef@secheading#1#2#3{@secheadingi {#3@enspace #1}} -@endgroup -@end iftex - -@setfilename com_err -@settitle A Common Error Description Library for UNIX - -@ifinfo -This file documents the use of the Common Error Description library. - -Copyright (C) 1987, 1988 Student Information Processing Board of the -Massachusetts Institute of Technology. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution of the software -without specific, written prior permission. M.I.T. and the M.I.T. S.I.P.B. -make no representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. - -Note that the file texinfo.tex, provided with this distribution, is from -the Free Software Foundation, and is under different copyright restrictions -from the remainder of this package. - -@end ifinfo - -@ignore -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore - -@setchapternewpage odd - -@titlepage -@center @titlefont{A Common Error Description} -@center @titlefont{Library for UNIX} -@sp 2 -@center Ken Raeburn -@center Bill Sommerfeld -@sp 1 -@center MIT Student Information Processing Board -@sp 3 -@center last updated 1 January 1989 -@center for version 1.2 -@center ***DRAFT COPY ONLY*** - -@vskip 2in - -@center @b{Abstract} - -UNIX has always had a clean and simple system call interface, with a -standard set of error codes passed between the kernel and user -programs. Unfortunately, the same cannot be said of many of the -libraries layered on top of the primitives provided by the kernel. -Typically, each one has used a different style of indicating errors to -their callers, leading to a total hodgepodge of error handling, and -considerable amounts of work for the programmer. This paper describes -a library and associated utilities which allows a more uniform way for -libraries to return errors to their callers, and for programs to -describe errors and exceptional conditions to their users. - -@page -@vskip 0pt plus 1filll - -Copyright @copyright{} 1987, 1988 by the Student Information Processing -Board of the Massachusetts Institute of Technology. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided -that the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution of the software -without specific, written prior permission. M.I.T. and the M.I.T. S.I.P.B. -make no representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. - -Note that the file texinfo.tex, provided with this distribution, is from -the Free Software Foundation, and is under different copyright restrictions -from the remainder of this package. - -@end titlepage - -@ifinfo -@c should put a menu here someday.... -@end ifinfo - -@page - -@section Why com_err? - -In building application software packages, a programmer often has to -deal with a number of libraries, each of which can use a different -error-reporting mechanism. Sometimes one of two values is returned, -indicating simply SUCCESS or FAILURE, with no description of errors -encountered. Sometimes it is an index into a table of text strings, -where the name of the table used is dependent on the library being -used when the error is generated; since each table starts numbering at -0 or 1, additional information as to the source of the error code is -needed to determine which table to look at. Sometimes no text messages are -supplied at all, and the programmer must supply them at any point at which -he may wish to report error conditions. -Often, a global variable is assigned some value describing the error, but -the programmer has to know in each case whether to look at @code{errno}, -@code{h_errno}, the return value from @code{hes_err()}, or whatever other -variables or routines are specified. -And what happens if something -in the procedure of -examining or reporting the error changes the same variable? - -The package we have developed is an attempt to present a common -error-handling mechanism to manipulate the most common form of error code -in a fashion that does not have the problems listed above. - -A list of up to 256 text messages is supplied to a translator we have -written, along with the three- to four-character ``name'' of the error -table. The library using this error table need only call a routine -generated from this error-table source to make the table ``known'' to the -com_err library, and any error code the library generates can be converted -to the corresponding error message. There is also a default format for -error codes accidentally returned before making the table known, which is -of the form @samp{unknown code foo 32}, where @samp{foo} would be the name -of the table. - -@section Error codes - -Error codes themselves are 32 bit (signed) integers, of which the high -order 24 bits are an identifier of which error table the error code is -from, and the low order 8 bits are a sequential error number within -the table. An error code may thus be easily decomposed into its component -parts. Only the lowest 32 bits of an error code are considered significant -on systems which support wider values. - -Error table 0 is defined to match the UNIX system call error table -(@code{sys_errlist}); this allows @code{errno} values to be used directly -in the library (assuming that @code{errno} is of a type with the same width -as @t{long}). Other error table numbers are formed by compacting together -the first four characters of the error table name. The mapping between -characters in the name and numeric values in the error code are defined in -a system-independent fashion, so that two systems that can pass integral -values between them can reliably pass error codes without loss of meaning; -this should work even if the character sets used are not the same. -(However, if this is to be done, error table 0 should be avoided, since the -local system call error tables may differ.) - -Any variable which is to contain an error code should be declared @t{long}. -The draft proposed American National Standard for C (as of May, 1988) -requires that @t{long} variables be at least 32 bits; any system which does -not support 32-bit @t{long} values cannot make use of this package (nor -much other software that assumes an ANSI-C environment base) without -significant effort. - -@section Error table source file - -The error table source file begins with the declaration of the table name, -as - -@example -error_table @var{tablename} -@end example - -Individual error codes are -specified with - -@example -error_code @var{ERROR_NAME}, @var{"text message"} -@end example - -where @samp{ec} can also be used as a short form of @samp{error_code}. To -indicate the end of the table, use @samp{end}. Thus, a (short) sample -error table might be: - -@example - - error_table dsc - - error_code DSC_DUP_MTG_NAME, - "Meeting already exists" - - ec DSC_BAD_PATH, - "A bad meeting pathname was given" - - ec DSC_BAD_MODES, - "Invalid mode for this access control list" - - end - -@end example - -@section The error-table compiler - -The error table compiler is named @code{compile_et}. It takes one -argument, the pathname of a file (ending in @samp{.et}, e.g., -@samp{dsc_err.et}) containing an error table source file. It parses the -error table, and generates two output files -- a C header file -(@samp{discuss_err.h}) which contains definitions of the numerical values -of the error codes defined in the error table, and a C source file which -should be compiled and linked with the executable. The header file must be -included in the source of a module which wishes to reference the error -codes defined; the object module generated from the C code may be linked in -to a program which wishes to use the printed forms of the error codes. - -This translator accepts a @kbd{-language @var{lang}} argument, which -determines for which language (or language variant) the output should be -written. At the moment, @var{lang} is currently limited to @kbd{ANSI-C} -and @kbd{K&R-C}, and some abbreviated forms of each. Eventually, this will -be extended to include some support for C++. The default is currently -@kbd{K&R-C}, though the generated sources will have ANSI-C code -conditionalized on the symbol @t{__STDC__}. - -@section Run-time support routines - -Any source file which uses the routines supplied with or produced by the -com_err package should include the header file @file{<com_err.h>}. It -contains declarations and definitions which may be needed on some systems. -(Some functions cannot be referenced properly without the return type -declarations in this file. Some functions may work properly on most -architectures even without the header file, but relying on this is not -recommended.) - -The run-time support routines and variables provided via this package -include the following: - -@example -void initialize_@var{xxxx}_error_table (void); -@end example - -One of these routines is built by the error compiler for each error table. -It makes the @var{xxxx} error table ``known'' to the error reporting -system. By convention, this routine should be called in the initialization -routine of the @var{xxxx} library. If the library has no initialization -routine, some combination of routines which form the core of the library -should ensure that this routine is called. It is not advised to leave it -the caller to make this call. - -There is no harm in calling this routine more than once. - -@example -#define ERROR_TABLE_BASE_@var{xxxx} @var{nnnnn}L -@end example - -This symbol contains the value of the first error code entry in the -specified table. -This rarely needs be used by the -programmer. - -@example -const char *error_message (long code); -@end example - -This routine returns the character string error message associated -with @code{code}; if this is associated with an unknown error table, or -if the code is associated with a known error table but the code is not -in the table, a string of the form @samp{Unknown code @var{xxxx nn}} is -returned, where @var{xxxx} is the error table name produced by -reversing the compaction performed on the error table number implied -by that error code, and @var{nn} is the offset from that base value. - -Although this routine is available for use when needed, its use should be -left to circumstances which render @code{com_err} (below) unusable. - -@example -void com_err (const char *whoami, /* module reporting error */ - long code, /* error code */ - const char *format, /* format for additional detail */ - ...); /* (extra parameters) */ -@end example - -This routine provides an alternate way to print error messages to -standard error; it allows the error message to be passed in as a -parameter, rather than in an external variable. @emph{Provide grammatical -context for ``message.''} - -If @var{format} is @code{(char *)NULL}, the formatted message will not be -printed. @var{format} may not be omitted. - -@example -#include <stdarg.h> - -void com_err_va (const char *whoami, - long code, - const char *format, - va_list args); -@end example - -This routine provides an interface, equivalent to @code{com_err} above, -which may be used by higher-level variadic functions (functions which -accept variable numbers of arguments). - -@example -#include <stdarg.h> - -void (*set_com_err_hook (void (*proc) ())) (); - -void (*@var{proc}) (const char *whoami, long code, va_list args); - -void reset_com_err_hook (); -@end example - -These two routines allow a routine to be dynamically substituted for -@samp{com_err}. After @samp{set_com_err_hook} has been called, -calls to @samp{com_err} will turn into calls to the new hook routine. -@samp{reset_com_err_hook} turns off this hook. This may intended to -be used in daemons (to use a routine which calls @var{syslog(3)}), or -in a window system application (which could pop up a dialogue box). - -If a program is to be used in an environment in which simply printing -messages to the @code{stderr} stream would be inappropriate (such as in a -daemon program which runs without a terminal attached), -@code{set_com_err_hook} may be used to redirect output from @code{com_err}. -The following is an example of an error handler which uses @var{syslog(3)} -as supplied in BSD 4.3: - -@example -#include <stdio.h> -#include <stdarg.h> -#include <syslog.h> - -/* extern openlog (const char * name, int logopt, int facility); */ -/* extern syslog (int priority, char * message, ...); */ - -void hook (const char * whoami, long code, - const char * format, va_list args) -@{ - char buffer[BUFSIZ]; - static int initialized = 0; - if (!initialized) @{ - openlog (whoami, - LOG_NOWAIT|LOG_CONS|LOG_PID|LOG_NDELAY, - LOG_DAEMON); - initialized = 1; - @} - vsprintf (buffer, format, args); - syslog (LOG_ERR, "%s %s", error_message (code), buffer); -@} -@end example - -After making the call -@code{set_com_err_hook (hook);}, -any calls to @code{com_err} will result in messages being sent to the -@var{syslogd} daemon for logging. -The name of the program, @samp{whoami}, is supplied to the -@samp{openlog()} call, and the message is formatted into a buffer and -passed to @code{syslog}. - -Note that since the extra arguments to @code{com_err} are passed by -reference via the @code{va_list} value @code{args}, the hook routine may -place any form of interpretation on them, including ignoring them. For -consistency, @code{printf}-style interpretation is suggested, via -@code{vsprintf} (or @code{_doprnt} on BSD systems without full support for -the ANSI C library). - -@section Coding Conventions - -The following conventions are just some general stylistic conventions -to follow when writing robust libraries and programs. Conventions -similar to this are generally followed inside the UNIX kernel and most -routines in the Multics operating system. In general, a routine -either succeeds (returning a zero error code, and doing some side -effects in the process), or it fails, doing minimal side effects; in -any event, any invariant which the library assumes must be maintained. - -In general, it is not in the domain of non user-interface library -routines to write error messages to the user's terminal, or halt the -process. Such forms of ``error handling'' should be reserved for -failures of internal invariants and consistancy checks only, as it -provides the user of the library no way to clean up for himself in the -event of total failure. - -Library routines which can fail should be set up to return an error -code. This should usually be done as the return value of the -function; if this is not acceptable, the routine should return a -``null'' value, and put the error code into a parameter passed by -reference. - -Routines which use the first style of interface can be used from -user-interface levels of a program as follows: - -@example -@{ - if ((code = initialize_world(getuid(), random())) != 0) @{ - com_err("demo", code, - "when trying to initialize world"); - exit(1); - @} - if ((database = open_database("my_secrets", &code))==NULL) @{ - com_err("demo", code, - "while opening my_secrets"); - exit(1); - @} -@} -@end example - -A caller which fails to check the return status is in error. It is -possible to look for code which ignores error returns by using lint; -look for error messages of the form ``foobar returns value which is -sometimes ignored'' or ``foobar returns value which is always -ignored.'' - -Since libraries may be built out of other libraries, it is often necessary -for the success of one routine to depend on another. When a lower level -routine returns an error code, the middle level routine has a few possible -options. It can simply return the error code to its caller after doing -some form of cleanup, it can substitute one of its own, or it can take -corrective action of its own and continue normally. For instance, a -library routine which makes a ``connect'' system call to make a network -connection may reflect the system error code @code{ECONNREFUSED} -(Connection refused) to its caller, or it may return a ``server not -available, try again later,'' or it may try a different server. - -Cleanup which is typically necessary may include, but not be limited -to, freeing allocated memory which will not be needed any more, -unlocking concurrancy locks, dropping reference counts, closing file -descriptors, or otherwise undoing anything which the procedure did up -to this point. When there are a lot of things which can go wrong, it -is generally good to write one block of error-handling code which is -branched to, using a goto, in the event of failure. A common source -of errors in UNIX programs is failing to close file descriptors on -error returns; this leaves a number of ``zombied'' file descriptors -open, which eventually causes the process to run out of file -descriptors and fall over. - -@example -@{ - FILE *f1=NULL, *f2=NULL, *f3=NULL; - int status = 0; - - if ( (f1 = fopen(FILE1, "r")) == NULL) @{ - status = errno; - goto error; - @} - - /* - * Crunch for a while - */ - - if ( (f2 = fopen(FILE2, "w")) == NULL) @{ - status = errno; - goto error; - @} - - if ( (f3 = fopen(FILE3, "a+")) == NULL) @{ - status = errno; - goto error; - @} - - /* - * Do more processing. - */ - fclose(f1); - fclose(f2); - fclose(f3); - return 0; - -error: - if (f1) fclose(f1); - if (f2) fclose(f2); - if (f3) fclose(f3); - return status; -@} -@end example - -@section Building and Installation - -The distribution of this package will probably be done as a compressed -``tar''-format file available via anonymous FTP from SIPB.MIT.EDU. -Retrieve @samp{pub/com_err.tar.Z} and extract the contents. A subdirectory -@t{profiled} should be created to hold objects compiled for profiling. -Running ``make all'' should then be sufficient to build the library and -error-table compiler. The files @samp{libcom_err.a}, -@samp{libcom_err_p.a}, @samp{com_err.h}, and @samp{compile_et} should be -installed for use; @samp{com_err.3} and @samp{compile_et.1} can also be -installed as manual pages. - -Potential problems: - -@itemize @bullet - -@item Use of @code{strcasecmp}, a routine provided in BSD for -case-insensitive string comparisons. If an equivalent routine is -available, you can modify @code{CFLAGS} in the makefile to define -@code{strcasecmp} to the name of that routine. - -@item Compilers that defined @code{__STDC__} without providing the header -file @code{<stdarg.h>}. One such example is Metaware's High ``C'' -compiler, as provided at Project Athena on the IBM RT/PC workstation; if -@code{__HIGHC__} is defined, it is assumed that @code{<stdarg.h>} is not -available, and therefore @code{<varargs.h>} must be used. If the symbol -@code{VARARGS} is defined (e.g., in the makefile), @code{<varargs.h>} will -be used. - -@item If your linker rejects symbols that are simultaneously defined in two -library files, edit @samp{Makefile} to remove @samp{perror.c} from the -library. This file contains a version of @var{perror(3)} which calls -@code{com_err} instead of calling @code{write} directly. - -@end itemize - -As I do not have access to non-BSD systems, there are probably -bugs present that may interfere with building or using this package on -other systems. If they are reported to me, they can probably be fixed for -the next version. - -@section Bug Reports - -Please send any comments or bug reports to the principal author: Ken -Raeburn, @t{Raeburn@@Athena.MIT.EDU}. - -@section Acknowledgements - -I would like to thank: Bill Sommerfeld, for his help with some of this -documentation, and catching some of the bugs the first time around; -Honeywell Information Systems, for not killing off the @emph{Multics} -operating system before I had an opportunity to use it; Honeywell's -customers, who persuaded them not to do so, for a while; Ted Anderson of -CMU, for catching some problems before version 1.2 left the nest; Stan -Zanarotti and several others of MIT's Student Information Processing Board, -for getting us started with ``discuss,'' for which this package was -originally written; and everyone I've talked into --- I mean, asked to read -this document and the ``man'' pages. - -@bye diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/compile_et.1 b/gnu/usr.sbin/e2fsprogs/lib/et/compile_et.1 deleted file mode 100644 index 15992284ac8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/compile_et.1 +++ /dev/null @@ -1,79 +0,0 @@ -.\" Copyright (c) 1988 Massachusetts Institute of Technology, -.\" Student Information Processing Board. All rights reserved. -.\" -.\" $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/compile_et.1,v 1.1 1997/06/14 07:18:44 downsj Exp $ -.\" -.TH COMPILE_ET 1 "22 Nov 1988" SIPB -.SH NAME -compile_et \- error table compiler -.SH SYNOPSIS -.B compile_et -file -.SH DESCRIPTION -.B Compile_et -converts a table listing error-code names and associated messages into -a C source file suitable for use with the -.IR com_err (3) -library. - -The source file name must end with a suffix of ``.et''; the file -consists of a declaration supplying the name (up to four characters -long) of the error-code table: - -.B error_table -.I name - -followed by up to 256 entries of the form: - -.B error_code -.I name, -" -.I string -" - -and a final - -.B end - -to indicate the end of the table. - -The name of the table is used to construct the name of a subroutine -.I initialize_XXXX_error_table -which must be called in order for the -.I com_err -library to recognize the error table. - -The various error codes defined are assigned sequentially increasing -numbers (starting with a large number computed as a hash function of -the name of the table); thus for compatibility it is suggested that -new codes be added only to the end of an existing table, and that no -codes be removed from tables. - -The names defined in the table are placed into a C header file with -preprocessor directives defining them as integer constants of up to -32 bits in magnitude. - -A C source file is also generated which should be compiled and linked -with the object files which reference these error codes; it contains -the text of the messages and the initialization subroutine. Both C -files have names derived from that of the original source file, with -the ``.et'' suffix replaced by ``.c'' and ``.h''. - -A ``#'' in the source file is treated as a comment character, and all -remaining text to the end of the source line will be ignored. - -.SH BUGS - -Since -.B compile_et -uses a very simple parser based on -.IR yacc (1), -its error recovery leaves much to be desired. - -.\" .IR for manual entries -.\" .PP for paragraph breaks - -.SH "SEE ALSO" -com_err (3). - -Ken Raeburn, "A Common Error Description Library for UNIX". diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/compile_et.sh.in b/gnu/usr.sbin/e2fsprogs/lib/et/compile_et.sh.in deleted file mode 100644 index 0cae2971cbd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/compile_et.sh.in +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# -AWK=@AWK@ -DIR=@ET_DIR@ - -ROOT=`echo $1 | sed -e s/.et$//` -BASE=`basename $ROOT` - -$AWK -f ${DIR}/et_h.awk outfile=${BASE}.h $ROOT.et -$AWK -f ${DIR}/et_c.awk outfile=${BASE}.c $ROOT.et diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.funcs b/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.funcs deleted file mode 100644 index c5cdbc41d8b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.funcs +++ /dev/null @@ -1,6 +0,0 @@ -00000000 T _error_message libcom_err jump/error_message -00000000 T _init_error_table libcom_err jump/init_et -00000000 T _com_err_va libcom_err jump/com_err -00000000 T _com_err libcom_err jump/com_err -00000000 T _set_com_err_hook libcom_err jump/com_err -00000000 T _reset_com_err_hook libcom_err jump/com_err diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.ignore b/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.ignore deleted file mode 100644 index 0bcb55196bf..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.ignore +++ /dev/null @@ -1 +0,0 @@ -00000000 T _error_table_name libxyzzy jump/et_name diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.import b/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.import deleted file mode 100644 index 51b1fd88d2b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.import +++ /dev/null @@ -1,164 +0,0 @@ -/usr/lib/libc.sa(__libc.o):00001000 a __GOT_SIZE -/usr/lib/libc.sa(__libc.o):6008f0b0 A _AL -/usr/lib/libc.sa(__libc.o):6008f198 A _AL_PARM -/usr/lib/libc.sa(__libc.o):6008f060 A _AM -/usr/lib/libc.sa(__libc.o):6008f0b4 A _BC -/usr/lib/libc.sa(__libc.o):6008f064 A _BS -/usr/lib/libc.sa(__libc.o):6008f0bc A _BT -/usr/lib/libc.sa(__libc.o):6008f068 A _CA -/usr/lib/libc.sa(__libc.o):6008f0c0 A _CD -/usr/lib/libc.sa(__libc.o):6008f0c4 A _CE -/usr/lib/libc.sa(__libc.o):6008f0c8 A _CL -/usr/lib/libc.sa(__libc.o):6008f0cc A _CM -/usr/lib/libc.sa(__libc.o):6008f048 A _COLS -/usr/lib/libc.sa(__libc.o):6008f0d0 A _CR -/usr/lib/libc.sa(__libc.o):6008f0d4 A _CS -/usr/lib/libc.sa(__libc.o):6008f06c A _DA -/usr/lib/libc.sa(__libc.o):6008f070 A _DB -/usr/lib/libc.sa(__libc.o):6008f0d8 A _DC -/usr/lib/libc.sa(__libc.o):6008f0dc A _DL -/usr/lib/libc.sa(__libc.o):6008f19c A _DL_PARM -/usr/lib/libc.sa(__libc.o):6008f0e0 A _DM -/usr/lib/libc.sa(__libc.o):6008f0e4 A _DO -/usr/lib/libc.sa(__libc.o):6008f1a4 A _DOWN_PARM -/usr/lib/libc.sa(__libc.o):6008f03c A _Def_term -/usr/lib/libc.sa(__libc.o):6008f0e8 A _ED -/usr/lib/libc.sa(__libc.o):6008f0ec A _EI -/usr/lib/libc.sa(__libc.o):6008f074 A _EO -/usr/lib/libc.sa(__libc.o):6008f1b8 A _GT -/usr/lib/libc.sa(__libc.o):6008f078 A _HC -/usr/lib/libc.sa(__libc.o):6008f118 A _HO -/usr/lib/libc.sa(__libc.o):6008f07c A _HZ -/usr/lib/libc.sa(__libc.o):6008f11c A _IC -/usr/lib/libc.sa(__libc.o):6008f120 A _IM -/usr/lib/libc.sa(__libc.o):6008f080 A _IN -/usr/lib/libc.sa(__libc.o):6008f124 A _IP -/usr/lib/libc.sa(__libc.o):6008f0f0 A _K0 -/usr/lib/libc.sa(__libc.o):6008f0f4 A _K1 -/usr/lib/libc.sa(__libc.o):6008f0f8 A _K2 -/usr/lib/libc.sa(__libc.o):6008f0fc A _K3 -/usr/lib/libc.sa(__libc.o):6008f100 A _K4 -/usr/lib/libc.sa(__libc.o):6008f104 A _K5 -/usr/lib/libc.sa(__libc.o):6008f108 A _K6 -/usr/lib/libc.sa(__libc.o):6008f10c A _K7 -/usr/lib/libc.sa(__libc.o):6008f110 A _K8 -/usr/lib/libc.sa(__libc.o):6008f114 A _K9 -/usr/lib/libc.sa(__libc.o):6008f128 A _KD -/usr/lib/libc.sa(__libc.o):6008f12c A _KE -/usr/lib/libc.sa(__libc.o):6008f130 A _KH -/usr/lib/libc.sa(__libc.o):6008f134 A _KL -/usr/lib/libc.sa(__libc.o):6008f138 A _KR -/usr/lib/libc.sa(__libc.o):6008f13c A _KS -/usr/lib/libc.sa(__libc.o):6008f140 A _KU -/usr/lib/libc.sa(__libc.o):6008f1a8 A _LEFT_PARM -/usr/lib/libc.sa(__libc.o):6008f044 A _LINES -/usr/lib/libc.sa(__libc.o):6008f144 A _LL -/usr/lib/libc.sa(__libc.o):6008f148 A _MA -/usr/lib/libc.sa(__libc.o):6008f300 A _MCAppPath -/usr/lib/libc.sa(__libc.o):6008f084 A _MI -/usr/lib/libc.sa(__libc.o):6008f088 A _MS -/usr/lib/libc.sa(__libc.o):6008f030 A _My_term -/usr/lib/libc.sa(__libc.o):6008f08c A _NC -/usr/lib/libc.sa(__libc.o):6008f14c A _ND -/usr/lib/libc.sa(__libc.o):6008f150 A _NL -/usr/lib/libc.sa(__libc.o):6008f1bc A _NONL -/usr/lib/libc.sa(__libc.o):6008f090 A _NS -/usr/lib/libc.sa(__libc.o):6008f094 A _OS -/usr/lib/libc.sa(__libc.o):6008f1b0 A _PC -/usr/lib/libc.sa(__libc.o):6008f154 A _RC -/usr/lib/libc.sa(__libc.o):6008f1ac A _RIGHT_PARM -/usr/lib/libc.sa(__libc.o):6008f158 A _SC -/usr/lib/libc.sa(__libc.o):6008f15c A _SE -/usr/lib/libc.sa(__libc.o):6008f160 A _SF -/usr/lib/libc.sa(__libc.o):6008f164 A _SO -/usr/lib/libc.sa(__libc.o):6008f168 A _SR -/usr/lib/libc.sa(__libc.o):6008f16c A _TA -/usr/lib/libc.sa(__libc.o):6008f170 A _TE -/usr/lib/libc.sa(__libc.o):6008f174 A _TI -/usr/lib/libc.sa(__libc.o):6008f178 A _UC -/usr/lib/libc.sa(__libc.o):6008f17c A _UE -/usr/lib/libc.sa(__libc.o):6008f098 A _UL -/usr/lib/libc.sa(__libc.o):6008f180 A _UP -/usr/lib/libc.sa(__libc.o):6008f1c0 A _UPPERCASE -/usr/lib/libc.sa(__libc.o):6008f1a0 A _UP_PARM -/usr/lib/libc.sa(__libc.o):6008f188 A _US -/usr/lib/libc.sa(__libc.o):6008f18c A _VB -/usr/lib/libc.sa(__libc.o):6008f194 A _VE -/usr/lib/libc.sa(__libc.o):6008f190 A _VS -/usr/lib/libc.sa(__libc.o):6008f09c A _XB -/usr/lib/libc.sa(__libc.o):6008f0a0 A _XN -/usr/lib/libc.sa(__libc.o):6008f0a8 A _XS -/usr/lib/libc.sa(__libc.o):6008f0a4 A _XT -/usr/lib/libc.sa(__libc.o):6008f0ac A _XX -/usr/lib/libc.sa(__libc.o):6008f2a4 A __IO_file_jumps -/usr/lib/libc.sa(__libc.o):6008f1f4 A __IO_list_all -/usr/lib/libc.sa(__libc.o):6008f2a8 A __IO_proc_jumps -/usr/lib/libc.sa(__libc.o):6008f1ec A __IO_stderr_ -/usr/lib/libc.sa(__libc.o):6008f1e4 A __IO_stdin_ -/usr/lib/libc.sa(__libc.o):6008f1e8 A __IO_stdout_ -/usr/lib/libc.sa(__libc.o):6008f2ac A __IO_str_jumps -/usr/lib/libc.sa(__libc.o):6008f214 A ____brk_addr -/usr/lib/libc.sa(__libc.o):6008f01c A ___ctype_b -/usr/lib/libc.sa(__libc.o):6008f020 A ___ctype_tolower -/usr/lib/libc.sa(__libc.o):6008f024 A ___ctype_toupper -/usr/lib/libc.sa(__libc.o):6008f1fc A ___environ -/usr/lib/libc.sa(__libc.o):6008f250 A ___exit_funcs -/usr/lib/libc.sa(__libc.o):6008f2f0 A ___glob_closedir_hook -/usr/lib/libc.sa(__libc.o):6008f2f4 A ___glob_opendir_hook -/usr/lib/libc.sa(__libc.o):6008f2f8 A ___glob_readdir_hook -/usr/lib/libc.sa(__libc.o):6008f278 A ___ttyname -/usr/lib/libc.sa(__libc.o):6008f238 A __collate_info -/usr/lib/libc.sa(__libc.o):6008f23c A __ctype_info -/usr/lib/libc.sa(__libc.o):6008f028 A __echoit -/usr/lib/libc.sa(__libc.o):6008f034 A __endwin -/usr/lib/libc.sa(__libc.o):6008f288 A __gdbm_fetch_val -/usr/lib/libc.sa(__libc.o):6008f280 A __gdbm_file -/usr/lib/libc.sa(__libc.o):6008f284 A __gdbm_memory -/usr/lib/libc.sa(__libc.o):6008f240 A __monetary_info -/usr/lib/libc.sa(__libc.o):6008f234 A __null_auth -/usr/lib/libc.sa(__libc.o):6008f244 A __numeric_info -/usr/lib/libc.sa(__libc.o):6008f2ec A __obstack -/usr/lib/libc.sa(__libc.o):6008f1c8 A __pfast -/usr/lib/libc.sa(__libc.o):6008f02c A __rawmode -/usr/lib/libc.sa(__libc.o):6008f1dc A __res -/usr/lib/libc.sa(__libc.o):6008f04c A __res_iflg -/usr/lib/libc.sa(__libc.o):6008f050 A __res_lflg -/usr/lib/libc.sa(__libc.o):6008f270 A __res_opcodes -/usr/lib/libc.sa(__libc.o):6008f274 A __res_resultcodes -/usr/lib/libc.sa(__libc.o):6008f248 A __response_info -/usr/lib/libc.sa(__libc.o):6008f2fc A __sigintr -/usr/lib/libc.sa(__libc.o):6008f00c A __sys_errlist -/usr/lib/libc.sa(__libc.o):6008f010 A __sys_nerr -/usr/lib/libc.sa(__libc.o):6008f014 A __sys_siglist -/usr/lib/libc.sa(__libc.o):6008f24c A __time_info -/usr/lib/libc.sa(__libc.o):6008f05c A __tty -/usr/lib/libc.sa(__libc.o):6008f040 A __tty_ch -/usr/lib/libc.sa(__libc.o):6008f1cc A __unctrl -/usr/lib/libc.sa(__libc.o):6008f27c A __win -/usr/lib/libc.sa(__libc.o):6008f058 A _curscr -/usr/lib/libc.sa(__libc.o):6008f228 A _daylight -/usr/lib/libc.sa(__libc.o):6008f200 A _errno -/usr/lib/libc.sa(__libc.o):6008f1d0 A _gdbm_errno -/usr/lib/libc.sa(__libc.o):6008f28c A _gdbm_version -/usr/lib/libc.sa(__libc.o):6008f008 A _h_errlist -/usr/lib/libc.sa(__libc.o):6008f1d8 A _h_errno -/usr/lib/libc.sa(__libc.o):6008f2a0 A _h_nerr -/usr/lib/libc.sa(__libc.o):6008f1c4 A _normtty -/usr/lib/libc.sa(__libc.o):6008f204 A _optarg -/usr/lib/libc.sa(__libc.o):6008f20c A _opterr -/usr/lib/libc.sa(__libc.o):6008f208 A _optind -/usr/lib/libc.sa(__libc.o):6008f2e4 A _optopt -/usr/lib/libc.sa(__libc.o):6008f218 A _ospeed -/usr/lib/libc.sa(__libc.o):6008f26c A _re_max_failures -/usr/lib/libc.sa(__libc.o):6008f210 A _re_syntax_options -/usr/lib/libc.sa(__libc.o):6008f1e0 A _rexecoptions -/usr/lib/libc.sa(__libc.o):6008f230 A _rpc_createerr -/usr/lib/libc.sa(__libc.o):6008f25c A _stderr -/usr/lib/libc.sa(__libc.o):6008f254 A _stdin -/usr/lib/libc.sa(__libc.o):6008f258 A _stdout -/usr/lib/libc.sa(__libc.o):6008f054 A _stdscr -/usr/lib/libc.sa(__libc.o):6008f2e8 A _svc_fdset -/usr/lib/libc.sa(__libc.o):6008f224 A _timezone -/usr/lib/libc.sa(__libc.o):6008f21c A _tputs_baud_rate -/usr/lib/libc.sa(__libc.o):6008f038 A _ttytype -/usr/lib/libc.sa(__libc.o):6008f220 A _tzname diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.params b/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.params deleted file mode 100644 index d88c8c2ffb0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.params +++ /dev/null @@ -1,6 +0,0 @@ -Name=libet -Text=0x66800000 -Data=0x00000000 -Jump=0x00001000 -GOT=0x00001000 -Version=1.0.0 diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.undefs b/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.undefs deleted file mode 100644 index de3f8d4901f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.undefs +++ /dev/null @@ -1 +0,0 @@ -66803000 D __NEEDS_SHRLIB_libc_4 diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.vars b/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.vars deleted file mode 100644 index c0aad656c88..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/dll/jump.vars +++ /dev/null @@ -1,2 +0,0 @@ -00000004 D __et_list libcom_err jump/error_message -00000004 D _com_err_hook libcom_err jump/com_err diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/error_message.c b/gnu/usr.sbin/e2fsprogs/lib/et/error_message.c deleted file mode 100644 index 349b850ce91..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/error_message.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/error_message.c,v 1.1 1997/06/14 07:18:44 downsj Exp $ - * $Source: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/error_message.c,v $ - * $Locker: $ - * - * Copyright 1987 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * For copyright info, see "mit-sipb-copyright.h". - */ - -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include "com_err.h" -#include "error_table.h" -#include "mit-sipb-copyright.h" -#include "internal.h" - -static char buffer[25]; - -struct et_list * _et_list = (struct et_list *) NULL; - - -#ifdef __STDC__ -const char * error_message (errcode_t code) -#else -const char * error_message (code) - errcode_t code; -#endif -{ - int offset; - struct et_list *et; - int table_num; - int started = 0; - char *cp; - - offset = code & ((1<<ERRCODE_RANGE)-1); - table_num = code - offset; - if (!table_num) { -#ifdef HAS_SYS_ERRLIST - if (offset < sys_nerr) - return(sys_errlist[offset]); - else - goto oops; -#else - cp = strerror(offset); - if (cp) - return(cp); - else - goto oops; -#endif - } - for (et = _et_list; et; et = et->next) { - if (et->table->base == table_num) { - /* This is the right table */ - if (et->table->n_msgs <= offset) - goto oops; - return(et->table->msgs[offset]); - } - } -oops: - strcpy (buffer, "Unknown code "); - if (table_num) { - strcat (buffer, error_table_name (table_num)); - strcat (buffer, " "); - } - for (cp = buffer; *cp; cp++) - ; - if (offset >= 100) { - *cp++ = '0' + offset / 100; - offset %= 100; - started++; - } - if (started || offset >= 10) { - *cp++ = '0' + offset / 10; - offset %= 10; - } - *cp++ = '0' + offset; - *cp = '\0'; - return(buffer); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/error_table.h b/gnu/usr.sbin/e2fsprogs/lib/et/error_table.h deleted file mode 100644 index 31971f03d23..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/error_table.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 1988 by the Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#ifndef _ET_H -/* Are we using ANSI C? */ -#ifndef __STDC__ -#define const -#endif - -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; - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - -#ifdef __STDC__ -extern const char *error_table_name(int num); -#else -extern const char *error_table_name(); -#endif - -#define _ET_H -#endif diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/et_c.awk b/gnu/usr.sbin/e2fsprogs/lib/et/et_c.awk deleted file mode 100644 index e3d4c9142af..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/et_c.awk +++ /dev/null @@ -1,185 +0,0 @@ -BEGIN { -char_shift=64 -## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; -c2n["A"]=1 -c2n["B"]=2 -c2n["C"]=3 -c2n["D"]=4 -c2n["E"]=5 -c2n["F"]=6 -c2n["G"]=7 -c2n["H"]=8 -c2n["I"]=9 -c2n["J"]=10 -c2n["K"]=11 -c2n["L"]=12 -c2n["M"]=13 -c2n["N"]=14 -c2n["O"]=15 -c2n["P"]=16 -c2n["Q"]=17 -c2n["R"]=18 -c2n["S"]=19 -c2n["T"]=20 -c2n["U"]=21 -c2n["V"]=22 -c2n["W"]=23 -c2n["X"]=24 -c2n["Y"]=25 -c2n["Z"]=26 -c2n["a"]=27 -c2n["b"]=28 -c2n["c"]=29 -c2n["d"]=30 -c2n["e"]=31 -c2n["f"]=32 -c2n["g"]=33 -c2n["h"]=34 -c2n["i"]=35 -c2n["j"]=36 -c2n["k"]=37 -c2n["l"]=38 -c2n["m"]=39 -c2n["n"]=40 -c2n["o"]=41 -c2n["p"]=42 -c2n["q"]=43 -c2n["r"]=44 -c2n["s"]=45 -c2n["t"]=46 -c2n["u"]=47 -c2n["v"]=48 -c2n["w"]=49 -c2n["x"]=50 -c2n["y"]=51 -c2n["z"]=52 -c2n["0"]=53 -c2n["1"]=54 -c2n["2"]=55 -c2n["3"]=56 -c2n["4"]=57 -c2n["5"]=58 -c2n["6"]=59 -c2n["7"]=60 -c2n["8"]=61 -c2n["9"]=62 -c2n["_"]=63 -} -/^#/ { next } -/^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ { - table_number = 0 - table_name = $2 - mod_base = 1000000 - for(i=1; i<=length(table_name); i++) { - table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)] - } - - # We start playing *_high, *low games here because the some - # awk programs do not have the necessary precision (sigh) - tab_base_low = table_number % mod_base - tab_base_high = int(table_number / mod_base) - tab_base_sign = 1; - - # figure out: table_number_base=table_number*256 - tab_base_low = tab_base_low * 256 - tab_base_high = (tab_base_high * 256) + \ - int(tab_base_low / mod_base) - tab_base_low = tab_base_low % mod_base - - if (table_number > 128*256*256) { - # figure out: table_number_base -= 256*256*256*256 - # sub_high, sub_low is 256*256*256*256 - sub_low = 256*256*256 % mod_base - sub_high = int(256*256*256 / mod_base) - - sub_low = sub_low * 256 - sub_high = (sub_high * 256) + int(sub_low / mod_base) - sub_low = sub_low % mod_base - - tab_base_low = sub_low - tab_base_low; - tab_base_high = sub_high - tab_base_high; - tab_base_sign = -1; - if (tab_base_low < 0) { - tab_base_low = tab_base_low + mod_base - tab_base_high-- - } - } - print "/*" > outfile - print " * " outfile ":" > outfile - print " * This file is automatically generated; please do not edit it." > outfile - print " */" > outfile - - print "#ifdef __STDC__" > outfile - print "#define NOARGS void" > outfile - print "#else" > outfile - print "#define NOARGS" > outfile - print "#define const" > outfile - print "#endif" > outfile - print "" > outfile - print "static const char * const text[] = {" > outfile - table_item_count = 0 -} - -/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*$/ { - skipone=1 - next -} - -/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*".*"[ \t]*$/ { - text="" - for (i=3; i<=NF; i++) { - text = text FS $i - } - text=substr(text,2,length(text)-1); - printf "\t%s,\n", text > outfile - table_item_count++ -} - -{ - if (skipone) { - printf "\t%s,\n", $0 > outfile - table_item_count++ - } - skipone=0 -} -END { - - - print " 0" > outfile - print "};" > outfile - print "" > outfile - print "struct error_table {" > outfile - print " char const * const * msgs;" > outfile - print " long base;" > outfile - print " int n_msgs;" > outfile - print "};" > outfile - print "struct et_list {" > outfile - print " struct et_list *next;" > outfile - print " const struct error_table * table;" > outfile - print "};" > outfile - print "extern struct et_list *_et_list;" > outfile - print "" > outfile - if (tab_base_high == 0) { - print "static const struct error_table et = { text, " \ - sprintf("%dL, %d };", tab_base_sign*tab_base_low, \ - table_item_count) > outfile - } else { - print "static const struct error_table et = { text, " \ - sprintf("%d%06dL, %d };", tab_base_sign*tab_base_high, \ - tab_base_low, table_item_count) > outfile - } - print "" > outfile - print "static struct et_list link = { 0, 0 };" > outfile - print "" > outfile - print "void initialize_" table_name "_error_table (NOARGS);" > outfile - print "" > outfile - print "void initialize_" table_name "_error_table (NOARGS) {" > outfile - print " if (!link.table) {" > outfile - print " link.next = _et_list;" > outfile - print " link.table = &et;" > outfile - print " _et_list = &link;" > outfile - print " }" > outfile - print "}" > outfile - - -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/et_h.awk b/gnu/usr.sbin/e2fsprogs/lib/et/et_h.awk deleted file mode 100644 index d7688e978f5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/et_h.awk +++ /dev/null @@ -1,157 +0,0 @@ -BEGIN { -char_shift=64 -## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; -c2n["A"]=1 -c2n["B"]=2 -c2n["C"]=3 -c2n["D"]=4 -c2n["E"]=5 -c2n["F"]=6 -c2n["G"]=7 -c2n["H"]=8 -c2n["I"]=9 -c2n["J"]=10 -c2n["K"]=11 -c2n["L"]=12 -c2n["M"]=13 -c2n["N"]=14 -c2n["O"]=15 -c2n["P"]=16 -c2n["Q"]=17 -c2n["R"]=18 -c2n["S"]=19 -c2n["T"]=20 -c2n["U"]=21 -c2n["V"]=22 -c2n["W"]=23 -c2n["X"]=24 -c2n["Y"]=25 -c2n["Z"]=26 -c2n["a"]=27 -c2n["b"]=28 -c2n["c"]=29 -c2n["d"]=30 -c2n["e"]=31 -c2n["f"]=32 -c2n["g"]=33 -c2n["h"]=34 -c2n["i"]=35 -c2n["j"]=36 -c2n["k"]=37 -c2n["l"]=38 -c2n["m"]=39 -c2n["n"]=40 -c2n["o"]=41 -c2n["p"]=42 -c2n["q"]=43 -c2n["r"]=44 -c2n["s"]=45 -c2n["t"]=46 -c2n["u"]=47 -c2n["v"]=48 -c2n["w"]=49 -c2n["x"]=50 -c2n["y"]=51 -c2n["z"]=52 -c2n["0"]=53 -c2n["1"]=54 -c2n["2"]=55 -c2n["3"]=56 -c2n["4"]=57 -c2n["5"]=58 -c2n["6"]=59 -c2n["7"]=60 -c2n["8"]=61 -c2n["9"]=62 -c2n["_"]=63 -} -/^#/ { next } -/^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ { - table_number = 0 - table_name = $2 - mod_base = 1000000 - for(i=1; i<=length(table_name); i++) { - table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)] - } - # We start playing *_high, *low games here because the some - # awk programs do not have the necessary precision (sigh) - tab_base_low = table_number % mod_base - tab_base_high = int(table_number / mod_base) - tab_base_sign = 1; - - # figure out: table_number_base=table_number*256 - tab_base_low = tab_base_low * 256 - tab_base_high = (tab_base_high * 256) + \ - int(tab_base_low / mod_base) - tab_base_low = tab_base_low % mod_base - - if (table_number > 128*256*256) { - # figure out: table_number_base -= 256*256*256*256 - # sub_high, sub_low is 256*256*256*256 - sub_low = 256*256*256 % mod_base - sub_high = int(256*256*256 / mod_base) - - sub_low = sub_low * 256 - sub_high = (sub_high * 256) + int(sub_low / mod_base) - sub_low = sub_low % mod_base - - tab_base_low = sub_low - tab_base_low; - tab_base_high = sub_high - tab_base_high; - tab_base_sign = -1; - if (tab_base_low < 0) { - tab_base_low = tab_base_low + mod_base - tab_base_high-- - } - } - curr_low = tab_base_low - curr_high = tab_base_high - curr_sign = tab_base_sign - print "/*" > outfile - print " * " outfile ":" > outfile - print " * This file is automatically generated; please do not edit it." > outfile - print " */" > outfile - print "#ifdef __STDC__" > outfile - print "#define NOARGS void" > outfile - print "#else" > outfile - print "#define NOARGS" > outfile - print "#define const" > outfile - print "#endif" > outfile - print "" > outfile -} - -/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,/ { - tag=substr($2,1,length($2)-1) - if (curr_high == 0) { - printf "#define %-40s (%dL)\n", tag, \ - curr_sign*curr_low > outfile - } else { - printf "#define %-40s (%d%06dL)\n", tag, curr_high*curr_sign, \ - curr_low > outfile - } - curr_low += curr_sign; - if (curr_low >= mod_base) { - curr_low -= mod_base; - curr_high++ - } - if (curr_low < 0) { - cur_low += mod_base - cur_high-- - } -} - -END { - print "extern void initialize_" table_name "_error_table (NOARGS);" > outfile - if (tab_base_high == 0) { - print "#define ERROR_TABLE_BASE_" table_name " (" \ - sprintf("%d", tab_base_sign*tab_base_low) \ - "L)" > outfile - } else { - print "#define ERROR_TABLE_BASE_" table_name " (" \ - sprintf("%d%06d", tab_base_sign*tab_base_high, \ - tab_base_low) "L)" > outfile - } - print "" > outfile - print "/* for compatibility with older versions... */" > outfile - print "#define init_" table_name "_err_tbl initialize_" table_name "_error_table" > outfile - print "#define " table_name "_err_base ERROR_TABLE_BASE_" table_name > outfile -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/et_name.c b/gnu/usr.sbin/e2fsprogs/lib/et/et_name.c deleted file mode 100644 index db4099fa69d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/et_name.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 1987 by MIT Student Information Processing Board - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include "error_table.h" -#include "mit-sipb-copyright.h" -#include "internal.h" - -static const char char_set[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; - -static char buf[6]; - -const char * error_table_name(num) - int num; -{ - int ch; - int i; - char *p; - - /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ - p = buf; - num >>= ERRCODE_RANGE; - /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */ - num &= 077777777; - /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */ - for (i = 4; i >= 0; i--) { - ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1); - if (ch != 0) - *p++ = char_set[ch-1]; - } - *p = '\0'; - return(buf); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/init_et.c b/gnu/usr.sbin/e2fsprogs/lib/et/init_et.c deleted file mode 100644 index 1ea2ad69564..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/init_et.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/init_et.c,v 1.1 1997/06/14 07:18:44 downsj Exp $ - * $Source: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/et/Attic/init_et.c,v $ - * $Locker: $ - * - * Copyright 1986, 1987, 1988 by MIT Information Systems and - * the MIT Student Information Processing Board. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include <stdio.h> -#include <errno.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#include "com_err.h" -#include "error_table.h" -#include "mit-sipb-copyright.h" - -#ifndef __STDC__ -#define const -#endif - -struct foobar { - struct et_list etl; - struct error_table et; -}; - -extern struct et_list * _et_list; - -#ifdef __STDC__ -int init_error_table(const char * const *msgs, int base, int count) -#else -int init_error_table(msgs, base, count) - const char * const * msgs; - int base; - int count; -#endif -{ - struct foobar * new_et; - - if (!base || !count || !msgs) - return 0; - - new_et = (struct foobar *) malloc(sizeof(struct foobar)); - if (!new_et) - return ENOMEM; /* oops */ - new_et->etl.table = &new_et->et; - new_et->et.msgs = msgs; - new_et->et.base = base; - new_et->et.n_msgs= count; - - new_et->etl.next = _et_list; - _et_list = &new_et->etl; - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/internal.h b/gnu/usr.sbin/e2fsprogs/lib/et/internal.h deleted file mode 100644 index 112c0161e51..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/internal.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * internal include file for com_err package - */ -#include "mit-sipb-copyright.h" -#ifndef __STDC__ -#undef const -#define const -#endif - -#include <errno.h> - -#ifdef NEED_SYS_ERRLIST -extern char const * const sys_errlist[]; -extern const int sys_nerr; -#endif - -/* AIX and Ultrix have standard conforming header files. */ -#if !defined(ultrix) && !defined(_AIX) -#ifdef __STDC__ -void perror (const char *); -#endif -#endif diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/mit-sipb-copyright.h b/gnu/usr.sbin/e2fsprogs/lib/et/mit-sipb-copyright.h deleted file mode 100644 index 2f7eb295014..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/mit-sipb-copyright.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - -Copyright 1987, 1988 by the Student Information Processing Board - of the Massachusetts Institute of Technology - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice -appear in all copies and that both that copyright notice and -this permission notice appear in supporting documentation, -and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. -M.I.T. and the M.I.T. S.I.P.B. make no representations about -the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -*/ - diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/texinfo.tex b/gnu/usr.sbin/e2fsprogs/lib/et/texinfo.tex deleted file mode 100644 index 838160c987f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/texinfo.tex +++ /dev/null @@ -1,2077 +0,0 @@ -%% TeX macros to handle texinfo files - -% Copyright (C) 1985, 1986, 1988 Richard M. Stallman - -% NO WARRANTY - -% BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY -%NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT -%WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, -%RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS" -%WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -%BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -%FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY -%AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -%DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -%CORRECTION. - -% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. -%STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY -%WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE -%LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR -%OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -%USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR -%DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR -%A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS -%PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH -%DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. - -% GENERAL PUBLIC LICENSE TO COPY - -% 1. You may copy and distribute verbatim copies of this source file -%as you receive it, in any medium, provided that you conspicuously -%and appropriately publish on each copy a valid copyright notice -%"Copyright (C) 1986 Richard M. Stallman"; and include -%following the copyright notice a verbatim copy of the above disclaimer -%of warranty and of this License. - -% 2. You may modify your copy or copies of this source file or -%any portion of it, and copy and distribute such modifications under -%the terms of Paragraph 1 above, provided that you also do the following: - -% a) cause the modified files to carry prominent notices stating -% that you changed the files and the date of any change; and - -% b) cause the whole of any work that you distribute or publish, -% that in whole or in part contains or is a derivative of this -% program or any part thereof, to be licensed at no charge to all -% third parties on terms identical to those contained in this -% License Agreement (except that you may choose to grant more extensive -% warranty protection to some or all third parties, at your option). - -% c) You may charge a distribution fee for the physical act of -% transferring a copy, and you may at your option offer warranty -% protection in exchange for a fee. - -%Mere aggregation of another unrelated program with this program (or its -%derivative) on a volume of a storage or distribution medium does not bring -%the other program under the scope of these terms. - -% 3. You may copy and distribute this program (or a portion or derivative -%of it, under Paragraph 2) in object code or executable form under the terms -%of Paragraphs 1 and 2 above provided that you also do one of the following: - -% a) accompany it with the complete corresponding machine-readable -% source code, which must be distributed under the terms of -% Paragraphs 1 and 2 above; or, - -% b) accompany it with a written offer, valid for at least three -% years, to give any third party free (except for a nominal -% shipping charge) a complete machine-readable copy of the -% corresponding source code, to be distributed under the terms of -% Paragraphs 1 and 2 above; or, - -% c) accompany it with the information you received as to where the -% corresponding source code may be obtained. (This alternative is -% allowed only for noncommercial distribution and only if you -% received the program in object code or executable form alone.) - -%For an executable file, complete source code means all the source code for -%all modules it contains; but, as a special exception, it need not include -%source code for modules which are standard libraries that accompany the -%operating system on which the executable file runs. - -% 4. You may not copy, sublicense, distribute or transfer this program -%except as expressly provided under this License Agreement. Any attempt -%otherwise to copy, sublicense, distribute or transfer this program is void and -%your rights to use the program under this License agreement shall be -%automatically terminated. However, parties who have received computer -%software programs from you with this License Agreement will not have -%their licenses terminated so long as such parties remain in full compliance. - -% 5. If you wish to incorporate parts of this program into other free -%programs whose distribution conditions are different, write to the Free -%Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet -%worked out a simple rule that can be stated here, but we will often permit -%this. We will be guided by the two goals of preserving the free status of -%all derivatives of our free software and of promoting the sharing and reuse of -%software. - -%In other words, you are welcome to use, share and improve this program. -%You are forbidden to forbid anyone else to use, share and improve -%what you give them. Help stamp out software-hoarding! - -\def\texinfoversion{1.18} -\message{Loading texinfo package [Version \texinfoversion]:} -\message{} - -% Save some parts of plain tex whose names we will redefine. - -\let\ptexlbrace=\{ -\let\ptexrbrace=\} -\let\ptexdot=\. -\let\ptexstar=\* -\let\ptexend=\end -\let\ptexbullet=\bullet -\let\ptexb=\b -\let\ptexc=\c -\let\ptexi=\i -\let\ptext=\t -\let\ptexl=\l -\let\ptexL=\L - -\def\tie{\penalty 10000\ } % Save plain tex definition of ~. - -\message{Basics,} -\chardef\other=12 - -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset \bindingoffset=0pt -\newdimen \normaloffset \normaloffset=\hoffset -\newdimen\pagewidth \newdimen\pageheight -\pagewidth=\hsize \pageheight=\vsize - -%---------------------Begin change----------------------- -% -% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\cornerlong \newdimen\cornerthick -\newdimen \topandbottommargin -\newdimen \outerhsize \newdimen \outervsize -\cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks -\outerhsize=7in -\outervsize=9.5in -\topandbottommargin=.75in -% -%---------------------End change----------------------- - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions itself, but you have to call it yourself. -\chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}} -\def\onepageout#1{\hoffset=\normaloffset -\ifodd\pageno \advance\hoffset by \bindingoffset -\else \advance\hoffset by -\bindingoffset\fi -\shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}% - {\let\hsize=\pagewidth \makefootline}} -\advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi} - - -% Here is a modification of the main output routine for Near East Publications -% This provides right-angle cropmarks at all four corners. -% The contents of the page are centerlined into the cropmarks, -% and any desired binding offset is added as an \hskip on either -% site of the centerlined box. (P. A. MacKay, 12 November, 1986) -% -\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up - \shipout - \vbox to \outervsize{\hsize=\outerhsize - \vbox{\line{\ewtop\hfill\ewtop}} - \nointerlineskip - \line{\vbox{\moveleft\cornerthick\nstop} - \hfill - \vbox{\moveright\cornerthick\nstop}} - \vskip \topandbottommargin - \centerline{\ifodd\pageno\hskip\bindingoffset\fi - \vbox{ - {\let\hsize=\pagewidth \makeheadline} - \pagebody{#1} - {\let\hsize=\pagewidth \makefootline}} - \ifodd\pageno\else\hskip\bindingoffset\fi} - \vskip \topandbottommargin plus1fill minus1fill - \boxmaxdepth\cornerthick - \line{\vbox{\moveleft\cornerthick\nsbot} - \hfill - \vbox{\moveright\cornerthick\nsbot}} - \nointerlineskip - \vbox{\line{\ewbot\hfill\ewbot}} - } - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi} -% -% Do @cropmarks to get crop marks -\def\cropmarks{\let\onepageout=\croppageout } - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. -% The argument can be delimited with [...] or with "..." or braces -% or it can be a whole line. -% #1 should be a macro which expects -% an ordinary undelimited TeX argument. - -\def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx} - -\def\parseargx{% -\ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else% -\aftergroup \parseargline % -\fi \endgroup} - -{\obeyspaces % -\gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}} - -\gdef\obeyedspace{\ } - -\def\parseargline{\begingroup \obeylines \parsearglinex} -{\obeylines % -\gdef\parsearglinex #1^^M{\endgroup \next {#1}}} - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment. Type Return to continue.} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Type <Return> to continue} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -%% @end foo executes the definition of \Efoo. -%% foo can be delimited by doublequotes or brackets. - -\def\end{\parsearg\endxxx} - -\def\endxxx #1{% -\expandafter\ifx\csname E#1\endcsname\relax -\expandafter\ifx\csname #1\endcsname\relax -\errmessage{Undefined command @end #1}\else -\errorE{#1}\fi\fi -\csname E#1\endcsname} -\def\errorE#1{ -{\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}} - -% Single-spacing is done by various environments. - -\newskip\singlespaceskip \singlespaceskip = \baselineskip -\def\singlespace{% -{\advance \baselineskip by -\singlespaceskip -\kern \baselineskip}% -\baselineskip=\singlespaceskip -} - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\sf \char '100}} - -% Define @` and @' to be the same as ` and ' -% but suppressing ligatures. -\def\`{{`}} -\def\'{{'}} - -% Used to generate quoted braces. - -\def\mylbrace {{\tt \char '173}} -\def\myrbrace {{\tt \char '175}} -\let\{=\mylbrace -\let\}=\myrbrace - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break} - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @w prevents a word break -\def\w #1{\hbox{#1}} - -% @group ... @end group forces ... to be all on one page. - -\def\group{\begingroup% \inENV ??? -\def \Egroup{\egroup\endgroup} -\vbox\bgroup} - -% @br forces paragraph break - -\let\br = \par - -% @dots{} output some dots - -\def\dots{$\ldots$} - -% @page forces the start of a new page - -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -\def\exdent{\errmessage{@exdent in filled text}} - % @lisp, etc, define \exdent locally from \internalexdent - -{\obeyspaces -\gdef\internalexdent{\parsearg\exdentzzz}} - -\def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing -\advance \hsize by -\leftskip -\advance \hsize by -\rightskip -\leftline{{\rm#1}}}} - -% @include file insert text of that file as input. - -\def\include{\parsearg\includezzz} -\def\includezzz #1{{\def\thisfile{#1}\input #1 -}} - -\def\thisfile{} - -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} - -% @sp n outputs n lines of vertical space - -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\par \vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\parsearg \commentxxx} - -\def\commentxxx #1{} - -\let\c=\comment - -\long\def\ignore #1\end ignore{} - -\outer\def\ifset{\parsearg\ifsetxxx} - -\def\ifsetxxx #1#2\end ifset{% -\expandafter\ifx\csname IF#1\endcsname\relax \else #2\fi} - -\outer\def\ifclear{\parsearg\ifclearxxx} - -\def\ifclearxxx #1#2\end ifclear{% -\expandafter\ifx\csname IF#1\endcsname\relax #2\fi} - -% Some texinfo constructs that are trivial in tex - -\def\iftex{} -\def\Eiftex{} -\long\def\ifinfo #1\end ifinfo{} -\long\def\menu #1\end menu{} -\def\asis#1{#1} - -\def\node{\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} -\let\lastnode=\relax - -\def\donoderef{\ifx\lastnode\relax\else -\expandafter\expandafter\expandafter\setref{\lastnode}\fi -\let\lastnode=\relax} - -\def\unnumbnoderef{\ifx\lastnode\relax\else -\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi -\let\lastnode=\relax} - -\let\refill=\relax - -\let\setfilename=\comment - -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'} -\def\losespace #1{#1} - -\message{fonts,} - -% Font-change commands. - -%% Try out Computer Modern fonts at \magstephalf -\font\tenrm=cmr10 scaled \magstephalf -\font\tentt=cmtt10 scaled \magstephalf -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. -\font\tenbf=cmb10 scaled \magstephalf -\font\tenit=cmti10 scaled \magstephalf -\font\tensl=cmsl10 scaled \magstephalf -\font\tensf=cmss10 scaled \magstephalf -\def\li{\sf} -\font\tensc=cmcsc10 scaled \magstephalf - -% Fonts for @defun, etc. -\font\defbf=cmbx10 scaled \magstep1 %was 1314 -\let\deftt=\tentt -\def\df{\let\tt=\deftt \defbf} - -% Font for title -\font\titlerm = cmbx10 scaled \magstep5 - -% Fonts for indices -\font\indit=cmti9 \font\indrm=cmr9 -\def\indbf{\indrm} \def\indsl{\indit} -\def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm} - -% Fonts for headings -\font\chaprm=cmbx10 scaled \magstep3 -\font\chapit=cmti10 scaled \magstep3 -\font\chapsl=cmsl10 scaled \magstep3 -\font\chaptt=cmtt10 scaled \magstep3 -\font\chapsf=cmss10 scaled \magstep3 -\let\chapbf=\chaprm - -\font\secrm=cmbx10 scaled \magstep2 -\font\secit=cmti10 scaled \magstep2 -\font\secsl=cmsl10 scaled \magstep2 -\font\sectt=cmtt10 scaled \magstep2 -\font\secsf=cmss10 scaled \magstep2 -\let\secbf=\secrm - -\font\ssecrm=cmbx10 scaled \magstep1 -\font\ssecit=cmti10 scaled \magstep1 -\font\ssecsl=cmsl10 scaled \magstep1 -\font\ssectt=cmtt10 scaled \magstep1 -\font\ssecsf=cmss10 scaled \magstep1 -\let\ssecbf=\ssecrm - -\def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf% -\let\sc=\tensc\let\sf=\tensf} -\def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf} -\def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf} -\def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf} -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -\def\i#1{{\sl #1}} -\let\var=\i -\let\dfn=\i -\let\emph=\i -\let\cite=\i - -\def\b#1{{\bf #1}} -\let\strong=\b - -\def\t#1{{\tt \rawbackslash \frenchspacing #1}\null} -\let\ttfont = \t -\let\kbd=\t -\let\code=\t -\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null} -\def\key #1{{\tt \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -\let\file=\samp - -\def\l#1{{\li #1}\null} - -\def\r#1{{\rm #1}} -\def\s#1{{\sc #1}} -\def\ii#1{{\it #1}} - -\def\titlefont#1{{\titlerm #1}} - -\def\titlepage{\begingroup \parindent=0pt \hbox{}% -\let\oldpage=\page -\def\page{\oldpage \hbox{}}} - -\def\Etitlepage{\endgroup\page\HEADINGSon} - -% Make altmode in file print out right - -\catcode `\^^[=\active \def^^[{$\diamondsuit$} - -\message{page headings,} - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks \evenheadline % Token sequence for heading line of even pages -\newtoks \oddheadline % Token sequence for heading line of odd pages -\newtoks \evenfootline % Token sequence for footing line of even pages -\newtoks \oddfootline % Token sequence for footing line of odd pages - -% Now make Tex use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}} - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish} -\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% -\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish} -\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}} -\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} -% -}% unbind the catcode of @. - -% @headings on turns them on. -% @headings off turns them off. -% By default, they are off. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{ -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1, -% Put current file name in lower left corner, -% Put chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSon{ -\pagealignmacro -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -} - -% Subroutines used in generating headings -% Produces Day Month Year style of output. -\def\today{\number\day\space -\ifcase\month\or -January\or February\or March\or April\or May\or June\or -July\or August\or September\or October\or November\or December\fi -\space\number\year} - -% Use this if you want the Month Day, Year style of output. -%\def\today{\ifcase\month\or -%January\or February\or March\or April\or May\or June\or -%July\or August\or September\or October\or November\or December\fi -%\space\number\day, \number\year} - -% @settitle line... specifies the title of the document, for headings -% It generates no output of its own - -\def\thistitle{No Title} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} - -\message{tables,} - -% Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table and @ftable define @item, @itemx, etc., with these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\par \parsearg\itemzzz} - -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\par \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}} - -\def\itemzzz #1{\begingroup % -\advance \hsize by -\rightskip % -\advance \hsize by -\leftskip % -\setbox0=\hbox{\itemfont{#1}}% -\itemindex{#1}% -\parskip=0in % -\noindent % -\ifdim \wd0>\itemmax % -\vadjust{\penalty 10000}% -\hbox to \hsize{\hskip -\tableindent\box0\hss}\ % -\else % -\hbox to 0pt{\hskip -\tableindent\box0\hss}% -\fi % -\endgroup % -} - -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -%% Contains a kludge to get @end[description] to work -\def\description{\tablez{\dontindex}{1}{}{}{}{}} - -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Neccessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\endgroup\afterenvbreak}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % -} - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\def\itemize{\parsearg\itemizezzz} - -\def\itemizezzz #1{\itemizey {#1}{\Eitemize}} - -\def\itemizey #1#2{% -\aboveenvbreak % -\begingroup % -\itemno = 0 % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\endgroup\afterenvbreak}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -\def\bullet{$\ptexbullet$} -\def\minus{$-$} - -\def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr} - -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{\in hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 300}}% -\flushcr} - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. - -\def\newindex #1{ -\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file -\openout \csname#1indfile\endcsname \jobname.#1 % Open the file -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\doindex {#1}} -} - -% @defindex foo == \newindex{foo} - -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. - -\def\newcodeindex #1{ -\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file -\openout \csname#1indfile\endcsname \jobname.#1 % Open the file -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\docodeindex {#1}} -} - -\def\defcodeindex{\parsearg\newcodeindex} - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -\def\synindex #1 #2 {% -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\doindex {#2}}% -} - -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -\def\syncodeindex #1 #2 {% -\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex -\noexpand\docodeindex {#2}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -\def\indexdummies{% -\def\bf{\realbackslash bf }% -\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\dots{\realbackslash dots }% -\def\copyright{\realbackslash copyright }% -} - -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexnofonts{% -\let\code=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other -@gdef@realbackslash{\}} - -\let\indexbackslash=0 %overridden during \printindex. - -\def\doind #1#2{% -{\indexdummies % Must do this here, since \bf, etc expand at this stage -\count10=\lastpenalty % -\escapechar=`\\% -{\let\folio=0% Expand all macros now EXCEPT \folio -\def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now -% so it will be output as is; and it will print as backslash in the indx. -% -% Now process the index-string once, with all font commands turned off, -% to get the string to sort the index by. -{\indexnofonts -\xdef\temp1{#2}% -}% -% Now produce the complete index entry. We process the index-string again, -% this time with font commands expanded, to get what to print in the index. -\edef\temp{% -\write \csname#1indfile\endcsname{% -\realbackslash entry {\temp1}{\folio}{#2}}}% -\temp }% -\penalty\count10}} - -\def\dosubind #1#2#3{% -{\indexdummies % Must do this here, since \bf, etc expand at this stage -\count10=\lastpenalty % -\escapechar=`\\% -{\let\folio=0% -\def\rawbackslashxx{\indexbackslash}% -% -% Now process the index-string once, with all font commands turned off, -% to get the string to sort the index by. -{\indexnofonts -\xdef\temp1{#2 #3}% -}% -% Now produce the complete index entry. We process the index-string again, -% this time with font commands expanded, to get what to print in the index. -\edef\temp{% -\write \csname#1indfile\endcsname{% -\realbackslash entry {\temp1}{\folio}{#2}{#3}}}% -\temp }% -\penalty\count10}} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% This is what you call to cause a particular index to get printed. -% Write -% @unnumbered Function Index -% @printindex fn - -\def\printindex{\parsearg\doprintindex} - -\def\doprintindex#1{\tex % -\catcode`\%=\other\catcode`\&=\other\catcode`\#=\other -\catcode`\$=\other\catcode`\_=\other -\catcode`\~=\other -\def\indexbackslash{\rawbackslashxx} -\indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt -\begindoublecolumns -\openin 1 \jobname.#1s -\ifeof 1 \else \closein 1 \input \jobname.#1s -\fi -\enddoublecolumns -\Etex} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -% Same as \bigskipamount except no shrink. -% \balancecolumns gets confused if there is any shrink. -\newskip\initialskipamount \initialskipamount 12pt plus4pt - -\outer\def\initial #1{% -{\let\tentt=\sectt \let\sf=\sectt -\ifdim\lastskip<\initialskipamount -\removelastskip \penalty-200 \vskip \initialskipamount\fi -\line{\secbf#1\hfill}\kern 2pt\penalty3000}} - -\outer\def\entry #1#2{ -{\parfillskip=0in \parskip=0in \parindent=0in -\hangindent=1in \hangafter=1% -\noindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll #2\par -}} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll#2\par -}} - -%% Define two-column mode, which is used in indexes. -%% Adapted from the TeXBook, page 416 -\catcode `\@=11 - -\newbox\partialpage - -\newdimen\doublecolumnhsize \doublecolumnhsize = 3.11in -\newdimen\doublecolumnvsize \doublecolumnvsize = 19.1in - -\def\begindoublecolumns{\begingroup - \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject - \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize} -\def\enddoublecolumns{\output={\balancecolumns}\eject - \endgroup \pagegoal=\vsize} - -\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar \unvbox255 \penalty\outputpenalty} -\def\pagesofar{\unvbox\partialpage % - \hsize=\doublecolumnhsize % have to restore this since output routine -% changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986) - \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}} -\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0 - \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip - \divide\dimen@ by2 \splittopskip=\topskip - {\vbadness=10000 \loop \global\setbox3=\copy0 - \global\setbox1=\vsplit3 to\dimen@ - \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat} - \setbox0=\vbox to\dimen@{\unvbox1} \setbox2=\vbox to\dimen@{\unvbox3} - \pagesofar} - -\catcode `\@=\other -\message{sectioning,} -% Define chapters, sections, etc. - -\newcount \chapno -\newcount \secno -\newcount \subsecno -\newcount \subsubsecno - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount \appendixno \appendixno = `\@ -\def\appendixletter{\char\the\appendixno} - -\newwrite \contentsfile -\openout \contentsfile = \jobname.toc - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise - -\def\thischapter{} \def\thissection{} -\def\seccheck#1{\if \pageno<0 % -\errmessage{@#1 not allowed after generating table of contents}\fi -% -} - -\outer\def\chapter{\parsearg\chapterzzz} -\def\chapterzzz #1{\seccheck{chapter}% -\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}\gdef\thischapter{#1}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -} - -\outer\def\appendix{\parsearg\appendixzzz} -\def\appendixzzz #1{\seccheck{appendix}% -\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}% -\chapmacro {#1}{Appendix \appendixletter}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -} - -\outer\def\unnumbered{\parsearg\unnumberedzzz} -\def\unnumberedzzz #1{\seccheck{unnumbered}% -\secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)} -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -} - -\outer\def\section{\parsearg\sectionzzz} -\def\sectionzzz #1{\seccheck{section}% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash secentry % -{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\penalty 10000 % -} - -\outer\def\appendixsection{\parsearg\appendixsectionzzz} -\outer\def\appendixsec{\parsearg\appendixsectionzzz} -\def\appendixsectionzzz #1{\seccheck{appendixsection}% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash secentry % -{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -} - -\outer\def\unnumberedsec{\parsearg\unnumberedseczzz} -\def\unnumberedseczzz #1{\seccheck{unnumberedsec}% -\plainsecheading {#1}\gdef\thissection{#1}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -} - -\outer\def\subsection{\parsearg\subsectionzzz} -\def\subsectionzzz #1{\seccheck{subsection}% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash subsecentry % -{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\penalty 10000 % -} - -\outer\def\appendixsubsec{\parsearg\appendixsubseczzz} -\def\appendixsubseczzz #1{\seccheck{appendixsubsec}% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash subsecentry % -{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -} - -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}% -\plainsecheading {#1}\gdef\thissection{#1}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -} - -\outer\def\subsubsection{\parsearg\subsubsectionzzz} -\def\subsubsectionzzz #1{\seccheck{subsubsection}% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash subsubsecentry % -{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\ -\escapechar=`\\% -\write \contentsfile \temp % -\donoderef % -\penalty 10000 % -} - -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz} -\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash subsubsecentry{#1}% -{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\ -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -} - -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} -\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}% -\plainsecheading {#1}\gdef\thissection{#1}% -\let\rawbackslash=\relax% -\let\frenchspacing=\relax% -\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}% -\escapechar=`\\% -\write \contentsfile \temp % -\unnumbnoderef % -\penalty 10000 % -} - -% Define @majorheading, @heading and @subheading - -\outer\def\majorheading #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200} - -\outer\def\chapheading #1{\chapbreak % -{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200} - -\let\heading=\secheadingi -\let\subheading=\subsecheadingi -\let\subsubheading=\subsubsecheadingi - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{ -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{ -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGodd{ -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage} - -\CHAPPAGon - -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain} - -\def\chfplain #1#2{% -\pchapsepmacro % -{\chapfonts \line{\chaprm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 % -} - -\def\unnchfplain #1{% -\pchapsepmacro % -{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 % -} -\CHAPFplain % The default - -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 % -} - -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen} - -% Parameter controlling skip before section headings. - -\newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} - -\newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} - -\def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}} -\def\plainsecheading #1{\secheadingi {#1}} -\def\secheadingi #1{{\advance \secheadingskip by \parskip % -\secheadingbreak}% -{\secfonts \line{\secrm #1\hfill}}% -\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 } - -\def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip % -\subsecheadingbreak}% -{\secfonts \line{\secrm#2.#3.#4\enspace #1\hfill}}% -\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 } - -\def\subsubsecfonts{\subsecfonts} % Maybe this should change - -\def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip % -\subsecheadingbreak}% -{\secfonts \line{\secrm#2.#3.#4.#5\enspace #1\hfill}}% -\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000} - -\message{toc printing,} - -\def\Dotsbox{\hbox to 1em{\hss.\hss}} % Used by index macros - -\def\finishcontents{% -\ifnum\pageno>0 % -\pagealignmacro % -\immediate\closeout \contentsfile% -\pageno=-1 % Request roman numbered pages -\fi} - -\outer\def\contents{% -\finishcontents % -\unnumbchapmacro{Table of Contents} -\def\thischapter{Table of Contents} -{\catcode`\\=0 -\catcode`\{=1 % Set up to handle contents files properly -\catcode`\}=2 -\catcode`\@=11 -\input \jobname.toc -} -\vfill \eject} - -\outer\def\summarycontents{% -\finishcontents % -\unnumbchapmacro{Summary Table of Contents} -\def\thischapter{Summary Table of Contents} -{\catcode`\\=0 -\catcode`\{=1 % Set up to handle contents files properly -\catcode`\}=2 -\catcode`\@=11 -\def\smallbreak{} -\def\secentry ##1##2##3##4{} -\def\subsecentry ##1##2##3##4##5{} -\def\subsubsecentry ##1##2##3##4##5##6{} -\def\unnumbsecentry ##1##2{} -\def\unnumbsubsecentry ##1##2{} -\def\unnumbsubsubsecentry ##1##2{} -\let\medbreak=\smallbreak -\input \jobname.toc -} -\vfill \eject} - -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - -% These macros generate individual entries in the table of contents -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -\def\chapentry #1#2#3{% -\medbreak -\line{#2.\space#1\leaders\hbox to 1em{\hss.\hss}\hfill #3} -} - -\def\unnumbchapentry #1#2{% -\medbreak -\line{#1\leaders\Dotsbox\hfill #2} -} - -\def\secentry #1#2#3#4{% -\line{\enspace\enspace#2.#3\space#1\leaders\Dotsbox\hfill#4} -} - -\def\unnumbsecentry #1#2{% -\line{\enspace\enspace#1\leaders\Dotsbox\hfill #2} -} - -\def\subsecentry #1#2#3#4#5{% -\line{\enspace\enspace\enspace\enspace -#2.#3.#4\space#1\leaders\Dotsbox\hfill #5} -} - -\def\unnumbsubsecentry #1#2{% -\line{\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2} -} - -\def\subsubsecentry #1#2#3#4#5#6{% -\line{\enspace\enspace\enspace\enspace\enspace\enspace -#2.#3.#4.#5\space#1\leaders\Dotsbox\hfill #6} -} - -\def\unnumbsubsubsecentry #1#2{% -\line{\enspace\enspace\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2} -} - -\message{environments,} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\def\tex{\begingroup -\catcode `\\=0 \catcode `\{=1 \catcode `\}=2 -\catcode `\$=3 \catcode `\&=4 \catcode `\#=6 -\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie -\catcode `\%=14 -\catcode`\"=12 -\catcode`\|=12 -\catcode`\<=12 -\catcode`\>=12 -\escapechar=`\\ -% -\let\{=\ptexlbrace -\let\}=\ptexrbrace -\let\.=\ptexdot -\let\*=\ptexstar -\def\@={@}% -\let\bullet=\ptexbullet -\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl -\let\L=\ptexL -% -\let\Etex=\endgroup} - -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^M gets inside @lisp -% phr: changed space to \null, to avoid overfull hbox problems. -{\obeyspaces% -\gdef\lisppar{\null\endgraf}} - -% Cause \obeyspaces to make each Space cause a word-separation -% rather than the default which is that it acts punctuation. -% This is because space in tt font looks funny. -{\obeyspaces % -\gdef\sepspaces{\def {\ }}} - -\newskip\aboveenvskipamount \aboveenvskipamount= 0pt -\def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip -\endgraf \ifdim\lastskip<\aboveenvskipamount -\removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}} - -\def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount -\removelastskip \penalty-50 \vskip\aboveenvskipamount \fi} - -\def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body -\hfuzz=12truept % Don't be fussy -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% Single space lines -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Elisp{\endgroup\afterenvbreak}% -\parskip=0pt \advance \rightskip by \lispnarrowing -\advance \leftskip by \lispnarrowing -\parindent=0pt -\let\exdent=\internalexdent -\obeyspaces \obeylines \tt \rawbackslash -\def\next##1{}\next} - - -\let\example=\lisp -\def\Eexample{\Elisp} - -\let\smallexample=\lisp -\def\Esmallexample{\Elisp} - -% Macro for 9 pt. examples, necessary to print with 5" lines. -% From Pavel@xerox. This is not really used unless the -% @smallbook command is given. - -\def\smalllispx{\aboveenvbreak\begingroup\inENV -% This group ends at the end of the @lisp body -\hfuzz=12truept % Don't be fussy -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% Single space lines -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Esmalllisp{\endgroup\afterenvbreak}% -\parskip=0pt \advance \rightskip by \lispnarrowing -\advance \leftskip by \lispnarrowing -\parindent=0pt -\let\exdent=\internalexdent -\obeyspaces \obeylines \ninett \rawbackslash -\def\next##1{}\next} - -% This is @display; same as @lisp except use roman font. - -\def\display{\begingroup\inENV %This group ends at the end of the @display body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% Single space lines -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Edisplay{\endgroup\afterenvbreak}% -\parskip=0pt \advance \rightskip by \lispnarrowing -\advance \leftskip by \lispnarrowing -\parindent=0pt -\let\exdent=\internalexdent -\obeyspaces \obeylines -\def\next##1{}\next} - -% This is @format; same as @lisp except use roman font and don't narrow margins - -\def\format{\begingroup\inENV %This group ends at the end of the @format body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Eformat{\endgroup\afterenvbreak} -\parskip=0pt \parindent=0pt -\obeyspaces \obeylines -\def\next##1{}\next} - -% @flushleft and @flushright - -\def\flushleft{\begingroup\inENV %This group ends at the end of the @format body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -% This also causes @ to work when the directive name -% is terminated by end of line. -\let\par=\lisppar -\def\Eflushleft{\endgroup\afterenvbreak}% -\parskip=0pt \parindent=0pt -\obeyspaces \obeylines -\def\next##1{}\next} - -\def\flushright{\begingroup\inENV %This group ends at the end of the @format body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -% This also causes @ to work when the directive name -% is terminated by end of line. -\let\par=\lisppar -\def\Eflushright{\endgroup\afterenvbreak}% -\parskip=0pt \parindent=0pt -\advance \leftskip by 0pt plus 1fill -\obeyspaces \obeylines -\def\next##1{}\next} - -% @quotation - narrow the margins. - -\def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body -{\parskip=0pt % because we will skip by \parskip too, later -\aboveenvbreak}% -\singlespace -\parindent=0pt -\def\Equotation{\par\endgroup\afterenvbreak}% -\advance \rightskip by \lispnarrowing -\advance \leftskip by \lispnarrowing} - -\message{defuns,} -% Define formatter for defuns -% First, allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} - -\newskip\defbodyindent \defbodyindent=36pt -\newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt -\newskip\deflastargmargin \deflastargmargin=18pt - -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. -\def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested % -\global\advance\parencount by 1 } -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. -% also in that case restore the outer-level definition of (. -\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi -\global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&} -\def\lbrb{{\tt\char`\[}} \def\rbrb{{\tt\char`\]}} - -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -\leftskip = 0in % -\noindent % -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 % -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}% -\tolerance=10000 \hbadness=10000 % Make all lines underfull and no complaints -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in \leftskip=\defbodyindent % -\begingroup\obeylines\activeparens\spacesplit#3} - -\def\defmethparsebody #1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in \leftskip=\defbodyindent % -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. - -% Define @defun. - -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up - -\def\defunargs #1{\functionparens \sl #1% -\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi% -\interlinepenalty=10000 -\endgraf\vskip -\parskip \penalty 10000} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Function}% -\defunargs {#2}\endgroup % -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Macro}% -\defunargs {#2}\endgroup % -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{Special form}% -\defunargs {#2}\endgroup % -} - -% This definition is run if you use @defunx -% anywhere other than immediately after a @defun or @defunx. - -\def\deffnx #1 {\errmessage{@deffnx in invalid context}} -\def\defunx #1 {\errmessage{@defunx in invalid context}} -\def\defmacx #1 {\errmessage{@defmacx in invalid context}} -\def\defspecx #1 {\errmessage{@defspecx in invalid context}} - -% @defmethod, and so on - -% @defop {Funny Method} foo-class frobnicate argument - -\def\defop #1 {\def\defoptype{#1}% -\defmethparsebody\Edefop\defopx\defopheader} - -\def\defopheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype{} on #1}% -\defunargs {#3}\endgroup % -} - -% @defmethod == @defop Method - -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} - -\def\defmethodheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% entry in function index -\begingroup\defname {#2}{Operation on #1}% -\defunargs {#3}\endgroup % -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defmethparsebody\Edefcv\defcvx\defcvheader} - -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype of #1}% -\defvarargs {#3}\endgroup % -} - -% @defivar == @defcv {Instance Variable} - -\def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader} - -\def\defivarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index -\begingroup\defname {#2}{Instance variable of #1}% -\defvarargs {#3}\endgroup % -} - -% These definitions are run if you use @defmethodx, etc., -% anywhere other than immediately after a @defmethod, etc. - -\def\defopx #1 {\errmessage{@defopx in invalid context}} -\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}} -\def\defcvx #1 {\errmessage{@defcvx in invalid context}} -\def\defivarx #1 {\errmessage{@defivarx in invalid context}} - -% Now @defvar - -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\vskip -\parskip \penalty 10000} - -% @defvr Counter foo-count - -\def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{Variable}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{User Option}% -\defvarargs {#2}\endgroup % -} - -% This definition is run if you use @defvarx -% anywhere other than immediately after a @defvar or @defvarx. - -\def\defvrx #1 {\errmessage{@defvrx in invalid context}} -\def\defvarx #1 {\errmessage{@defvarx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% This definition is run if you use @deftpx, etc -% anywhere other than immediately after a @deftp, etc. - -\def\deftpx #1 {\errmessage{@deftpx in invalid context}} - -\message{cross reference,} -% Define cross-reference macros -\newwrite \auxfile - -% \setref{foo} defines a cross-reference point named foo. - -\def\setref#1{% -\dosetq{#1-pg}{Ypagenumber}% -\dosetq{#1-snt}{Ysectionnumberandtype}} - -\def\unnumbsetref#1{% -\dosetq{#1-pg}{Ypagenumber}% -\dosetq{#1-snt}{Ynothing}} - -% \xref and \pxref generate cross references to specified points. - -\def\pxref #1{see \xrefX [#1,,,,,,,]} -\def\xref #1{See \xrefX [#1,,,,,,,]} -\def\xrefX [#1,#2,#3,#4,#5,#6]{% -\setbox1=\hbox{\i{\losespace#5{}}}% -\setbox0=\hbox{\losespace#3{}}% -\ifdim \wd0 =0pt \setbox0=\hbox{\losespace#1{}}\fi% -\ifdim \wd1 >0pt% -section \unhbox0{} in \unhbox1% -\else% -\refx{#1-snt} [\unhbox0], page\tie \refx{#1-pg}% -\fi } - -% \dosetq is the interface for calls from other macros - -\def\dosetq #1#2{{\let\folio=0% -\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}% -\next}} - -% \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 chapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 section\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -section\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} - -% Define @refx to reference a specific cross-reference string. - -\def\refx#1{% -{% -\expandafter\ifx\csname X#1\endcsname\relax -% If not defined, say something at least. -\expandafter\gdef\csname X#1\endcsname {$<$undefined$>$}% -\message {WARNING: Cross-reference "#1" used but not yet defined}% -\message {}% -\fi % -\csname X#1\endcsname %It's defined, so just use it. -}} - -% Read the last existing aux file, if any. No error if none exists. - -% This is the macro invoked by entries in the aux file. -\def\xrdef #1#2{ -{\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}} - -{ -\catcode `\^^@=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\^^C=\other -\catcode `\^^D=\other -\catcode `\^^E=\other -\catcode `\^^F=\other -\catcode `\^^G=\other -\catcode `\^^H=\other -\catcode `\=\other -\catcode `\^^L=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\=\other -\catcode `\^^[=\other -\catcode `\^^\=\other -\catcode `\^^]=\other -\catcode `\^^^=\other -\catcode `\^^_=\other -\catcode `\@=\other -\catcode `\^=\other -\catcode `\~=\other -\catcode `\[=\other -\catcode `\]=\other -\catcode`\"=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode `\$=\other -\catcode `\#=\other -\catcode `\&=\other - -% the aux file uses ' as the escape. -% Turn off \ as an escape so we do not lose on -% entries which were dumped with control sequences in their names. -% For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ -% Reference to such entries still does not work the way one would wish, -% but at least they do not bomb out when the aux file is read in. - -\catcode `\{=1 \catcode `\}=2 -\catcode `\%=\other -\catcode `\'=0 -\catcode `\\=\other - -'openin 1 'jobname.aux -'ifeof 1 'else 'closein 1 'input 'jobname.aux -'fi -} - -% Open the new aux file. Tex will close it automatically at exit. - -\openout \auxfile=\jobname.aux - -% Footnotes. - -\newcount \footnoteno - -\def\supereject{\par\penalty -20000\footnoteno =0 } - -\let\ptexfootnote=\footnote - -{\catcode `\@=11 -\gdef\footnote{\global\advance \footnoteno by \@ne -\edef\thisfootno{$^{\the\footnoteno}$}% -\let\@sf\empty -\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi -\thisfootno\@sf\parsearg\footnotezzz} - -\gdef\footnotezzz #1{\insert\footins{ -\interlinepenalty\interfootnotelinepenalty -\splittopskip\ht\strutbox % top baseline for broken footnotes -\splitmaxdepth\dp\strutbox \floatingpenalty\@MM -\leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip -\footstrut\hang\textindent{\thisfootno}#1\strut}} - -}%end \catcode `\@=11 - -% End of control word definitions. - -\message{and turning on texinfo input format.} - -\newindex{cp} -\newcodeindex{fn} -\newcodeindex{vr} -\newcodeindex{tp} -\newcodeindex{ky} -\newcodeindex{pg} - -% Set some numeric style parameters, for 8.5 x 11 format. - -\hsize = 6.5in -\parindent 15pt -\parskip 18pt plus 1pt -\baselineskip 15pt -\advance\topskip by 1.2cm - -% Prevent underfull vbox error messages. -\vbadness=10000 - -% Use @smallbook to reset parameters for 7x9.5 format -\def\smallbook{ -\global\lispnarrowing = 0.3in -\global\baselineskip 12pt -\global\parskip 3pt plus 1pt -\global\hsize = 5in -\global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in -\global\vsize=7.5in -\global\tolerance=700 -\global\hfuzz=1pt - -\global\pagewidth=\hsize -\global\pageheight=\vsize -\global\font\ninett=cmtt9 - -\global\let\smalllisp=\smalllispx -\global\let\smallexample=\smalllispx -\global\def\Esmallexample{\Esmalllisp} -} - -%% For a final copy, take out the rectangles -%% that mark overfull boxes (in case you have decided -%% that the text looks ok even though it passes the margin). -\def\finalout{\overfullrule=0pt} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary) -% Define certain chars to be always in tt font. - -\catcode`\"=\active -\def\activedoublequote{{\tt \char '042}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt \char '176}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} -\catcode`\_=\active -\def_{{\tt \char '137}} -\catcode`\|=\active -\def|{{\tt \char '174}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} - -\catcode`\@=0 - -% \rawbackslashxx output one backslash character in current font -{\catcode`\\=\other -@gdef@rawbackslashxx{\}} - -% \rawbackslash redefines \ as input to do \rawbackslashxx. -{\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} - -% Say @foo, not \foo, in error messages. -\escapechar=`\@ - -%% These look ok in all fonts, so just make them not special. The @rm below -%% makes sure that the current font starts out as the newly loaded cmr10 -\catcode`\$=\other \catcode`\%=\other \catcode`\&=\other \catcode`\#=\other - -\catcode 17=0 @c Define control-q -\catcode`\\=\active -@let\=@normalbackslash - -@textfonts -@rm diff --git a/gnu/usr.sbin/e2fsprogs/lib/et/vfprintf.c b/gnu/usr.sbin/e2fsprogs/lib/et/vfprintf.c deleted file mode 100644 index a1dc1e8cf7f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/et/vfprintf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -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> - -int -vfprintf(iop, fmt, ap) - FILE *iop; - char *fmt; - va_list ap; -{ - int len; - char localbuf[BUFSIZ]; - - if (iop->_flag & _IONBF) { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = localbuf; - len = _doprnt(fmt, ap, iop); - (void) fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } else - len = _doprnt(fmt, ap, iop); - - return (ferror(iop) ? EOF : len); -} -#endif /* !HAVE_VPRINTF */ diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ChangeLog b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ChangeLog deleted file mode 100644 index d48c30596ab..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ChangeLog +++ /dev/null @@ -1,870 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 24 10:13:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * alloc_tables.c (ext2fs_allocate_tables): Correctly place the - inode and block bitmaps based on the RAID 0 stride - parameter (which is passed by mke2fs). - - * ext2fs.h: Add "stride" parameter to ext2_filsys, to be used by - mke2fs to communicate the stride length to - ext2fs_allocate_tables() - -Wed Apr 23 21:50:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * initialize.c (ext2fs_initialize): Fix to compile under Linux 1.2 - systems. (We can't assume that the new filesystem types - are supported.) - -Wed Apr 23 18:40:53 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * alloc_tables.c (ext2fs_allocate_tables): Make sure that we - allocate the inode and block bitmaps inside block group at - all times. - -Mon Apr 21 00:06:28 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * alloc.c (ext2fs_new_block): Fix bug where if goal==0 and the - filesystem has no free blocks, ext2fs_new_block would loop - forever. - - * dupfs.c (ext2fs_dup_handle): Duplicate an ext2 filesystem handle - - * freefs.c (ext2fs_free_inode_cache): Decrement refcount and only - free if refcount goes to zero. - - * inode.c (create_icache): Initialize refcount to 1. - - * ext2fsP.h: Added refcount to ext2_inode_cache - - * dblist.c (ext2fs_copy_dblist): New function to copy a directory - block list. - - * badblocks.c (ext2fs_badblocks_copy): New function to copy a - badblocks structure. - -Sun Apr 20 23:19:51 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * bitmaps.c (ext2fs_copy_bitmap): New function to copy a bitmap. - - * unix_io.c, test_io.c (unix_open, test_open): Initialize the - refcount to 1. - (unix_close, test_close): Decrement the refcount and only - close the io_channel if the refcount goes to 0. - - * io.h: Add refcount to the io_channel structure. Add new macro - interface io_channel_bumpcount() to bump the refcount. - -Thu Apr 17 20:25:03 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_read_inode, ext2fs_write_inode): Use the inode - cache in the filesystem handle, instead of the inode cache - in a static variable. - - * freefs.c: Added static function to free the inode cache (called by - ext2fs_free). - - * ext2fsP.h: Added definition of the ext2_inode_cache structures. - - * ext2fs.h: Added pointer to the inode_cache structure. - - * block.c (block_iterate_ind, block_iterate_dind, - block_iterate_tind): If there are holes in the indirect, - doubly indirect, or triply indirect blocks, increment the - block count field automatically. - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Mon Apr 14 20:38:56 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * version.c (ext2fs_parse_version_string): Check the passed in - version string (instead of the hard-coded one). - - * alloc_tables.c (ext2fs_allocate_tables): If the last block is - greater filesystem size, clamp it to prevent allocating a - block or inode bitmap beyond the filesystem. - - * initialize.c (ext2fs_initialize): Fix bug where the metatdata - overhead calculation was accidentally removed. - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Thu Apr 10 13:15:15 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * dblist.c (ext2fs_set_dir_block): New function which sets the - block of a dblist entry, given the directory inode and - blockcnt. - -Sat Apr 5 12:42:42 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * alloc_tables.c (ext2fs_allocate_tables): Allocate the bitmap and - inode bitmaps at staggered locations across the block - groups, to avoid concentrating the bitmaps on a small - number of disks when using striped RAID arrays. - - * initialize.c (ext2fs_initialize): By default, choose the maximum - possible number of blocks per group (based on the size of - the bitmaps in the blocksize). - -Fri Apr 4 11:28:16 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * initialize.c (ext2fs_initialize): Add support for - EXT2_COMPAT_SPARSE_SUPER feature. - - * closefs.c (ext2fs_bg_has_super): New function to determine - whether or a particular block group should have a - superblock and block group descriptor. Used for the - EXT2_COMPAT_SPARSE_SUPER feature is turned on. - (ext2fs_flush): Check ext2fs_bg_has_super to see whether - or not the superblock should be written out for the block - group. - - * ext2fs.h (EXT2_COMPAT_SPARSE_SUPER): Define compatibility flag - for sparse duplicate superblocks. - - * version.c (ext2fs_get_library_version): New function which - returns the library version. - - * version.c (ext2fs_parse_version_string): New function which - parses a version string and returns a version number, - so application programs can compare version numbers as - integers. - -Wed Mar 26 00:43:52 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * icount.c (ext2fs_create_icount): Change function so that it also - takes a new argument which contains a "hint" icount - structure. This "hint" icount allows the create function - to set up the sorted list in advance. This reduces - significantly the amount of data moving needed to insert - these inodes into the list later. - - * icount.c (ext2fs_icount_validate): New function which validates - that the icount structure's rep invariant. - - * icount.c (get_icount_el): Completely revamped implementation - to subsume put_icount_el(). Put_icount_el() used to - use an O(N) implementation to insert in the middle - of the icount list. It now uses a O(ln N) to search - for where the icount should be inserted, and then uses - a memcpy to move the list down (instead of a for loop). - - * icount.c (ext2fs_icount_fetch, ext2fs_icount_store, - ext2fs_icount_increment, ext2fs_icount_decrement): Check - to see if the inode is within bounds; if it isn't, return - EINVAL. - - * bitops.h (ext2fs_test_generic_bitmap): Fix error message given - when a bad inode number is passed to test_generic_bitmap - to be EXT2FS_TEST_ERROR instead of the wrong - EXT2FS_UNMARK_ERROR. - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Sun Mar 2 16:46:18 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (ELF_VERSION): Change version to be 2.2 - -Tue Feb 11 14:54:02 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * alloc.c (ext2fs_get_free_blocks): Change routine to use - ext2fs_fast_test_block_bitmap_range(). - - * bitops.h (ext2fs_fast_test_block_bitmap_range, - ext2fs_test_block_bitmap_range: New inline functions which - test to see whether a contiguous range of blocks is - available. - -Thu Feb 6 10:00:13 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * badblocks.c (ext2fs_badblocks_list_create): Rename sybmols to use - use ext2fs_badblocks_* instead of badblocks_* - - * bb_compat.c: New file which translates between old badblocks_*() - names to ext2fs_badblocks_*() - - * unlink.c (ext2fs_unlink): New file, moved ext2fs_unlink() from - link.c (since e2fsck doesn't use ext2fs_unlink()). - - * rs_bitmap.c (ext2fs_resize_generic_bitmap): New file, contains - bitmap resizing routine moved from bitmaps.c, since e2fsck - doesn't need to use this function. - - * lookup.c (ext2fs_lookup): Moved ext2fs_lookup to its own file, - since e2fsck only needs ext2fs_lookup. - -Mon Feb 3 10:11:40 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_open_inode_scan): Set fs->badblocks if it is not - already set; this is needed so that programs like dump - which use the inode scan functions will deal with - filesystems that have bad blocks in the inode table. - -Sun Feb 2 00:17:36 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ext2fs.h (struct_badblocks_list, struct_badblocks_iterate): - Moved to ext2fsP.h, since it doesn't need to be part of - the public interface. - - * dir_iterate.c: Move ext2_dir_iterate out of namei.c. - -Sat Feb 1 10:14:55 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * dblist.c (ext2fs_get_num_dirs): New file, which implements a - directory block list abstraction. (Code moved from - e2fsck). - - * ext2fs.h, inode.c: Moved definition of ext2_struct_inode_scan to - to inode.c (since no one else should be peeking inside it!) - - * valid_blk.c (ext2_inode_has_valid_blocks): New function. - - * openfs.c (ext2fs_open): Check the feature set in the ext2 - superblock, and refuse to open filesystems if they contain - incompatible features. (Can be overriden with the - EXT2_FLAG_FORCE - -Sun Jan 12 11:31:46 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * block.c (ext2fs_block_iterate2): Added new function - ext2fs_block_iterate2 which changes the function - signature of the callback function to include the - referencing block and offset. - - * inode.c (ext2fs_inode_scan_goto_blockgroup): Added new function - ext2fs_inode_scan_goto_blockgroup which allows an - application to jump to a particular block group while - doing an inode scan. - -Wed Jan 1 23:50:12 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * dirblock.c: Include string.h, since we use memcpy(). - -Tue Dec 3 12:27:29 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * getsize.c (ext2fs_get_device_size): The ioctl BLKGETSIZE returns - a long not an int; this doesn't matter on i386 machines, - but it does on Alpha's. - -Fri Nov 29 20:57:37 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_write_inode, ext2fs_read_inode): If the inode - table pointer is NULL, then return an error indicating - that the inode table is missing. - (get_next_blockgroup, get_next_blocks, - ext2fs_get_next_inode): Don't treat a missing inode table - as permanent error. Return MISSING_INODE_TABLE, but as an - advisory error code, much like BAD_BLOCK_IN_INODE_TABLE. - - * rw_bitmaps.c (ext2fs_write_block_bitmap, - ext2fs_write_inode_bitmap): If the inode or block bitmap - block is zero, then don't write out the inode or block - bitmap. The idea here is to avoid stomping on the - superblock. - (read_bitmaps): If the inode or block bitmap block is - zero, then fill in that portion of the inode or block - bitmap with all zeros. - - * inode.c (ext2fs_get_next_inode): Fix bug in handling of bad - blocks in inode table when the inode table size is - non-standard (and can therefore span blocks). - -Tue Oct 29 20:13:14 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * alloc.c (ext2fs_new_block): Fix fencepost error in - ext2fs_new_block; make sure we don't try to allocate the - first block beyond the end of the filesystem. - -Mon Oct 14 11:00:48 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * inode.c (check_for_inode_bad_blocks): New function called by - get_next_blocks() to avoid reading in bad blocks marked in - fs->badblocks. Inodes located in bad blocks are returned - by ext2fs_get_next_inode() returns the error code - EXT2_ET_BAD_BLOCK_IN_INODE_TABLE. - - * alloc_tables.c (ext2fs_allocate_tables): New function which - performs the part of mke2fs's job of allocating the - filesystem tables. - - * test_io.c (test_close): IO manager which is used for testing - purposes. - -Sun Oct 13 04:31:57 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_get_next_inode): Separate out the function of - setting up for a new block group to get_next_blockgroup(). - Separate out the function of reading in blocks of the - inode table to get_next_blocks(). - - * ext2fs.h: Add the badblocks list to the ext2_filsys entry - - * badblocks.c (badblocks_list_add, badblocks_list_test): Add - blocks to the badblock list in sorted order. This allows - badblocks_list_test to be coded using a binary search for - speed. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Mon Oct 7 00:44:17 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ext2fs.h, block.c, closefs.c, dirblock.c, inode.c, native.c, - open.c: Change EXT2_SWAP to EXT2_FLAG_SWAP for - consistency's sake. - - * closefs.c (ext2fs_flush): If the flag EXT2_MASTER_SB_ONLY is - set, then only write out the master superblock. - -Sun Oct 6 21:45:26 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * block.c (ext2fs_block_iterate): Fixed bug which caused - block_iterate to fail to handle HURD created filesystems; - it tested the inode translator field before the inode was - loaded. - -Tue Sep 17 14:08:24 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * initialize.c (ext2fs_initialize): Make sure the description for - the inode bitmap is set correctly. - - * bitmaps.c (ext2fs_allocate_generic_bitmap): Fix minor type typo. - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Sat Sep 7 07:36:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * initialize.c: Override the kernel's idea of default - checkinterval from 0 (never) to 180 days. - -Wed Aug 28 03:20:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * namei.c (ext2fs_namei_follow): New function which follows - symbolic link (if any) at the target. - -Tue Aug 27 01:48:43 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_read_inode, ext2fs_write_inode): Add support - for shortcut function fs->read_inode() and fs->write_inode(). - Added inode_cache to reduce CPU time spent in doing - byte swapping. - - * swapfs.c (ext2fs_swap_super): Swap the new fields in a V2 - superblock. - - * namei.c (ext2fs_follow_link): New function. - (ext2fs_namei): Extended to have support for chasing - symbolic links. ext2fs_namei() still returns an inode - which is a symbolic link. Symbolic links are only chased - while resolving the containing directory. To chase - symbolic links of the final result, use - ext2fs_follow_link(). - -Mon Aug 26 23:46:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ext2_err.et.in: Added new error code EXT2_ET_SYMLINK_LOOP. - - * bitops.h (ext2fs_set_bit, ext2fs_celar_bit): Use asm inlines - provided by Pete A. Zaitcev (zaitcev@lab.sun.mcst.ru). - -Thu Aug 22 00:40:18 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * initialize.c (ext2fs_initialize): On systems where the byte - order is not i386 compatible, set the swap_byte flag. - - * inode.c (inocpy_with_swap): Check to see if inode contains a - fast symlink before swapping the inode block fields. This - required adding a new argument to inocpy_with_swap to - determine whether the mode field is in host order or not. - -Wed Aug 21 00:45:42 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * bitops.h (ext2fs_set_bit, ext2fs_clear_bit, ext2fs_test_bit): On - the sparc, if EXT2_STD_BITOPS set, use the standard - i386-compatible bitmask operations, instead on the - non-standard native bitmask operators. - -Fri Aug 9 11:11:35 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * block.c (ext2fs_block_iterate): Cause block iterator to return - the HURD translator block (along with everything else). - If the flag BLOCK_FLAG_DATA_ONLY is passed to the block - iterator, then don't return any meta data blocks - (including the HURD translator). - -Wed Jul 17 17:13:34 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * gen_uuid.c: New file, which generates DCE-compatible UUIDs. - - * uuid.c: New file, containing UUID utility functions. - -Tue Jul 16 10:19:16 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ext2fs.h: Add a definition of the "real" ext2 superblock. - -Fri May 24 14:54:55 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * ext2fs.h: Fix erroneous ino_t type used in block_bitmap type. - -Sun May 19 15:39:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * openfs.c (ext2fs_open): If the blocksize in the superblock is - zero, return the error EXT2_ET_CORRUPT_SUPERBLOCK, since - that's a basic value that must be correct for the rest of - the library to work. - - * ext2_err.et.in (EXT2_ET_CORRUPT_SUPERBLOCK): Added new error - code. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Tue Mar 26 12:06:32 1996 <tytso@rsts-11.mit.edu> - - * bitops.h (ext2fs_set_bit, ext2fs_clear_bit, ext2fs_test_bit): - Change the m68k bit numbering for bitmasks to match with - the bit numbering used by all other ext2 implementations. - -Thu Mar 7 03:37:00 1996 <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_get_next_inode, ext2fs_close_inode_scan, - ext2fs_open_inode_scan): Support dynamically-sized inodes. - -Wed Mar 6 12:26:29 1996 <tytso@rsts-11.mit.edu> - - * inode.c (ext2fs_read_inode, ext2fs_write_inode): Support - dynamically-sized inodes. - - * openfs.c (ext2fs_open): Allow dynamic revision filesystem to be - loaded. - -Tue Mar 5 03:49:37 1996 <tytso@rsts-11.mit.edu> - - * initialize.c (ext2fs_initialize): Catch an error condition where - the passed in size is *really* too small. - - * alloc.c (ext2fs_new_inode): - * ext2fs.h (EXT2_FIRST_INODE): Add support for dynamic revision to - get first inode. - -Wed Feb 21 15:56:17 1996 <tytso@rsts-11.mit.edu> - - * getsize.c (ext2fs_get_device_size): Open the device read-only - when trying to determine its size. - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Sat Dec 9 09:57:50 1995 <tytso@rsts-11.mit.edu> - - * rw_bitops.c (ext2fs_write_block_bitmap): - * bitops.c (ext2fs_test_bit, ext2fs_clear_bit, ext2fs_set_bit): - * bitops.h (ext2fs_test_bit, ext2fs_clear_bit, ext2fs_set_bit): - Rename {test,set,clear}_bit to ext2fs_{test,set,clear}_bit, - to avoid conflicts with with kernel include files. Also - rename ADDR and CONST_ADDR to EXT2FS_ADDR and - EXT2FS_CONST_ADDR. - -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() - compat code to protect against overflow. This only - applies to 1.0 and early 1.1 kernels, which don't support - the llseek() system call. - -Thu Nov 24 16:29:00 1994 Theodore Y. Ts'o (tytso@rt-11) - - * unix_io.c (unix_open): Initialize the read_error and write_error - io_channel pointers to be null. - - * bb_inode.c (clear_bad_block_proc): If an illegal block number is - found, clear it but don't try to update the filesystem - accounting information, since that's hopeless anyway. - - * block.c (bloblock_iterate_ind, bloblock_iterate_dind, - bloblock_iterate_tind): Check to see if the indirect blocks are - valid before trying to read them. - - * ext2_err.et (EXT2_ET_BAD_IND_BLOCK, EX2_ET_BAD_DIND_BLOCK, - EXT2_ET_BAD_TIND_BLOCK): Add new error codes. - - * bitops.h (ext2fs_mark_block_bitmap, ext2fs_unmark_block_bitmap, - ext2fs_test_block_bitmap, ext2fs_mark_inode_bitmap, - ext2fs_unmark_inode_bitmap, ext2fs_test_inode_bitmap): If an - illegal block or inode number is passed in, return instead - of trying to test, set, or clear the bit. - -Mon Nov 7 21:32:33 1994 Remy Card <card@bbj> - - * Makefile: Added a dummy install target in case shared libraries - are not built. - -Mon Oct 24 14:11:44 1994 (tytso@rsx-11) - - * bitmaps.c (ext2fs_allocate_block_bitmap): Fix calculation of how - the real last block of the bitmap should be calculated. - -Wed Sep 7 10:05:36 1994 (tytso@rsx-11) - - * bitmaps.c (ext2fs_fudge_inode_bitmap_end, - ext2fs_fudge_block_bitmap_end, ext2fs_clear_inode_bitmap, - ext2fs_clear_block_bitmap, ext2fs_free_inode_bitmap, - ext2fs_free_block_bitmap): Add magic number checking for - the inode and block bitmaps. - - * bitmaps.c (ext2fs_allocate_block_bitmap): Fix to set the correct - magic number for a block bitmap instead of an inode bitmap. - - * inode.c (ext2fs_close_inode_scan, ext2fs_get_next_inode): Add - magic number checking for the inode_scan structure. - - * badblocks.c (badblocks_list_free, badblocks_list_add, - badblocks_list_test, badblocks_list_iterate_begin, - badblocks_list_iterate, badblocks_list_iterate_end): Add - magic number checking for the badblocks_list and - badblocks_iterate structures. - - * ext2_err.et (EXT2_ET_MAGIC_UNIX_IO_CHANNEL): - * unix_io.c (unix_open, unix_close, unix_set_blksize, unix_read_blk, - unix_write_blk, unix_flush): Add magic number checking - both for io_channel structure and unix_private_data - structure. - - * openfs.c (ext2fs_open): Add check for io_manager structure's - magic number. - - * rw_bitmaps.c (ext2fs_write_inode_bitmap, ext2fs_write_block_bitmap, - ext2fs_read_inode_bitmap, ext2fs_read_block_bitmap, - ext2fs_read_bitmaps, ext2fs_write_bitmaps): - * read_bb.c (ext2fs_read_bb_inode): - * read_bb_file.c (ext2fs_read_bb_FILE): - * newdir.c (ext2fs_new_dir_block): - * namei.c (ext2fs_dir_iterate, ext2fs_lookup, ext2fs_namei): - * link.c (ext2fs_link, ext2fs_unlink): - * inode.c (ext2fs_open_inode_scan, ext2fs_read_inode, - ext2fs_write_inode, ext2fs_get_blocks, - ext2fs_check_directory): - * get_pathname.c (ext2fs_get_pathname): - * expanddir.c (ext2fs_expand_dir): - * block.c (ext2fs_block_iterate): - * bitmaps.c (ext2fs_allocate_inode_bitmap, - ext2fs_allocate_block_bitmap): - * bb_inode.c (ext2fs_update_bb_inode): - * alloc.c (ext2fs_new_inode,ext2fs_new_block,ext2fs_get_free_blocks): - * check_desc.c (ext2fs_check_desc): - * closefs.c (ext2fs_close, ext2fs_flush): - * freefs.c (ext2fs_free): Add check for ext2_filsys magic number. - - * Makefile: - * ext2fs.h: - * openfs.c: - * check_desc.c (ext2fs_check_desc): Move ext2fs_check_desc from - openfs.c into its own file. - - * ext2fs.h (EXT2_CHECK_MAGIC): Added macro for checking for - structure magic numbers. - - * closefs.c (ext2fs_flush): Folded in Remy Card's changes to clear - the EXT2_VALID_FS flag in the backup superblock blocks, so that if - someone uses the -b option to specify the use of the backup - superblock --- this usually means that the main superblock is - toast. :-) - - * ext2fs.h: - * ext2_err.et (EXT2_ET_REV_TOO_HIGH): - * openfs.c (ext2fs_open): Folded in Remy Card's changes to add a - revision level to the superblock. - -Sun Aug 21 00:50:08 1994 Theodore Y. Ts'o (tytso@rt-11) - - * ext2fs.h: - * bitmaps.c: - * bitops.c - * bitops.h: - * openfs.c: - * initialize.c: Completely revamped the inode and block bitmap - structures, so that they can be better chance of being extensible - in a shared library. They are now their own type, instead of - being a char *. Also, the function signatures of - ext2fs_test_block_bitmap, ext2fs_mark_block_bitmap, - ext2fs_unmark_block_bitmap, ext2fs_test_inode_bitmap, - ext2fs_mark_inode_bitmap, and ext2fs_unmark_inode_bitmap were - changed to eliminate the ext2_filsys argument, since it is no - longer necessary. - -Wed Aug 17 21:46:44 1994 Remy Card (card@bbj) - - * unix_io.c (unix_read_blk and unix_write_blk): use the llseek - system call if available. - - * llseek.c: new file. This is the stub calling the llseek system - call which allows supports for 2GB+ file systems. - - * initialize.c (ext2fs_initialize): Ext2fs_initialize now stores - the creator operating system. - -Wed Aug 17 10:03:24 1994 Theodore Y. Ts'o (tytso@rt-11) - - * initialize.c (ext2fs_initialize): Ext2fs_initialize now sets up - the group descriptor statistics in addition to everything else. - This relieves mke2fs of the responsibility of doing it. - - * bitops.c, bitops.h: Add assembly inline functions for the 68000. - Added a new #define, _EXT2_HAVE_ASM_BITOPS_ to control whether or - not the generic C function equivalents should be included or not. - - * openfs.c (ext2fs_open): If a superblock is specified, then use - the backup group descriptors that go along with this superblock, - instead of using the primary group descriptors. This allows - e2fsck to recover filesystems where the primary group descriptors - have been trashed. - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/Makefile.in b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/Makefile.in deleted file mode 100644 index 4e220c60873..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/Makefile.in +++ /dev/null @@ -1,333 +0,0 @@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = ../.. -my_dir = lib/ext2fs -INSTALL = @INSTALL@ - -@MCONFIG@ - -OBJS= ext2_err.o \ - alloc.o \ - alloc_tables.o \ - badblocks.o \ - bb_compat.o \ - bb_inode.o \ - bitmaps.o \ - bitops.o \ - block.o \ - brel_ma.o \ - check_desc.o \ - closefs.o \ - cmp_bitmaps.o \ - dblist.o \ - dblist_dir.o \ - dirblock.o \ - dir_iterate.o \ - dupfs.o \ - expanddir.o \ - freefs.o \ - get_pathname.o \ - getsize.o \ - icount.o \ - initialize.o \ - inline.o \ - inode.o \ - irel_ma.o \ - ismounted.o \ - link.o \ - llseek.o \ - lookup.o \ - mkdir.o \ - namei.o \ - native.o \ - newdir.o \ - openfs.o \ - read_bb.o \ - read_bb_file.o \ - rs_bitmap.o \ - rw_bitmaps.o \ - swapfs.o \ - test_io.o \ - unix_io.o \ - unlink.o \ - valid_blk.o \ - version.o - -SRCS= ext2_err.c \ - $(srcdir)/alloc.c \ - $(srcdir)/alloc_tables.c \ - $(srcdir)/badblocks.c \ - $(srcdir)/bb_compat.c \ - $(srcdir)/bb_inode.c \ - $(srcdir)/bitmaps.c \ - $(srcdir)/bitops.c \ - $(srcdir)/block.c \ - $(srcdir)/brel_ma.c \ - $(srcdir)/check_desc.c \ - $(srcdir)/closefs.c \ - $(srcdir)/cmp_bitmaps.c \ - $(srcdir)/dblist.c \ - $(srcdir)/dblist_dir.c \ - $(srcdir)/dirblock.c \ - $(srcdir)/dir_iterate.c \ - $(srcdir)/dupfs.c \ - $(srcdir)/expanddir.c \ - $(srcdir)/freefs.c \ - $(srcdir)/get_pathname.c \ - $(srcdir)/getsize.c \ - $(srcdir)/icount.c \ - $(srcdir)/initialize.c \ - $(srcdir)/inline.c \ - $(srcdir)/inode.c \ - $(srcdir)/irel_ma.c \ - $(srcdir)/ismounted.c \ - $(srcdir)/link.c \ - $(srcdir)/llseek.c \ - $(srcdir)/lookup.c \ - $(srcdir)/mkdir.c \ - $(srcdir)/namei.c \ - $(srcdir)/native.c \ - $(srcdir)/newdir.c \ - $(srcdir)/openfs.c \ - $(srcdir)/read_bb.c \ - $(srcdir)/read_bb_file.c \ - $(srcdir)/rs_bitmap.c \ - $(srcdir)/rw_bitmaps.c \ - $(srcdir)/swapfs.c \ - $(srcdir)/test_io.c \ - $(srcdir)/unix_io.c \ - $(srcdir)/unlink.c \ - $(srcdir)/valid_blk.c \ - $(srcdir)/version.c - -HFILES= bitops.h ext2fs.h io.h - -LIBRARY= libext2fs -LIBDIR= ext2fs - -DLL_ADDRESS = 0x66900000 -DLL_JUMPSIZE = 0x1000 -DLL_GOTSIZE = 0x1000 -DLL_VERSION = 1.2 -DLL_IMAGE = libe2fs -DLL_STUB = libext2fs -DLL_LIBS = -L../.. -lcom_err -DLL_MYDIR = ext2fs -DLL_INSTALL_DIR = $(libdir) - -ELF_VERSION = 2.3 -ELF_SO_VERSION = 2 -ELF_IMAGE = libext2fs -ELF_MYDIR = ext2fs -ELF_INSTALL_DIR = $(libdir) -ELF_OTHER_LIBS = -lc -L../.. -lcom_err - -BSDLIB_VERSION = 2.1 -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) $(ALL_CFLAGS) -c $< -o $@ -@PROFILE_CMT@ $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< -@CHECKER_CMT@ $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $< -@DLL_CMT@ (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(ALL_CFLAGS) \ -@DLL_CMT@ -o jump/$*.o -c $<) -@ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< -@BSDLIB_CMT@ $(CC) $(ALL_CFLAGS) -fpic -o pic/$*.o -c $< - -COMPILE_ET=../et/compile_et - -DISTFILES= Makefile *.c *.h image - -ext2_err.et: $(SUBSTITUTE) $(srcdir)/ext2_err.et.in - -$(CHMOD) +x $(SUBSTITUTE) - $(SUBSTITUTE) $(srcdir)/ext2_err.et.in ext2_err.et - -ext2_err.c ext2_err.h: ext2_err.et - $(COMPILE_ET) ext2_err.et - -tst_badblocks: tst_badblocks.o badblocks.o - $(CC) -o tst_badblocks tst_badblocks.o badblocks.o $(LIBCOM_ERR) - -tst_iscan: tst_iscan.o inode.o $(STATIC_LIBEXT2FS) - $(CC) -o tst_iscan tst_iscan.o inode.o $(STATIC_LIBEXT2FS) \ - $(LIBCOM_ERR) - -check:: tst_badblocks tst_iscan - ./tst_badblocks - ./tst_iscan - -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.et 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 -alloc_tables.o: $(srcdir)/alloc_tables.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h -badblocks.o: $(srcdir)/badblocks.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h $(srcdir)/bitops.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h -bb_compat.o: $(srcdir)/bb_compat.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h -bb_inode.o: $(srcdir)/bb_inode.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h -bitmaps.o: $(srcdir)/bitmaps.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h -bitops.o: $(srcdir)/bitops.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.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 -brel_ma.o: $(srcdir)/brel_ma.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h $(srcdir)/bitops.h \ - $(srcdir)/brel.h $(top_builddir)/lib/ext2fs/ext2_err.h -check_desc.o: $(srcdir)/check_desc.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h -closefs.o: $(srcdir)/closefs.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/bitops.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.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 -dblist.o: $(srcdir)/dblist.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h $(srcdir)/bitops.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h -dblist_dir.o: $(srcdir)/dblist_dir.c $(srcdir)/ext2fsP.h $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h $(srcdir)/bitops.h \ - $(top_builddir)/lib/ext2fs/ext2_err.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 -dir_iterate.o: $(srcdir)/dir_iterate.c $(srcdir)/ext2fsP.h \ - $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h -dupfs.o: $(srcdir)/dupfs.c $(srcdir)/ext2fsP.h $(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)/ext2fsP.h $(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 -icount.o: $(srcdir)/icount.c $(top_srcdir)/lib/et/com_err.h \ - $(srcdir)/ext2fs.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)/ext2fsP.h \ - $(srcdir)/ext2fs.h $(top_srcdir)/lib/et/com_err.h \ - $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/bitops.h -irel_ma.o: $(srcdir)/irel_ma.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/bitops.h $(srcdir)/irel.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 -lookup.o: $(srcdir)/lookup.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.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 -native.o: $(srcdir)/native.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 -rs_bitmap.o: $(srcdir)/rs_bitmap.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 -test_io.o: $(srcdir)/test_io.c $(top_srcdir)/lib/et/com_err.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/io.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 -unlink.o: $(srcdir)/unlink.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h -valid_blk.o: $(srcdir)/valid_blk.c $(srcdir)/ext2fs.h \ - $(top_srcdir)/lib/et/com_err.h $(srcdir)/io.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h -version.o: $(srcdir)/version.c $(top_srcdir)/lib/et/com_err.h \ - $(srcdir)/ext2fs.h $(srcdir)/io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/bitops.h $(srcdir)/../../version.h diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/alloc.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/alloc.c deleted file mode 100644 index 50cee77c0b8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/alloc.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * alloc.c --- allocate new inodes, blocks for ext2fs - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.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" - -/* - * Right now, just search forward from the parent directory's block - * group to find the next free inode. - * - * Should have a special policy for directories. - */ -errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode, - ext2fs_inode_bitmap map, ino_t *ret) -{ - int dir_group = 0; - ino_t i; - ino_t start_inode; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!map) - map = fs->inode_map; - if (!map) - return EXT2_ET_NO_INODE_BITMAP; - - if (dir > 0) - 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_INODE(fs->super)) - start_inode = EXT2_FIRST_INODE(fs->super); - i = start_inode; - - do { - if (!ext2fs_test_inode_bitmap(map, i)) - break; - i++; - if (i > fs->super->s_inodes_count) - i = EXT2_FIRST_INODE(fs->super); - } while (i != start_inode); - - if (ext2fs_test_inode_bitmap(map, i)) - return ENOSPC; - *ret = i; - return 0; -} - -/* - * Stupid algorithm --- we now just search forward starting from the - * goal. Should put in a smarter one someday.... - */ -errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, - ext2fs_block_bitmap map, blk_t *ret) -{ - blk_t i; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!map) - map = fs->block_map; - if (!map) - return EXT2_ET_NO_BLOCK_BITMAP; - if (!goal || (goal >= fs->super->s_blocks_count)) - goal = fs->super->s_first_data_block; - i = goal; - do { - if (!ext2fs_test_block_bitmap(map, i)) { - *ret = i; - return 0; - } - i++; - if (i >= fs->super->s_blocks_count) - i = fs->super->s_first_data_block; - } while (i != goal); - return ENOSPC; -} - -errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, - int num, ext2fs_block_bitmap map, blk_t *ret) -{ - blk_t b = start; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!map) - map = fs->block_map; - if (!map) - return EXT2_ET_NO_BLOCK_BITMAP; - if (!b) - b = fs->super->s_first_data_block; - if (!finish) - finish = start; - if (!num) - num = 1; - do { - if (b+num-1 > fs->super->s_blocks_count) - b = fs->super->s_first_data_block; - if (ext2fs_fast_test_block_bitmap_range(map, b, num)) { - *ret = b; - return 0; - } - b++; - } while (b != finish); - return ENOSPC; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/alloc_tables.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/alloc_tables.c deleted file mode 100644 index 6a60bf76495..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/alloc_tables.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * alloc_tables.c --- Allocate tables for a newly initialized - * filesystem. Used by mke2fs when initializing a filesystem - * - * Copyright (C) 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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_allocate_tables(ext2_filsys fs) -{ - errcode_t retval; - blk_t group_blk, start_blk, last_blk, new_blk, blk; - int i, j; - - group_blk = fs->super->s_first_data_block; - for (i = 0; i < fs->group_desc_count; i++) { - last_blk = group_blk + fs->super->s_blocks_per_group; - if (last_blk >= fs->super->s_blocks_count) - last_blk = fs->super->s_blocks_count - 1; - - /* - * Allocate the inode table - */ - start_blk = group_blk + 3 + fs->desc_blocks; - if (start_blk > last_blk) - start_blk = group_blk; - retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, - fs->inode_blocks_per_group, - fs->block_map, &new_blk); - if (retval) - return retval; - for (j=0, blk = new_blk; - j < fs->inode_blocks_per_group; - j++, blk++) - ext2fs_mark_block_bitmap(fs->block_map, blk); - fs->group_desc[i].bg_inode_table = new_blk; - - /* - * Allocate the block and inode bitmaps - */ - if (fs->stride) { - start_blk += fs->inode_blocks_per_group; - start_blk += ((fs->stride * i) % - (last_blk - start_blk)); - if (start_blk > last_blk) - /* should never happen */ - start_blk = group_blk; - } else - start_blk = group_blk; - retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, - 1, fs->block_map, &new_blk); - if (retval) - return retval; - ext2fs_mark_block_bitmap(fs->block_map, new_blk); - fs->group_desc[i].bg_block_bitmap = new_blk; - - retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, - 1, fs->block_map, &new_blk); - if (retval) - return retval; - ext2fs_mark_block_bitmap(fs->block_map, new_blk); - fs->group_desc[i].bg_inode_bitmap = new_blk; - - /* - * Increment the start of the block group - */ - group_blk += fs->super->s_blocks_per_group; - } - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/badblocks.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/badblocks.c deleted file mode 100644 index f8a562a53d2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/badblocks.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * badblocks.c --- routines to manipulate the bad block structure - * - * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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 "ext2fsP.h" - -/* - * Helper function for making a badblocks list - */ -static errcode_t make_badblocks_list(int size, int num, blk_t *list, - ext2_badblocks_list *ret) -{ - ext2_badblocks_list bb; - - bb = malloc(sizeof(struct ext2_struct_badblocks_list)); - if (!bb) - return ENOMEM; - memset(bb, 0, sizeof(struct ext2_struct_badblocks_list)); - bb->magic = EXT2_ET_MAGIC_BADBLOCKS_LIST; - bb->size = size ? size : 10; - bb->num = num; - bb->list = malloc(bb->size * sizeof(blk_t)); - if (!bb->list) { - free(bb); - return ENOMEM; - } - if (list) - memcpy(bb->list, list, bb->size * sizeof(blk_t)); - else - memset(bb->list, 0, bb->size * sizeof(blk_t)); - *ret = bb; - return 0; -} - - -/* - * This procedure creates an empty badblocks list. - */ -errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size) -{ - return make_badblocks_list(size, 0, 0, ret); -} - -/* - * This procedure copies a badblocks list - */ -errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src, - ext2_badblocks_list *dest) -{ - errcode_t retval; - - retval = make_badblocks_list(src->size, src->num, src->list, - dest); - if (retval) - return retval; - (*dest)->badblocks_flags = src->badblocks_flags; - return 0; -} - - -/* - * This procedure frees a badblocks list. - * - * (note: moved to closefs.c) - */ - - -/* - * This procedure adds a block to a badblocks list. - */ -errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, blk_t blk) -{ - int i, j; - blk_t *new_list; - - EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST); - - if (bb->num >= bb->size) { - bb->size += 10; - new_list = realloc(bb->list, bb->size * sizeof(blk_t)); - if (!new_list) - return ENOMEM; - bb->list = new_list; - } - - j = bb->num; - for (i=0; i < bb->num; i++) { - if (bb->list[i] == blk) - return 0; - if (bb->list[i] > blk) { - j = i; - break; - } - } - for (i=bb->num; i > j; i--) - bb->list[i] = bb->list[i-1]; - bb->list[j] = blk; - bb->num++; - return 0; -} - -/* - * This procedure tests to see if a particular block is on a badblocks - * list. - */ -int ext2fs_badblocks_list_test(ext2_badblocks_list bb, blk_t blk) -{ - int low, high, mid; - - if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) - return 0; - - low = 0; - high = bb->num-1; - if (blk == bb->list[low]) - return 1; - if (blk == bb->list[high]) - return 1; - - while (low < high) { - mid = (low+high)/2; - if (mid == low || mid == high) - break; - if (blk == bb->list[mid]) - return 1; - if (blk < bb->list[mid]) - high = mid; - else - low = mid; - } - return 0; -} - -errcode_t ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb, - ext2_badblocks_iterate *ret) -{ - ext2_badblocks_iterate iter; - - EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST); - - iter = malloc(sizeof(struct ext2_struct_badblocks_iterate)); - if (!iter) - return ENOMEM; - - iter->magic = EXT2_ET_MAGIC_BADBLOCKS_ITERATE; - iter->bb = bb; - iter->ptr = 0; - *ret = iter; - return 0; -} - -int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, blk_t *blk) -{ - ext2_badblocks_list bb; - - if (iter->magic != EXT2_ET_MAGIC_BADBLOCKS_ITERATE) - return 0; - - bb = iter->bb; - - if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) - return 0; - - if (iter->ptr < bb->num) { - *blk = bb->list[iter->ptr++]; - return 1; - } - *blk = 0; - return 0; -} - -void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter) -{ - if (!iter || (iter->magic != EXT2_ET_MAGIC_BADBLOCKS_ITERATE)) - return; - - iter->bb = 0; - free(iter); -} - - - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bb_compat.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bb_compat.c deleted file mode 100644 index 38aeb8aab58..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bb_compat.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * bb_compat.c --- compatibility badblocks routines - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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 "ext2fsP.h" - -errcode_t badblocks_list_create(badblocks_list *ret, int size) -{ - return ext2fs_badblocks_list_create(ret, size); -} - -void badblocks_list_free(badblocks_list bb) -{ - ext2fs_badblocks_list_free(bb); -} - -errcode_t badblocks_list_add(badblocks_list bb, blk_t blk) -{ - return ext2fs_badblocks_list_add(bb, blk); -} - -int badblocks_list_test(badblocks_list bb, blk_t blk) -{ - return ext2fs_badblocks_list_test(bb, blk); -} - -errcode_t badblocks_list_iterate_begin(badblocks_list bb, - badblocks_iterate *ret) -{ - return ext2fs_badblocks_list_iterate_begin(bb, ret); -} - -int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk) -{ - return ext2fs_badblocks_list_iterate(iter, blk); -} - -void badblocks_list_iterate_end(badblocks_iterate iter) -{ - ext2fs_badblocks_list_iterate_end(iter); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bb_inode.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bb_inode.c deleted file mode 100644 index a5dd3a965a8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bb_inode.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * bb_inode.c --- routines to update the bad block inode. - * - * WARNING: This routine modifies a lot of state in the filesystem; if - * this routine returns an error, the bad block inode may be in an - * inconsistent state. - * - * Copyright (C) 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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" - -struct set_badblock_record { - ext2_badblocks_iterate bb_iter; - int bad_block_count; - blk_t *ind_blocks; - int max_ind_blocks; - int ind_blocks_size; - int ind_blocks_ptr; - char *block_buf; - errcode_t err; -}; - -static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt, - blk_t ref_block, int ref_offset, void *private); -static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt, - blk_t ref_block, int ref_offset, - void *private); - -/* - * Given a bad blocks bitmap, update the bad blocks inode to reflect - * the map. - */ -errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) -{ - errcode_t retval; - struct set_badblock_record rec; - struct ext2_inode inode; - blk_t blk; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!fs->block_map) - return EXT2_ET_NO_BLOCK_BITMAP; - - rec.bad_block_count = 0; - rec.ind_blocks_size = rec.ind_blocks_ptr = 0; - rec.max_ind_blocks = 10; - rec.ind_blocks = malloc(rec.max_ind_blocks * sizeof(blk_t)); - if (!rec.ind_blocks) - return ENOMEM; - memset(rec.ind_blocks, 0, rec.max_ind_blocks * sizeof(blk_t)); - rec.block_buf = malloc(fs->blocksize); - if (!rec.block_buf) { - retval = ENOMEM; - goto cleanup; - } - memset(rec.block_buf, 0, fs->blocksize); - rec.err = 0; - - /* - * First clear the old bad blocks (while saving the indirect blocks) - */ - retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, - BLOCK_FLAG_DEPTH_TRAVERSE, 0, - clear_bad_block_proc, &rec); - if (retval) - goto cleanup; - if (rec.err) { - retval = rec.err; - goto cleanup; - } - - /* - * Now set the bad blocks! - * - * First, mark the bad blocks as used. This prevents a bad - * block from being used as an indirecto block for the bad - * block inode (!). - */ - if (bb_list) { - retval = ext2fs_badblocks_list_iterate_begin(bb_list, - &rec.bb_iter); - if (retval) - goto cleanup; - while (ext2fs_badblocks_list_iterate(rec.bb_iter, &blk)) { - ext2fs_mark_block_bitmap(fs->block_map, blk); - } - ext2fs_badblocks_list_iterate_end(rec.bb_iter); - ext2fs_mark_bb_dirty(fs); - - retval = ext2fs_badblocks_list_iterate_begin(bb_list, - &rec.bb_iter); - if (retval) - goto cleanup; - retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, - BLOCK_FLAG_APPEND, 0, - set_bad_block_proc, &rec); - ext2fs_badblocks_list_iterate_end(rec.bb_iter); - if (retval) - goto cleanup; - if (rec.err) { - retval = rec.err; - goto cleanup; - } - } - - /* - * Update the bad block inode's mod time and block count - * field. - */ - retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); - if (retval) - goto cleanup; - - inode.i_atime = inode.i_mtime = time(0); - if (!inode.i_ctime) - inode.i_ctime = time(0); - inode.i_blocks = rec.bad_block_count * (fs->blocksize / 512); - inode.i_size = rec.bad_block_count * fs->blocksize; - - retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); - if (retval) - goto cleanup; - -cleanup: - free(rec.ind_blocks); - free(rec.block_buf); - return retval; -} - -/* - * Helper function for update_bb_inode() - * - * Clear the bad blocks in the bad block inode, while saving the - * indirect blocks. - */ -static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt, - blk_t ref_block, int ref_offset, void *private) -{ - struct set_badblock_record *rec = (struct set_badblock_record *) - private; - int group; - - if (!*block_nr) - return 0; - - /* - * If the block number is outrageous, clear it and ignore it. - */ - if (*block_nr >= fs->super->s_blocks_count || - *block_nr < fs->super->s_first_data_block) { - *block_nr = 0; - return BLOCK_CHANGED; - } - - if (blockcnt < 0) { - if (rec->ind_blocks_size >= rec->max_ind_blocks) { - rec->max_ind_blocks += 10; - rec->ind_blocks = realloc(rec->ind_blocks, - rec->max_ind_blocks * - sizeof(blk_t)); - if (!rec->ind_blocks) { - rec->err = ENOMEM; - return BLOCK_ABORT; - } - } - rec->ind_blocks[rec->ind_blocks_size++] = *block_nr; - } - - /* - * Mark the block as unused, and update accounting information - */ - ext2fs_unmark_block_bitmap(fs->block_map, *block_nr); - ext2fs_mark_bb_dirty(fs); - group = ext2fs_group_of_blk(fs, *block_nr); - fs->group_desc[group].bg_free_blocks_count++; - fs->super->s_free_blocks_count++; - ext2fs_mark_super_dirty(fs); - - *block_nr = 0; - return BLOCK_CHANGED; -} - - -/* - * Helper function for update_bb_inode() - * - * Set the block list in the bad block inode, using the supplied bitmap. - */ -static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, - int blockcnt, blk_t ref_block, - int ref_offset, void *private) -{ - struct set_badblock_record *rec = (struct set_badblock_record *) - private; - errcode_t retval; - blk_t blk; - int group; - - if (blockcnt >= 0) { - /* - * Get the next bad block. - */ - if (!ext2fs_badblocks_list_iterate(rec->bb_iter, &blk)) - return BLOCK_ABORT; - rec->bad_block_count++; - } else { - /* - * An indirect block; fetch a block from the - * previously used indirect block list. The block - * most be not marked as used; if so, get another one. - * If we run out of reserved indirect blocks, allocate - * a new one. - */ - retry: - if (rec->ind_blocks_ptr < rec->ind_blocks_size) { - blk = rec->ind_blocks[rec->ind_blocks_ptr++]; - if (ext2fs_test_block_bitmap(fs->block_map, blk)) - goto retry; - } else { - retval = ext2fs_new_block(fs, 0, 0, &blk); - if (retval) { - rec->err = retval; - return BLOCK_ABORT; - } - } - retval = io_channel_write_blk(fs->io, blk, 1, rec->block_buf); - if (retval) { - rec->err = retval; - return BLOCK_ABORT; - } - ext2fs_mark_block_bitmap(fs->block_map, blk); - ext2fs_mark_bb_dirty(fs); - } - - /* - * Update block counts - */ - group = ext2fs_group_of_blk(fs, blk); - fs->group_desc[group].bg_free_blocks_count--; - fs->super->s_free_blocks_count--; - ext2fs_mark_super_dirty(fs); - - *block_nr = blk; - return BLOCK_CHANGED; -} - - - - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitmaps.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitmaps.c deleted file mode 100644 index c3a778d5db4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitmaps.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * bitmaps.c --- routines to read, write, and manipulate the inode and - * block bitmaps. - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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" - -static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end, - const char *descr, char *init_map, - ext2fs_generic_bitmap *ret) -{ - ext2fs_generic_bitmap bitmap; - int size; - - bitmap = malloc(sizeof(struct ext2fs_struct_generic_bitmap)); - if (!bitmap) - return ENOMEM; - - bitmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP; - bitmap->fs = NULL; - bitmap->start = start; - bitmap->end = end; - bitmap->real_end = real_end; - bitmap->base_error_code = EXT2_ET_BAD_GENERIC_MARK; - if (descr) { - bitmap->description = malloc(strlen(descr)+1); - if (!bitmap->description) { - free(bitmap); - return ENOMEM; - } - strcpy(bitmap->description, descr); - } else - bitmap->description = 0; - - size = ((bitmap->real_end - bitmap->start) / 8) + 1; - bitmap->bitmap = malloc(size); - if (!bitmap->bitmap) { - free(bitmap->description); - free(bitmap); - return ENOMEM; - } - - if (init_map) - memcpy(bitmap->bitmap, init_map, size); - else - memset(bitmap->bitmap, 0, size); - *ret = bitmap; - return 0; -} - -errcode_t ext2fs_allocate_generic_bitmap(__u32 start, - __u32 end, - __u32 real_end, - const char *descr, - ext2fs_generic_bitmap *ret) -{ - return make_bitmap(start, end, real_end, descr, 0, ret); -} - -errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, - ext2fs_generic_bitmap *dest) -{ - errcode_t retval; - ext2fs_generic_bitmap new; - - retval = make_bitmap(src->start, src->end, src->real_end, - src->description, src->bitmap, &new); - if (retval) - return retval; - new->magic = src->magic; - new->fs = src->fs; - new->base_error_code = src->base_error_code; - return 0; -} - - -errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, - const char *descr, - ext2fs_inode_bitmap *ret) -{ - ext2fs_inode_bitmap bitmap; - errcode_t retval; - __u32 start, end, real_end; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - fs->write_bitmaps = ext2fs_write_bitmaps; - - start = 1; - end = fs->super->s_inodes_count; - real_end = (EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count); - - retval = ext2fs_allocate_generic_bitmap(start, end, real_end, - descr, &bitmap); - if (retval) - return retval; - - bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; - bitmap->fs = fs; - bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; - - *ret = bitmap; - return 0; -} - -errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, - const char *descr, - ext2fs_block_bitmap *ret) -{ - ext2fs_block_bitmap bitmap; - errcode_t retval; - __u32 start, end, real_end; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - fs->write_bitmaps = ext2fs_write_bitmaps; - - start = fs->super->s_first_data_block; - end = fs->super->s_blocks_count-1; - real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) - * fs->group_desc_count)-1 + start; - - retval = ext2fs_allocate_generic_bitmap(start, end, real_end, - descr, &bitmap); - if (retval) - return retval; - - bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; - bitmap->fs = fs; - bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; - - *ret = bitmap; - return 0; -} - -errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, - ino_t end, ino_t *oend) -{ - EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); - - if (end > bitmap->real_end) - return EXT2_ET_FUDGE_INODE_BITMAP_END; - if (oend) - *oend = bitmap->end; - bitmap->end = end; - return 0; -} - -errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, - blk_t end, blk_t *oend) -{ - EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); - - if (end > bitmap->real_end) - return EXT2_ET_FUDGE_BLOCK_BITMAP_END; - if (oend) - *oend = bitmap->end; - bitmap->end = end; - return 0; -} - -void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap) -{ - if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP)) - return; - - memset(bitmap->bitmap, 0, - ((bitmap->real_end - bitmap->start) / 8) + 1); -} - -void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap) -{ - if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP)) - return; - - memset(bitmap->bitmap, 0, - ((bitmap->real_end - bitmap->start) / 8) + 1); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitops.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitops.c deleted file mode 100644 index 8ae0242785d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitops.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined - * routines. - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <sys/types.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -#ifndef _EXT2_HAVE_ASM_BITOPS_ - -/* - * 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. - * - * 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 ext2fs_set_bit(int nr,void * addr) -{ - int mask, retval; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; - *ADDR |= mask; - return retval; -} - -int ext2fs_clear_bit(int nr, void * addr) -{ - int mask, retval; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; - *ADDR &= ~mask; - return retval; -} - -int ext2fs_test_bit(int nr, const void * addr) -{ - int mask; - const unsigned char *ADDR = (const unsigned char *) addr; - - 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, - const char *description) -{ - if (description) - com_err(0, errcode, "#%u for %s", arg, description); - else - com_err(0, errcode, "#%u", arg); -} - -void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, - int code, unsigned long arg) -{ - if (bitmap->description) - com_err(0, bitmap->base_error_code+code, - "#%u for %s", arg, bitmap->description); - else - com_err(0, bitmap->base_error_code + code, "#%u", arg); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitops.h b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitops.h deleted file mode 100644 index a20d3955ad5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/bitops.h +++ /dev/null @@ -1,596 +0,0 @@ -/* - * bitops.h --- Bitmap frobbing code. The byte swapping routines are - * also included here. - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, - * Linus Torvalds. - */ - - -extern int ext2fs_set_bit(int nr,void * addr); -extern int ext2fs_clear_bit(int nr, void * addr); -extern int ext2fs_test_bit(int nr, const void * addr); -extern __u16 ext2fs_swab16(__u16 val); -extern __u32 ext2fs_swab32(__u32 val); - -/* - * EXT2FS bitmap manipulation routines. - */ - -/* Support for sending warning messages from the inline subroutines */ -extern const char *ext2fs_block_string; -extern const char *ext2fs_inode_string; -extern const char *ext2fs_mark_string; -extern const char *ext2fs_unmark_string; -extern const char *ext2fs_test_string; -extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, - const char *description); -extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, - int code, unsigned long arg); - -extern void ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern void ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, - blk_t block); -extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); - -extern void ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode); -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 ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap); -extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap); -extern ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap); - -extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num); -extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num); -extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num); -extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num); -extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num); -extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num); - -/* - * The inline routines themselves... - * - * If NO_INLINE_FUNCS is defined, then we won't try to do inline - * 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 -#else -#define _INLINE_ extern __inline__ -#endif - -#if (defined(__i386__) || defined(__i486__) || defined(__i586__)) - -#define _EXT2_HAVE_ASM_BITOPS_ - -/* - * These are done by inline assembly for speed reasons..... - * - * All bitoperations return 0 if the bit was cleared before the - * operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32 - * is the LSB of (addr+1). - */ - -/* - * Some hacks to defeat gcc over-optimizations.. - */ -struct __dummy_h { unsigned long a[100]; }; -#define EXT2FS_ADDR (*(struct __dummy_h *) addr) -#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr) - -_INLINE_ int ext2fs_set_bit(int nr, void * addr) -{ - int oldbit; - - __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"=m" (EXT2FS_ADDR) - :"r" (nr)); - return oldbit; -} - -_INLINE_ int ext2fs_clear_bit(int nr, void * addr) -{ - int oldbit; - - __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"=m" (EXT2FS_ADDR) - :"r" (nr)); - return oldbit; -} - -_INLINE_ int ext2fs_test_bit(int nr, const void * addr) -{ - int oldbit; - - __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit) - :"m" (EXT2FS_CONST_ADDR),"r" (nr)); - return oldbit; -} - -#undef EXT2FS_ADDR - -#endif /* i386 */ - -#ifdef __mc68000__ - -#define _EXT2_HAVE_ASM_BITOPS_ - -_INLINE_ int ext2fs_set_bit(int nr,void * addr) -{ - char retval; - - __asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0" - : "=d" (retval) : "d" (nr^7), "a" (addr)); - - return retval; -} - -_INLINE_ int ext2fs_clear_bit(int nr, void * addr) -{ - char retval; - - __asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0" - : "=d" (retval) : "d" (nr^7), "a" (addr)); - - return retval; -} - -_INLINE_ int ext2fs_test_bit(int nr, const void * addr) -{ - char retval; - - __asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0" - : "=d" (retval) : "d" (nr^7), "a" (addr)); - - return retval; -} - -#endif /* __mc68000__ */ - -#ifdef __sparc__ - -#define _EXT2_HAVE_ASM_BITOPS_ - -#ifndef EXT2_OLD_BITOPS - -/* - * Do the bitops so that we are compatible with the standard i386 - * convention. - */ - -_INLINE_ int ext2fs_set_bit(int nr,void * addr) -{ -#if 1 - int mask; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - __asm__ __volatile__("ldub [%0], %%g6\n\t" - "or %%g6, %2, %%g5\n\t" - "stb %%g5, [%0]\n\t" - "and %%g6, %2, %0\n" - : "=&r" (ADDR) - : "0" (ADDR), "r" (mask) - : "g5", "g6"); - return (int) ADDR; -#else - int mask, retval; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; - *ADDR |= mask; - return retval; -#endif -} - -_INLINE_ int ext2fs_clear_bit(int nr, void * addr) -{ -#if 1 - int mask; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - __asm__ __volatile__("ldub [%0], %%g6\n\t" - "andn %%g6, %2, %%g5\n\t" - "stb %%g5, [%0]\n\t" - "and %%g6, %2, %0\n" - : "=&r" (ADDR) - : "0" (ADDR), "r" (mask) - : "g5", "g6"); - return (int) ADDR; - -#else - int mask, retval; - unsigned char *ADDR = (unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - retval = (mask & *ADDR) != 0; - *ADDR &= ~mask; - return retval; -#endif -} - -_INLINE_ int ext2fs_test_bit(int nr, const void * addr) -{ - int mask; - const unsigned char *ADDR = (const unsigned char *) addr; - - ADDR += nr >> 3; - mask = 1 << (nr & 0x07); - return ((mask & *ADDR) != 0); -} - -#else - -/* Do things the old, unplesant way. */ - -_INLINE_ int ext2fs_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 ext2fs_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 ext2fs_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 - -#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_generic_bitmap(ext2fs_generic_bitmap bitmap, - __u32 bitno); -_INLINE_ void ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, - blk_t bitno); -_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, - blk_t bitno); - -_INLINE_ void ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, - __u32 bitno) -{ - if ((bitno < bitmap->start) || (bitno > bitmap->end)) { - ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno); - return; - } - ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap); -} - -_INLINE_ void ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, - blk_t bitno) -{ - if ((bitno < bitmap->start) || (bitno > bitmap->end)) { - ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno); - return; - } - ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap); -} - -_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, - blk_t bitno) -{ - if ((bitno < bitmap->start) || (bitno > bitmap->end)) { - ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, bitno); - return 0; - } - return ext2fs_test_bit(bitno - bitmap->start, bitmap->bitmap); -} - -_INLINE_ void ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, - blk_t block) -{ - ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); -} - -_INLINE_ void ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, - blk_t block) -{ - ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); -} - -_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, - blk_t block) -{ - return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, - block); -} - -_INLINE_ void ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, - ino_t inode) -{ - ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); -} - -_INLINE_ void ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, - ino_t inode) -{ - ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); -} - -_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, - ino_t inode) -{ - return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, - inode); -} - -_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 - ext2fs_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 - ext2fs_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 ext2fs_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 - ext2fs_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 - ext2fs_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 ext2fs_test_bit(inode - bitmap->start, bitmap->bitmap); -} - -_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap) -{ - return bitmap->start; -} - -_INLINE_ ino_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_ ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap) -{ - return bitmap->end; -} - -_INLINE_ int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num) -{ - int i; - - if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { - ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST, - block, bitmap->description); - return 0; - } - for (i=0; i < num; i++) { - if (ext2fs_fast_test_block_bitmap(bitmap, block+i)) - return 0; - } - return 1; -} - -_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num) -{ - int i; - -#ifdef EXT2FS_DEBUG_FAST_OPS - if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { - ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST, - block, bitmap->description); - return 0; - } -#endif - for (i=0; i < num; i++) { - if (ext2fs_fast_test_block_bitmap(bitmap, block+i)) - return 0; - } - return 1; -} - -_INLINE_ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num) -{ - int i; - - if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { - ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, - bitmap->description); - return; - } - for (i=0; i < num; i++) - ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); -} - -_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num) -{ - int i; - -#ifdef EXT2FS_DEBUG_FAST_OPS - if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { - ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, - bitmap->description); - return; - } -#endif - for (i=0; i < num; i++) - ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); -} - -_INLINE_ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num) -{ - int i; - - if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { - ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, - bitmap->description); - return; - } - for (i=0; i < num; i++) - ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); -} - -_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, - blk_t block, int num) -{ - int i; - -#ifdef EXT2FS_DEBUG_FAST_OPS - if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { - ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, - bitmap->description); - return; - } -#endif - for (i=0; i < num; i++) - ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); -} - -#undef _INLINE_ -#endif - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/block.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/block.c deleted file mode 100644 index 03bf5f3609f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/block.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * block.c --- iterate over all blocks in an inode - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct block_context { - ext2_filsys fs; - int (*func)(ext2_filsys fs, - blk_t *blocknr, - int bcount, - blk_t ref_blk, - int ref_offset, - void *private); - int bcount; - int bsize; - int flags; - errcode_t errcode; - char *ind_buf; - char *dind_buf; - char *tind_buf; - void *private; -}; - -static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, - int ref_offset, struct block_context *ctx) -{ - int ret = 0, changed = 0; - int i, flags, limit, offset; - blk_t *block_nr; - - limit = ctx->fs->blocksize >> 2; - if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) && - !(ctx->flags & BLOCK_FLAG_DATA_ONLY)) - ret = (*ctx->func)(ctx->fs, ind_block, - BLOCK_COUNT_IND, ref_block, - ref_offset, ctx->private); - if (!*ind_block || (ret & BLOCK_ABORT)) { - ctx->bcount += limit; - return ret; - } - if (*ind_block >= ctx->fs->super->s_blocks_count || - *ind_block < ctx->fs->super->s_first_data_block) { - ctx->errcode = EXT2_ET_BAD_IND_BLOCK; - ret |= BLOCK_ERROR; - return ret; - } - ctx->errcode = io_channel_read_blk(ctx->fs->io, *ind_block, - 1, ctx->ind_buf); - if (ctx->errcode) { - ret |= BLOCK_ERROR; - return ret; - } - if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) { - 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; - offset = 0; - 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, - *ind_block, offset, - ctx->private); - changed |= flags; - if (flags & BLOCK_ABORT) { - ret |= BLOCK_ABORT; - break; - } - offset += sizeof(blk_t); - } - } 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, - *ind_block, offset, - ctx->private); - changed |= flags; - if (flags & BLOCK_ABORT) { - ret |= BLOCK_ABORT; - break; - } - offset += sizeof(blk_t); - } - } - if (changed & BLOCK_CHANGED) { - if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) { - 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) - ret |= BLOCK_ERROR | BLOCK_ABORT; - } - if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) && - !(ctx->flags & BLOCK_FLAG_DATA_ONLY) && - !(ret & BLOCK_ABORT)) - ret |= (*ctx->func)(ctx->fs, ind_block, - BLOCK_COUNT_IND, ref_block, - ref_offset, ctx->private); - return ret; -} - -static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, - int ref_offset, struct block_context *ctx) -{ - int ret = 0, changed = 0; - int i, flags, limit, offset; - blk_t *block_nr; - - limit = ctx->fs->blocksize >> 2; - if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) && - !(ctx->flags & BLOCK_FLAG_DATA_ONLY)) - ret = (*ctx->func)(ctx->fs, dind_block, - BLOCK_COUNT_DIND, ref_block, - ref_offset, ctx->private); - if (!*dind_block || (ret & BLOCK_ABORT)) { - ctx->bcount += limit*limit; - return ret; - } - if (*dind_block >= ctx->fs->super->s_blocks_count || - *dind_block < ctx->fs->super->s_first_data_block) { - ctx->errcode = EXT2_ET_BAD_DIND_BLOCK; - ret |= BLOCK_ERROR; - return ret; - } - ctx->errcode = io_channel_read_blk(ctx->fs->io, *dind_block, - 1, ctx->dind_buf); - if (ctx->errcode) { - ret |= BLOCK_ERROR; - return ret; - } - if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) { - 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; - offset = 0; - if (ctx->flags & BLOCK_FLAG_APPEND) { - for (i = 0; i < limit; i++, block_nr++) { - flags = block_iterate_ind(block_nr, - *dind_block, offset, - ctx); - changed |= flags; - if (flags & (BLOCK_ABORT | BLOCK_ERROR)) { - ret |= flags & (BLOCK_ABORT | BLOCK_ERROR); - break; - } - offset += sizeof(blk_t); - } - } else { - for (i = 0; i < limit; i++, block_nr++) { - if (*block_nr == 0) { - ctx->bcount += limit; - continue; - } - flags = block_iterate_ind(block_nr, - *dind_block, offset, - ctx); - changed |= flags; - if (flags & (BLOCK_ABORT | BLOCK_ERROR)) { - ret |= flags & (BLOCK_ABORT | BLOCK_ERROR); - break; - } - offset += sizeof(blk_t); - } - } - if (changed & BLOCK_CHANGED) { - if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) { - 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) - ret |= BLOCK_ERROR | BLOCK_ABORT; - } - if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) && - !(ctx->flags & BLOCK_FLAG_DATA_ONLY) && - !(ret & BLOCK_ABORT)) - ret |= (*ctx->func)(ctx->fs, dind_block, - BLOCK_COUNT_DIND, ref_block, - ref_offset, ctx->private); - return ret; -} - -static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, - int ref_offset, struct block_context *ctx) -{ - int ret = 0, changed = 0; - int i, flags, limit, offset; - blk_t *block_nr; - - limit = ctx->fs->blocksize >> 2; - if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) && - !(ctx->flags & BLOCK_FLAG_DATA_ONLY)) - ret = (*ctx->func)(ctx->fs, tind_block, - BLOCK_COUNT_TIND, ref_block, - ref_offset, ctx->private); - if (!*tind_block || (ret & BLOCK_ABORT)) { - ctx->bcount += limit*limit*limit; - return ret; - } - if (*tind_block >= ctx->fs->super->s_blocks_count || - *tind_block < ctx->fs->super->s_first_data_block) { - ctx->errcode = EXT2_ET_BAD_TIND_BLOCK; - ret |= BLOCK_ERROR; - return ret; - } - ctx->errcode = io_channel_read_blk(ctx->fs->io, *tind_block, - 1, ctx->tind_buf); - if (ctx->errcode) { - ret |= BLOCK_ERROR; - return ret; - } - if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) { - 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; - offset = 0; - if (ctx->flags & BLOCK_FLAG_APPEND) { - for (i = 0; i < limit; i++, block_nr++) { - flags = block_iterate_dind(block_nr, - *tind_block, - offset, ctx); - changed |= flags; - if (flags & (BLOCK_ABORT | BLOCK_ERROR)) { - ret |= flags & (BLOCK_ABORT | BLOCK_ERROR); - break; - } - offset += sizeof(blk_t); - } - } else { - for (i = 0; i < limit; i++, block_nr++) { - if (*block_nr == 0) { - ctx->bcount += limit*limit; - continue; - } - flags = block_iterate_dind(block_nr, - *tind_block, - offset, ctx); - changed |= flags; - if (flags & (BLOCK_ABORT | BLOCK_ERROR)) { - ret |= flags & (BLOCK_ABORT | BLOCK_ERROR); - break; - } - offset += sizeof(blk_t); - } - } - if (changed & BLOCK_CHANGED) { - if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) { - 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) - ret |= BLOCK_ERROR | BLOCK_ABORT; - } - if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) && - !(ctx->flags & BLOCK_FLAG_DATA_ONLY) && - !(ret & BLOCK_ABORT)) - ret |= (*ctx->func)(ctx->fs, tind_block, - BLOCK_COUNT_TIND, ref_block, - ref_offset, ctx->private); - - return ret; -} - -errcode_t ext2fs_block_iterate2(ext2_filsys fs, - ino_t ino, - int flags, - char *block_buf, - int (*func)(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - blk_t ref_blk, - int ref_offset, - void *private), - void *private) -{ - int i; - int got_inode = 0; - int ret = 0; - blk_t blocks[EXT2_N_BLOCKS]; /* directory data blocks */ - struct ext2_inode inode; - errcode_t retval; - struct block_context ctx; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - ret = ext2fs_get_blocks(fs, ino, blocks); - if (ret) - return ret; - - ctx.fs = fs; - ctx.func = func; - ctx.private = private; - ctx.flags = flags; - ctx.bcount = 0; - if (block_buf) { - ctx.ind_buf = block_buf; - } else { - ctx.ind_buf = malloc(fs->blocksize * 3); - if (!ctx.ind_buf) - return ENOMEM; - } - ctx.dind_buf = ctx.ind_buf + fs->blocksize; - ctx.tind_buf = ctx.dind_buf + fs->blocksize; - - /* - * Iterate over the HURD translator block (if present) - */ - if ((fs->super->s_creator_os == EXT2_OS_HURD) && - !(flags & BLOCK_FLAG_DATA_ONLY)) { - ctx.errcode = ext2fs_read_inode(fs, ino, &inode); - if (ctx.errcode) - goto abort; - got_inode = 1; - if (inode.osd1.hurd1.h_i_translator) { - ret |= (*ctx.func)(fs, - &inode.osd1.hurd1.h_i_translator, - BLOCK_COUNT_TRANSLATOR, - 0, 0, private); - if (ret & BLOCK_ABORT) - goto abort; - } - } - - /* - * Iterate over normal data blocks - */ - for (i = 0; i < EXT2_NDIR_BLOCKS ; i++, ctx.bcount++) { - if (blocks[i] || (flags & BLOCK_FLAG_APPEND)) { - ret |= (*ctx.func)(fs, &blocks[i], - ctx.bcount, 0, 0, private); - if (ret & BLOCK_ABORT) - goto abort; - } - } - if (*(blocks + EXT2_IND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) { - ret |= block_iterate_ind(blocks + EXT2_IND_BLOCK, - 0, 0, &ctx); - if (ret & BLOCK_ABORT) - goto abort; - } - if (*(blocks + EXT2_DIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) { - ret |= block_iterate_dind(blocks + EXT2_DIND_BLOCK, - 0, 0, &ctx); - if (ret & BLOCK_ABORT) - goto abort; - } - if (*(blocks + EXT2_TIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) { - ret |= block_iterate_tind(blocks + EXT2_TIND_BLOCK, - 0, 0, &ctx); - if (ret & BLOCK_ABORT) - goto abort; - } - -abort: - if (ret & BLOCK_CHANGED) { - if (!got_inode) { - retval = ext2fs_read_inode(fs, ino, &inode); - if (retval) - return retval; - } - for (i=0; i < EXT2_N_BLOCKS; i++) - inode.i_block[i] = blocks[i]; - retval = ext2fs_write_inode(fs, ino, &inode); - if (retval) - return retval; - } - - if (!block_buf) - free(ctx.ind_buf); - - return (ret & BLOCK_ERROR) ? ctx.errcode : 0; -} - -struct xlate { - int (*func)(ext2_filsys fs, - blk_t *blocknr, - int bcount, - void *private); - void *real_private; -}; - -static int xlate_func(ext2_filsys fs, blk_t *blocknr, int blockcnt, - blk_t ref_block, int ref_offset, void *private) -{ - struct xlate *xl = private; - - return (*xl->func)(fs, blocknr, blockcnt, xl->real_private); -} - -errcode_t ext2fs_block_iterate(ext2_filsys fs, - ino_t ino, - int flags, - char *block_buf, - int (*func)(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private), - void *private) -{ - struct xlate xl; - - xl.real_private = private; - xl.func = func; - - return ext2fs_block_iterate2(fs, ino, flags, block_buf, - xlate_func, &xl); -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/brel.h b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/brel.h deleted file mode 100644 index f31b7ae2646..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/brel.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * brel.h - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -struct ext2_block_relocate_entry { - blk_t new; - __s16 offset; - __u16 flags; - union { - blk_t block_ref; - ino_t inode_ref; - } owner; -}; - -#define RELOCATE_INODE_REF 0x0001 - -typedef struct ext2_block_relocation_table *ext2_brel; - -struct ext2_block_relocation_table { - __u32 magic; - char *name; - blk_t current; - void *private; - - /* - * Add a block relocation entry. - */ - errcode_t (*put)(ext2_brel brel, blk_t old, - struct ext2_block_relocate_entry *ent); - - /* - * Get a block relocation entry. - */ - errcode_t (*get)(ext2_brel brel, blk_t old, - struct ext2_block_relocate_entry *ent); - - /* - * Initialize for iterating over the block relocation entries. - */ - errcode_t (*start_iter)(ext2_brel brel); - - /* - * The iterator function for the inode relocation entries. - * Returns an inode number of 0 when out of entries. - */ - errcode_t (*next)(ext2_brel brel, blk_t *old, - struct ext2_block_relocate_entry *ent); - - /* - * Move the inode relocation table from one block number to - * another. - */ - errcode_t (*move)(ext2_brel brel, blk_t old, blk_t new); - - /* - * Remove a block relocation entry. - */ - errcode_t (*delete)(ext2_brel brel, blk_t old); - - - /* - * Free the block relocation table. - */ - errcode_t (*free)(ext2_brel brel); -}; - -errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, - ext2_brel *brel); - -#define ext2fs_brel_put(brel, old, ent) ((brel)->put((brel), old, ent)) -#define ext2fs_brel_get(brel, old, ent) ((brel)->get((brel), old, ent)) -#define ext2fs_brel_start_iter(brel) ((brel)->start_iter((brel))) -#define ext2fs_brel_next(brel, old, ent) ((brel)->next((brel), old, ent)) -#define ext2fs_brel_move(brel, old, new) ((brel)->move((brel), old, new)) -#define ext2fs_brel_delete(brel, old) ((brel)->delete((brel), old)) -#define ext2fs_brel_free(brel) ((brel)->free((brel))) - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/brel_ma.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/brel_ma.c deleted file mode 100644 index a4258a70169..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/brel_ma.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * brel_ma.c - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" -#include "brel.h" - -static errcode_t bma_put(ext2_brel brel, blk_t old, - struct ext2_block_relocate_entry *ent); -static errcode_t bma_get(ext2_brel brel, blk_t old, - struct ext2_block_relocate_entry *ent); -static errcode_t bma_start_iter(ext2_brel brel); -static errcode_t bma_next(ext2_brel brel, blk_t *old, - struct ext2_block_relocate_entry *ent); -static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new); -static errcode_t bma_delete(ext2_brel brel, blk_t old); -static errcode_t bma_free(ext2_brel brel); - -struct brel_ma { - __u32 magic; - blk_t max_block; - struct ext2_block_relocate_entry *entries; -}; - -errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, - ext2_brel *new_brel) -{ - ext2_brel brel = 0; - errcode_t retval; - struct brel_ma *ma = 0; - size_t size; - - *new_brel = 0; - - /* - * Allocate memory structures - */ - retval = ENOMEM; - brel = malloc(sizeof(struct ext2_block_relocation_table)); - if (!brel) - goto errout; - memset(brel, 0, sizeof(struct ext2_block_relocation_table)); - - brel->name = malloc(strlen(name)+1); - if (!brel->name) - goto errout; - strcpy(brel->name, name); - - ma = malloc(sizeof(struct brel_ma)); - if (!ma) - goto errout; - memset(ma, 0, sizeof(struct brel_ma)); - brel->private = ma; - - size = sizeof(struct ext2_block_relocate_entry) * (max_block+1); - ma->entries = malloc(size); - if (!ma->entries) - goto errout; - memset(ma->entries, 0, size); - ma->max_block = max_block; - - /* - * Fill in the brel data structure - */ - brel->put = bma_put; - brel->get = bma_get; - brel->start_iter = bma_start_iter; - brel->next = bma_next; - brel->move = bma_move; - brel->delete = bma_delete; - brel->free = bma_free; - - *new_brel = brel; - return 0; - -errout: - bma_free(brel); - return retval; -} - -static errcode_t bma_put(ext2_brel brel, blk_t old, - struct ext2_block_relocate_entry *ent) -{ - struct brel_ma *ma; - - ma = brel->private; - if (old > ma->max_block) - return EINVAL; - ma->entries[old] = *ent; - return 0; -} - -static errcode_t bma_get(ext2_brel brel, blk_t old, - struct ext2_block_relocate_entry *ent) -{ - struct brel_ma *ma; - - ma = brel->private; - if (old > ma->max_block) - return EINVAL; - if (ma->entries[old].new == 0) - return ENOENT; - *ent = ma->entries[old]; - return 0; -} - -static errcode_t bma_start_iter(ext2_brel brel) -{ - brel->current = 0; - return 0; -} - -static errcode_t bma_next(ext2_brel brel, blk_t *old, - struct ext2_block_relocate_entry *ent) -{ - struct brel_ma *ma; - - ma = brel->private; - while (++brel->current < ma->max_block) { - if (ma->entries[brel->current].new == 0) - continue; - *old = brel->current; - *ent = ma->entries[brel->current]; - return 0; - } - *old = 0; - return 0; -} - -static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) -{ - struct brel_ma *ma; - - ma = brel->private; - if ((old > ma->max_block) || (new > ma->max_block)) - return EINVAL; - if (ma->entries[old].new == 0) - return ENOENT; - ma->entries[new] = ma->entries[old]; - ma->entries[old].new = 0; - return 0; -} - -static errcode_t bma_delete(ext2_brel brel, blk_t old) -{ - struct brel_ma *ma; - - ma = brel->private; - if (old > ma->max_block) - return EINVAL; - if (ma->entries[old].new == 0) - return ENOENT; - ma->entries[old].new = 0; - return 0; -} - -static errcode_t bma_free(ext2_brel brel) -{ - struct brel_ma *ma; - - if (!brel) - return 0; - - ma = brel->private; - - if (ma) { - if (ma->entries) - free (ma->entries); - free(ma); - } - if (brel->name) - free(brel->name); - free (brel); - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/check_desc.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/check_desc.c deleted file mode 100644 index 74b3e2d4068..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/check_desc.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * check_desc.c --- Check the group descriptors of an ext2 filesystem - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -/* - * This routine sanity checks the group descriptors - */ -errcode_t ext2fs_check_desc(ext2_filsys fs) -{ - int i; - int block = fs->super->s_first_data_block; - int next; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - for (i = 0; i < fs->group_desc_count; i++) { - next = block + fs->super->s_blocks_per_group; - /* - * Check to make sure block bitmap for group is - * located within the group. - */ - if (fs->group_desc[i].bg_block_bitmap < block || - fs->group_desc[i].bg_block_bitmap >= next) - return EXT2_ET_GDESC_BAD_BLOCK_MAP; - /* - * Check to make sure inode bitmap for group is - * located within the group - */ - if (fs->group_desc[i].bg_inode_bitmap < block || - fs->group_desc[i].bg_inode_bitmap >= next) - return EXT2_ET_GDESC_BAD_INODE_MAP; - /* - * Check to make sure inode table for group is located - * within the group - */ - if (fs->group_desc[i].bg_inode_table < block || - ((fs->group_desc[i].bg_inode_table + - fs->inode_blocks_per_group) >= next)) - return EXT2_ET_GDESC_BAD_INODE_TABLE; - - block = next; - } - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/closefs.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/closefs.c deleted file mode 100644 index 4678d9ee4a7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/closefs.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * closefs.c --- close an ext2 filesystem - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#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> - -#include "ext2fsP.h" - -static int test_root(int a, int b) -{ - if (a == 0) - return 1; - while (1) { - if (a == 1) - return 1; - if (a % b) - return 0; - a = a / b; - } -} - -int ext2fs_bg_has_super(ext2_filsys fs, int group_block) -{ -#ifdef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER - struct ext2fs_sb *s; - - s = (struct ext2fs_sb *) fs->super; - if (!(s->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) - return 1; - - if (test_root(group_block, 3) || (test_root(group_block, 5)) || - test_root(group_block, 7)) - return 1; - - return 0; -#else - return 1; -#endif -} - -errcode_t ext2fs_flush(ext2_filsys fs) -{ - int i,j,maxgroup; - int group_block; - 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_FLAG_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). - */ - io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET); - retval = io_channel_write_blk(fs->io, 1, -SUPERBLOCK_SIZE, - super_shadow); - if (retval) - goto errout; - io_channel_set_blksize(fs->io, fs->blocksize); - - /* - * 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->super->s_state &= ~EXT2_VALID_FS; - if (fs->flags & EXT2_FLAG_SWAP_BYTES) { - *super_shadow = *fs->super; - ext2fs_swap_super(super_shadow); - } - - /* - * Write out the master group descriptors, and the backup - * superblocks and group descriptors. - */ - group_block = fs->super->s_first_data_block; - maxgroup = (fs->flags & EXT2_FLAG_MASTER_SB_ONLY) ? 1 : - fs->group_desc_count; - for (i = 0; i < maxgroup; i++) { - if (!ext2fs_bg_has_super(fs, i)) - goto next_group; - - if (i !=0 ) { - retval = io_channel_write_blk(fs->io, group_block, - -SUPERBLOCK_SIZE, - super_shadow); - if (retval) - goto errout; - } - 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) - goto errout; - group_ptr += fs->blocksize; - } - next_group: - group_block += EXT2_BLOCKS_PER_GROUP(fs->super); - } - - /* - * If the write_bitmaps() function is present, call it to - * flush the bitmaps. This is done this way so that a simple - * program that doesn't mess with the bitmaps doesn't need to - * drag in the bitmaps.c code. - */ - if (fs->write_bitmaps) { - retval = fs->write_bitmaps(fs); - if (retval) - goto errout; - } - retval = 0; -errout: - fs->super->s_state = fs_state; - if (fs->flags & EXT2_FLAG_SWAP_BYTES) { - if (super_shadow) - free(super_shadow); - if (group_shadow) - free(group_shadow); - } - return retval; -} - -errcode_t ext2fs_close(ext2_filsys fs) -{ - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (fs->flags & EXT2_FLAG_DIRTY) { - retval = ext2fs_flush(fs); - if (retval) - return retval; - } - if (fs->write_bitmaps) { - retval = fs->write_bitmaps(fs); - if (retval) - return retval; - } - ext2fs_free(fs); - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/cmp_bitmaps.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/cmp_bitmaps.c deleted file mode 100644 index 3d04a97e12a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/cmp_bitmaps.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * cmp_bitmaps.c --- routines to compare inode and block bitmaps. - * - * Copyright (C) 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dblist.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dblist.c deleted file mode 100644 index f990c10df46..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dblist.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * dblist.c -- directory block list functions - * - * Copyright 1997 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fsP.h" - -static int dir_block_cmp(const void *a, const void *b); - -/* - * Returns the number of directories in the filesystem as reported by - * the group descriptors. Of course, the group descriptors could be - * wrong! - */ -errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs) -{ - int i; - ino_t num_dirs; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - num_dirs = 0; - for (i = 0; i < fs->group_desc_count; i++) - num_dirs += fs->group_desc[i].bg_used_dirs_count; - - *ret_num_dirs = num_dirs; - - return 0; -} - -/* - * helper function for making a new directory block list (for - * initialize and copy). - */ -static errcode_t make_dblist(ext2_filsys fs, ino_t size, ino_t count, - struct ext2_db_entry *list, - ext2_dblist *ret_dblist) -{ - ext2_dblist dblist; - errcode_t retval; - size_t len; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if ((ret_dblist == 0) && fs->dblist && - (fs->dblist->magic == EXT2_ET_MAGIC_DBLIST)) - return 0; - - dblist = malloc(sizeof(struct ext2_struct_dblist)); - if (!dblist) - return ENOMEM; - memset(dblist, 0, sizeof(struct ext2_struct_dblist)); - - dblist->magic = EXT2_ET_MAGIC_DBLIST; - dblist->fs = fs; - if (size) - dblist->size = size; - else { - retval = ext2fs_get_num_dirs(fs, &dblist->size); - if (retval) - goto cleanup; - } - len = sizeof(struct ext2_db_entry) * dblist->size; - dblist->count = count; - dblist->list = malloc(len); - if (dblist->list == NULL) { - retval = ENOMEM; - goto cleanup; - } - if (list) - memcpy(dblist->list, list, len); - else - memset(dblist->list, 0, len); - *ret_dblist = dblist; - return 0; -cleanup: - if (dblist) - free(dblist); - return retval; -} - -/* - * Initialize a directory block list - */ -errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist) -{ - ext2_dblist dblist; - errcode_t retval; - - retval = make_dblist(fs, 0, 0, 0, &dblist); - if (retval) - return retval; - - dblist->sorted = 1; - if (ret_dblist) - *ret_dblist = dblist; - else - fs->dblist = dblist; - - return 0; -} - -/* - * Copy a directory block list - */ -errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest) -{ - ext2_dblist dblist; - errcode_t retval; - - retval = make_dblist(src->fs, src->size, src->count, src->list, - &dblist); - if (retval) - return retval; - dblist->sorted = src->sorted; - *dest = dblist; - return 0; -} - -/* - * Close a directory block list - * - * (moved to closefs.c) - */ - - -/* - * Add a directory block to the directory block list - */ -errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk, - int blockcnt) -{ - struct ext2_db_entry *nlist, *new; - - EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); - - if (dblist->count >= dblist->size) { - dblist->size += 100; - nlist = realloc(dblist->list, - dblist->size * sizeof(struct ext2_db_entry)); - if (nlist == 0) { - dblist->size -= 100; - return ENOMEM; - } - dblist->list = nlist; - } - new = dblist->list + dblist->count++; - new->blk = blk; - new->ino = ino; - new->blockcnt = blockcnt; - - dblist->sorted = 0; - - return 0; -} - -/* - * Change the directory block to the directory block list - */ -errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk, - int blockcnt) -{ - struct ext2_db_entry *ent; - int i; - - EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); - - for (i=0; i < dblist->count; i++) { - if ((dblist->list[i].ino != ino) || - (dblist->list[i].blockcnt != blockcnt)) - continue; - dblist->list[i].blk = blk; - dblist->sorted = 0; - return 0; - } - return ENOENT; -} - -/* - * This function iterates over the directory block list - */ -errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, - int (*func)(ext2_filsys fs, - struct ext2_db_entry *db_info, - void *private), - void *private) -{ - ino_t i; - int ret; - - EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); - - if (!dblist->sorted) { - qsort(dblist->list, dblist->count, - sizeof(struct ext2_db_entry), dir_block_cmp); - dblist->sorted = 1; - } - for (i=0; i < dblist->count; i++) { - ret = (*func)(dblist->fs, &dblist->list[i], private); - if (ret & DBLIST_ABORT) - return 0; - } - return 0; -} - - -static int dir_block_cmp(const void *a, const void *b) -{ - const struct ext2_db_entry *db_a = - (const struct ext2_db_entry *) a; - const struct ext2_db_entry *db_b = - (const struct ext2_db_entry *) b; - - 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); -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dblist_dir.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dblist_dir.c deleted file mode 100644 index 10c7b58a0a6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dblist_dir.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * dblist_dir.c --- iterate by directory entry - * - * Copyright 1997 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fsP.h" - -static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, - void *private); - -extern errcode_t - ext2fs_dblist_dir_iterate(ext2_dblist dblist, - int flags, - char *block_buf, - int (*func)(ino_t dir, - int entry, - struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private), - void *private) -{ - errcode_t retval; - struct dir_context ctx; - - EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); - - ctx.dir = 0; - ctx.flags = flags; - if (block_buf) - ctx.buf = block_buf; - else { - ctx.buf = malloc(dblist->fs->blocksize); - if (!ctx.buf) - return ENOMEM; - } - ctx.func = 0; - ctx.func2 = func; - ctx.private = private; - ctx.errcode = 0; - - retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); - - if (!block_buf) - free(ctx.buf); - if (retval) - return retval; - return ctx.errcode; -} - -static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, - void *private) -{ - struct dir_context *ctx = private; - - ctx->dir = db_info->ino; - - return ext2fs_process_dir_block(fs, &db_info->blk, - db_info->blockcnt, private); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dir_iterate.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dir_iterate.c deleted file mode 100644 index 91f8ca67ad6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dir_iterate.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * dir_iterate.c --- ext2fs directory iteration operations - * - * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fsP.h" - -errcode_t ext2fs_dir_iterate(ext2_filsys fs, - ino_t dir, - int flags, - char *block_buf, - int (*func)(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private), - void *private) -{ - struct dir_context ctx; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - retval = ext2fs_check_directory(fs, dir); - if (retval) - return retval; - - ctx.dir = dir; - ctx.flags = flags; - if (block_buf) - ctx.buf = block_buf; - else { - ctx.buf = malloc(fs->blocksize); - if (!ctx.buf) - return ENOMEM; - } - ctx.func = func; - ctx.func2 = 0; - ctx.private = private; - ctx.errcode = 0; - retval = ext2fs_block_iterate(fs, dir, 0, 0, - ext2fs_process_dir_block, &ctx); - if (!block_buf) - free(ctx.buf); - if (retval) - return retval; - return ctx.errcode; -} - -/* - * Helper function which is private to this module. Used by - * ext2fs_dir_iterate() and ext2fs_dblist_dir_iterate() - */ -extern int ext2fs_process_dir_block(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private) -{ - struct dir_context *ctx = (struct dir_context *) private; - int offset = 0; - int ret = 0; - int changed = 0; - int do_abort = 0; - int entry; - struct ext2_dir_entry *dirent; - - if (blockcnt < 0) - return 0; - - ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); - if (ctx->errcode) - return BLOCK_ABORT; - - entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; - - while (offset < fs->blocksize) { - dirent = (struct ext2_dir_entry *) (ctx->buf + offset); - if (!dirent->inode && - !(ctx->flags & DIRENT_FLAG_INCLUDE_EMPTY)) - goto next; - - if (ctx->func) - ret = (ctx->func)(dirent, offset, fs->blocksize, - ctx->buf, ctx->private); - else if (ctx->func2) { - ret = (ctx->func2)(ctx->dir, entry, dirent, offset, - fs->blocksize, ctx->buf, - ctx->private); - if (entry < DIRENT_OTHER_FILE) - entry++; - } - - if (ret & DIRENT_CHANGED) - changed++; - if (ret & DIRENT_ABORT) { - do_abort++; - break; - } -next: - if (((offset + dirent->rec_len) > fs->blocksize) || - (dirent->rec_len < 8) || - ((dirent->name_len+8) > dirent->rec_len)) { - ctx->errcode = EXT2_ET_DIR_CORRUPTED; - return BLOCK_ABORT; - } - offset += dirent->rec_len; - } - - if (changed) { - ctx->errcode = ext2fs_write_dir_block(fs, *blocknr, ctx->buf); - if (ctx->errcode) - return BLOCK_ABORT; - } - if (do_abort) - return BLOCK_ABORT; - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dirblock.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dirblock.c deleted file mode 100644 index 4db5b18c7ea..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dirblock.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * dirblock.c --- directory block routines. - * - * Copyright (C) 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.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_FLAG_SWAP_BYTES| - EXT2_FLAG_SWAP_BYTES_READ)) == 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_FLAG_SWAP_BYTES) || - (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) { - 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; -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.funcs b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.funcs deleted file mode 100644 index 680a64d794e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.funcs +++ /dev/null @@ -1,152 +0,0 @@ -00000000 T _ext2fs_open libext2fs openfs -00000000 T _ext2fs_check_desc libext2fs openfs -00000000 T _ext2fs_free libext2fs freefs -00000000 T _ext2fs_flush libext2fs closefs -00000000 T _ext2fs_close libext2fs closefs -00000000 T _ext2fs_allocate_inode_bitmap libext2fs bitmaps -00000000 T _ext2fs_allocate_block_bitmap libext2fs bitmaps -00000000 T _ext2fs_free_inode_bitmap libext2fs bitmaps -00000000 T _ext2fs_free_block_bitmap libext2fs bitmaps -00000000 T _ext2fs_fudge_inode_bitmap_end libext2fs bitmaps -00000000 T _ext2fs_fudge_block_bitmap_end libext2fs bitmaps -00000000 T _ext2fs_clear_inode_bitmap libext2fs bitmaps -00000000 T _ext2fs_clear_block_bitmap libext2fs bitmaps -00000000 T _ext2fs_write_inode_bitmap libext2fs rw_bitmaps -00000000 T _ext2fs_write_block_bitmap libext2fs rw_bitmaps -00000000 T _ext2fs_read_inode_bitmap libext2fs rw_bitmaps -00000000 T _ext2fs_read_block_bitmap libext2fs rw_bitmaps -00000000 T _ext2fs_read_bitmaps libext2fs rw_bitmaps -00000000 T _ext2fs_write_bitmaps libext2fs rw_bitmaps -00000000 T _ext2fs_open_inode_scan libext2fs inode -00000000 T _ext2fs_close_inode_scan libext2fs inode -00000000 T _ext2fs_get_next_inode libext2fs inode -00000000 T _ext2fs_read_inode libext2fs inode -00000000 T _ext2fs_write_inode libext2fs inode -00000000 T _ext2fs_get_blocks libext2fs inode -00000000 T _ext2fs_check_directory libext2fs inode -00000000 T _ext2fs_block_iterate libext2fs block -00000000 T _ext2fs_dir_iterate libext2fs namei -00000000 T _ext2fs_lookup libext2fs namei -00000000 T _ext2fs_namei libext2fs namei -00000000 T _ext2fs_new_dir_block libext2fs newdir -00000000 T _ext2fs_mkdir libext2fs mkdir -00000000 T _ext2fs_get_pathname libext2fs get_pathname -00000000 T _ext2fs_warn_bitmap libext2fs bitops -00000000 T _ext2fs_link libext2fs link -00000000 T _ext2fs_unlink libext2fs link -00000000 T _ext2fs_new_inode libext2fs alloc -00000000 T _ext2fs_new_block libext2fs alloc -00000000 T _ext2fs_get_free_blocks libext2fs alloc -00000000 T _ext2fs_expand_dir libext2fs expanddir -00000000 T _ext2fs_set_bit libext2fs inline -00000000 T _ext2fs_clear_bit libext2fs inline -00000000 T _ext2fs_test_bit libext2fs inline -00000000 T _ext2fs_mark_block_bitmap libext2fs inline -00000000 T _ext2fs_unmark_block_bitmap libext2fs inline -00000000 T _ext2fs_test_block_bitmap libext2fs inline -00000000 T _ext2fs_mark_inode_bitmap libext2fs inline -00000000 T _ext2fs_unmark_inode_bitmap libext2fs inline -00000000 T _ext2fs_test_inode_bitmap libext2fs inline -00000000 T _ext2fs_mark_super_dirty libext2fs inline -00000000 T _ext2fs_mark_changed libext2fs inline -00000000 T _ext2fs_test_changed libext2fs inline -00000000 T _ext2fs_mark_valid libext2fs inline -00000000 T _ext2fs_unmark_valid libext2fs inline -00000000 T _ext2fs_test_valid libext2fs inline -00000000 T _ext2fs_mark_ib_dirty libext2fs inline -00000000 T _ext2fs_mark_bb_dirty libext2fs inline -00000000 T _ext2fs_test_ib_dirty libext2fs inline -00000000 T _ext2fs_test_bb_dirty libext2fs inline -00000000 T _ext2fs_group_of_blk libext2fs inline -00000000 T _ext2fs_group_of_ino libext2fs inline -00000000 T _ext2fs_initialize libext2fs initialize -00000000 T _badblocks_list_create libext2fs badblocks -00000000 T _badblocks_list_free libext2fs badblocks -00000000 T _badblocks_list_add libext2fs badblocks -00000000 T _badblocks_list_test libext2fs badblocks -00000000 T _badblocks_list_iterate_begin libext2fs badblocks -00000000 T _badblocks_list_iterate libext2fs badblocks -00000000 T _badblocks_list_iterate_end libext2fs badblocks -00000000 T _ext2fs_read_bb_inode libext2fs read_bb -00000000 T _ext2fs_update_bb_inode libext2fs bb_inode -00000000 T _ext2fs_read_bb_FILE libext2fs read_bb_file -00000000 T _initialize_ext2_error_table libext2fs ext2_err -00000000 T _ext2fs_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 -00000000 T _ext2fs_allocate_tables libext2fs alloc_tables -00000000 T _ext2fs_allocate_generic_bitmap libext2fs bitmaps -00000000 T _ext2fs_warn_bitmap2 libext2fs bitops -00000000 T _ext2fs_free_generic_bitmap libext2fs freefs -00000000 T _ext2fs_mark_generic_bitmap libext2fs inline -00000000 T _ext2fs_unmark_generic_bitmap libext2fs inline -00000000 T _ext2fs_test_generic_bitmap libext2fs inline -00000000 T _ext2fs_namei_follow libext2fs namei -00000000 T _ext2fs_follow_link libext2fs namei -00000000 T _ext2fs_native_flag libext2fs native -00000000 T _ext2fs_swap_inode libext2fs swapfs -00000000 T _ext2fs_block_iterate2 libext2fs block -00000000 T _ext2fs_inode_scan_goto_blockgroup libext2fs inode -00000000 T _ext2fs_badblocks_list_create libext2fs badblocks -00000000 T _ext2fs_badblocks_list_add libext2fs badblocks -00000000 T _ext2fs_badblocks_list_test libext2fs badblocks -00000000 T _ext2fs_badblocks_list_iterate_begin libext2fs badblocks -00000000 T _ext2fs_badblocks_list_iterate libext2fs badblocks -00000000 T _ext2fs_badblocks_list_iterate_end libext2fs badblocks -00000000 T _ext2fs_brel_memarray_create libext2fs brel_ma -00000000 T _ext2fs_badblocks_list_free libext2fs closefs -00000000 T _ext2fs_free_dblist libext2fs closefs -00000000 T _ext2fs_get_num_dirs libext2fs dblist -00000000 T _ext2fs_init_dblist libext2fs dblist -00000000 T _ext2fs_add_dir_block libext2fs dblist -00000000 T _ext2fs_dblist_iterate libext2fs dblist -00000000 T _ext2fs_dblist_dir_iterate libext2fs dblist_dir -00000000 T _ext2fs_process_dir_block libext2fs dir_iterate -00000000 T _ext2fs_test_block_bitmap_range libext2fs inline -00000000 T _ext2fs_fast_test_block_bitmap_range libext2fs inline -00000000 T _ext2fs_mark_block_bitmap_range libext2fs inline -00000000 T _ext2fs_fast_mark_block_bitmap_range libext2fs inline -00000000 T _ext2fs_unmark_block_bitmap_range libext2fs inline -00000000 T _ext2fs_fast_unmark_block_bitmap_range libext2fs inline -00000000 T _ext2fs_inode_scan_flags libext2fs inode -00000000 T _ext2fs_irel_memarray_create libext2fs irel_ma -00000000 T _ext2fs_resize_generic_bitmap libext2fs rs_bitmap -00000000 T _ext2fs_inode_has_valid_blocks libext2fs valid_blk -00000000 T _ext2fs_free_icount libext2fs icount -00000000 T _ext2fs_create_icount libext2fs icount -00000000 T _ext2fs_icount_fetch libext2fs icount -00000000 T _ext2fs_icount_increment libext2fs icount -00000000 T _ext2fs_icount_decrement libext2fs icount -00000000 T _ext2fs_icount_store libext2fs icount -00000000 T _ext2fs_get_icount_size libext2fs icount -00000000 T _ext2fs_create_icount2 libext2fs icount -00000000 T _ext2fs_get_library_version libext2fs version -00000000 T _ext2fs_parse_version_string libext2fs version -00000000 T _ext2fs_set_dir_block libext2fs dblist -00000000 T _ext2fs_badblocks_copy libext2fs badblocks -00000000 T _ext2fs_copy_bitmap libext2fs bitmaps -00000000 T _ext2fs_bg_has_super libext2fs closefs -00000000 T _ext2fs_copy_dblist libext2fs dblist -00000000 T _ext2fs_dup_handle libext2fs dupfs -00000000 T _ext2fs_icount_validate libext2fs icount -00000000 T _ext2fs_resize_inode_bitmap libext2fs rs_bitmap -00000000 T _ext2fs_resize_block_bitmap libext2fs rs_bitmap diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.ignore b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.ignore deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.ignore +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.import b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.import deleted file mode 100644 index 53208d55aad..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.import +++ /dev/null @@ -1,166 +0,0 @@ -00000004 D __et_list libcom_err jump/error_message -00000004 D _com_err_hook libcom_err jump/com_err -/usr/lib/libc.sa(__libc.o):00001000 a __GOT_SIZE -/usr/lib/libc.sa(__libc.o):6008f0b0 A _AL -/usr/lib/libc.sa(__libc.o):6008f198 A _AL_PARM -/usr/lib/libc.sa(__libc.o):6008f060 A _AM -/usr/lib/libc.sa(__libc.o):6008f0b4 A _BC -/usr/lib/libc.sa(__libc.o):6008f064 A _BS -/usr/lib/libc.sa(__libc.o):6008f0bc A _BT -/usr/lib/libc.sa(__libc.o):6008f068 A _CA -/usr/lib/libc.sa(__libc.o):6008f0c0 A _CD -/usr/lib/libc.sa(__libc.o):6008f0c4 A _CE -/usr/lib/libc.sa(__libc.o):6008f0c8 A _CL -/usr/lib/libc.sa(__libc.o):6008f0cc A _CM -/usr/lib/libc.sa(__libc.o):6008f048 A _COLS -/usr/lib/libc.sa(__libc.o):6008f0d0 A _CR -/usr/lib/libc.sa(__libc.o):6008f0d4 A _CS -/usr/lib/libc.sa(__libc.o):6008f06c A _DA -/usr/lib/libc.sa(__libc.o):6008f070 A _DB -/usr/lib/libc.sa(__libc.o):6008f0d8 A _DC -/usr/lib/libc.sa(__libc.o):6008f0dc A _DL -/usr/lib/libc.sa(__libc.o):6008f19c A _DL_PARM -/usr/lib/libc.sa(__libc.o):6008f0e0 A _DM -/usr/lib/libc.sa(__libc.o):6008f0e4 A _DO -/usr/lib/libc.sa(__libc.o):6008f1a4 A _DOWN_PARM -/usr/lib/libc.sa(__libc.o):6008f03c A _Def_term -/usr/lib/libc.sa(__libc.o):6008f0e8 A _ED -/usr/lib/libc.sa(__libc.o):6008f0ec A _EI -/usr/lib/libc.sa(__libc.o):6008f074 A _EO -/usr/lib/libc.sa(__libc.o):6008f1b8 A _GT -/usr/lib/libc.sa(__libc.o):6008f078 A _HC -/usr/lib/libc.sa(__libc.o):6008f118 A _HO -/usr/lib/libc.sa(__libc.o):6008f07c A _HZ -/usr/lib/libc.sa(__libc.o):6008f11c A _IC -/usr/lib/libc.sa(__libc.o):6008f120 A _IM -/usr/lib/libc.sa(__libc.o):6008f080 A _IN -/usr/lib/libc.sa(__libc.o):6008f124 A _IP -/usr/lib/libc.sa(__libc.o):6008f0f0 A _K0 -/usr/lib/libc.sa(__libc.o):6008f0f4 A _K1 -/usr/lib/libc.sa(__libc.o):6008f0f8 A _K2 -/usr/lib/libc.sa(__libc.o):6008f0fc A _K3 -/usr/lib/libc.sa(__libc.o):6008f100 A _K4 -/usr/lib/libc.sa(__libc.o):6008f104 A _K5 -/usr/lib/libc.sa(__libc.o):6008f108 A _K6 -/usr/lib/libc.sa(__libc.o):6008f10c A _K7 -/usr/lib/libc.sa(__libc.o):6008f110 A _K8 -/usr/lib/libc.sa(__libc.o):6008f114 A _K9 -/usr/lib/libc.sa(__libc.o):6008f128 A _KD -/usr/lib/libc.sa(__libc.o):6008f12c A _KE -/usr/lib/libc.sa(__libc.o):6008f130 A _KH -/usr/lib/libc.sa(__libc.o):6008f134 A _KL -/usr/lib/libc.sa(__libc.o):6008f138 A _KR -/usr/lib/libc.sa(__libc.o):6008f13c A _KS -/usr/lib/libc.sa(__libc.o):6008f140 A _KU -/usr/lib/libc.sa(__libc.o):6008f1a8 A _LEFT_PARM -/usr/lib/libc.sa(__libc.o):6008f044 A _LINES -/usr/lib/libc.sa(__libc.o):6008f144 A _LL -/usr/lib/libc.sa(__libc.o):6008f148 A _MA -/usr/lib/libc.sa(__libc.o):6008f300 A _MCAppPath -/usr/lib/libc.sa(__libc.o):6008f084 A _MI -/usr/lib/libc.sa(__libc.o):6008f088 A _MS -/usr/lib/libc.sa(__libc.o):6008f030 A _My_term -/usr/lib/libc.sa(__libc.o):6008f08c A _NC -/usr/lib/libc.sa(__libc.o):6008f14c A _ND -/usr/lib/libc.sa(__libc.o):6008f150 A _NL -/usr/lib/libc.sa(__libc.o):6008f1bc A _NONL -/usr/lib/libc.sa(__libc.o):6008f090 A _NS -/usr/lib/libc.sa(__libc.o):6008f094 A _OS -/usr/lib/libc.sa(__libc.o):6008f1b0 A _PC -/usr/lib/libc.sa(__libc.o):6008f154 A _RC -/usr/lib/libc.sa(__libc.o):6008f1ac A _RIGHT_PARM -/usr/lib/libc.sa(__libc.o):6008f158 A _SC -/usr/lib/libc.sa(__libc.o):6008f15c A _SE -/usr/lib/libc.sa(__libc.o):6008f160 A _SF -/usr/lib/libc.sa(__libc.o):6008f164 A _SO -/usr/lib/libc.sa(__libc.o):6008f168 A _SR -/usr/lib/libc.sa(__libc.o):6008f16c A _TA -/usr/lib/libc.sa(__libc.o):6008f170 A _TE -/usr/lib/libc.sa(__libc.o):6008f174 A _TI -/usr/lib/libc.sa(__libc.o):6008f178 A _UC -/usr/lib/libc.sa(__libc.o):6008f17c A _UE -/usr/lib/libc.sa(__libc.o):6008f098 A _UL -/usr/lib/libc.sa(__libc.o):6008f180 A _UP -/usr/lib/libc.sa(__libc.o):6008f1c0 A _UPPERCASE -/usr/lib/libc.sa(__libc.o):6008f1a0 A _UP_PARM -/usr/lib/libc.sa(__libc.o):6008f188 A _US -/usr/lib/libc.sa(__libc.o):6008f18c A _VB -/usr/lib/libc.sa(__libc.o):6008f194 A _VE -/usr/lib/libc.sa(__libc.o):6008f190 A _VS -/usr/lib/libc.sa(__libc.o):6008f09c A _XB -/usr/lib/libc.sa(__libc.o):6008f0a0 A _XN -/usr/lib/libc.sa(__libc.o):6008f0a8 A _XS -/usr/lib/libc.sa(__libc.o):6008f0a4 A _XT -/usr/lib/libc.sa(__libc.o):6008f0ac A _XX -/usr/lib/libc.sa(__libc.o):6008f2a4 A __IO_file_jumps -/usr/lib/libc.sa(__libc.o):6008f1f4 A __IO_list_all -/usr/lib/libc.sa(__libc.o):6008f2a8 A __IO_proc_jumps -/usr/lib/libc.sa(__libc.o):6008f1ec A __IO_stderr_ -/usr/lib/libc.sa(__libc.o):6008f1e4 A __IO_stdin_ -/usr/lib/libc.sa(__libc.o):6008f1e8 A __IO_stdout_ -/usr/lib/libc.sa(__libc.o):6008f2ac A __IO_str_jumps -/usr/lib/libc.sa(__libc.o):6008f214 A ____brk_addr -/usr/lib/libc.sa(__libc.o):6008f01c A ___ctype_b -/usr/lib/libc.sa(__libc.o):6008f020 A ___ctype_tolower -/usr/lib/libc.sa(__libc.o):6008f024 A ___ctype_toupper -/usr/lib/libc.sa(__libc.o):6008f1fc A ___environ -/usr/lib/libc.sa(__libc.o):6008f250 A ___exit_funcs -/usr/lib/libc.sa(__libc.o):6008f2f0 A ___glob_closedir_hook -/usr/lib/libc.sa(__libc.o):6008f2f4 A ___glob_opendir_hook -/usr/lib/libc.sa(__libc.o):6008f2f8 A ___glob_readdir_hook -/usr/lib/libc.sa(__libc.o):6008f278 A ___ttyname -/usr/lib/libc.sa(__libc.o):6008f238 A __collate_info -/usr/lib/libc.sa(__libc.o):6008f23c A __ctype_info -/usr/lib/libc.sa(__libc.o):6008f028 A __echoit -/usr/lib/libc.sa(__libc.o):6008f034 A __endwin -/usr/lib/libc.sa(__libc.o):6008f288 A __gdbm_fetch_val -/usr/lib/libc.sa(__libc.o):6008f280 A __gdbm_file -/usr/lib/libc.sa(__libc.o):6008f284 A __gdbm_memory -/usr/lib/libc.sa(__libc.o):6008f240 A __monetary_info -/usr/lib/libc.sa(__libc.o):6008f234 A __null_auth -/usr/lib/libc.sa(__libc.o):6008f244 A __numeric_info -/usr/lib/libc.sa(__libc.o):6008f2ec A __obstack -/usr/lib/libc.sa(__libc.o):6008f1c8 A __pfast -/usr/lib/libc.sa(__libc.o):6008f02c A __rawmode -/usr/lib/libc.sa(__libc.o):6008f1dc A __res -/usr/lib/libc.sa(__libc.o):6008f04c A __res_iflg -/usr/lib/libc.sa(__libc.o):6008f050 A __res_lflg -/usr/lib/libc.sa(__libc.o):6008f270 A __res_opcodes -/usr/lib/libc.sa(__libc.o):6008f274 A __res_resultcodes -/usr/lib/libc.sa(__libc.o):6008f248 A __response_info -/usr/lib/libc.sa(__libc.o):6008f2fc A __sigintr -/usr/lib/libc.sa(__libc.o):6008f00c A __sys_errlist -/usr/lib/libc.sa(__libc.o):6008f010 A __sys_nerr -/usr/lib/libc.sa(__libc.o):6008f014 A __sys_siglist -/usr/lib/libc.sa(__libc.o):6008f24c A __time_info -/usr/lib/libc.sa(__libc.o):6008f05c A __tty -/usr/lib/libc.sa(__libc.o):6008f040 A __tty_ch -/usr/lib/libc.sa(__libc.o):6008f1cc A __unctrl -/usr/lib/libc.sa(__libc.o):6008f27c A __win -/usr/lib/libc.sa(__libc.o):6008f058 A _curscr -/usr/lib/libc.sa(__libc.o):6008f228 A _daylight -/usr/lib/libc.sa(__libc.o):6008f200 A _errno -/usr/lib/libc.sa(__libc.o):6008f1d0 A _gdbm_errno -/usr/lib/libc.sa(__libc.o):6008f28c A _gdbm_version -/usr/lib/libc.sa(__libc.o):6008f008 A _h_errlist -/usr/lib/libc.sa(__libc.o):6008f1d8 A _h_errno -/usr/lib/libc.sa(__libc.o):6008f2a0 A _h_nerr -/usr/lib/libc.sa(__libc.o):6008f1c4 A _normtty -/usr/lib/libc.sa(__libc.o):6008f204 A _optarg -/usr/lib/libc.sa(__libc.o):6008f20c A _opterr -/usr/lib/libc.sa(__libc.o):6008f208 A _optind -/usr/lib/libc.sa(__libc.o):6008f2e4 A _optopt -/usr/lib/libc.sa(__libc.o):6008f218 A _ospeed -/usr/lib/libc.sa(__libc.o):6008f26c A _re_max_failures -/usr/lib/libc.sa(__libc.o):6008f210 A _re_syntax_options -/usr/lib/libc.sa(__libc.o):6008f1e0 A _rexecoptions -/usr/lib/libc.sa(__libc.o):6008f230 A _rpc_createerr -/usr/lib/libc.sa(__libc.o):6008f25c A _stderr -/usr/lib/libc.sa(__libc.o):6008f254 A _stdin -/usr/lib/libc.sa(__libc.o):6008f258 A _stdout -/usr/lib/libc.sa(__libc.o):6008f054 A _stdscr -/usr/lib/libc.sa(__libc.o):6008f2e8 A _svc_fdset -/usr/lib/libc.sa(__libc.o):6008f224 A _timezone -/usr/lib/libc.sa(__libc.o):6008f21c A _tputs_baud_rate -/usr/lib/libc.sa(__libc.o):6008f038 A _ttytype -/usr/lib/libc.sa(__libc.o):6008f220 A _tzname diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.params b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.params deleted file mode 100644 index d4d1b338fc1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.params +++ /dev/null @@ -1,6 +0,0 @@ -Name=libe2fs -Text=0x66900000 -Data=0x00000000 -Jump=0x00001000 -GOT=0x00001000 -Version=1.2.0 diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.undefs b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.undefs deleted file mode 100644 index 294a0b7faa9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.undefs +++ /dev/null @@ -1,2 +0,0 @@ -6690b080 D __NEEDS_SHRLIB_libc_4 -6690b098 D __NEEDS_SHRLIB_libet_1 diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.vars b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.vars deleted file mode 100644 index 5f219d39128..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dll/jump.vars +++ /dev/null @@ -1,6 +0,0 @@ -00000004 D _unix_io_manager libext2fs unix_io -00000004 D _test_io_manager libext2fs test_io -00000004 D _test_io_backing_manager libext2fs test_io -00000004 D _test_io_cb_read_blk libext2fs test_io -00000004 D _test_io_cb_write_blk libext2fs test_io -00000004 D _test_io_cb_set_blksize libext2fs test_io diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dupfs.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dupfs.c deleted file mode 100644 index b2eee0b7c3b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/dupfs.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * dupfs.c --- duplicate a ext2 filesystem handle - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#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> - -#include "ext2fsP.h" - -errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) -{ - ext2_filsys fs; - errcode_t retval; - - EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - fs = (ext2_filsys) malloc(sizeof(struct struct_ext2_filsys)); - if (!fs) - return ENOMEM; - - *fs = *src; - fs->device_name = 0; - fs->super = 0; - fs->group_desc = 0; - fs->inode_map = 0; - fs->block_map = 0; - fs->badblocks = 0; - fs->dblist = 0; - - io_channel_bumpcount(fs->io); - if (fs->icache) - fs->icache->refcount++; - - retval = ENOMEM; - fs->device_name = malloc(strlen(src->device_name)+1); - if (!fs->device_name) - goto errout; - strcpy(fs->device_name, src->device_name); - - fs->super = malloc(SUPERBLOCK_SIZE); - if (!fs->super) - goto errout; - memcpy(fs->super, src->super, SUPERBLOCK_SIZE); - - fs->group_desc = malloc(fs->desc_blocks * fs->blocksize); - if (!fs->group_desc) - goto errout; - memcpy(fs->group_desc, src->group_desc, - fs->desc_blocks * fs->blocksize); - - if (src->inode_map) { - retval = ext2fs_copy_bitmap(src->inode_map, &fs->inode_map); - if (retval) - goto errout; - } - if (src->block_map) { - retval = ext2fs_copy_bitmap(src->block_map, &fs->block_map); - if (retval) - goto errout; - } - if (src->badblocks) { - retval = ext2fs_badblocks_copy(src->badblocks, &fs->badblocks); - if (retval) - goto errout; - } - if (src->dblist) { - retval = ext2fs_copy_dblist(src->dblist, &fs->dblist); - if (retval) - goto errout; - } - *dest = fs; - return 0; -errout: - ext2fs_free(fs); - return retval; - -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/expanddir.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/expanddir.c deleted file mode 100644 index 852b40f5717..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/expanddir.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * expand.c --- expand an ext2fs directory - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct expand_dir_struct { - int done; - errcode_t err; -}; - -static int expand_dir_proc(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private) -{ - struct expand_dir_struct *es = (struct expand_dir_struct *) private; - blk_t new_blk; - static blk_t last_blk = 0; - char *block; - errcode_t retval; - int group; - - if (*blocknr) { - last_blk = *blocknr; - return 0; - } - retval = ext2fs_new_block(fs, last_blk, 0, &new_blk); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - if (blockcnt > 0) { - retval = ext2fs_new_dir_block(fs, 0, 0, &block); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - es->done = 1; - } else { - block = malloc(fs->blocksize); - if (!block) { - es->err = ENOMEM; - return BLOCK_ABORT; - } - memset(block, 0, fs->blocksize); - } - retval = ext2fs_write_dir_block(fs, new_blk, block); - if (retval) { - es->err = retval; - return BLOCK_ABORT; - } - free(block); - *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 (es->done) - return (BLOCK_CHANGED | BLOCK_ABORT); - else - return BLOCK_CHANGED; -} - -errcode_t ext2fs_expand_dir(ext2_filsys fs, ino_t dir) -{ - errcode_t retval; - struct expand_dir_struct es; - struct ext2_inode inode; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - - retval = ext2fs_check_directory(fs, dir); - if (retval) - return retval; - - es.done = 0; - es.err = 0; - - retval = ext2fs_block_iterate(fs, dir, BLOCK_FLAG_APPEND, - 0, expand_dir_proc, &es); - - if (es.err) - return es.err; - if (!es.done) - return EXT2_ET_EXPAND_DIR_ERR; - - /* - * Update the size and block count fields in the inode. - */ - retval = ext2fs_read_inode(fs, dir, &inode); - if (retval) - return retval; - - inode.i_size += fs->blocksize; - inode.i_blocks += fs->blocksize / 512; - - retval = ext2fs_write_inode(fs, dir, &inode); - if (retval) - return retval; - - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2_err.et.in b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2_err.et.in deleted file mode 100644 index 075acee31e3..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2_err.et.in +++ /dev/null @@ -1,227 +0,0 @@ -# -# Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. -# -# %Begin-Header% -# This file may be redistributed under the terms of the GNU Public -# License. -# %End-Header% -# - error_table ext2 - -ec EXT2_ET_BASE, - "EXT2FS Library version @E2FSPROGS_VERSION@" - -ec EXT2_ET_MAGIC_EXT2FS_FILSYS, - "Wrong magic number for ext2_filsys structure" - -ec EXT2_ET_MAGIC_BADBLOCKS_LIST, - "Wrong magic number for badblocks_list structure" - -ec EXT2_ET_MAGIC_BADBLOCKS_ITERATE, - "Wrong magic number for badblocks_iterate structure" - -ec EXT2_ET_MAGIC_INODE_SCAN, - "Wrong magic number for inode_scan structure" - -ec EXT2_ET_MAGIC_IO_CHANNEL, - "Wrong magic number for io_channel structure" - -ec EXT2_ET_MAGIC_UNIX_IO_CHANNEL, - "Wrong magic number for unix io_channel structure" - -ec EXT2_ET_MAGIC_IO_MANAGER, - "Wrong magic number for io_manager structure" - -ec EXT2_ET_MAGIC_BLOCK_BITMAP, - "Wrong magic number for block_bitmap structure" - -ec EXT2_ET_MAGIC_INODE_BITMAP, - "Wrong magic number for inode_bitmap structure" - -ec EXT2_ET_MAGIC_GENERIC_BITMAP, - "Wrong magic number for generic_bitmap structure" - -ec EXT2_ET_MAGIC_TEST_IO_CHANNEL, - "Wrong magic number for test io_channel structure" - -ec EXT2_ET_MAGIC_DBLIST, - "Wrong magic number for directory block list structure" - -ec EXT2_ET_MAGIC_ICOUNT, - "Wrong magic number for icount structure" - -ec EXT2_ET_MAGIC_RESERVED_5, - "Wrong magic number --- RESERVED_5" - -ec EXT2_ET_MAGIC_RESERVED_6, - "Wrong magic number --- RESERVED_6" - -ec EXT2_ET_MAGIC_RESERVED_7, - "Wrong magic number --- RESERVED_7" - -ec EXT2_ET_MAGIC_RESERVED_8, - "Wrong magic number --- RESERVED_8" - -ec EXT2_ET_MAGIC_RESERVED_9, - "Wrong magic number --- RESERVED_9" - -ec EXT2_ET_BAD_MAGIC, - "Bad magic number in super-block" - -ec EXT2_ET_REV_TOO_HIGH, - "Filesystem revision too high" - -ec EXT2_ET_SB_LSEEK, - "Can't seek to superblock" - -ec EXT2_ET_SB_READ, - "Can't read superblock" - -ec EXT2_ET_SB_WRITE, - "Can't write superblock" - -ec EXT2_ET_RO_FILSYS, - "Attempt to write to filesystem opened read-only" - -ec EXT2_ET_GDESC_READ, - "Can't read group descriptors" - -ec EXT2_ET_GDESC_WRITE, - "Can't write group descriptors" - -ec EXT2_ET_GDESC_BAD_BLOCK_MAP, - "Corrupt group descriptor: bad block for block bitmap" - -ec EXT2_ET_GDESC_BAD_INODE_MAP, - "Corrupt group descriptor: bad block for inode bitmap" - -ec EXT2_ET_GDESC_BAD_INODE_TABLE, - "Corrupt group descriptor: bad block for inode table" - -ec EXT2_ET_INODE_BITMAP_WRITE, - "Can't write an inode bitmap" - -ec EXT2_ET_INODE_BITMAP_READ, - "Can't read an inode bitmap" - -ec EXT2_ET_BLOCK_BITMAP_WRITE, - "Can't write an block bitmap" - -ec EXT2_ET_BLOCK_BITMAP_READ, - "Can't read an block bitmap" - -ec EXT2_ET_INODE_TABLE_WRITE, - "Can't write an inode table" - -ec EXT2_ET_INODE_TABLE_READ, - "Can't read an inode table" - -ec EXT2_ET_NEXT_INODE_READ, - "Can't read next inode" - -ec EXT2_ET_UNEXPECTED_BLOCK_SIZE, - "Filesystem has unexpected block size" - -ec EXT2_ET_DIR_CORRUPTED, - "EXT2 directory corrupted" - -ec EXT2_ET_SHORT_READ, - "Attempt to read block from filesystem resulted in short read" - -ec EXT2_ET_SHORT_WRITE, - "Attempt to write block from filesystem resulted in short write" - -ec EXT2_ET_DIR_NO_SPACE, - "No free space in the directory" - -ec EXT2_ET_NO_INODE_BITMAP, - "Inode bitmap not loaded" - -ec EXT2_ET_NO_BLOCK_BITMAP, - "BLOCK bitmap not loaded" - -ec EXT2_ET_BAD_INODE_NUM, - "Illegal inode number" - -ec EXT2_ET_BAD_BLOCK_NUM, - "Illegal block number" - -ec EXT2_ET_EXPAND_DIR_ERR, - "Internal error in ext2fs_expand_dir" - -ec EXT2_ET_TOOSMALL, - "Not enough space to build proposed filesystem" - -ec EXT2_ET_BAD_BLOCK_MARK, - "Illegal block number passed to ext2fs_mark_block_bitmap" - -ec EXT2_ET_BAD_BLOCK_UNMARK, - "Illegal block number passed to ext2fs_unmark_block_bitmap" - -ec EXT2_ET_BAD_BLOCK_TEST, - "Illegal block number passed to ext2fs_test_block_bitmap" - -ec EXT2_ET_BAD_INODE_MARK, - "Illegal inode number passed to ext2fs_mark_inode_bitmap" - -ec EXT2_ET_BAD_INODE_UNMARK, - "Illegal inode number passed to ext2fs_unmark_inode_bitmap" - -ec EXT2_ET_BAD_INODE_TEST, - "Illegal inode number passed to ext2fs_test_inode_bitmap" - -ec EXT2_ET_FUDGE_BLOCK_BITMAP_END, - "Attempt to fudge end of block bitmap past the real end" - -ec EXT2_ET_FUDGE_INODE_BITMAP_END, - "Attempt to fudge end of inode bitmap past the real end" - -ec EXT2_ET_BAD_IND_BLOCK, - "Illegal indirect block found" - -ec EXT2_ET_BAD_DIND_BLOCK, - "Illegal doubly indirect block found" - -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" - -ec EXT2_ET_MISSING_INODE_TABLE, - "A block group is missing an inode table" - -ec EXT2_ET_CORRUPT_SUPERBLOCK, - "The ext2 superblock is corrupt" - -ec EXT2_ET_BAD_GENERIC_MARK, - "Illegal generic bit number passed to ext2fs_mark_generic_bitmap" - -ec EXT2_ET_BAD_GENERIC_UNMARK, - "Illegal generic bit number passed to ext2fs_unmark_generic_bitmap" - -ec EXT2_ET_BAD_GENERIC_TEST, - "Illegal generic bit number passed to ext2fs_test_generic_bitmap" - -ec EXT2_ET_SYMLINK_LOOP, - "Too many symbolic links encountered." - -ec EXT2_ET_CALLBACK_NOTHANDLED, - "The callback function will not handle this case" - -ec EXT2_ET_BAD_BLOCK_IN_INODE_TABLE, - "The inode is from a bad block in the inode table" - -ec EXT2_ET_UNSUPP_FEATURE, - "Filesystem has unsupported feature(s)" - -ec EXT2_ET_RO_UNSUPP_FEATURE, - "Filesystem has unsupported read-only feature(s)" - - end diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2fs.h b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2fs.h deleted file mode 100644 index 2e68c4c73d8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2fs.h +++ /dev/null @@ -1,786 +0,0 @@ -/* - * ext2fs.h --- ext2fs - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* - * Non-GNU C compilers won't necessarily understand inline - */ -#ifndef __GNUC__ -#define NO_INLINE_FUNCS -#endif - -/* - * Where the master copy of the superblock is located, and how big - * superblocks are supposed to be. We define SUPERBLOCK_SIZE because - * the size of the superblock structure is not necessarily trustworthy - * (some versions have the padding set up so that the superblock is - * 1032 bytes long). - */ -#define SUPERBLOCK_OFFSET 1024 -#define SUPERBLOCK_SIZE 1024 - -/* - * The last ext2fs revision level that this version of the library is - * able to support. - */ -#define EXT2_LIB_CURRENT_REV 0 - -#include <sys/types.h> -#include <linux/types.h> - -typedef __u32 blk_t; -typedef unsigned int dgrp_t; - -#include "et/com_err.h" -#include "ext2fs/io.h" -#include "ext2fs/ext2_err.h" - -typedef struct struct_ext2_filsys *ext2_filsys; - -struct ext2fs_struct_generic_bitmap { - int magic; - ext2_filsys fs; - __u32 start, end; - __u32 real_end; - char * description; - char * bitmap; - errcode_t base_error_code; - __u32 reserved[7]; -}; - -#define EXT2FS_MARK_ERROR 0 -#define EXT2FS_UNMARK_ERROR 1 -#define EXT2FS_TEST_ERROR 2 - -typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; -typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap; -typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap; - -#ifdef EXT2_DYNAMIC_REV -#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s) -#else -#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO -#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode) -#endif - -/* - * badblocks list definitions - */ - -typedef struct ext2_struct_badblocks_list *ext2_badblocks_list; -typedef struct ext2_struct_badblocks_iterate *ext2_badblocks_iterate; - -/* old */ -typedef struct ext2_struct_badblocks_list *badblocks_list; -typedef struct ext2_struct_badblocks_iterate *badblocks_iterate; - -#define BADBLOCKS_FLAG_DIRTY 1 - -/* - * ext2_dblist structure and abstractions (see dblist.c) - */ -struct ext2_db_entry { - ino_t ino; - blk_t blk; - int blockcnt; -}; - -typedef struct ext2_struct_dblist *ext2_dblist; - -#define DBLIST_ABORT 1 - -/* - * Flags for the ext2_filsys structure - */ - -#define EXT2_FLAG_RW 0x01 -#define EXT2_FLAG_CHANGED 0x02 -#define EXT2_FLAG_DIRTY 0x04 -#define EXT2_FLAG_VALID 0x08 -#define EXT2_FLAG_IB_DIRTY 0x10 -#define EXT2_FLAG_BB_DIRTY 0x20 -#define EXT2_FLAG_SWAP_BYTES 0x40 -#define EXT2_FLAG_SWAP_BYTES_READ 0x80 -#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100 -#define EXT2_FLAG_MASTER_SB_ONLY 0x200 -#define EXT2_FLAG_FORCE 0x400 - -/* - * Special flag in the ext2 inode i_flag field that means that this is - * a new inode. (So that ext2_write_inode() can clear extra fields.) - */ -#define EXT2_NEW_INODE_FL 0x80000000 - -struct struct_ext2_filsys { - int magic; - io_channel io; - int flags; - char * device_name; - struct ext2_super_block * super; - int blocksize; - int fragsize; - unsigned long group_desc_count; - unsigned long desc_blocks; - struct ext2_group_desc * group_desc; - int inode_blocks_per_group; - ext2fs_inode_bitmap inode_map; - ext2fs_block_bitmap block_map; - errcode_t (*get_blocks)(ext2_filsys fs, ino_t ino, blk_t *blocks); - errcode_t (*check_directory)(ext2_filsys fs, ino_t ino); - errcode_t (*write_bitmaps)(ext2_filsys fs); - errcode_t (*read_inode)(ext2_filsys fs, ino_t ino, - struct ext2_inode *inode); - errcode_t (*write_inode)(ext2_filsys fs, ino_t ino, - struct ext2_inode *inode); - badblocks_list badblocks; - ext2_dblist dblist; - __u32 stride; /* for mke2fs */ - /* - * Reserved for future expansion - */ - __u32 reserved[11]; - - /* - * Reserved for the use of the calling application. - */ - void * private; - - /* - * Inode cache - */ - struct ext2_inode_cache *icache; -}; - -#include "ext2fs/bitops.h" - -/* - * Return flags for the block iterator functions - */ -#define BLOCK_CHANGED 1 -#define BLOCK_ABORT 2 -#define BLOCK_ERROR 4 - -/* - * 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. - * - * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be - * called for data blocks only. - */ -#define BLOCK_FLAG_APPEND 1 -#define BLOCK_FLAG_HOLE 1 -#define BLOCK_FLAG_DEPTH_TRAVERSE 2 -#define BLOCK_FLAG_DATA_ONLY 4 - -/* - * Magic "block count" return values for the block iterator function. - */ -#define BLOCK_COUNT_IND (-1) -#define BLOCK_COUNT_DIND (-2) -#define BLOCK_COUNT_TIND (-3) -#define BLOCK_COUNT_TRANSLATOR (-4) - -/* - * Return flags for the directory iterator functions - */ -#define DIRENT_CHANGED 1 -#define DIRENT_ABORT 2 -#define DIRENT_ERROR 3 - -/* - * Directory iterator flags - */ - -#define DIRENT_FLAG_INCLUDE_EMPTY 1 - - -#define DIRENT_DOT_FILE 1 -#define DIRENT_DOT_DOT_FILE 2 -#define DIRENT_OTHER_FILE 3 - -/* - * Inode scan definitions - */ -typedef struct ext2_struct_inode_scan *ext2_inode_scan; - -/* - * ext2fs_scan flags - */ -#define EXT2_SF_CHK_BADBLOCKS 0x0001 -#define EXT2_SF_BAD_INODE_BLK 0x0002 -#define EXT2_SF_BAD_EXTRA_BYTES 0x0004 -#define EXT2_SF_SKIP_MISSING_ITABLE 0x0008 - -/* - * 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_IRWXU 00700 -#define LINUX_S_IRUSR 00400 -#define LINUX_S_IWUSR 00200 -#define LINUX_S_IXUSR 00100 - -#define LINUX_S_IRWXG 00070 -#define LINUX_S_IRGRP 00040 -#define LINUX_S_IWGRP 00020 -#define LINUX_S_IXGRP 00010 - -#define LINUX_S_IRWXO 00007 -#define LINUX_S_IROTH 00004 -#define LINUX_S_IWOTH 00002 -#define LINUX_S_IXOTH 00001 - -#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) - -/* - * ext2_icount_t abstraction - */ -#define EXT2_ICOUNT_OPT_INCREMENT 0x01 - -typedef struct ext2_icount *ext2_icount_t; - -/* - * For checking structure magic numbers... - */ - -#define EXT2_CHECK_MAGIC(struct, code) \ - if ((struct)->magic != (code)) return (code) - - -/* - * The ext2fs library private definition of the ext2 superblock, so we - * don't have to depend on the kernel's definition of the superblock, - * which might not have the latest features. - */ -struct ext2fs_sb { - __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_minor_rev_level; /* minor revision level */ - __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 */ - /* - * These fields are for EXT2_DYNAMIC_REV superblocks only. - * - * Note: the difference between the compatible feature set and - * the incompatible feature set is that if there is a bit set - * in the incompatible feature set that the kernel doesn't - * know about, it should refuse to mount the filesystem. - * - * e2fsck's requirements are more strict; if it doesn't know - * about a feature in either the compatible or incompatible - * feature set, it must abort and not try to meddle with - * things it doesn't understand... - */ - __u32 s_first_ino; /* First non-reserved inode */ - __u16 s_inode_size; /* size of inode structure */ - __u16 s_block_group_nr; /* block group # of this superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ - __u8 s_uuid[16]; /* 128-bit uuid for volume */ - char s_volume_name[16]; /* volume name */ - char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_reserved[206]; /* Padding to the end of the block */ -}; - -/* - * Feature set definitions (that might not be in ext2_fs.h - * (was EXT2_COMPAT_SPARSE_SUPER) - */ -#ifndef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER -#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 -#endif - -#define EXT2_LIB_FEATURE_COMPAT_SUPP 0 -#define EXT2_LIB_FEATURE_INCOMPAT_SUPP 0 -#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER - -/* - * function prototypes - */ - -/* alloc.c */ -extern errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode, - ext2fs_inode_bitmap map, ino_t *ret); -extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, - ext2fs_block_bitmap map, blk_t *ret); -extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, - blk_t finish, int num, - ext2fs_block_bitmap map, - blk_t *ret); - -/* allocate_tables.c */ -errcode_t ext2fs_allocate_tables(ext2_filsys fs); - -/* badblocks.c */ -extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, - int size); -extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, - blk_t blk); -extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb, - blk_t blk); -extern errcode_t - ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb, - ext2_badblocks_iterate *ret); -extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, - blk_t *blk); -extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter); -extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src, - ext2_badblocks_list *dest); - -/* bb_compat */ -extern errcode_t badblocks_list_create(badblocks_list *ret, int size); -extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk); -extern int badblocks_list_test(badblocks_list bb, blk_t blk); -extern errcode_t badblocks_list_iterate_begin(badblocks_list bb, - badblocks_iterate *ret); -extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk); -extern void badblocks_list_iterate_end(badblocks_iterate iter); -extern void badblocks_list_free(badblocks_list bb); - -/* bb_inode.c */ -extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs, - ext2_badblocks_list bb_list); - -/* bitmaps.c */ -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); -extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start, - __u32 end, - __u32 real_end, - const char *descr, - ext2fs_generic_bitmap *ret); -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); - -/* block.c */ -extern errcode_t ext2fs_block_iterate(ext2_filsys fs, - ino_t ino, - int flags, - char *block_buf, - int (*func)(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private), - void *private); - -errcode_t ext2fs_block_iterate2(ext2_filsys fs, - ino_t ino, - int flags, - char *block_buf, - int (*func)(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - blk_t ref_blk, - int ref_offset, - void *private), - void *private); - -/* check_desc.c */ -extern errcode_t ext2fs_check_desc(ext2_filsys fs); - -/* closefs.c */ -extern errcode_t ext2fs_close(ext2_filsys fs); -extern errcode_t ext2fs_flush(ext2_filsys fs); -extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); - -/* 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); - -/* dblist.c */ - -extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs); -extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist); -extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, - blk_t blk, int blockcnt); -extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, - int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info, - void *private), - void *private); -extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, - blk_t blk, int blockcnt); -extern errcode_t ext2fs_copy_dblist(ext2_dblist src, - ext2_dblist *dest); - -/* dblist_dir.c */ -extern errcode_t - ext2fs_dblist_dir_iterate(ext2_dblist dblist, - int flags, - char *block_buf, - int (*func)(ino_t dir, - int entry, - struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private), - void *private); - -/* 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); - -/* dir_iterate.c */ -extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, - ino_t dir, - int flags, - char *block_buf, - int (*func)(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private), - void *private); - /* private to library */ -extern int ext2fs_process_dir_block(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private); - -/* dupfs.c */ -extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest); - -/* 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_generic_bitmap(ext2fs_inode_bitmap bitmap); -extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap); -extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap); -extern void ext2fs_free_dblist(ext2_dblist dblist); -extern void ext2fs_badblocks_list_free(badblocks_list bb); - -/* 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, - struct ext2_super_block *param, - io_manager manager, ext2_filsys *ret_fs); - -/* inode.c */ -extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, - ext2_inode_scan *ret_scan); -extern void ext2fs_close_inode_scan(ext2_inode_scan scan); -extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino, - struct ext2_inode *inode); -extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan, - int group); -extern void ext2fs_set_inode_callback - (ext2_inode_scan scan, - errcode_t (*done_group)(ext2_filsys fs, - ext2_inode_scan scan, - dgrp_t group, - void * private), - void *done_group_data); -extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, - int clear_flags); -extern errcode_t ext2fs_read_inode (ext2_filsys fs, ino_t ino, - struct ext2_inode * inode); -extern errcode_t ext2fs_write_inode(ext2_filsys fs, ino_t ino, - struct ext2_inode * inode); -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); - -/* icount.c */ -extern void ext2fs_free_icount(ext2_icount_t icount); -extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, int size, - ext2_icount_t hint, ext2_icount_t *ret); -extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, int size, - ext2_icount_t *ret); -extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ino_t ino, - __u16 *ret); -extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino, - __u16 *ret); -extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino, - __u16 *ret); -extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino, - __u16 count); -extern ino_t ext2fs_get_icount_size(ext2_icount_t icount); -errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); - -/* ismounted.c */ -extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); - -/* namei.c */ -extern errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name, - int namelen, char *buf, ino_t *inode); -extern errcode_t ext2fs_namei(ext2_filsys fs, ino_t root, ino_t cwd, - const char *name, ino_t *inode); -errcode_t ext2fs_namei_follow(ext2_filsys fs, ino_t root, ino_t cwd, - const char *name, ino_t *inode); -extern errcode_t ext2fs_follow_link(ext2_filsys fs, ino_t root, ino_t cwd, - ino_t inode, ino_t *res_inode); - -/* native.c */ -int ext2fs_native_flag(void); - -/* newdir.c */ -extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ino_t dir_ino, - ino_t parent_ino, char **block); - -/* mkdir.c */ -extern errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum, - const char *name); - -/* openfs.c */ -extern errcode_t ext2fs_open(const char *name, int flags, int superblock, - int block_size, io_manager manager, - ext2_filsys *ret_fs); - -/* get_pathname.c */ -extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ino_t dir, ino_t ino, - char **name); - -/* link.c */ -errcode_t ext2fs_link(ext2_filsys fs, ino_t dir, const char *name, - ino_t ino, int flags); -errcode_t ext2fs_unlink(ext2_filsys fs, ino_t dir, const char *name, - ino_t ino, int flags); - -/* read_bb.c */ -extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, - ext2_badblocks_list *bb_list); - -/* read_bb_file.c */ -extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, - ext2_badblocks_list *bb_list, - void (*invalid)(ext2_filsys fs, - blk_t blk)); - -/* rs_bitmap.c */ -extern errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, - __u32 new_real_end, - ext2fs_generic_bitmap bmap); -extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, - ext2fs_inode_bitmap bmap); -extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, - ext2fs_block_bitmap bmap); -extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, - ext2fs_generic_bitmap *dest); - -/* swapfs.c */ -extern void ext2fs_swap_super(struct ext2_super_block * super); -extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); -extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t, - struct ext2_inode *f, int hostorder); - -/* valid_blk.c */ -extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode); - -/* version.c */ -extern int ext2fs_parse_version_string(const char *ver_string); -extern int ext2fs_get_library_version(const char **ver_string, - const char **date_string); - -/* inline functions */ -extern void ext2fs_mark_super_dirty(ext2_filsys fs); -extern void ext2fs_mark_changed(ext2_filsys fs); -extern int ext2fs_test_changed(ext2_filsys fs); -extern void ext2fs_mark_valid(ext2_filsys fs); -extern void ext2fs_unmark_valid(ext2_filsys fs); -extern int ext2fs_test_valid(ext2_filsys fs); -extern void ext2fs_mark_ib_dirty(ext2_filsys fs); -extern void ext2fs_mark_bb_dirty(ext2_filsys fs); -extern int ext2fs_test_ib_dirty(ext2_filsys fs); -extern int ext2fs_test_bb_dirty(ext2_filsys fs); -extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); -extern int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino); - -/* - * The actual inlined functions definitions themselves... - * - * If NO_INLINE_FUNCS is defined, then we won't try to do inline - * functions at all! - */ -#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) -#ifdef INCLUDE_INLINE_FUNCS -#define _INLINE_ extern -#else -#define _INLINE_ extern __inline__ -#endif - -/* - * Mark a filesystem superblock as dirty - */ -_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs) -{ - fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED; -} - -/* - * Mark a filesystem as changed - */ -_INLINE_ void ext2fs_mark_changed(ext2_filsys fs) -{ - fs->flags |= EXT2_FLAG_CHANGED; -} - -/* - * Check to see if a filesystem has changed - */ -_INLINE_ int ext2fs_test_changed(ext2_filsys fs) -{ - return (fs->flags & EXT2_FLAG_CHANGED); -} - -/* - * Mark a filesystem as valid - */ -_INLINE_ void ext2fs_mark_valid(ext2_filsys fs) -{ - fs->flags |= EXT2_FLAG_VALID; -} - -/* - * Mark a filesystem as NOT valid - */ -_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs) -{ - fs->flags &= ~EXT2_FLAG_VALID; -} - -/* - * Check to see if a filesystem is valid - */ -_INLINE_ int ext2fs_test_valid(ext2_filsys fs) -{ - return (fs->flags & EXT2_FLAG_VALID); -} - -/* - * Mark the inode bitmap as dirty - */ -_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs) -{ - fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED; -} - -/* - * Mark the block bitmap as dirty - */ -_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs) -{ - fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED; -} - -/* - * Check to see if a filesystem's inode bitmap is dirty - */ -_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs) -{ - return (fs->flags & EXT2_FLAG_IB_DIRTY); -} - -/* - * Check to see if a filesystem's block bitmap is dirty - */ -_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs) -{ - return (fs->flags & EXT2_FLAG_BB_DIRTY); -} - -/* - * Return the group # of a block - */ -_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk) -{ - return (blk - fs->super->s_first_data_block) / - fs->super->s_blocks_per_group; -} - -/* - * Return the group # of an inode number - */ -_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino) -{ - return (ino - 1) / fs->super->s_inodes_per_group; -} -#undef _INLINE_ -#endif - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2fsP.h b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2fsP.h deleted file mode 100644 index 113a9b69b19..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ext2fsP.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ext2fsP.h --- private header file for ext2 library - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include "ext2fs.h" - -/* - * Badblocks list - */ -struct ext2_struct_badblocks_list { - int magic; - int num; - int size; - blk_t *list; - int badblocks_flags; -}; - -struct ext2_struct_badblocks_iterate { - int magic; - badblocks_list bb; - int ptr; -}; - - -/* - * Directory block iterator definition - */ -struct ext2_struct_dblist { - int magic; - ext2_filsys fs; - ino_t size; - ino_t count; - int sorted; - struct ext2_db_entry * list; -}; - -/* - * For directory iterators - */ -struct dir_context { - ino_t dir; - int flags; - char *buf; - int (*func)(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private); - int (*func2)(ino_t dir, - int entry, - struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private); - void *private; - errcode_t errcode; -}; - -/* - * Inode cache structure - */ -struct ext2_inode_cache { - void * buffer; - blk_t buffer_blk; - int cache_last; - int cache_size; - int refcount; - struct ext2_inode_cache_ent *cache; -}; - -struct ext2_inode_cache_ent { - ino_t ino; - struct ext2_inode inode; -}; - -/* Function prototypes */ - -extern int ext2_process_dir_block(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private); - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/freefs.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/freefs.c deleted file mode 100644 index 43331aba681..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/freefs.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * freefs.c --- free an ext2 filesystem - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> - -#include <linux/ext2_fs.h> - -#include "ext2fsP.h" - -static void ext2fs_free_inode_cache(struct ext2_inode_cache *icache); - -void ext2fs_free(ext2_filsys fs) -{ - if (!fs || (fs->magic != EXT2_ET_MAGIC_EXT2FS_FILSYS)) - return; - if (fs->io) { - io_channel_close(fs->io); - } - if (fs->device_name) - free(fs->device_name); - if (fs->super) - free(fs->super); - if (fs->group_desc) - free(fs->group_desc); - if (fs->block_map) - ext2fs_free_block_bitmap(fs->block_map); - if (fs->inode_map) - ext2fs_free_inode_bitmap(fs->inode_map); - - if (fs->badblocks) - badblocks_list_free(fs->badblocks); - fs->badblocks = 0; - - if (fs->dblist) - ext2fs_free_dblist(fs->dblist); - - if (fs->icache) - ext2fs_free_inode_cache(fs->icache); - - fs->magic = 0; - - free(fs); -} - -void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap) -{ - if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_GENERIC_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_inode_bitmap(ext2fs_inode_bitmap bitmap) -{ - if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP)) - return; - - bitmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP; - ext2fs_free_generic_bitmap(bitmap); -} - -void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap) -{ - if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP)) - return; - - bitmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP; - ext2fs_free_generic_bitmap(bitmap); -} - -/* - * Free the inode cache structure - */ -static void ext2fs_free_inode_cache(struct ext2_inode_cache *icache) -{ - if (--icache->refcount) - return; - if (icache->buffer) - free(icache->buffer); - if (icache->cache) - free(icache->cache); - icache->buffer_blk = 0; - free(icache); -} - -/* - * This procedure frees a badblocks list. - */ -void ext2fs_badblocks_list_free(ext2_badblocks_list bb) -{ - if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) - return; - - if (bb->list) - free(bb->list); - bb->list = 0; - free(bb); -} - -/* - * Free a directory block list - */ -void ext2fs_free_dblist(ext2_dblist dblist) -{ - if (!dblist || (dblist->magic != EXT2_ET_MAGIC_DBLIST)) - return; - - if (dblist->list) - free(dblist->list); - dblist->list = 0; - if (dblist->fs && dblist->fs->dblist == dblist) - dblist->fs->dblist = 0; - dblist->magic = 0; - free(dblist); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/get_pathname.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/get_pathname.c deleted file mode 100644 index 8c94e9328c9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/get_pathname.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * get_pathname.c --- do directry/inode -> name translation - * - * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - * ext2fs_get_pathname(fs, dir, ino, name) - * - * This function translates takes two inode numbers into a - * string, placing the result in <name>. <dir> is the containing - * directory inode, and <ino> is the inode number itself. If - * <ino> is zero, then ext2fs_get_pathname will return pathname - * of the the directory <dir>. - * - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct get_pathname_struct { - int search_ino; - int parent; - char *name; - errcode_t errcode; -}; - -static int get_pathname_proc(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private) -{ - struct get_pathname_struct *gp; - - gp = (struct get_pathname_struct *) private; - - if ((dirent->name_len == 2) && - !strncmp(dirent->name, "..", 2)) - gp->parent = dirent->inode; - if (dirent->inode == gp->search_ino) { - gp->name = malloc(dirent->name_len + 1); - if (!gp->name) { - gp->errcode = ENOMEM; - return DIRENT_ABORT; - } - strncpy(gp->name, dirent->name, dirent->name_len); - gp->name[dirent->name_len] = '\0'; - return DIRENT_ABORT; - } - return 0; -} - -static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ino_t dir, ino_t ino, - int maxdepth, char *buf, char **name) -{ - struct get_pathname_struct gp; - char *parent_name, *ret; - errcode_t retval; - - if (dir == ino) { - *name = malloc(2); - if (!*name) - return ENOMEM; - strcpy(*name, (dir == EXT2_ROOT_INO) ? "/" : "."); - return 0; - } - - if (!dir || (maxdepth < 0)) { - *name = malloc(4); - if (!*name) - return ENOMEM; - strcpy(*name, "..."); - return 0; - } - - gp.search_ino = ino; - gp.parent = 0; - gp.name = 0; - gp.errcode = 0; - - retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); - if (retval) - goto cleanup; - if (gp.errcode) { - retval = gp.errcode; - goto cleanup; - } - - retval = ext2fs_get_pathname_int(fs, gp.parent, dir, maxdepth-1, - buf, &parent_name); - if (retval) - goto cleanup; - if (!ino) { - *name = parent_name; - return 0; - } - - if (gp.name) - ret = malloc(strlen(parent_name)+strlen(gp.name)+2); - else - ret = malloc(strlen(parent_name)+5); /* strlen("???") + 2 */ - - if (!ret) { - retval = ENOMEM; - goto cleanup; - } - ret[0] = 0; - if (parent_name[1]) - strcat(ret, parent_name); - strcat(ret, "/"); - if (gp.name) - strcat(ret, gp.name); - else - strcat(ret, "???"); - *name = ret; - free(parent_name); - retval = 0; - -cleanup: - if (gp.name) - free(gp.name); - return retval; -} - -errcode_t ext2fs_get_pathname(ext2_filsys fs, ino_t dir, ino_t ino, - char **name) -{ - char *buf; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - buf = malloc(fs->blocksize); - if (!buf) - return ENOMEM; - if (dir == ino) - ino = 0; - retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); - free(buf); - return retval; - -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/getsize.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/getsize.c deleted file mode 100644 index c9fc00ae25d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/getsize.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * getsize.c --- get the size of a partition. - * - * Copyright (C) 1995, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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 (ext2fs_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; - long size; - ext2_loff_t high, low; -#ifdef FDGETPRM - struct floppy_struct this_floppy; -#endif -#ifdef HAVE_SYS_DISKLABEL_H - int part; - struct disklabel lab; - struct partition *pp; - char ch; -#endif /* HAVE_SYS_DISKLABEL_H */ - - fd = open(file, O_RDONLY); - 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 - part = strlen(file) - 1; - if (part >= 0) { - ch = file[part]; - if (isdigit(ch)) - part = 0; - else if (ch >= 'a' && ch <= 'h') - part = ch - 'a'; - else - part = -1; - } - if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) { - pp = &lab.d_partitions[part]; - 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 best 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; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/icount.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/icount.c deleted file mode 100644 index 7c686804214..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/icount.c +++ /dev/null @@ -1,482 +0,0 @@ -/* - * icount.c --- an efficient inode count abstraction - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <et/com_err.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> -#include "ext2fs.h" - -/* - * The data storage strategy used by icount relies on the observation - * that most inode counts are either zero (for non-allocated inodes), - * one (for most files), and only a few that are two or more - * (directories and files that are linked to more than one directory). - * - * Also, e2fsck tends to load the icount data sequentially. - * - * So, we use an inode bitmap to indicate which inodes have a count of - * one, and then use a sorted list to store the counts for inodes - * which are greater than one. - * - * We also use an optional bitmap to indicate which inodes are already - * in the sorted list, to speed up the use of this abstraction by - * e2fsck's pass 2. Pass 2 increments inode counts as it finds them, - * so this extra bitmap avoids searching the sorted list to see if a - * particular inode is on the sorted list already. - */ - -struct ext2_icount_el { - ino_t ino; - __u16 count; -}; - -struct ext2_icount { - int magic; - ext2fs_inode_bitmap single; - ext2fs_inode_bitmap multiple; - ino_t count; - ino_t size; - ino_t num_inodes; - int cursor; - struct ext2_icount_el *list; -}; - -void ext2fs_free_icount(ext2_icount_t icount) -{ - if (!icount) - return; - - icount->magic = 0; - if (icount->list) - free(icount->list); - if (icount->single) - ext2fs_free_inode_bitmap(icount->single); - if (icount->multiple) - ext2fs_free_inode_bitmap(icount->multiple); - free(icount); -} - -errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, int size, - ext2_icount_t hint, ext2_icount_t *ret) -{ - ext2_icount_t icount; - errcode_t retval; - size_t bytes; - int i; - - if (hint) { - EXT2_CHECK_MAGIC(hint, EXT2_ET_MAGIC_ICOUNT); - if (hint->size > size) - size = hint->size; - } - - icount = malloc(sizeof(struct ext2_icount)); - if (!icount) - return ENOMEM; - memset(icount, 0, sizeof(struct ext2_icount)); - - retval = ext2fs_allocate_inode_bitmap(fs, 0, - &icount->single); - if (retval) - goto errout; - - if (flags & EXT2_ICOUNT_OPT_INCREMENT) { - retval = ext2fs_allocate_inode_bitmap(fs, 0, - &icount->multiple); - if (retval) - goto errout; - } else - icount->multiple = 0; - - if (size) { - icount->size = size; - } else { - /* - * Figure out how many special case inode counts we will - * have. We know we will need one for each directory; - * we also need to reserve some extra room for file links - */ - retval = ext2fs_get_num_dirs(fs, &icount->size); - if (retval) - goto errout; - icount->size += fs->super->s_inodes_count / 50; - } - - bytes = icount->size * sizeof(struct ext2_icount_el); -#if 0 - printf("Icount allocated %d entries, %d bytes.\n", - icount->size, bytes); -#endif - icount->list = malloc(bytes); - if (!icount->list) - goto errout; - memset(icount->list, 0, bytes); - - icount->magic = EXT2_ET_MAGIC_ICOUNT; - icount->count = 0; - icount->cursor = 0; - icount->num_inodes = fs->super->s_inodes_count; - - /* - * Populate the sorted list with those entries which were - * found in the hint icount (since those are ones which will - * likely need to be in the sorted list this time around). - */ - if (hint) { - for (i=0; i < hint->count; i++) - icount->list[i].ino = hint->list[i].ino; - icount->count = hint->count; - } - - *ret = icount; - return 0; - -errout: - ext2fs_free_icount(icount); - return(retval); -} - -errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, int size, - ext2_icount_t *ret) -{ - return ext2fs_create_icount2(fs, flags, size, 0, ret); -} - -/* - * insert_icount_el() --- Insert a new entry into the sorted list at a - * specified position. - */ -static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, - ino_t ino, int pos) -{ - struct ext2_icount_el *el, *new_list; - ino_t new_size = 0; - int num; - - if (icount->count >= icount->size) { - if (icount->count) { - new_size = icount->list[icount->count-1].ino; - new_size = icount->count * - ((float) new_size / icount->num_inodes); - } - if (new_size < (icount->size + 100)) - new_size = icount->size + 100; -#if 0 - printf("Reallocating icount %d entries...\n", new_size); -#endif - new_list = realloc(icount->list, - new_size * sizeof(struct ext2_icount_el)); - if (!new_list) - return 0; - icount->size = new_size; - icount->list = new_list; - } - num = icount->count - pos; - if (num < 0) - return 0; /* should never happen */ - if (num) { - memmove(&icount->list[pos+1], &icount->list[pos], - sizeof(struct ext2_icount_el) * num); - } - icount->count++; - el = &icount->list[pos]; - el->count = 0; - el->ino = ino; - return el; -} - -/* - * get_icount_el() --- given an inode number, try to find icount - * information in the sorted list. If the create flag is set, - * and we can't find an entry, create one in the sorted list. - */ -static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, - ino_t ino, int create) -{ - float range; - int low, high, mid; - ino_t lowval, highval; - - if (!icount || !icount->list) - return 0; - - if (create && ((icount->count == 0) || - (ino > icount->list[icount->count-1].ino))) { - return insert_icount_el(icount, ino, icount->count); - } - if (icount->count == 0) - return 0; - - if (icount->cursor >= icount->count) - icount->cursor = 0; - if (ino == icount->list[icount->cursor].ino) - return &icount->list[icount->cursor++]; -#if 0 - printf("Non-cursor get_icount_el: %u\n", ino); -#endif - low = 0; - high = icount->count-1; - while (low <= high) { -#if 0 - mid = (low+high)/2; -#else - if (low == high) - mid = low; - else { - /* Interpolate for efficiency */ - lowval = icount->list[low].ino; - highval = icount->list[high].ino; - - if (ino < lowval) - range = 0; - else if (ino > highval) - range = 1; - else - range = ((float) (ino - lowval)) / - (highval - lowval); - mid = low + ((int) (range * (high-low))); - } -#endif - if (ino == icount->list[mid].ino) { - icount->cursor = mid+1; - return &icount->list[mid]; - } - if (ino < icount->list[mid].ino) - high = mid-1; - else - low = mid+1; - } - /* - * If we need to create a new entry, it should be right at - * low (where high will be left at low-1). - */ - if (create) - return insert_icount_el(icount, ino, low); - return 0; -} - -errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) -{ - errcode_t ret = 0; - int i; - const char *bad = "bad icount"; - - EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); - - if (icount->count > icount->size) { - fprintf(out, "%s: count > size\n", bad); - return EINVAL; - } - for (i=1; i < icount->count; i++) { - if (icount->list[i-1].ino >= icount->list[i].ino) { - fprintf(out, "%s: list[%d].ino=%u, list[%d].ino=%u\n", - bad, i-1, icount->list[i-1].ino, - i, icount->list[i].ino); - ret = EINVAL; - } - } - return ret; -} - -errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ino_t ino, __u16 *ret) -{ - struct ext2_icount_el *el; - - EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); - - if (!ino || (ino > icount->num_inodes)) - return EINVAL; - - if (ext2fs_test_inode_bitmap(icount->single, ino)) { - *ret = 1; - return 0; - } - if (icount->multiple && - !ext2fs_test_inode_bitmap(icount->multiple, ino)) { - *ret = 0; - return 0; - } - el = get_icount_el(icount, ino, 0); - if (!el) { - *ret = 0; - return 0; - } - *ret = el->count; - return 0; -} - -errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino, - __u16 *ret) -{ - struct ext2_icount_el *el; - - EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); - - if (!ino || (ino > icount->num_inodes)) - return EINVAL; - - if (ext2fs_test_inode_bitmap(icount->single, ino)) { - /* - * If the existing count is 1, then we know there is - * no entry in the list. - */ - el = get_icount_el(icount, ino, 1); - if (!el) - return ENOMEM; - ext2fs_unmark_inode_bitmap(icount->single, ino); - el->count = 2; - } else if (icount->multiple) { - /* - * The count is either zero or greater than 1; if the - * inode is set in icount->multiple, then there should - * be an entry in the list, so find it using - * get_icount_el(). - */ - if (ext2fs_test_inode_bitmap(icount->multiple, ino)) { - el = get_icount_el(icount, ino, 1); - if (!el) - return ENOMEM; - el->count++; - } else { - /* - * The count was zero; mark the single bitmap - * and return. - */ - zero_count: - ext2fs_mark_inode_bitmap(icount->single, ino); - if (ret) - *ret = 1; - return 0; - } - } else { - /* - * The count is either zero or greater than 1; try to - * find an entry in the list to determine which. - */ - el = get_icount_el(icount, ino, 0); - if (!el) { - /* No entry means the count was zero */ - goto zero_count; - } - el = get_icount_el(icount, ino, 1); - if (!el) - return ENOMEM; - el->count++; - } - if (icount->multiple) - ext2fs_mark_inode_bitmap(icount->multiple, ino); - if (ret) - *ret = el->count; - return 0; -} - -errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino, - __u16 *ret) -{ - struct ext2_icount_el *el; - - if (!ino || (ino > icount->num_inodes)) - return EINVAL; - - EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); - - if (ext2fs_test_inode_bitmap(icount->single, ino)) { - ext2fs_unmark_inode_bitmap(icount->single, ino); - if (icount->multiple) - ext2fs_unmark_inode_bitmap(icount->multiple, ino); - else { - el = get_icount_el(icount, ino, 0); - if (el) - el->count = 0; - } - if (ret) - *ret = 0; - return 0; - } - - if (icount->multiple && - !ext2fs_test_inode_bitmap(icount->multiple, ino)) - return EINVAL; - - el = get_icount_el(icount, ino, 0); - if (!el || el->count == 0) - return EINVAL; - - el->count--; - if (el->count == 1) - ext2fs_mark_inode_bitmap(icount->single, ino); - if ((el->count == 0) && icount->multiple) - ext2fs_unmark_inode_bitmap(icount->multiple, ino); - - if (ret) - *ret = el->count; - return 0; -} - -errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino, - __u16 count) -{ - struct ext2_icount_el *el; - - if (!ino || (ino > icount->num_inodes)) - return EINVAL; - - EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); - - if (count == 1) { - ext2fs_mark_inode_bitmap(icount->single, ino); - if (icount->multiple) - ext2fs_unmark_inode_bitmap(icount->multiple, ino); - return 0; - } - if (count == 0) { - ext2fs_unmark_inode_bitmap(icount->single, ino); - if (icount->multiple) { - /* - * If the icount->multiple bitmap is enabled, - * we can just clear both bitmaps and we're done - */ - ext2fs_unmark_inode_bitmap(icount->multiple, ino); - } else { - el = get_icount_el(icount, ino, 0); - if (el) - el->count = 0; - } - return 0; - } - - /* - * Get the icount element - */ - el = get_icount_el(icount, ino, 1); - if (!el) - return ENOMEM; - el->count = count; - ext2fs_unmark_inode_bitmap(icount->single, ino); - if (icount->multiple) - ext2fs_mark_inode_bitmap(icount->multiple, ino); - return 0; -} - -ino_t ext2fs_get_icount_size(ext2_icount_t icount) -{ - if (!icount || icount->magic != EXT2_ET_MAGIC_ICOUNT) - return 0; - - return icount->size; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/initialize.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/initialize.c deleted file mode 100644 index f9e744b35e2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/initialize.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * initialize.c --- initialize a filesystem handle given superblock - * parameters. Used by mke2fs when initializing a filesystem. - * - * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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" - -#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 - -/* - * Note we override the kernel include file's idea of what the default - * check interval (never) should be. It's a good idea to check at - * least *occasionally*, specially since servers will never rarely get - * to reboot, since Linux is so robust these days. :-) - * - * 180 days (six months) seems like a good value. - */ -#ifdef EXT2_DFL_CHECKINTERVAL -#undef EXT2_DFL_CHECKINTERVAL -#endif -#define EXT2_DFL_CHECKINTERVAL (86400 * 180) - -errcode_t ext2fs_initialize(const char *name, int flags, - struct ext2_super_block *param, - io_manager manager, ext2_filsys *ret_fs) -{ - ext2_filsys fs; - errcode_t retval; - struct ext2_super_block *super; - int frags_per_block; - int rem; - int overhead = 0; - blk_t group_block; - int i, j; - int numblocks; - char *buf; - - if (!param || !param->s_blocks_count) - return EINVAL; - - fs = (ext2_filsys) malloc(sizeof(struct struct_ext2_filsys)); - if (!fs) - return ENOMEM; - - memset(fs, 0, sizeof(struct struct_ext2_filsys)); - fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; - fs->flags = flags | EXT2_FLAG_RW | ext2fs_native_flag(); - retval = manager->open(name, IO_FLAG_RW, &fs->io); - if (retval) - goto cleanup; - fs->device_name = malloc(strlen(name)+1); - if (!fs->device_name) { - retval = ENOMEM; - goto cleanup; - } - strcpy(fs->device_name, name); - fs->super = super = malloc(SUPERBLOCK_SIZE); - if (!super) { - retval = ENOMEM; - goto cleanup; - } - memset(super, 0, SUPERBLOCK_SIZE); - -#define set_field(field, default) (super->field = param->field ? \ - param->field : (default)) - - super->s_magic = EXT2_SUPER_MAGIC; - super->s_state = EXT2_VALID_FS; - - set_field(s_log_block_size, 0); /* default blocksize: 1024 bytes */ - set_field(s_log_frag_size, 0); /* default fragsize: 1024 bytes */ - set_field(s_first_data_block, super->s_log_block_size ? 0 : 1); - set_field(s_max_mnt_count, EXT2_DFL_MAX_MNT_COUNT); - set_field(s_errors, EXT2_ERRORS_DEFAULT); -#ifdef EXT2_DYNAMIC_REV - set_field(s_feature_compat, 0); - set_field(s_feature_incompat, 0); - set_field(s_feature_ro_compat, 0); - if (super->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) - return EXT2_ET_UNSUPP_FEATURE; - if (super->s_feature_ro_compat & ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP) - return EXT2_ET_RO_UNSUPP_FEATURE; - - set_field(s_rev_level, EXT2_GOOD_OLD_REV); - if (super->s_rev_level >= EXT2_DYNAMIC_REV) { - set_field(s_first_ino, EXT2_GOOD_OLD_FIRST_INO); - set_field(s_inode_size, EXT2_GOOD_OLD_INODE_SIZE); - } -#endif - - set_field(s_checkinterval, EXT2_DFL_CHECKINTERVAL); - super->s_lastcheck = time(NULL); - - super->s_creator_os = CREATOR_OS; - - fs->blocksize = EXT2_BLOCK_SIZE(super); - fs->fragsize = EXT2_FRAG_SIZE(super); - frags_per_block = fs->blocksize / fs->fragsize; - - /* default: (fs->blocksize*8) blocks/group */ - set_field(s_blocks_per_group, fs->blocksize*8); - super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; - - super->s_blocks_count = param->s_blocks_count; - super->s_r_blocks_count = param->s_r_blocks_count; - if (super->s_r_blocks_count >= param->s_blocks_count) { - retval = EINVAL; - goto cleanup; - } - -retry: - fs->group_desc_count = (super->s_blocks_count - - super->s_first_data_block + - EXT2_BLOCKS_PER_GROUP(super) - 1) - / EXT2_BLOCKS_PER_GROUP(super); - if (fs->group_desc_count == 0) - return EXT2_ET_TOOSMALL; - fs->desc_blocks = (fs->group_desc_count + - EXT2_DESC_PER_BLOCK(super) - 1) - / EXT2_DESC_PER_BLOCK(super); - - set_field(s_inodes_count, (super->s_blocks_count*fs->blocksize)/4096); - - /* - * There should be at least as many inodes as the user - * requested. Figure out how many inodes per group that - * 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 - * the inode table blocks in the descriptor. If not, add some - * additional inodes/group. Waste not, want not... - */ - fs->inode_blocks_per_group = (((super->s_inodes_per_group * - EXT2_INODE_SIZE(super)) + - EXT2_BLOCK_SIZE(super) - 1) / - EXT2_BLOCK_SIZE(super)); - super->s_inodes_per_group = ((fs->inode_blocks_per_group * - EXT2_BLOCK_SIZE(super)) / - EXT2_INODE_SIZE(super)); - /* - * Finally, make sure the number of inodes per group is a - * multiple of 8. This is needed to simplify the bitmap - * splicing code. - */ - super->s_inodes_per_group &= ~7; - fs->inode_blocks_per_group = (((super->s_inodes_per_group * - EXT2_INODE_SIZE(super)) + - EXT2_BLOCK_SIZE(super) - 1) / - EXT2_BLOCK_SIZE(super)); - - /* - * adjust inode count to reflect the adjusted inodes_per_group - */ - super->s_inodes_count = super->s_inodes_per_group * - fs->group_desc_count; - super->s_free_inodes_count = super->s_inodes_count; - - /* - * Overhead is the number of bookkeeping blocks per group. It - * includes the superblock backup, the group descriptor - * backups, the inode bitmap, the block bitmap, and the inode - * table. - * - * XXX Not all block groups need the descriptor blocks, but - * being clever is tricky... - */ - overhead = 3 + fs->desc_blocks + fs->inode_blocks_per_group; - - /* - * See if the last group is big enough to support the - * necessary data structures. If not, we need to get rid of - * it. - */ - rem = (super->s_blocks_count - super->s_first_data_block) % - super->s_blocks_per_group; - if ((fs->group_desc_count == 1) && rem && (rem < overhead)) - return EXT2_ET_TOOSMALL; - if (rem && (rem < overhead+50)) { - super->s_blocks_count -= rem; - goto retry; - } - - /* - * At this point we know how big the filesystem will be. So - * we can do any and all allocations that depend on the block - * count. - */ - - buf = malloc(strlen(fs->device_name) + 80); - if (!buf) { - retval = ENOMEM; - goto cleanup; - } - - sprintf(buf, "block bitmap for %s", fs->device_name); - retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); - if (retval) - goto cleanup; - - sprintf(buf, "inode bitmap for %s", fs->device_name); - retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); - if (retval) - goto cleanup; - - free(buf); - - fs->group_desc = malloc(fs->desc_blocks * fs->blocksize); - if (!fs->group_desc) { - retval = ENOMEM; - goto cleanup; - } - memset(fs->group_desc, 0, fs->desc_blocks * fs->blocksize); - - /* - * Reserve the superblock and group descriptors for each - * group, and fill in the correct group statistics for group. - * Note that although the block bitmap, inode bitmap, and - * inode table have not been allocated (and in fact won't be - * by this routine), they are accounted for nevertheless. - */ - group_block = super->s_first_data_block; - super->s_free_blocks_count = 0; - for (i = 0; i < fs->group_desc_count; i++) { - if (i == fs->group_desc_count-1) { - numblocks = (fs->super->s_blocks_count - - fs->super->s_first_data_block) % - fs->super->s_blocks_per_group; - if (!numblocks) - numblocks = fs->super->s_blocks_per_group; - } else - numblocks = fs->super->s_blocks_per_group; - - if (ext2fs_bg_has_super(fs, i)) { - for (j=0; j < fs->desc_blocks+1; j++) - ext2fs_mark_block_bitmap(fs->block_map, - group_block + j); - numblocks -= 1 + fs->desc_blocks; - } - - numblocks -= 2 + fs->inode_blocks_per_group; - - super->s_free_blocks_count += numblocks; - fs->group_desc[i].bg_free_blocks_count = numblocks; - fs->group_desc[i].bg_free_inodes_count = - fs->super->s_inodes_per_group; - fs->group_desc[i].bg_used_dirs_count = 0; - - group_block += super->s_blocks_per_group; - } - - ext2fs_mark_super_dirty(fs); - ext2fs_mark_bb_dirty(fs); - ext2fs_mark_ib_dirty(fs); - - io_channel_set_blksize(fs->io, fs->blocksize); - - *ret_fs = fs; - return 0; -cleanup: - ext2fs_free(fs); - return retval; -} - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/inline.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/inline.c deleted file mode 100644 index 3451c3534b6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/inline.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * inline.c --- Includes the inlined functions defined in the header - * files as standalone functions, in case the application program - * is compiled with inlining turned off. - * - * Copyright (C) 1993, 1994 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - - -#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> - -#include <linux/ext2_fs.h> - -#define INCLUDE_INLINE_FUNCS - -#include "ext2fs.h" - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/inode.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/inode.c deleted file mode 100644 index be882ad5460..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/inode.c +++ /dev/null @@ -1,634 +0,0 @@ -/* - * inode.c --- utility routines to read and write inodes - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#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 "ext2fsP.h" - -struct ext2_struct_inode_scan { - int magic; - ext2_filsys fs; - ino_t current_inode; - blk_t current_block; - dgrp_t current_group; - int inodes_left, blocks_left, groups_left; - int inode_buffer_blocks; - char * inode_buffer; - int inode_size; - char * ptr; - int bytes_left; - char *temp_buffer; - errcode_t (*done_group)(ext2_filsys fs, - ext2_inode_scan scan, - dgrp_t group, - void * private); - void * done_group_data; - int bad_block_ptr; - int scan_flags; - int reserved[6]; -}; - -static errcode_t create_icache(ext2_filsys fs) -{ - int i; - - if (fs->icache) - return 0; - fs->icache = malloc(sizeof(struct ext2_inode_cache)); - memset(fs->icache, 0, sizeof(struct ext2_inode_cache)); - fs->icache->buffer = malloc(fs->blocksize); - if (!fs->icache->buffer) { - free(fs->icache); - return ENOMEM; - } - fs->icache->buffer_blk = 0; - fs->icache->cache_last = -1; - fs->icache->cache_size = 4; - fs->icache->refcount = 1; - fs->icache->cache = malloc(sizeof(struct ext2_inode_cache_ent) - * fs->icache->cache_size); - if (!fs->icache->cache) { - free(fs->icache->buffer); - free(fs->icache); - return ENOMEM; - } - for (i=0; i < fs->icache->cache_size; i++) - fs->icache->cache[i].ino = 0; - return 0; -} - -errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, - ext2_inode_scan *ret_scan) -{ - ext2_inode_scan scan; - errcode_t retval; - errcode_t (*save_get_blocks)(ext2_filsys fs, ino_t ino, blk_t *blocks); - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - /* - * If fs->badblocks isn't set, then set it --- since the inode - * scanning functions require it. - */ - if (fs->badblocks == 0) { - /* - * Temporarly save fs->get_blocks and set it to zero, - * for compatibility with old e2fsck's. - */ - save_get_blocks = fs->get_blocks; - fs->get_blocks = 0; - retval = ext2fs_read_bb_inode(fs, &fs->badblocks); - if (retval && fs->badblocks) { - badblocks_list_free(fs->badblocks); - fs->badblocks = 0; - } - fs->get_blocks = save_get_blocks; - } - - scan = (ext2_inode_scan) malloc(sizeof(struct ext2_struct_inode_scan)); - if (!scan) - return ENOMEM; - memset(scan, 0, sizeof(struct ext2_struct_inode_scan)); - - scan->magic = EXT2_ET_MAGIC_INODE_SCAN; - scan->fs = fs; - scan->inode_size = EXT2_INODE_SIZE(fs->super); - scan->bytes_left = 0; - scan->current_group = -1; - scan->inode_buffer_blocks = buffer_blocks ? buffer_blocks : 8; - scan->groups_left = fs->group_desc_count; - scan->inode_buffer = malloc(scan->inode_buffer_blocks * fs->blocksize); - scan->done_group = 0; - scan->done_group_data = 0; - scan->bad_block_ptr = 0; - if (!scan->inode_buffer) { - free(scan); - return ENOMEM; - } - scan->temp_buffer = malloc(scan->inode_size); - if (!scan->temp_buffer) { - free(scan->inode_buffer); - free(scan); - return ENOMEM; - } - if (scan->fs->badblocks && scan->fs->badblocks->num) - scan->scan_flags |= EXT2_SF_CHK_BADBLOCKS; - *ret_scan = scan; - return 0; -} - -void ext2fs_close_inode_scan(ext2_inode_scan scan) -{ - if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) - return; - - free(scan->inode_buffer); - scan->inode_buffer = NULL; - free(scan->temp_buffer); - scan->temp_buffer = NULL; - free(scan); - return; -} - -void ext2fs_set_inode_callback(ext2_inode_scan scan, - errcode_t (*done_group)(ext2_filsys fs, - ext2_inode_scan scan, - dgrp_t group, - void * private), - void *done_group_data) -{ - if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) - return; - - scan->done_group = done_group; - scan->done_group_data = done_group_data; -} - -int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, - int clear_flags) -{ - int old_flags; - - if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) - return 0; - - old_flags = scan->scan_flags; - scan->scan_flags &= ~clear_flags; - scan->scan_flags |= set_flags; - return old_flags; -} - -/* - * This function is called by ext2fs_get_next_inode when it needs to - * get ready to read in a new blockgroup. - */ -static errcode_t get_next_blockgroup(ext2_inode_scan scan) -{ - scan->current_group++; - scan->groups_left--; - - scan->current_block = scan->fs-> - group_desc[scan->current_group].bg_inode_table; - - scan->bytes_left = 0; - scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); - scan->blocks_left = scan->fs->inode_blocks_per_group; - return 0; -} - -errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan, - int group) -{ - scan->current_group = group - 1; - scan->groups_left = scan->fs->group_desc_count - group; - return get_next_blockgroup(scan); -} - -/* - * This function is called by get_next_blocks() to check for bad - * blocks in the inode table. - * - * This function assumes that badblocks_list->list is sorted in - * increasing order. - */ -static errcode_t check_for_inode_bad_blocks(ext2_inode_scan scan, - int *num_blocks) -{ - blk_t blk = scan->current_block; - badblocks_list bb = scan->fs->badblocks; - - /* - * If the inode table is missing, then obviously there are no - * bad blocks. :-) - */ - if (blk == 0) - return 0; - - /* - * If the current block is greater than the bad block listed - * in the bad block list, then advance the pointer until this - * is no longer the case. If we run out of bad blocks, then - * we don't need to do any more checking! - */ - while (blk > bb->list[scan->bad_block_ptr]) { - if (++scan->bad_block_ptr >= bb->num) { - scan->scan_flags &= ~EXT2_SF_CHK_BADBLOCKS; - return 0; - } - } - - /* - * If the current block is equal to the bad block listed in - * the bad block list, then handle that one block specially. - * (We could try to handle runs of bad blocks, but that - * only increases CPU efficiency by a small amount, at the - * expense of a huge expense of code complexity, and for an - * uncommon case at that.) - */ - if (blk == bb->list[scan->bad_block_ptr]) { - scan->scan_flags |= EXT2_SF_BAD_INODE_BLK; - *num_blocks = 1; - if (++scan->bad_block_ptr >= bb->num) - scan->scan_flags &= ~EXT2_SF_CHK_BADBLOCKS; - return 0; - } - - /* - * If there is a bad block in the range that we're about to - * read in, adjust the number of blocks to read so that we we - * don't read in the bad block. (Then the next block to read - * will be the bad block, which is handled in the above case.) - */ - if ((blk + *num_blocks) > bb->list[scan->bad_block_ptr]) - *num_blocks = bb->list[scan->bad_block_ptr] - blk; - - return 0; -} - -/* - * This function is called by ext2fs_get_next_inode when it needs to - * read in more blocks from the current blockgroup's inode table. - */ -static errcode_t get_next_blocks(ext2_inode_scan scan) -{ - int num_blocks; - errcode_t retval; - - /* - * Figure out how many blocks to read; we read at most - * inode_buffer_blocks, and perhaps less if there aren't that - * many blocks left to read. - */ - num_blocks = scan->inode_buffer_blocks; - if (num_blocks > scan->blocks_left) - num_blocks = scan->blocks_left; - - /* - * If the past block "read" was a bad block, then mark the - * left-over extra bytes as also being bad. - */ - if (scan->scan_flags & EXT2_SF_BAD_INODE_BLK) { - if (scan->bytes_left) - scan->scan_flags |= EXT2_SF_BAD_EXTRA_BYTES; - scan->scan_flags &= ~EXT2_SF_BAD_INODE_BLK; - } - - /* - * Do inode bad block processing, if necessary. - */ - if (scan->scan_flags & EXT2_SF_CHK_BADBLOCKS) { - retval = check_for_inode_bad_blocks(scan, &num_blocks); - if (retval) - return retval; - } - - if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || - (scan->current_block == 0)) { - memset(scan->inode_buffer, 0, - num_blocks * scan->fs->blocksize); - } else { - retval = io_channel_read_blk(scan->fs->io, - scan->current_block, - num_blocks, scan->inode_buffer); - if (retval) - return EXT2_ET_NEXT_INODE_READ; - } - scan->ptr = scan->inode_buffer; - scan->bytes_left = num_blocks * scan->fs->blocksize; - - scan->blocks_left -= num_blocks; - if (scan->current_block) - scan->current_block += num_blocks; - return 0; -} - -errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino, - struct ext2_inode *inode) -{ - errcode_t retval; - int extra_bytes = 0; - - EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); - - /* - * Do we need to start reading a new block group? - */ - if (scan->inodes_left <= 0) { - retry: - if (scan->done_group) { - retval = (scan->done_group) - (scan->fs, scan, scan->current_group, - scan->done_group_data); - if (retval) - return retval; - } - if (scan->groups_left <= 0) { - *ino = 0; - return 0; - } - retval = get_next_blockgroup(scan); - if (retval) - return retval; - if (scan->current_block == 0) { - if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) { - goto retry; - } else - return EXT2_ET_MISSING_INODE_TABLE; - } - } - - /* - * Have we run out of space in the inode buffer? If so, we - * need to read in more blocks. - */ - if (scan->bytes_left < scan->inode_size) { - memcpy(scan->temp_buffer, scan->ptr, scan->bytes_left); - extra_bytes = scan->bytes_left; - - retval = get_next_blocks(scan); - if (retval) - return retval; - } - - retval = 0; - if (extra_bytes) { - memcpy(scan->temp_buffer+extra_bytes, scan->ptr, - scan->inode_size - extra_bytes); - scan->ptr += scan->inode_size - extra_bytes; - scan->bytes_left -= scan->inode_size - extra_bytes; - - if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode(scan->fs, inode, - (struct ext2_inode *) scan->temp_buffer, 0); - else - *inode = *((struct ext2_inode *) scan->temp_buffer); - if (scan->scan_flags & EXT2_SF_BAD_EXTRA_BYTES) - retval = EXT2_ET_BAD_BLOCK_IN_INODE_TABLE; - scan->scan_flags &= ~EXT2_SF_BAD_EXTRA_BYTES; - } else { - if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || - (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode(scan->fs, inode, - (struct ext2_inode *) scan->ptr, 0); - else - *inode = *((struct ext2_inode *) scan->ptr); - scan->ptr += scan->inode_size; - scan->bytes_left -= scan->inode_size; - if (scan->scan_flags & EXT2_SF_BAD_INODE_BLK) - retval = EXT2_ET_BAD_BLOCK_IN_INODE_TABLE; - } - - scan->inodes_left--; - scan->current_inode++; - *ino = scan->current_inode; - return retval; -} - -/* - * Functions to read and write a single inode. - */ -errcode_t ext2fs_read_inode (ext2_filsys fs, ino_t ino, - struct ext2_inode * inode) -{ - unsigned long group, block, block_nr, offset; - char *ptr; - errcode_t retval; - int clen, length, i; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - /* Check to see if user has an override function */ - if (fs->read_inode) { - retval = (fs->read_inode)(fs, ino, inode); - if (retval != EXT2_ET_CALLBACK_NOTHANDLED) - return retval; - } - /* Create inode cache if not present */ - if (!fs->icache) { - retval = create_icache(fs); - if (retval) - return retval; - } - /* Check to see if it's in the inode cache */ - for (i=0; i < fs->icache->cache_size; i++) { - if (fs->icache->cache[i].ino == ino) { - *inode = fs->icache->cache[i].inode; - return 0; - } - } - if (ino > fs->super->s_inodes_count) - return EXT2_ET_BAD_INODE_NUM; - group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); - offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * - EXT2_INODE_SIZE(fs->super); - block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); - if (!fs->group_desc[group].bg_inode_table) - return EXT2_ET_MISSING_INODE_TABLE; - block_nr = fs->group_desc[group].bg_inode_table + block; - if (block_nr != fs->icache->buffer_blk) { - retval = io_channel_read_blk(fs->io, block_nr, 1, - fs->icache->buffer); - if (retval) - return retval; - fs->icache->buffer_blk = block_nr; - } - offset &= (EXT2_BLOCK_SIZE(fs->super) - 1); - ptr = ((char *) fs->icache->buffer) + offset; - - memset(inode, 0, sizeof(struct ext2_inode)); - length = EXT2_INODE_SIZE(fs->super); - if (length > sizeof(struct ext2_inode)) - length = sizeof(struct ext2_inode); - - if ((offset + length) > EXT2_BLOCK_SIZE(fs->super)) { - clen = EXT2_BLOCK_SIZE(fs->super) - offset; - memcpy((char *) inode, ptr, clen); - length -= clen; - - retval = io_channel_read_blk(fs->io, block_nr+1, 1, - fs->icache->buffer); - if (retval) { - fs->icache->buffer_blk = 0; - return retval; - } - fs->icache->buffer_blk = block_nr+1; - - memcpy(((char *) inode) + clen, - fs->icache->buffer, length); - } else - memcpy((char *) inode, ptr, length); - - if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || - (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode(fs, inode, inode, 0); - - /* Update the inode cache */ - fs->icache->cache_last = (fs->icache->cache_last + 1) % - fs->icache->cache_size; - fs->icache->cache[fs->icache->cache_last].ino = ino; - fs->icache->cache[fs->icache->cache_last].inode = *inode; - - return 0; -} - -errcode_t ext2fs_write_inode(ext2_filsys fs, ino_t ino, - struct ext2_inode * inode) -{ - unsigned long group, block, block_nr, offset; - errcode_t retval; - struct ext2_inode temp_inode; - char *ptr; - int clen, length, i; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - /* Check to see if user provided an override function */ - if (fs->write_inode) { - retval = (fs->write_inode)(fs, ino, inode); - if (retval != EXT2_ET_CALLBACK_NOTHANDLED) - return retval; - } - - /* Check to see if the inode cache needs to be updated */ - if (fs->icache) { - for (i=0; i < fs->icache->cache_size; i++) { - if (fs->icache->cache[i].ino == ino) { - fs->icache->cache[i].inode = *inode; - break; - } - } - } else { - retval = create_icache(fs); - if (retval) - return retval; - } - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - - if (ino > fs->super->s_inodes_count) - return EXT2_ET_BAD_INODE_NUM; - - if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || - (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) - ext2fs_swap_inode(fs, &temp_inode, inode, 1); - else - memcpy(&temp_inode, inode, sizeof(struct ext2_inode)); - - group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); - offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * - EXT2_INODE_SIZE(fs->super); - block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); - if (!fs->group_desc[group].bg_inode_table) - return EXT2_ET_MISSING_INODE_TABLE; - block_nr = fs->group_desc[group].bg_inode_table + block; - offset &= (EXT2_BLOCK_SIZE(fs->super) - 1); - ptr = (char *) fs->icache->buffer + offset; - - length = EXT2_INODE_SIZE(fs->super); - clen = length; - if (length > sizeof(struct ext2_inode)) - length = sizeof(struct ext2_inode); - - if (fs->icache->buffer_blk != block_nr) { - retval = io_channel_read_blk(fs->io, block_nr, 1, - fs->icache->buffer); - if (retval) - return retval; - fs->icache->buffer_blk = block_nr; - } - - if ((offset + length) > EXT2_BLOCK_SIZE(fs->super)) { - clen = EXT2_BLOCK_SIZE(fs->super) - offset; - length -= clen; - } else { - length = 0; - } - memcpy(ptr, &temp_inode, clen); - retval = io_channel_write_blk(fs->io, block_nr, 1, fs->icache->buffer); - if (retval) - return retval; - - if (length) { - retval = io_channel_read_blk(fs->io, ++block_nr, 1, - fs->icache->buffer); - if (retval) { - fs->icache->buffer_blk = 0; - return retval; - } - fs->icache->buffer_blk = block_nr; - memcpy(fs->icache->buffer, ((char *) &temp_inode) + clen, - length); - - retval = io_channel_write_blk(fs->io, block_nr, 1, - fs->icache->buffer); - if (retval) - return retval; - } - - fs->flags |= EXT2_FLAG_CHANGED; - return 0; -} - -errcode_t ext2fs_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks) -{ - struct ext2_inode inode; - int i; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (ino > fs->super->s_inodes_count) - return EXT2_ET_BAD_INODE_NUM; - - if (fs->get_blocks) { - if (!(*fs->get_blocks)(fs, ino, blocks)) - return 0; - } - retval = ext2fs_read_inode(fs, ino, &inode); - if (retval) - return retval; - for (i=0; i < EXT2_N_BLOCKS; i++) - blocks[i] = inode.i_block[i]; - return 0; -} - -errcode_t ext2fs_check_directory(ext2_filsys fs, ino_t ino) -{ - struct ext2_inode inode; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (ino > fs->super->s_inodes_count) - return EXT2_ET_BAD_INODE_NUM; - - if (fs->check_directory) - return (fs->check_directory)(fs, ino); - retval = ext2fs_read_inode(fs, ino, &inode); - if (retval) - return retval; - if (!LINUX_S_ISDIR(inode.i_mode)) - return ENOTDIR; - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/io.h b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/io.h deleted file mode 100644 index fcd1a01f0a2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/io.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * io.h --- the I/O manager abstraction - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* - * ext2_loff_t is defined here since unix_io.c needs it. - */ -#if defined(__GNUC__) || defined(HAS_LONG_LONG) -typedef long long ext2_loff_t; -#else -typedef long ext2_loff_t; -#endif - -/* llseek.c */ -ext2_loff_t ext2fs_llseek (unsigned int, ext2_loff_t, unsigned int); - -typedef struct struct_io_manager *io_manager; -typedef struct struct_io_channel *io_channel; - -struct struct_io_channel { - int magic; - io_manager manager; - char *name; - int block_size; - errcode_t (*read_error)(io_channel channel, - unsigned long block, - int count, - void *data, - size_t size, - int actual_bytes_read, - errcode_t error); - errcode_t (*write_error)(io_channel channel, - unsigned long block, - int count, - const void *data, - size_t size, - int actual_bytes_written, - errcode_t error); - int refcount; - int reserved[15]; - void *private_data; -}; - -struct struct_io_manager { - int magic; - const char *name; - errcode_t (*open)(const char *name, int flags, io_channel *channel); - errcode_t (*close)(io_channel channel); - errcode_t (*set_blksize)(io_channel channel, int blksize); - errcode_t (*read_blk)(io_channel channel, unsigned long block, - int count, void *data); - errcode_t (*write_blk)(io_channel channel, unsigned long block, - int count, const void *data); - errcode_t (*flush)(io_channel channel); - int reserved[16]; -}; - -#define IO_FLAG_RW 1 - -/* - * Convenience functions.... - */ -#define io_channel_close(c) ((c)->manager->close((c))) -#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s)) -#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d)) -#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d)) -#define io_channel_flush(c) ((c)->manager->flush((c))) -#define io_channel_bumpcount(c) ((c)->refcount++) - -/* unix_io.c */ -extern io_manager unix_io_manager; - -/* test_io.c */ -extern io_manager test_io_manager, test_io_backing_manager; -extern void (*test_io_cb_read_blk) - (unsigned long block, int count, errcode_t err); -extern void (*test_io_cb_write_blk) - (unsigned long block, int count, errcode_t err); -extern void (*test_io_cb_set_blksize) - (int blksize, errcode_t err); diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/irel.h b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/irel.h deleted file mode 100644 index 9c7529ab382..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/irel.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * irel.h - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -struct ext2_inode_reference { - blk_t block; - __u16 offset; -}; - -struct ext2_inode_relocate_entry { - ino_t new; - ino_t orig; - __u16 flags; - __u16 max_refs; -}; - -typedef struct ext2_inode_relocation_table *ext2_irel; - -struct ext2_inode_relocation_table { - __u32 magic; - char *name; - ino_t current; - void *private; - - /* - * Add an inode relocation entry. - */ - errcode_t (*put)(ext2_irel irel, ino_t old, - struct ext2_inode_relocate_entry *ent); - /* - * Get an inode relocation entry. - */ - errcode_t (*get)(ext2_irel irel, ino_t old, - struct ext2_inode_relocate_entry *ent); - - /* - * Get an inode relocation entry by its original inode number - */ - errcode_t (*get_by_orig)(ext2_irel irel, ino_t orig, ino_t *old, - struct ext2_inode_relocate_entry *ent); - - /* - * Initialize for iterating over the inode relocation entries. - */ - errcode_t (*start_iter)(ext2_irel irel); - - /* - * The iterator function for the inode relocation entries. - * Returns an inode number of 0 when out of entries. - */ - errcode_t (*next)(ext2_irel irel, ino_t *old, - struct ext2_inode_relocate_entry *ent); - - /* - * Add an inode reference (i.e., note the fact that a - * particular block/offset contains a reference to an inode) - */ - errcode_t (*add_ref)(ext2_irel irel, ino_t ino, - struct ext2_inode_reference *ref); - - /* - * Initialize for iterating over the inode references for a - * particular inode. - */ - errcode_t (*start_iter_ref)(ext2_irel irel, ino_t ino); - - /* - * The iterator function for the inode references for an - * inode. The references for only one inode can be interator - * over at a time, as the iterator state is stored in ext2_irel. - */ - errcode_t (*next_ref)(ext2_irel irel, - struct ext2_inode_reference *ref); - - /* - * Move the inode relocation table from one inode number to - * another. Note that the inode references also must move. - */ - errcode_t (*move)(ext2_irel irel, ino_t old, ino_t new); - - /* - * Remove an inode relocation entry, along with all of the - * inode references. - */ - errcode_t (*delete)(ext2_irel irel, ino_t old); - - /* - * Free the inode relocation table. - */ - errcode_t (*free)(ext2_irel irel); -}; - -errcode_t ext2fs_irel_memarray_create(char *name, ino_t max_inode, - ext2_irel *irel); - -#define ext2fs_irel_put(irel, old, ent) ((irel)->put((irel), old, ent)) -#define ext2fs_irel_get(irel, old, ent) ((irel)->get((irel), old, ent)) -#define ext2fs_irel_get_by_orig(irel, orig, old, ent) \ - ((irel)->get_by_orig((irel), orig, old, ent)) -#define ext2fs_irel_start_iter(irel) ((irel)->start_iter((irel))) -#define ext2fs_irel_next(irel, old, ent) ((irel)->next((irel), old, ent)) -#define ext2fs_irel_add_ref(irel, ino, ref) ((irel)->add_ref((irel), ino, ref)) -#define ext2fs_irel_start_iter_ref(irel, ino) ((irel)->start_iter_ref((irel), ino)) -#define ext2fs_irel_next_ref(irel, ref) ((irel)->next_ref((irel), ref)) -#define ext2fs_irel_move(irel, old, new) ((irel)->move((irel), old, new)) -#define ext2fs_irel_delete(irel, old) ((irel)->delete((irel), old)) -#define ext2fs_irel_free(irel) ((irel)->free((irel))) diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/irel_ma.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/irel_ma.c deleted file mode 100644 index 1bb3af6a69c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/irel_ma.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * irel_ma.c - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" -#include "irel.h" - -static errcode_t ima_put(ext2_irel irel, ino_t old, - struct ext2_inode_relocate_entry *ent); -static errcode_t ima_get(ext2_irel irel, ino_t old, - struct ext2_inode_relocate_entry *ent); -static errcode_t ima_get_by_orig(ext2_irel irel, ino_t orig, ino_t *old, - struct ext2_inode_relocate_entry *ent); -static errcode_t ima_start_iter(ext2_irel irel); -static errcode_t ima_next(ext2_irel irel, ino_t *old, - struct ext2_inode_relocate_entry *ent); -static errcode_t ima_add_ref(ext2_irel irel, ino_t ino, - struct ext2_inode_reference *ref); -static errcode_t ima_start_iter_ref(ext2_irel irel, ino_t ino); -static errcode_t ima_next_ref(ext2_irel irel, struct ext2_inode_reference *ref); -static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new); -static errcode_t ima_delete(ext2_irel irel, ino_t old); -static errcode_t ima_free(ext2_irel irel); - -/* - * This data structure stores the array of inode references; there is - * a structure for each inode. - */ -struct inode_reference_entry { - __u16 num; - struct ext2_inode_reference *refs; -}; - -struct irel_ma { - __u32 magic; - ino_t max_inode; - ino_t ref_current; - int ref_iter; - ino_t *orig_map; - struct ext2_inode_relocate_entry *entries; - struct inode_reference_entry *ref_entries; -}; - -errcode_t ext2fs_irel_memarray_create(char *name, ino_t max_inode, - ext2_irel *new_irel) -{ - ext2_irel irel = 0; - errcode_t retval; - struct irel_ma *ma = 0; - size_t size; - - *new_irel = 0; - - /* - * Allocate memory structures - */ - retval = ENOMEM; - irel = malloc(sizeof(struct ext2_inode_relocation_table)); - if (!irel) - goto errout; - memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); - - irel->name = malloc(strlen(name)+1); - if (!irel->name) - goto errout; - strcpy(irel->name, name); - - ma = malloc(sizeof(struct irel_ma)); - if (!ma) - goto errout; - memset(ma, 0, sizeof(struct irel_ma)); - irel->private = ma; - - size = sizeof(ino_t) * (max_inode+1); - ma->orig_map = malloc(size); - if (!ma->orig_map) - goto errout; - memset(ma->orig_map, 0, size); - - size = sizeof(struct ext2_inode_relocate_entry) * (max_inode+1); - ma->entries = malloc(size); - if (!ma->entries) - goto errout; - memset(ma->entries, 0, size); - - size = sizeof(struct inode_reference_entry) * (max_inode+1); - ma->ref_entries = malloc(size); - if (!ma->ref_entries) - goto errout; - memset(ma->ref_entries, 0, size); - ma->max_inode = max_inode; - - /* - * Fill in the irel data structure - */ - irel->put = ima_put; - irel->get = ima_get; - irel->get_by_orig = ima_get_by_orig; - irel->start_iter = ima_start_iter; - irel->next = ima_next; - irel->add_ref = ima_add_ref; - irel->start_iter_ref = ima_start_iter_ref; - irel->next_ref = ima_next_ref; - irel->move = ima_move; - irel->delete = ima_delete; - irel->free = ima_free; - - *new_irel = irel; - return 0; - -errout: - ima_free(irel); - return retval; -} - -static errcode_t ima_put(ext2_irel irel, ino_t old, - struct ext2_inode_relocate_entry *ent) -{ - struct irel_ma *ma; - struct inode_reference_entry *ref_ent; - struct ext2_inode_reference *new_refs; - int size; - - ma = irel->private; - if (old > ma->max_inode) - return EINVAL; - - /* - * Force the orig field to the correct value; the application - * program shouldn't be messing with this field. - */ - if (ma->entries[old].new == 0) - ent->orig = old; - else - ent->orig = ma->entries[old].orig; - - /* - * If max_refs has changed, reallocate the refs array - */ - ref_ent = ma->ref_entries + old; - if (ref_ent->refs && ent->max_refs != ma->entries[old].max_refs) { - size = (sizeof(struct ext2_inode_reference) * ent->max_refs); - new_refs = realloc(ref_ent->refs, size); - if (!new_refs) - return ENOMEM; - ref_ent->refs = new_refs; - } - - ma->entries[old] = *ent; - ma->orig_map[ent->orig] = old; - return 0; -} - -static errcode_t ima_get(ext2_irel irel, ino_t old, - struct ext2_inode_relocate_entry *ent) -{ - struct irel_ma *ma; - - ma = irel->private; - if (old > ma->max_inode) - return EINVAL; - if (ma->entries[old].new == 0) - return ENOENT; - *ent = ma->entries[old]; - return 0; -} - -static errcode_t ima_get_by_orig(ext2_irel irel, ino_t orig, ino_t *old, - struct ext2_inode_relocate_entry *ent) -{ - struct irel_ma *ma; - ino_t ino; - - ma = irel->private; - if (orig > ma->max_inode) - return EINVAL; - ino = ma->orig_map[orig]; - if (ino == 0) - return ENOENT; - *old = ino; - *ent = ma->entries[ino]; - return 0; -} - -static errcode_t ima_start_iter(ext2_irel irel) -{ - irel->current = 0; - return 0; -} - -static errcode_t ima_next(ext2_irel irel, ino_t *old, - struct ext2_inode_relocate_entry *ent) -{ - struct irel_ma *ma; - - ma = irel->private; - while (++irel->current < ma->max_inode) { - if (ma->entries[irel->current].new == 0) - continue; - *old = irel->current; - *ent = ma->entries[irel->current]; - return 0; - } - *old = 0; - return 0; -} - -static errcode_t ima_add_ref(ext2_irel irel, ino_t ino, - struct ext2_inode_reference *ref) -{ - struct irel_ma *ma; - size_t size; - struct inode_reference_entry *ref_ent; - struct ext2_inode_relocate_entry *ent; - - ma = irel->private; - if (ino > ma->max_inode) - return EINVAL; - - ref_ent = ma->ref_entries + ino; - ent = ma->entries + ino; - - /* - * If the inode reference array doesn't exist, create it. - */ - if (ref_ent->refs == 0) { - size = (sizeof(struct ext2_inode_reference) * ent->max_refs); - ref_ent->refs = malloc(size); - if (ref_ent->refs == 0) - return ENOMEM; - memset(ref_ent->refs, 0, size); - ref_ent->num = 0; - } - - if (ref_ent->num >= ent->max_refs) - return ENOSPC; - - ref_ent->refs[ref_ent->num++] = *ref; - return 0; -} - -static errcode_t ima_start_iter_ref(ext2_irel irel, ino_t ino) -{ - struct irel_ma *ma; - - ma = irel->private; - if (ino > ma->max_inode) - return EINVAL; - if (ma->entries[ino].new == 0) - return ENOENT; - ma->ref_current = ino; - ma->ref_iter = 0; - return 0; -} - -static errcode_t ima_next_ref(ext2_irel irel, - struct ext2_inode_reference *ref) -{ - struct irel_ma *ma; - struct inode_reference_entry *ref_ent; - - ma = irel->private; - - ref_ent = ma->ref_entries + ma->ref_current; - - if ((ref_ent->refs == NULL) || - (ma->ref_iter >= ref_ent->num)) { - ref->block = 0; - ref->offset = 0; - return 0; - } - *ref = ref_ent->refs[ma->ref_iter++]; - return 0; -} - - -static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new) -{ - struct irel_ma *ma; - - ma = irel->private; - if ((old > ma->max_inode) || (new > ma->max_inode)) - return EINVAL; - if (ma->entries[old].new == 0) - return ENOENT; - - ma->entries[new] = ma->entries[old]; - if (ma->ref_entries[new].refs) - free(ma->ref_entries[new].refs); - ma->ref_entries[new] = ma->ref_entries[old]; - - ma->entries[old].new = 0; - ma->ref_entries[old].num = 0; - ma->ref_entries[old].refs = 0; - - ma->orig_map[ma->entries[new].orig] = new; - return 0; -} - -static errcode_t ima_delete(ext2_irel irel, ino_t old) -{ - struct irel_ma *ma; - - ma = irel->private; - if (old > ma->max_inode) - return EINVAL; - if (ma->entries[old].new == 0) - return ENOENT; - - ma->entries[old].new = 0; - if (ma->ref_entries[old].refs) - free(ma->ref_entries[old].refs); - ma->orig_map[ma->entries[old].orig] = 0; - - ma->ref_entries[old].num = 0; - ma->ref_entries[old].refs = 0; - return 0; -} - -static errcode_t ima_free(ext2_irel irel) -{ - struct irel_ma *ma; - ino_t ino; - - if (!irel) - return 0; - - ma = irel->private; - - if (ma) { - if (ma->orig_map) - free (ma->orig_map); - if (ma->entries) - free (ma->entries); - if (ma->ref_entries) { - for (ino = 0; ino <= ma->max_inode; ino++) { - if (ma->ref_entries[ino].refs) - free(ma->ref_entries[ino].refs); - } - free(ma->ref_entries); - } - free(ma); - } - if (irel->name) - free(irel->name); - free (irel); - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ismounted.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ismounted.c deleted file mode 100644 index 9c2593cc50d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/ismounted.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * ismounted.c --- Check to see if the filesystem was mounted - * - * Copyright (C) 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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. - */ -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/gnu/usr.sbin/e2fsprogs/lib/ext2fs/link.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/link.c deleted file mode 100644 index 933dfa83670..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/link.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * link.c --- create links in a ext2fs directory - * - * Copyright (C) 1993, 1994 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct link_struct { - const char *name; - int namelen; - ino_t inode; - int flags; - int done; -}; - -static int link_proc(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private) -{ - struct link_struct *ls = (struct link_struct *) private; - struct ext2_dir_entry *next; - int rec_len; - int ret = 0; - - rec_len = EXT2_DIR_REC_LEN(ls->namelen); - - /* - * See if the following directory entry (if any) is unused; - * if so, absorb it into this one. - */ - next = (struct ext2_dir_entry *) (buf + offset + dirent->rec_len); - if ((offset + dirent->rec_len < blocksize - 8) && - (next->inode == 0) && - (offset + dirent->rec_len + next->rec_len <= blocksize)) { - dirent->rec_len += next->rec_len; - ret = DIRENT_CHANGED; - } - - /* - * If the directory entry is used, see if we can split the - * directory entry to make room for the new name. If so, - * truncate it and return. - */ - if (dirent->inode) { - if (dirent->rec_len < (EXT2_DIR_REC_LEN(dirent->name_len) + - rec_len)) - return ret; - rec_len = dirent->rec_len - EXT2_DIR_REC_LEN(dirent->name_len); - dirent->rec_len = EXT2_DIR_REC_LEN(dirent->name_len); - next = (struct ext2_dir_entry *) (buf + offset + - dirent->rec_len); - next->inode = 0; - next->name_len = 0; - next->rec_len = rec_len; - return DIRENT_CHANGED; - } - - /* - * If we get this far, then the directory entry is not used. - * See if we can fit the request entry in. If so, do it. - */ - if (dirent->rec_len < rec_len) - return ret; - dirent->inode = ls->inode; - dirent->name_len = ls->namelen; - strncpy(dirent->name, ls->name, ls->namelen); - - ls->done++; - return DIRENT_ABORT|DIRENT_CHANGED; -} - -errcode_t ext2fs_link(ext2_filsys fs, ino_t dir, const char *name, ino_t ino, - int flags) -{ - errcode_t retval; - struct link_struct ls; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - - ls.name = name; - ls.namelen = name ? strlen(name) : 0; - ls.inode = ino; - ls.flags = 0; - ls.done = 0; - - retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, - 0, link_proc, &ls); - if (retval) - return retval; - - return (ls.done) ? 0 : EXT2_ET_DIR_NO_SPACE; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/llseek.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/llseek.c deleted file mode 100644 index 71a9d910a20..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/llseek.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * llseek.c -- stub calling the llseek system call - * - * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <sys/types.h> - -#include <errno.h> -#include <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 - -static int _llseek (unsigned int, unsigned long, - unsigned long, ext2_loff_t *, unsigned int); - -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 ext2fs_llseek (unsigned int fd, ext2_loff_t offset, - unsigned int origin) -{ - ext2_loff_t result; - 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) { - errno = EINVAL; - return -1; - } - - 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++; - errno = EINVAL; - } - return result; -} - -#else /* !linux */ - -ext2_loff_t ext2fs_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; - return -1; - } - return lseek (fd, (off_t) offset, origin); -} - -#endif /* linux */ - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/lookup.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/lookup.c deleted file mode 100644 index 5cded5ff9e0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/lookup.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * lookup.c --- ext2fs directory lookup operations - * - * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct lookup_struct { - const char *name; - int len; - ino_t *inode; - int found; -}; - -static int lookup_proc(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private) -{ - struct lookup_struct *ls = (struct lookup_struct *) private; - - if (ls->len != dirent->name_len) - return 0; - if (strncmp(ls->name, dirent->name, dirent->name_len)) - return 0; - *ls->inode = dirent->inode; - ls->found++; - return DIRENT_ABORT; -} - - -errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name, - int namelen, char *buf, ino_t *inode) -{ - errcode_t retval; - struct lookup_struct ls; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - ls.name = name; - ls.len = namelen; - ls.inode = inode; - ls.found = 0; - - retval = ext2fs_dir_iterate(fs, dir, 0, buf, lookup_proc, &ls); - if (retval) - return retval; - - return (ls.found) ? 0 : ENOENT; -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/mkdir.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/mkdir.c deleted file mode 100644 index 67a2046d0ad..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/mkdir.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * mkdir.c --- make a directory in the filesystem - * - * Copyright (C) 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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_mkdir(ext2_filsys fs, ino_t parent, ino_t inum, - const char *name) -{ - errcode_t retval; - struct ext2_inode inode; - ino_t ino = inum; - ino_t scratch_ino; - blk_t blk; - char *block = 0; - int group; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - /* - * Allocate an inode, if necessary - */ - if (!ino) { - retval = ext2fs_new_inode(fs, parent, LINUX_S_IFDIR | 0755, - 0, &ino); - if (retval) - goto cleanup; - } - - /* - * Allocate a data block for the directory - */ - retval = ext2fs_new_block(fs, 0, 0, &blk); - if (retval) - goto cleanup; - - /* - * Create a scratch template for the directory - */ - retval = ext2fs_new_dir_block(fs, ino, parent, &block); - if (retval) - goto cleanup; - - /* - * Create the inode structure.... - */ - memset(&inode, 0, sizeof(struct ext2_inode)); - 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; - inode.i_links_count = 2; - inode.i_ctime = inode.i_atime = inode.i_mtime = time(NULL); - inode.i_size = fs->blocksize; - - /* - * Write out the inode and inode data block - */ - retval = ext2fs_write_dir_block(fs, blk, block); - if (retval) - goto cleanup; - retval = ext2fs_write_inode(fs, ino, &inode); - if (retval) - goto cleanup; - - /* - * Update parent inode's counts - */ - if (parent != ino) { - retval = ext2fs_read_inode(fs, parent, &inode); - if (retval) - goto cleanup; - inode.i_links_count++; - retval = ext2fs_write_inode(fs, parent, &inode); - if (retval) - goto cleanup; - } - - /* - * Link the directory into the filesystem hierarchy - */ - if (name) { - retval = ext2fs_lookup(fs, parent, name, strlen(name), 0, - &scratch_ino); - if (!retval) { - retval = EEXIST; - name = 0; - goto cleanup; - } - if (retval != ENOENT) - goto cleanup; - retval = ext2fs_link(fs, parent, name, ino, 0); - if (retval) - goto cleanup; - } - - /* - * Update accounting.... - */ - ext2fs_mark_block_bitmap(fs->block_map, blk); - ext2fs_mark_bb_dirty(fs); - ext2fs_mark_inode_bitmap(fs->inode_map, ino); - ext2fs_mark_ib_dirty(fs); - - group = ext2fs_group_of_blk(fs, blk); - fs->group_desc[group].bg_free_blocks_count--; - group = ext2fs_group_of_ino(fs, ino); - fs->group_desc[group].bg_free_inodes_count--; - fs->group_desc[group].bg_used_dirs_count++; - fs->super->s_free_blocks_count--; - fs->super->s_free_inodes_count--; - ext2fs_mark_super_dirty(fs); - -cleanup: - if (block) - free(block); - return retval; - -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/namei.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/namei.c deleted file mode 100644 index ae39eecd8d7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/namei.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * namei.c --- ext2fs directory lookup operations - * - * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -/* #define NAMEI_DEBUG */ - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -static errcode_t open_namei(ext2_filsys fs, ino_t root, ino_t base, - const char *pathname, int pathlen, int follow, - int link_count, char *buf, ino_t *res_inode); - -static errcode_t follow_link(ext2_filsys fs, ino_t root, ino_t dir, - ino_t inode, int link_count, - char *buf, ino_t *res_inode) -{ - char *pathname; - char *buffer = 0; - errcode_t retval; - struct ext2_inode ei; - -#ifdef NAMEI_DEBUG - printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", - root, dir, inode, link_count); - -#endif - retval = ext2fs_read_inode (fs, inode, &ei); - if (retval) return retval; - if (!LINUX_S_ISLNK (ei.i_mode)) { - *res_inode = inode; - return 0; - } - if (link_count++ > 5) { - return EXT2_ET_SYMLINK_LOOP; - } - if (ei.i_blocks) { - buffer = malloc (fs->blocksize); - if (!buffer) - return ENOMEM; - retval = io_channel_read_blk(fs->io, ei.i_block[0], 1, buffer); - if (retval) { - free(buffer); - return retval; - } - pathname = buffer; - } else - pathname = (char *)&(ei.i_block[0]); - retval = open_namei(fs, root, dir, pathname, ei.i_size, 1, - link_count, buf, res_inode); - if (buffer) - free (buffer); - return retval; -} - -/* - * This routine interprets a pathname in the context of the current - * directory and the root directory, and returns the inode of the - * containing directory, and a pointer to the filename of the file - * (pointing into the pathname) and the length of the filename. - */ -static errcode_t dir_namei(ext2_filsys fs, ino_t root, ino_t dir, - const char *pathname, int pathlen, - int link_count, char *buf, - const char **name, int *namelen, ino_t *res_inode) -{ - char c; - const char *thisname; - int len; - ino_t inode; - errcode_t retval; - - if ((c = *pathname) == '/') { - dir = root; - pathname++; - pathlen--; - } - while (1) { - thisname = pathname; - for (len=0; --pathlen >= 0;len++) { - c = *(pathname++); - if (c == '/') - break; - } - if (pathlen < 0) - break; - retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); - if (retval) return retval; - retval = follow_link (fs, root, dir, inode, - link_count, buf, &dir); - if (retval) return retval; - } - *name = thisname; - *namelen = len; - *res_inode = dir; - return 0; -} - -static errcode_t open_namei(ext2_filsys fs, ino_t root, ino_t base, - const char *pathname, int pathlen, int follow, - int link_count, char *buf, ino_t *res_inode) -{ - const char *basename; - int namelen; - ino_t dir, inode; - errcode_t retval; - -#ifdef NAMEI_DEBUG - printf("open_namei: root=%lu, dir=%lu, path=%*s, lc=%d\n", - root, base, pathlen, pathname, link_count); -#endif - retval = dir_namei(fs, root, base, pathname, pathlen, - link_count, buf, &basename, &namelen, &dir); - if (retval) return retval; - if (!namelen) { /* special case: '/usr/' etc */ - *res_inode=dir; - return 0; - } - retval = ext2fs_lookup (fs, dir, basename, namelen, buf, &inode); - if (retval) - return retval; - if (follow) { - retval = follow_link(fs, root, dir, inode, link_count, - buf, &inode); - if (retval) - return retval; - } -#ifdef NAMEI_DEBUG - printf("open_namei: (link_count=%d) returns %lu\n", - link_count, inode); -#endif - *res_inode = inode; - return 0; -} - -errcode_t ext2fs_namei(ext2_filsys fs, ino_t root, ino_t cwd, - const char *name, ino_t *inode) -{ - char *buf; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - buf = malloc(fs->blocksize); - if (!buf) - return ENOMEM; - - retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, - buf, inode); - - free(buf); - return retval; -} - -errcode_t ext2fs_namei_follow(ext2_filsys fs, ino_t root, ino_t cwd, - const char *name, ino_t *inode) -{ - char *buf; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - buf = malloc(fs->blocksize); - if (!buf) - return ENOMEM; - - retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, - buf, inode); - - free(buf); - return retval; -} - -extern errcode_t ext2fs_follow_link(ext2_filsys fs, ino_t root, ino_t cwd, - ino_t inode, ino_t *res_inode) -{ - char *buf; - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - buf = malloc(fs->blocksize); - if (!buf) - return ENOMEM; - - retval = follow_link(fs, root, cwd, inode, 0, buf, res_inode); - - free(buf); - return retval; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/native.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/native.c deleted file mode 100644 index 3fdc4a0fb4c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/native.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * native.c --- returns the ext2_flag for a native byte order - * - * Copyright (C) 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -static int i386_byteorder(void) -{ - int one = 1; - char *cp = (char *) &one; - - return (*cp == 1); -} - -int ext2fs_native_flag(void) -{ - if (i386_byteorder()) - return 0; - return EXT2_FLAG_SWAP_BYTES; -} - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/newdir.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/newdir.c deleted file mode 100644 index 863960fac1a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/newdir.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * newdir.c --- create a new directory block - * - * Copyright (C) 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -/* - * Create new directory block - */ -errcode_t ext2fs_new_dir_block(ext2_filsys fs, ino_t dir_ino, ino_t parent_ino, - char **block) -{ - char *buf; - struct ext2_dir_entry *dir = NULL; - int rec_len; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - buf = malloc(fs->blocksize); - if (!buf) - return ENOMEM; - memset(buf, 0, fs->blocksize); - dir = (struct ext2_dir_entry *) buf; - dir->rec_len = fs->blocksize; - - if (dir_ino) { - /* - * Set up entry for '.' - */ - dir->inode = dir_ino; - dir->name_len = 1; - dir->name[0] = '.'; - rec_len = dir->rec_len - EXT2_DIR_REC_LEN(dir->name_len); - dir->rec_len = EXT2_DIR_REC_LEN(dir->name_len); - - /* - * Set up entry for '..' - */ - dir = (struct ext2_dir_entry *) (buf + dir->rec_len); - dir->rec_len = rec_len; - dir->inode = parent_ino; - dir->name_len = 2; - dir->name[0] = '.'; - dir->name[1] = '.'; - - } - *block = buf; - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/openfs.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/openfs.c deleted file mode 100644 index a1c0d5bcbf0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/openfs.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * openfs.c --- open an ext2 filesystem - * - * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -/* - * Note: if superblock is non-zero, block-size must also be non-zero. - * Superblock and block_size can be zero to use the default size. - * - * Valid flags for ext2fs_open() - * - * EXT2_FLAG_RW - Open the filesystem for read/write. - * EXT2_FLAG_FORCE - Open the filesystem even if some of the - * features aren't supported. - */ -errcode_t ext2fs_open(const char *name, int flags, int superblock, - int block_size, io_manager manager, ext2_filsys *ret_fs) -{ - ext2_filsys fs; - errcode_t retval; - int i, j, group_block, groups_per_block; - char *dest; - struct ext2_group_desc *gdp; - struct ext2fs_sb *s; - - EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); - - fs = (ext2_filsys) malloc(sizeof(struct struct_ext2_filsys)); - if (!fs) - return ENOMEM; - - memset(fs, 0, sizeof(struct struct_ext2_filsys)); - fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; - fs->flags = flags; - retval = manager->open(name, (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, - &fs->io); - if (retval) - goto cleanup; - fs->device_name = malloc(strlen(name)+1); - if (!fs->device_name) { - retval = ENOMEM; - goto cleanup; - } - strcpy(fs->device_name, name); - fs->super = malloc(SUPERBLOCK_SIZE); - if (!fs->super) { - retval = ENOMEM; - goto cleanup; - } - - /* - * If the user specifies a specific block # for the - * superblock, then he/she must also specify the block size! - * Otherwise, read the master superblock located at offset - * SUPERBLOCK_OFFSET from the start of the partition. - */ - if (superblock) { - if (!block_size) { - retval = EINVAL; - goto cleanup; - } - io_channel_set_blksize(fs->io, block_size); - group_block = superblock + 1; - } else { - io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET); - superblock = 1; - group_block = 0; - } - retval = io_channel_read_blk(fs->io, superblock, -SUPERBLOCK_SIZE, - fs->super); - if (retval) - goto cleanup; - - if ((fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) || - (fs->flags & EXT2_FLAG_SWAP_BYTES)) { - fs->flags |= EXT2_FLAG_SWAP_BYTES; - - ext2fs_swap_super(fs->super); - } - - if (fs->super->s_magic != EXT2_SUPER_MAGIC) { - retval = EXT2_ET_BAD_MAGIC; - goto cleanup; - } -#ifdef EXT2_DYNAMIC_REV - if (fs->super->s_rev_level > EXT2_DYNAMIC_REV) { - retval = EXT2_ET_REV_TOO_HIGH; - goto cleanup; - } -#else -#ifdef EXT2_CURRENT_REV - if (fs->super->s_rev_level > EXT2_LIB_CURRENT_REV) { - retval = EXT2_ET_REV_TOO_HIGH; - goto cleanup; - } -#endif -#endif - /* - * Check for feature set incompatibility - */ - if (!(flags & EXT2_FLAG_FORCE)) { - s = (struct ext2fs_sb *) fs->super; - if (s->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) { - retval = EXT2_ET_UNSUPP_FEATURE; - goto cleanup; - } - if ((flags & EXT2_FLAG_RW) && - (s->s_feature_ro_compat & - ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP)) { - retval = EXT2_ET_RO_UNSUPP_FEATURE; - goto cleanup; - } - } - - fs->blocksize = EXT2_BLOCK_SIZE(fs->super); - if (fs->blocksize == 0) { - retval = EXT2_ET_CORRUPT_SUPERBLOCK; - goto cleanup; - } - fs->fragsize = EXT2_FRAG_SIZE(fs->super); - fs->inode_blocks_per_group = ((fs->super->s_inodes_per_group * - EXT2_INODE_SIZE(fs->super) + - EXT2_BLOCK_SIZE(fs->super) - 1) / - EXT2_BLOCK_SIZE(fs->super)); - if (block_size) { - if (block_size != fs->blocksize) { - retval = EXT2_ET_UNEXPECTED_BLOCK_SIZE; - goto cleanup; - } - } - /* - * Set the blocksize to the filesystem's blocksize. - */ - io_channel_set_blksize(fs->io, fs->blocksize); - - /* - * Read group descriptors - */ - fs->group_desc_count = (fs->super->s_blocks_count - - fs->super->s_first_data_block + - EXT2_BLOCKS_PER_GROUP(fs->super) - 1) - / EXT2_BLOCKS_PER_GROUP(fs->super); - fs->desc_blocks = (fs->group_desc_count + - EXT2_DESC_PER_BLOCK(fs->super) - 1) - / EXT2_DESC_PER_BLOCK(fs->super); - fs->group_desc = malloc(fs->desc_blocks * fs->blocksize); - if (!fs->group_desc) { - retval = ENOMEM; - goto cleanup; - } - if (!group_block) - group_block = fs->super->s_first_data_block + 1; - dest = (char *) fs->group_desc; - for (i=0 ; i < fs->desc_blocks; i++) { - retval = io_channel_read_blk(fs->io, group_block, 1, dest); - if (retval) - goto cleanup; - group_block++; - if (fs->flags & EXT2_FLAG_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; - } - - *ret_fs = fs; - return 0; -cleanup: - ext2fs_free(fs); - return retval; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/read_bb.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/read_bb.c deleted file mode 100644 index 3fabddd2dd0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/read_bb.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * read_bb --- read the bad blocks inode - * - * Copyright (C) 1994 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct read_bb_record { - ext2_badblocks_list bb_list; - errcode_t err; -}; - -/* - * Helper function for ext2fs_read_bb_inode() - */ -static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, - int blockcnt, void *private) -{ - struct read_bb_record *rb = (struct read_bb_record *) private; - - if (blockcnt < 0) - return 0; - - rb->err = ext2fs_badblocks_list_add(rb->bb_list, *block_nr); - if (rb->err) - return BLOCK_ABORT; - return 0; -} - -/* - * Reads the current bad blocks from the bad blocks inode. - */ -errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list) -{ - errcode_t retval; - struct read_bb_record rb; - struct ext2_inode inode; - int numblocks; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!*bb_list) { - retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); - if (retval) - return retval; - numblocks = (inode.i_blocks / (fs->blocksize / 512)) + 20; - retval = ext2fs_badblocks_list_create(bb_list, numblocks); - if (retval) - return retval; - } - - rb.bb_list = *bb_list; - rb.err = 0; - retval = ext2fs_block_iterate(fs, EXT2_BAD_INO, 0, 0, - mark_bad_block, &rb); - if (retval) - return retval; - - return rb.err; -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/read_bb_file.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/read_bb_file.c deleted file mode 100644 index 16c2e0b0cd0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/read_bb_file.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * read_bb_file.c --- read a list of bad blocks for a FILE * - * - * Copyright (C) 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -/* - * Reads a list of bad blocks from a FILE * - */ -errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, - ext2_badblocks_list *bb_list, - void (*invalid)(ext2_filsys fs, blk_t blk)) -{ - errcode_t retval; - blk_t blockno; - int count; - char buf[128]; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!*bb_list) { - retval = ext2fs_badblocks_list_create(bb_list, 10); - if (retval) - return retval; - } - - while (!feof (f)) { - if (fgets(buf, sizeof(buf), f) == NULL) - break; - count = sscanf(buf, "%u", &blockno); - if (count <= 0) - continue; - if ((blockno < fs->super->s_first_data_block) || - (blockno >= fs->super->s_blocks_count)) { - if (invalid) - (invalid)(fs, blockno); - continue; - } - retval = ext2fs_badblocks_list_add(*bb_list, blockno); - if (retval) - return retval; - } - return 0; -} - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/rs_bitmap.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/rs_bitmap.c deleted file mode 100644 index 901785349b8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/rs_bitmap.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * rs_bitmap.c --- routine for changing the size of a bitmap - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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_resize_generic_bitmap(__u32 new_end, __u32 new_real_end, - ext2fs_generic_bitmap bmap) -{ - size_t size, new_size; - char *new_bitmap; - - if (!bmap) - return EINVAL; - - EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_GENERIC_BITMAP); - - if (new_real_end == bmap->real_end) { - bmap->end = new_end; - return 0; - } - - size = ((bmap->real_end - bmap->start) / 8) + 1; - new_size = ((new_real_end - bmap->start) / 8) + 1; - - new_bitmap = realloc(bmap->bitmap, new_size); - if (!new_bitmap) - return ENOMEM; - if (new_size > size) - memset(new_bitmap + size, 0, new_size - size); - - bmap->bitmap = new_bitmap; - bmap->end = new_end; - bmap->real_end = new_real_end; - return 0; -} - -errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, - ext2fs_inode_bitmap bmap) -{ - errcode_t retval; - - if (!bmap) - return EINVAL; - - EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_INODE_BITMAP); - - bmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP; - retval = ext2fs_resize_generic_bitmap(new_end, new_real_end, - bmap); - bmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; - return retval; -} - -errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, - ext2fs_block_bitmap bmap) -{ - errcode_t retval; - - if (!bmap) - return EINVAL; - - EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_BLOCK_BITMAP); - - bmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP; - retval = ext2fs_resize_generic_bitmap(new_end, new_real_end, - bmap); - bmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; - return retval; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/rw_bitmaps.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/rw_bitmaps.c deleted file mode 100644 index e9bb58c4819..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/rw_bitmaps.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * rw_bitmaps.c --- routines to read and write the inode and block bitmaps. - * - * Copyright (C) 1993, 1994, 1994, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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_write_inode_bitmap(ext2_filsys fs) -{ - int i; - int nbytes; - errcode_t retval; - char * inode_bitmap = fs->inode_map->bitmap; - char * bitmap_block = NULL; - blk_t blk; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - if (!inode_bitmap) - return 0; - nbytes = (EXT2_INODES_PER_GROUP(fs->super)+7) / 8; - - bitmap_block = malloc(fs->blocksize); - if (!bitmap_block) - return ENOMEM; - memset(bitmap_block, 0xff, fs->blocksize); - for (i = 0; i < fs->group_desc_count; i++) { - memcpy(bitmap_block, inode_bitmap, nbytes); - blk = fs->group_desc[i].bg_inode_bitmap; - if (blk) { - retval = io_channel_write_blk(fs->io, blk, 1, - bitmap_block); - if (retval) - return EXT2_ET_INODE_BITMAP_WRITE; - } - inode_bitmap += nbytes; - } - fs->flags |= EXT2_FLAG_CHANGED; - fs->flags &= ~EXT2_FLAG_IB_DIRTY; - free(bitmap_block); - return 0; -} - -errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) -{ - int i; - int j; - int nbytes; - int nbits; - errcode_t retval; - char * block_bitmap = fs->block_map->bitmap; - char * bitmap_block = NULL; - blk_t blk; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - if (!block_bitmap) - return 0; - nbytes = EXT2_BLOCKS_PER_GROUP(fs->super) / 8; - bitmap_block = malloc(fs->blocksize); - if (!bitmap_block) - return ENOMEM; - memset(bitmap_block, 0xff, fs->blocksize); - for (i = 0; i < fs->group_desc_count; i++) { - memcpy(bitmap_block, block_bitmap, nbytes); - if (i == fs->group_desc_count - 1) { - /* Force bitmap padding for the last group */ - nbits = (fs->super->s_blocks_count - - fs->super->s_first_data_block) - % EXT2_BLOCKS_PER_GROUP(fs->super); - if (nbits) - for (j = nbits; j < fs->blocksize * 8; j++) - ext2fs_set_bit(j, bitmap_block); - } - blk = fs->group_desc[i].bg_block_bitmap; - if (blk) { - retval = io_channel_write_blk(fs->io, blk, 1, - bitmap_block); - if (retval) - return EXT2_ET_BLOCK_BITMAP_WRITE; - } - block_bitmap += nbytes; - } - fs->flags |= EXT2_FLAG_CHANGED; - fs->flags &= ~EXT2_FLAG_BB_DIRTY; - free(bitmap_block); - return 0; -} - -static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) -{ - int i; - char *block_bitmap = 0, *inode_bitmap = 0; - char *buf; - errcode_t retval; - int block_nbytes = EXT2_BLOCKS_PER_GROUP(fs->super) / 8; - int inode_nbytes = EXT2_INODES_PER_GROUP(fs->super) / 8; - blk_t blk; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - fs->write_bitmaps = ext2fs_write_bitmaps; - - buf = malloc(strlen(fs->device_name) + 80); - if (do_block) { - if (fs->block_map) - ext2fs_free_block_bitmap(fs->block_map); - sprintf(buf, "block bitmap for %s", fs->device_name); - retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); - if (retval) - goto cleanup; - block_bitmap = fs->block_map->bitmap; - } - if (do_inode) { - if (fs->inode_map) - ext2fs_free_inode_bitmap(fs->inode_map); - sprintf(buf, "inode bitmap for %s", fs->device_name); - retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); - if (retval) - goto cleanup; - inode_bitmap = fs->inode_map->bitmap; - } - free(buf); - - for (i = 0; i < fs->group_desc_count; i++) { - if (block_bitmap) { - blk = fs->group_desc[i].bg_block_bitmap; - if (blk) { - retval = io_channel_read_blk(fs->io, blk, - -block_nbytes, block_bitmap); - if (retval) { - retval = EXT2_ET_BLOCK_BITMAP_READ; - goto cleanup; - } - } else - memset(block_bitmap, 0, block_nbytes); - block_bitmap += block_nbytes; - } - if (inode_bitmap) { - blk = fs->group_desc[i].bg_inode_bitmap; - if (blk) { - retval = io_channel_read_blk(fs->io, blk, - -inode_nbytes, inode_bitmap); - if (retval) { - retval = EXT2_ET_INODE_BITMAP_READ; - goto cleanup; - } - } else - memset(inode_bitmap, 0, inode_nbytes); - inode_bitmap += inode_nbytes; - } - } - return 0; - -cleanup: - if (do_block) { - free(fs->block_map); - fs->block_map = 0; - } - if (do_inode) { - free(fs->inode_map); - fs->inode_map = 0; - } - if (buf) - free(buf); - return retval; -} - -errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs) -{ - return read_bitmaps(fs, 1, 0); -} - -errcode_t ext2fs_read_block_bitmap(ext2_filsys fs) -{ - return read_bitmaps(fs, 0, 1); -} - -errcode_t ext2fs_read_bitmaps(ext2_filsys fs) -{ - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - return read_bitmaps(fs, !fs->inode_map, !fs->block_map); -} - -errcode_t ext2fs_write_bitmaps(ext2_filsys fs) -{ - errcode_t retval; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (fs->block_map && ext2fs_test_bb_dirty(fs)) { - retval = ext2fs_write_block_bitmap(fs); - if (retval) - return retval; - } - if (fs->inode_map && ext2fs_test_ib_dirty(fs)) { - retval = ext2fs_write_inode_bitmap(fs); - if (retval) - return retval; - } - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/swapfs.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/swapfs.c deleted file mode 100644 index de347ac306e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/swapfs.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * swapfs.c --- swap ext2 filesystem data structures - * - * Copyright (C) 1995, 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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) -{ - struct ext2fs_sb *s = (struct ext2fs_sb *) 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); - s->s_minor_rev_level = ext2fs_swab16(s->s_minor_rev_level); - 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 - s->s_first_ino = ext2fs_swab32(s->s_first_ino); - s->s_inode_size = ext2fs_swab16(s->s_inode_size); - s->s_block_group_nr = ext2fs_swab16(s->s_block_group_nr); - s->s_feature_compat = ext2fs_swab32(s->s_feature_compat); - s->s_feature_incompat = ext2fs_swab32(s->s_feature_incompat); - s->s_feature_ro_compat = ext2fs_swab32(s->s_feature_ro_compat); -} - -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); -} - -void ext2fs_swap_inode(ext2_filsys fs, struct ext2_inode *t, - struct ext2_inode *f, int hostorder) -{ - unsigned i; - int islnk = 0; - - if (hostorder && LINUX_S_ISLNK(f->i_mode)) - islnk = 1; - t->i_mode = ext2fs_swab16(f->i_mode); - if (!hostorder && LINUX_S_ISLNK(t->i_mode)) - islnk = 1; - 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); - if (!islnk || f->i_blocks) { - for (i = 0; i < EXT2_N_BLOCKS; i++) - t->i_block[i] = ext2fs_swab32(f->i_block[i]); - } else if (t != f) { - for (i = 0; i < EXT2_N_BLOCKS; i++) - t->i_block[i] = 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); - - switch (fs->super->s_creator_os) { - case EXT2_OS_LINUX: - t->osd1.linux1.l_i_reserved1 = - ext2fs_swab32(f->osd1.linux1.l_i_reserved1); - 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); - t->osd2.linux2.l_i_reserved2[0] = - ext2fs_swab32(f->osd2.linux2.l_i_reserved2[0]); - t->osd2.linux2.l_i_reserved2[1] = - ext2fs_swab32(f->osd2.linux2.l_i_reserved2[1]); - break; - case EXT2_OS_HURD: - t->osd1.hurd1.h_i_translator = - ext2fs_swab32 (f->osd1.hurd1.h_i_translator); - t->osd2.hurd2.h_i_frag = f->osd2.hurd2.h_i_frag; - t->osd2.hurd2.h_i_fsize = f->osd2.hurd2.h_i_fsize; - t->osd2.hurd2.h_i_mode_high = - ext2fs_swab16 (f->osd2.hurd2.h_i_mode_high); - t->osd2.hurd2.h_i_uid_high = - ext2fs_swab16 (f->osd2.hurd2.h_i_uid_high); - t->osd2.hurd2.h_i_gid_high = - ext2fs_swab16 (f->osd2.hurd2.h_i_gid_high); - t->osd2.hurd2.h_i_author = - ext2fs_swab32 (f->osd2.hurd2.h_i_author); - break; - case EXT2_OS_MASIX: - t->osd1.masix1.m_i_reserved1 = - ext2fs_swab32(f->osd1.masix1.m_i_reserved1); - t->osd2.masix2.m_i_frag = f->osd2.masix2.m_i_frag; - t->osd2.masix2.m_i_fsize = f->osd2.masix2.m_i_fsize; - t->osd2.masix2.m_pad1 = ext2fs_swab16(f->osd2.masix2.m_pad1); - t->osd2.masix2.m_i_reserved2[0] = - ext2fs_swab32(f->osd2.masix2.m_i_reserved2[0]); - t->osd2.masix2.m_i_reserved2[1] = - ext2fs_swab32(f->osd2.masix2.m_i_reserved2[1]); - break; - } -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/test_io.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/test_io.c deleted file mode 100644 index a82f0946fb7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/test_io.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * test_io.c --- This is the Test I/O interface. - * - * Copyright (C) 1996 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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 "et/com_err.h" -#include "ext2fs/ext2_err.h" -#include "io.h" - -/* - * For checking structure magic numbers... - */ - -#define EXT2_CHECK_MAGIC(struct, code) \ - if ((struct)->magic != (code)) return (code) - -struct test_private_data { - int magic; - io_channel real; - void (*read_blk)(unsigned long block, int count, errcode_t err); - void (*write_blk)(unsigned long block, int count, errcode_t err); - void (*set_blksize)(int blksize, errcode_t err); -}; - -static errcode_t test_open(const char *name, int flags, io_channel *channel); -static errcode_t test_close(io_channel channel); -static errcode_t test_set_blksize(io_channel channel, int blksize); -static errcode_t test_read_blk(io_channel channel, unsigned long block, - int count, void *data); -static errcode_t test_write_blk(io_channel channel, unsigned long block, - int count, const void *data); -static errcode_t test_flush(io_channel channel); - -static struct struct_io_manager struct_test_manager = { - EXT2_ET_MAGIC_IO_MANAGER, - "Test I/O Manager", - test_open, - test_close, - test_set_blksize, - test_read_blk, - test_write_blk, - test_flush -}; - -io_manager test_io_manager = &struct_test_manager; - -/* - * These global variable can be set by the test program as - * necessary *before* calling test_open - */ -io_manager test_io_backing_manager = 0; -void (*test_io_cb_read_blk) - (unsigned long block, int count, errcode_t err) = 0; -void (*test_io_cb_write_blk) - (unsigned long block, int count, errcode_t err) = 0; -void (*test_io_cb_set_blksize) - (int blksize, errcode_t err) = 0; - -static errcode_t test_open(const char *name, int flags, io_channel *channel) -{ - io_channel io = NULL; - struct test_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; - memset(io, 0, sizeof(struct struct_io_channel)); - io->magic = EXT2_ET_MAGIC_IO_CHANNEL; - data = (struct test_private_data *) - malloc(sizeof(struct test_private_data)); - if (!data) { - retval = ENOMEM; - goto cleanup; - } - io->manager = test_io_manager; - io->name = malloc(strlen(name)+1); - if (!io->name) { - retval = ENOMEM; - goto cleanup; - } - strcpy(io->name, name); - io->private_data = data; - io->block_size = 1024; - io->read_error = 0; - io->write_error = 0; - io->refcount = 1; - - memset(data, 0, sizeof(struct test_private_data)); - data->magic = EXT2_ET_MAGIC_TEST_IO_CHANNEL; - if (test_io_backing_manager) { - retval = test_io_backing_manager->open(name, flags, - &data->real); - if (retval) - goto cleanup; - } else - data->real = 0; - data->read_blk = test_io_cb_read_blk; - data->write_blk = test_io_cb_write_blk; - data->set_blksize = test_io_cb_set_blksize; - - *channel = io; - return 0; - -cleanup: - if (io) - free(io); - if (data) - free(data); - return retval; -} - -static errcode_t test_close(io_channel channel) -{ - struct test_private_data *data; - errcode_t retval = 0; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct test_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); - - if (--channel->refcount > 0) - return 0; - - if (data->real) - retval = io_channel_close(data->real); - - if (channel->private_data) - free(channel->private_data); - if (channel->name) - free(channel->name); - free(channel); - return retval; -} - -static errcode_t test_set_blksize(io_channel channel, int blksize) -{ - struct test_private_data *data; - errcode_t retval = 0; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct test_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); - - if (data->real) - retval = io_channel_set_blksize(data->real, blksize); - if (data->set_blksize) - data->set_blksize(blksize, retval); - else - printf("Test_io: set_blksize(%d) returned %s\n", - blksize, retval ? error_message(retval) : "OK"); - return retval; -} - - -static errcode_t test_read_blk(io_channel channel, unsigned long block, - int count, void *buf) -{ - struct test_private_data *data; - errcode_t retval = 0; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct test_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); - - if (data->real) - retval = io_channel_read_blk(data->real, block, count, buf); - if (data->read_blk) - data->read_blk(block, count, retval); - else - printf("Test_io: read_blk(%lu, %d) returned %s\n", - block, count, retval ? error_message(retval) : "OK"); - return retval; -} - -static errcode_t test_write_blk(io_channel channel, unsigned long block, - int count, const void *buf) -{ - struct test_private_data *data; - errcode_t retval = 0; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct test_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); - - if (data->real) - retval = io_channel_write_blk(data->real, block, count, buf); - if (data->write_blk) - data->write_blk(block, count, retval); - else - printf("Test_io: write_blk(%lu, %d) returned %s\n", - block, count, retval ? error_message(retval) : "OK"); - return retval; -} - -/* - * Flush data buffers to disk. - */ -static errcode_t test_flush(io_channel channel) -{ - struct test_private_data *data; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct test_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); - - if (data->real) - return io_channel_flush(data->real); - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/tst_badblocks.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/tst_badblocks.c deleted file mode 100644 index d071406a265..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/tst_badblocks.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This testing program makes sure the badblocks implementation works. - * - * Copyright (C) 1996 by Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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" - -blk_t test1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0 }; -blk_t test2[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; -blk_t test3[] = { 3, 1, 4, 5, 9, 2, 7, 10, 6, 8, 0 }; -blk_t test4[] = { 20, 50, 12, 17, 13, 2, 66, 23, 56, 0 }; -blk_t test4a[] = { - 20, 1, - 50, 1, - 3, 0, - 17, 1, - 18, 0, - 16, 0, - 11, 0, - 12, 1, - 13, 1, - 14, 0, - 80, 0, - 45, 0, - 66, 1, - 0 }; - -static int test_fail = 0; - -static errcode_t create_test_list(blk_t *vec, badblocks_list *ret) -{ - errcode_t retval; - badblocks_list bb; - int i; - - retval = badblocks_list_create(&bb, 5); - if (retval) { - com_err("create_test_list", retval, "while creating list"); - return retval; - } - for (i=0; vec[i]; i++) { - retval = badblocks_list_add(bb, vec[i]); - if (retval) { - com_err("create_test_list", retval, - "while adding test vector %d", i); - badblocks_list_free(bb); - return retval; - } - } - *ret = bb; - return 0; -} - -static void print_list(badblocks_list bb, int verify) -{ - errcode_t retval; - badblocks_iterate iter; - blk_t blk; - int i, ok; - - retval = badblocks_list_iterate_begin(bb, &iter); - if (retval) { - com_err("print_list", retval, "while setting up iterator"); - return; - } - ok = i = 1; - while (badblocks_list_iterate(iter, &blk)) { - printf("%d ", blk); - if (i++ != blk) - ok = 0; - } - badblocks_list_iterate_end(iter); - if (verify) { - if (ok) - printf("--- OK"); - else { - printf("--- NOT OK"); - test_fail++; - } - } -} - -static void validate_test_seq(badblocks_list bb, blk_t *vec) -{ - int i, match, ok; - - for (i = 0; vec[i]; i += 2) { - match = badblocks_list_test(bb, vec[i]); - if (match == vec[i+1]) - ok = 1; - else { - ok = 0; - test_fail++; - } - printf("\tblock %d is %s --- %s\n", vec[i], - match ? "present" : "absent", - ok ? "OK" : "NOT OK"); - } -} - -int main(int argc, char *argv) -{ - badblocks_list bb; - errcode_t retval; - - printf("test1: "); - retval = create_test_list(test1, &bb); - if (retval == 0) { - print_list(bb, 1); - badblocks_list_free(bb); - } - printf("\n"); - - printf("test2: "); - retval = create_test_list(test2, &bb); - if (retval == 0) { - print_list(bb, 1); - badblocks_list_free(bb); - } - printf("\n"); - - printf("test3: "); - retval = create_test_list(test3, &bb); - if (retval == 0) { - print_list(bb, 1); - badblocks_list_free(bb); - } - printf("\n"); - - printf("test4: "); - retval = create_test_list(test4, &bb); - if (retval == 0) { - print_list(bb, 0); - printf("\n"); - validate_test_seq(bb, test4a); - badblocks_list_free(bb); - } - printf("\n"); - if (test_fail == 0) - printf("ext2fs library badblocks tests checks out OK!\n"); - return test_fail; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/tst_iscan.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/tst_iscan.c deleted file mode 100644 index dbf0813a306..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/tst_iscan.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * tst_inode.c --- this function tests the inode scan function - * - * Copyright (C) 1996 by Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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" - -blk_t test_vec[] = { 8, 12, 24, 34, 43, 44, 100, 0 }; - -ext2_filsys test_fs; -ext2fs_block_bitmap bad_block_map, touched_map; -ext2fs_inode_bitmap bad_inode_map; -badblocks_list test_badblocks; - -int first_no_comma = 1; -int failed = 0; - -static void test_read_blk(unsigned long block, int count, errcode_t err) -{ - int i; - - if (first_no_comma) - first_no_comma = 0; - else - printf(", "); - - if (count > 1) - printf("%lu-%lu", block, block+count-1); - else - printf("%lu", block); - - for (i=0; i < count; i++, block++) { - if (ext2fs_test_block_bitmap(touched_map, block)) { - printf("\nDuplicate block?!? --- %lu\n", block); - failed++; - first_no_comma = 1; - } - ext2fs_mark_block_bitmap(touched_map, block); - } -} - -/* - * Setup the variables for doing the inode scan test. - */ -static void setup(void) -{ - errcode_t retval; - int i; - struct ext2_super_block param; - - initialize_ext2_error_table(); - - memset(¶m, 0, sizeof(param)); - param.s_blocks_count = 12000; - - - test_io_cb_read_blk = test_read_blk; - - retval = ext2fs_initialize("test fs", 0, ¶m, - test_io_manager, &test_fs); - if (retval) { - com_err("setup", retval, - "While initializing filesystem"); - exit(1); - } - retval = ext2fs_allocate_tables(test_fs); - if (retval) { - com_err("setup", retval, - "While allocating tables for test filesystem"); - exit(1); - } - retval = ext2fs_allocate_block_bitmap(test_fs, "bad block map", - &bad_block_map); - if (retval) { - com_err("setup", retval, - "While allocating bad_block bitmap"); - exit(1); - } - retval = ext2fs_allocate_block_bitmap(test_fs, "touched map", - &touched_map); - if (retval) { - com_err("setup", retval, - "While allocating touched block bitmap"); - exit(1); - } - retval = ext2fs_allocate_inode_bitmap(test_fs, "bad inode map", - &bad_inode_map); - if (retval) { - com_err("setup", retval, - "While allocating bad inode bitmap"); - exit(1); - } - - retval = badblocks_list_create(&test_badblocks, 5); - if (retval) { - com_err("setup", retval, "while creating badblocks list"); - exit(1); - } - for (i=0; test_vec[i]; i++) { - retval = badblocks_list_add(test_badblocks, test_vec[i]); - if (retval) { - com_err("setup", retval, - "while adding test vector %d", i); - exit(1); - } - ext2fs_mark_block_bitmap(bad_block_map, test_vec[i]); - } - test_fs->badblocks = test_badblocks; -} - -/* - * Iterate using inode_scan - */ -static void iterate(void) -{ - struct ext2_inode inode; - ext2_inode_scan scan; - errcode_t retval; - ino_t ino; - - retval = ext2fs_open_inode_scan(test_fs, 8, &scan); - if (retval) { - com_err("iterate", retval, "While opening inode scan"); - exit(1); - } - printf("Reading blocks: "); - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval) { - com_err("iterate", retval, "while reading first inode"); - exit(1); - } - while (ino) { - retval = ext2fs_get_next_inode(scan, &ino, &inode); - if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) { - ext2fs_mark_inode_bitmap(bad_inode_map, ino); - continue; - } - if (retval) { - com_err("iterate", retval, - "while getting next inode"); - exit(1); - } - } - printf("\n"); - ext2fs_close_inode_scan(scan); -} - -/* - * Verify the touched map - */ -static void check_map(void) -{ - int i, j, first=1; - unsigned long blk; - - for (i=0; test_vec[i]; i++) { - if (ext2fs_test_block_bitmap(touched_map, test_vec[i])) { - printf("Bad block was touched --- %d\n", test_vec[i]); - failed++; - first_no_comma = 1; - } - ext2fs_mark_block_bitmap(touched_map, test_vec[i]); - } - for (i = 0; i < test_fs->group_desc_count; i++) { - for (j=0, blk = test_fs->group_desc[i].bg_inode_table; - j < test_fs->inode_blocks_per_group; - j++, blk++) { - if (!ext2fs_test_block_bitmap(touched_map, blk) && - !ext2fs_test_block_bitmap(bad_block_map, blk)) { - printf("Missing block --- %lu\n", blk); - failed++; - } - } - } - printf("Bad inodes: "); - for (i=1; i <= test_fs->super->s_inodes_count; i++) { - if (ext2fs_test_inode_bitmap(bad_inode_map, i)) { - if (first) - first = 0; - else - printf(", "); - printf("%d", i); - } - } - printf("\n"); -} - - -int main(int argc, char **argv) -{ - setup(); - iterate(); - check_map(); - if (!failed) - printf("Inode scan tested OK!\n"); - return failed; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/unix_io.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/unix_io.c deleted file mode 100644 index ef00902d4f4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/unix_io.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * unix_io.c --- This is the Unix I/O interface to the I/O manager. - * - * Implements a one-block write-through cache. - * - * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#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 "et/com_err.h" -#include "ext2fs/ext2_err.h" -#include "io.h" - -/* - * For checking structure magic numbers... - */ - -#define EXT2_CHECK_MAGIC(struct, code) \ - if ((struct)->magic != (code)) return (code) - -struct unix_private_data { - int magic; - int dev; - int flags; - char *buf; - int buf_block_nr; -}; - -static errcode_t unix_open(const char *name, int flags, io_channel *channel); -static errcode_t unix_close(io_channel channel); -static errcode_t unix_set_blksize(io_channel channel, int blksize); -static errcode_t unix_read_blk(io_channel channel, unsigned long block, - int count, void *data); -static errcode_t unix_write_blk(io_channel channel, unsigned long block, - int count, const void *data); -static errcode_t unix_flush(io_channel channel); - -static struct struct_io_manager struct_unix_manager = { - EXT2_ET_MAGIC_IO_MANAGER, - "Unix I/O Manager", - unix_open, - unix_close, - unix_set_blksize, - unix_read_blk, - unix_write_blk, - unix_flush -}; - -io_manager unix_io_manager = &struct_unix_manager; - -static errcode_t unix_open(const char *name, int flags, io_channel *channel) -{ - io_channel io = NULL; - 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; - memset(io, 0, sizeof(struct struct_io_channel)); - io->magic = EXT2_ET_MAGIC_IO_CHANNEL; - data = (struct unix_private_data *) - malloc(sizeof(struct unix_private_data)); - if (!data) { - retval = ENOMEM; - goto cleanup; - } - io->manager = unix_io_manager; - io->name = malloc(strlen(name)+1); - if (!io->name) { - retval = ENOMEM; - goto cleanup; - } - strcpy(io->name, name); - io->private_data = data; - io->block_size = 1024; - io->read_error = 0; - io->write_error = 0; - io->refcount = 1; - - memset(data, 0, sizeof(struct unix_private_data)); - data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL; - data->buf = malloc(io->block_size); - data->buf_block_nr = -1; - if (!data->buf) { - retval = ENOMEM; - goto cleanup; - } - data->dev = open(name, (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY); - if (data->dev < 0) { - retval = errno; - goto cleanup; - } - *channel = io; - return 0; - -cleanup: - if (io) - free(io); - if (data) { - if (data->buf) - free(data->buf); - free(data); - } - return retval; -} - -static errcode_t unix_close(io_channel channel) -{ - struct unix_private_data *data; - errcode_t retval = 0; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct unix_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); - - if (--channel->refcount > 0) - return 0; - - if (close(data->dev) < 0) - retval = errno; - if (data->buf) - free(data->buf); - if (channel->private_data) - free(channel->private_data); - if (channel->name) - free(channel->name); - free(channel); - return retval; -} - -static errcode_t unix_set_blksize(io_channel channel, int blksize) -{ - struct unix_private_data *data; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct unix_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); - - if (channel->block_size != blksize) { - channel->block_size = blksize; - free(data->buf); - data->buf = malloc(blksize); - if (!data->buf) - return ENOMEM; - data->buf_block_nr = -1; - } - return 0; -} - - -static errcode_t unix_read_blk(io_channel channel, unsigned long block, - int count, void *buf) -{ - struct unix_private_data *data; - errcode_t retval; - size_t size; - ext2_loff_t location; - int actual = 0; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct unix_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); - - /* - * If it's in the cache, use it! - */ - if ((count == 1) && (block == data->buf_block_nr)) { - memcpy(buf, data->buf, channel->block_size); - return 0; - } -#if 0 - printf("read_block %lu (%d)\n", block, count); -#endif - size = (count < 0) ? -count : count * channel->block_size; - location = (ext2_loff_t) block * channel->block_size; - if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { - retval = errno; - goto error_out; - } - actual = read(data->dev, buf, size); - if (actual != size) { - if (actual < 0) - actual = 0; - retval = EXT2_ET_SHORT_READ; - goto error_out; - } - if (count == 1) { - data->buf_block_nr = block; - memcpy(data->buf, buf, size); /* Update the cache */ - } - return 0; - -error_out: - memset((char *) buf+actual, 0, size-actual); - if (channel->read_error) - retval = (channel->read_error)(channel, block, count, buf, - size, actual, retval); - return retval; -} - -static errcode_t unix_write_blk(io_channel channel, unsigned long block, - int count, const void *buf) -{ - struct unix_private_data *data; - size_t size; - ext2_loff_t location; - int actual = 0; - errcode_t retval; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct unix_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); - - if (count == 1) - size = channel->block_size; - else { - data->buf_block_nr = -1; /* Invalidate the cache */ - if (count < 0) - size = -count; - else - size = count * channel->block_size; - } - - location = (ext2_loff_t) block * channel->block_size; - if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { - retval = errno; - goto error_out; - } - - actual = write(data->dev, buf, size); - if (actual != size) { - retval = EXT2_ET_SHORT_WRITE; - goto error_out; - } - - if ((count == 1) && (block == data->buf_block_nr)) - memcpy(data->buf, buf, size); /* Update the cache */ - - return 0; - -error_out: - if (channel->write_error) - retval = (channel->write_error)(channel, block, count, buf, - size, actual, retval); - return retval; -} - -/* - * Flush data buffers to disk. Since we are currently using a - * write-through cache, this is a no-op. - */ -static errcode_t unix_flush(io_channel channel) -{ - struct unix_private_data *data; - - EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - data = (struct unix_private_data *) channel->private_data; - EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); - - return 0; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/unlink.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/unlink.c deleted file mode 100644 index e0309aa587d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/unlink.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * unlink.c --- delete links in a ext2fs directory - * - * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -struct link_struct { - const char *name; - int namelen; - ino_t inode; - int flags; - int done; -}; - -static int unlink_proc(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *private) -{ - struct link_struct *ls = (struct link_struct *) private; - - if (ls->name && (dirent->name_len != ls->namelen)) - return 0; - if (ls->name && strncmp(ls->name, dirent->name, dirent->name_len)) - return 0; - if (ls->inode && (dirent->inode != ls->inode)) - return 0; - - dirent->inode = 0; - ls->done++; - return DIRENT_ABORT|DIRENT_CHANGED; -} - -errcode_t ext2fs_unlink(ext2_filsys fs, ino_t dir, const char *name, ino_t ino, - int flags) -{ - errcode_t retval; - struct link_struct ls; - - EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - - if (!(fs->flags & EXT2_FLAG_RW)) - return EXT2_ET_RO_FILSYS; - - ls.name = name; - ls.namelen = name ? strlen(name) : 0; - ls.inode = ino; - ls.flags = 0; - ls.done = 0; - - retval = ext2fs_dir_iterate(fs, dir, 0, 0, unlink_proc, &ls); - if (retval) - return retval; - - return (ls.done) ? 0 : EXT2_ET_DIR_NO_SPACE; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/valid_blk.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/valid_blk.c deleted file mode 100644 index 3a0cb3ebe94..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/valid_blk.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * valid_blk.c --- does the inode have valid blocks? - * - * Copyright 1997 by Theodore Ts'o - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - * - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> - -#include "ext2fs.h" - -/* - * This function returns 1 if the inode's block entries actually - * contain block entries. - */ -int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode) -{ - /* - * Only directories, regular files, and some symbolic links - * have valid block entries. - */ - 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 (LINUX_S_ISLNK (inode->i_mode) && inode->i_blocks == 0 && - inode->i_size < EXT2_N_BLOCKS * sizeof (unsigned long)) - return 0; - - return 1; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/version.c b/gnu/usr.sbin/e2fsprogs/lib/ext2fs/version.c deleted file mode 100644 index 38accf6b915..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ext2fs/version.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * version.c --- Return the version of the ext2 library - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <et/com_err.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include <linux/ext2_fs.h> -#include "ext2fs.h" - -#include "../../version.h" - -static const char *lib_version = E2FSPROGS_VERSION; -static const char *lib_date = E2FSPROGS_DATE; - -int ext2fs_parse_version_string(const char *ver_string) -{ - const char *cp; - int version = 0; - - for (cp = ver_string; *cp; cp++) { - if (!isdigit(*cp)) - continue; - version = (version * 10) + (*cp - '0'); - } - return version; -} - - -int ext2fs_get_library_version(const char **ver_string, - const char **date_string) -{ - if (ver_string) - *ver_string = lib_version; - if (date_string) - *date_string = lib_date; - - return ext2fs_parse_version_string(lib_version); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/fpopen.c b/gnu/usr.sbin/e2fsprogs/lib/fpopen.c deleted file mode 100644 index f12ab90f724..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/fpopen.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * fpopen.c --- unlike the libc popen, it directly executes the - * command instead of call out to the shell. - */ - -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#include <string.h> -#include <ctype.h> - -#define MAX_ARGV 256 - -extern FILE *fpopen(const char *cmd, const char *mode); - -FILE *fpopen(const char *cmd, const char *mode) -{ - char *argv[MAX_ARGV]; - int i = 0; - char *buf, *prog = 0; - char *p; - int do_stdin; - int fds[2]; - pid_t pid; - - if (!mode) { - errno = EFAULT; - return NULL; - } - - switch (*mode) { - case 'r': - do_stdin = 0; - break; - case 'w': - do_stdin = 1; - break; - default: - errno = EINVAL; - return NULL; - } - - /* - * Create the argv vector.... - */ - buf = malloc(strlen(cmd)+1); - if (!buf) - return NULL; - strcpy(buf, cmd); - p = buf; - while (p && *p) { - if (isspace(*p)) { - p++; - continue; - } - if (i == 0) - prog = p; - argv[i++] = p; - p = strchr(p, ' '); - if (p) - *p++ = 0; - } - - argv[i] = 0; - - /* - * Get the pipe - */ - if (pipe(fds) < 0) - return NULL; - - /* Fork and execute the correct program. */ - if ((pid = fork()) < 0) { - perror("fork"); - return NULL; - } else if (pid == 0) { - if (do_stdin) { - close(fds[1]); - dup2(fds[0], 0); - } else { - close(fds[0]); - dup2(fds[1], 1); - } - (void) execvp(prog, argv); - perror(prog); - exit(1); - } - return fdopen(do_stdin ? fds[1] : fds[0], mode); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/ChangeLog b/gnu/usr.sbin/e2fsprogs/lib/ss/ChangeLog deleted file mode 100644 index 32983b6a1d2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/ChangeLog +++ /dev/null @@ -1,134 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Wed Mar 12 21:54:32 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * help.c, pager.c, ss.h: Don't use "extern int errno", but use - #include <errno.h> instead. - -Thu Jan 2 00:16:03 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * parse.c: Put in an include of string.h - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Fri Aug 30 22:36:48 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * invocation.c (ss_create_invocation): Change function prototype - of invocation so that the first two arguments are const - char *, and that the info_ptr is a void *, not a char *. - - * ss.h: Added declaration of ss_execute_line() - -Sat Aug 10 00:17:14 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * listen.c (ss_listen): Fix -Wall flames. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Thu May 16 10:04:09 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (INSTALL_HFILES): Install the correct header files - so that /usr/include/ss/ss.h is actually usable! - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -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.in (DLL_INSTALL_DIR): Install libss in /lib, since it's - needed by debugfs (which is installed in /sbin). - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/Makefile.in b/gnu/usr.sbin/e2fsprogs/lib/ss/Makefile.in deleted file mode 100644 index d3b6bf4b4f6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/Makefile.in +++ /dev/null @@ -1,186 +0,0 @@ -# -# Makefile for lib/ss -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = ../.. -my_dir = lib/ss -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_SO_VERSION = 2 -ELF_IMAGE = libss -ELF_MYDIR = ss -ELF_INSTALL_DIR = $(libdir) -ELF_OTHER_LIBS = -lc -L../.. -lcom_err - -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) $(ALL_CFLAGS) -c $< -@PROFILE_CMT@ $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< -@CHECKER_CMT@ $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $< -@DLL_CMT@ (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) \ -@DLL_CMT@ $(ALL_CFLAGS) -o jump/$*.o -c $<) -@ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< -@BSDLIB_CMT@ $(CC) $(ALL_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 - -INSTALL_HFILES= ss.h ss_err.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 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: $(SUBSTITUTE) $(srcdir)/mk_cmds.sh.in - -$(CHMOD) +x $(SUBSTITUTE) - $(SUBSTITUTE) $(srcdir)/mk_cmds.sh.in mk_cmds - $(CHMOD) +x mk_cmds - -installdirs:: - $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ulibdir) \ - $(DESTDIR)$(includedir)/ss - -install:: libss.a $(INSTALL_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 $(INSTALL_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 ss_err.h ss_err.c std_rqs.c \ - *.o *~ \#* *.bak 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 -# -invocation.o: $(srcdir)/invocation.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \ - $(srcdir)/copyright.h $(top_builddir)/lib/ss/ss_err.h -help.o: $(srcdir)/help.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \ - $(srcdir)/copyright.h $(top_builddir)/lib/ss/ss_err.h -execute_cmd.o: $(srcdir)/execute_cmd.c $(srcdir)/ss_internal.h \ - $(srcdir)/ss.h $(srcdir)/copyright.h $(top_builddir)/lib/ss/ss_err.h -listen.o: $(srcdir)/listen.c $(srcdir)/copyright.h $(srcdir)/ss_internal.h \ - $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h -parse.o: $(srcdir)/parse.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \ - $(srcdir)/copyright.h $(top_builddir)/lib/ss/ss_err.h -error.o: $(srcdir)/error.c $(srcdir)/copyright.h $(srcdir)/../et/com_err.h \ - $(srcdir)/ss_internal.h $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h -prompt.o: $(srcdir)/prompt.c $(srcdir)/copyright.h $(srcdir)/ss_internal.h \ - $(srcdir)/ss.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 $(top_builddir)/lib/ss/ss_err.h -list_rqs.o: $(srcdir)/list_rqs.c $(srcdir)/copyright.h \ - $(srcdir)/ss_internal.h $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h -pager.o: $(srcdir)/pager.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \ - $(srcdir)/copyright.h $(top_builddir)/lib/ss/ss_err.h -requests.o: $(srcdir)/requests.c $(srcdir)/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)/copyright.h $(top_builddir)/lib/ss/ss_err.h - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/copyright.h b/gnu/usr.sbin/e2fsprogs/lib/ss/copyright.h deleted file mode 100644 index e0d15722485..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/copyright.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - -Copyright 1987, 1989 by the Student Information Processing Board - of the Massachusetts Institute of Technology - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice -appear in all copies and that both that copyright notice and -this permission notice appear in supporting documentation, -and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. -M.I.T. and the M.I.T. S.I.P.B. make no representations about -the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -*/ - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/ct_c.awk b/gnu/usr.sbin/e2fsprogs/lib/ss/ct_c.awk deleted file mode 100644 index 872f6e00707..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/ct_c.awk +++ /dev/null @@ -1,77 +0,0 @@ -/^command_table / { - cmdtbl = $2; - printf "/* %s.c - automatically generated from %s.ct */\n", \ - rootname, rootname > outfile - print "#include <ss/ss.h>" > outfile - print "" >outfile - print "#ifndef __STDC__" > outfile - print "#define const" > outfile - print "#endif" > outfile - print "" > outfile -} - -/^BOR$/ { - cmdnum++ - options = 0 - cmdtab = "" - printf "static char const * const ssu%05d[] = {\n", cmdnum > outfile -} - -/^sub/ { - subr = substr($0, 6, length($0)-5) -} - -/^hlp/ { - help = substr($0, 6, length($0)-5) -} - -/^cmd/ { - cmd = substr($0, 6, length($0)-5) - printf "%s\"%s\",\n", cmdtab, cmd > outfile - cmdtab = " " -} - -/^opt/ { - opt = substr($0, 6, length($0)-5) - if (opt == "dont_list") { - options += 1 - } - if (opt == "dont_summarize") { - options += 2 - } -} - -/^EOR/ { - print " (char const *)0" > outfile - print "};" > outfile - printf "extern void %s __SS_PROTO;\n", subr > outfile - subr_tab[cmdnum] = subr - options_tab[cmdnum] = options - help_tab[cmdnum] = help -} - -/^[0-9]/ { - linenum = $1; -} - -/^ERROR/ { - error = substr($0, 8, length($0)-7) - printf "Error in line %d: %s\n", linenum, error - print "#__ERROR_IN_FILE__" > outfile -} - -END { - printf "static ss_request_entry ssu%05d[] = {\n", cmdnum+1 > outfile - for (i=1; i <= cmdnum; i++) { - printf " { ssu%05d,\n", i > outfile - printf " %s,\n", subr_tab[i] > outfile - printf " \"%s\",\n", help_tab[i] > outfile - printf " %d },\n", options_tab[i] > outfile - } - print " { 0, 0, 0, 0 }" > outfile - print "};" > outfile - print "" > outfile - printf "ss_request_table %s = { 2, ssu%05d };\n", \ - cmdtbl, cmdnum+1 > outfile -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/ct_c.sed b/gnu/usr.sbin/e2fsprogs/lib/ss/ct_c.sed deleted file mode 100644 index 8d6452bee8e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/ct_c.sed +++ /dev/null @@ -1,160 +0,0 @@ -# -# This script parses a command_table file into something which is a bit -# easier for an awk script to understand. -# -# Input syntax: a .ct file -# -# Output syntax: -# (for the command_table line) -# command_table <command_table> -# -#(for each request definition) -# BOR -# sub: <subroutine name> -# hlp: <help text> -# cmd: <command> -# opt: <option> -# EOR -# (there may be more than one 'cmd' or 'opt' line -# -# A number sent to the output represents a parse error --- it will be -# followed by the next line which will have the form: -# ERROR: <error text> -# -# The design of this output syntax is such that it should be easy for -# an awk script to parse. - -# -# The first section of this script is just to cannoicalize the file. -# It removes comments, and puts each command_table request onto a single -# line -# -:FIRST -y/ / / -s/^ *// -s/#.*$// -/; *$/!{ -N -y/ / / -s/\n */ / -bFIRST -} -s/, */, /g -# -# Now we take care of some syntatic sugar..... -# -/^unimplemented/ { - s/^unimplemented [A-Za-z_0-9]*/request ss_unimplemented/ - s/;/, (dont_list, dont_summarize);/ -} -/^unknown/ { - s/^unknown /request ss_unknown, "", / -} -# -# Dispatch based on the keyword.... illegal keywords are prefixed by ERROR: -# and are handled by the awk script. -# -/^command_table /bCMD -/^request /bREQUEST -/^end;/bEND -s/ .*// -s/^/ERROR: unknown keyword: / -= -b -# -# Handle the command_table keyword -# -:CMD -s/;$// -p -d -b -# -# Handle the request keyword --- this is the heart of the sed script. -# -:REQUEST -s/^request *// -h -i\ -BOR -# First, parse out the subroutine name -s/^/sub: / -s/,.*// -p -# Next, parse out the help message, being careful to handle a quoted string -g -s/^[^,]*, *// -h -/^"/ { - s/^"// - s/".*// - x - s/^"[^"]*", *// - x - b EMITHLP -} -s/[^a-zA-Z0-9].*// -x -s/[a-zA-Z0-9]*, *// -x -:EMITHLP -s/^/hlp: / -p -# Next take care of the command names -:CMDLIST -g -/^(/b OPTIONS -/^;/b EOR -/^"/ { - s/^"// - s/".*// - x - s/^"[^"]*"// - s/, *// - x - b EMITREQ -} -s/[^A-Za-z_0-9].*// -x -s/[A-Za-z_0-9]*// -s/, *// -x -:EMITREQ -s/^/cmd: / -p -b CMDLIST -# -# Here we parse the list of options. -# -: OPTIONS -g -s/^(// -h -: OPTLIST -/^)/ b EOR -/^[^A-Za-z_0-9]/ { - = - c\ -ERROR: parse error in options list -} -s/[^A-Za-z_0-9].*// -x -s/[A-Za-z_0-9]*// -s/, *// -x -s/^/opt: / -p -g -b OPTLIST -: EOR -c\ -EOR\ - -d -b -# -# Handle the end keyword --- it's basically ignored. -# -:END -d -b diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/data.c b/gnu/usr.sbin/e2fsprogs/lib/ss/data.c deleted file mode 100644 index 45e49d781fc..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/data.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 1987, 1988, 1989 Massachusetts Institute of Technology - * (Student Information Processing Board) - * - * For copyright info, see copyright.h. - */ - -#include <stdio.h> -#include "ss_internal.h" -#include "copyright.h" - -static const char copyright[] = - "Copyright 1987, 1988, 1989 by the Massachusetts Institute of Technology"; - -ss_data **_ss_table = (ss_data **)NULL; -char *_ss_pager_name = (char *)NULL; diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.funcs b/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.funcs deleted file mode 100644 index a8b08c621ab..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.funcs +++ /dev/null @@ -1,26 +0,0 @@ -00000000 T _initialize_ss_error_table libss jump/ss_err -00000000 T _ss_create_invocation libss jump/invocation -00000000 T _ss_delete_invocation libss jump/invocation -00000000 T _ss_help libss jump/help -00000000 T _ss_add_info_dir libss jump/help -00000000 T _ss_delete_info_dir libss jump/help -00000000 T _ss_execute_command libss jump/execute_cmd -00000000 T _ss_execute_line libss jump/execute_cmd -00000000 T _ss_listen libss jump/listen -00000000 T _ss_abort_subsystem libss jump/listen -00000000 T _ss_quit libss jump/listen -00000000 T _ss_parse libss jump/parse -00000000 T _ss_name libss jump/error -00000000 T _ss_error libss jump/error -00000000 T _ss_perror libss jump/error -00000000 T _ss_set_prompt libss jump/prompt -00000000 T _ss_get_prompt libss jump/prompt -00000000 T _ss_add_request_table libss jump/request_tbl -00000000 T _ss_delete_request_table libss jump/request_tbl -00000000 T _ss_list_requests libss jump/list_rqs -00000000 T _ss_pager_create libss jump/pager -00000000 T _ss_page_stdin libss jump/pager -00000000 T _ss_self_identify libss jump/requests -00000000 T _ss_subsystem_name libss jump/requests -00000000 T _ss_subsystem_version libss jump/requests -00000000 T _ss_unimplemented libss jump/requests diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.ignore b/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.ignore deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.ignore +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.import b/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.import deleted file mode 100644 index 53208d55aad..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.import +++ /dev/null @@ -1,166 +0,0 @@ -00000004 D __et_list libcom_err jump/error_message -00000004 D _com_err_hook libcom_err jump/com_err -/usr/lib/libc.sa(__libc.o):00001000 a __GOT_SIZE -/usr/lib/libc.sa(__libc.o):6008f0b0 A _AL -/usr/lib/libc.sa(__libc.o):6008f198 A _AL_PARM -/usr/lib/libc.sa(__libc.o):6008f060 A _AM -/usr/lib/libc.sa(__libc.o):6008f0b4 A _BC -/usr/lib/libc.sa(__libc.o):6008f064 A _BS -/usr/lib/libc.sa(__libc.o):6008f0bc A _BT -/usr/lib/libc.sa(__libc.o):6008f068 A _CA -/usr/lib/libc.sa(__libc.o):6008f0c0 A _CD -/usr/lib/libc.sa(__libc.o):6008f0c4 A _CE -/usr/lib/libc.sa(__libc.o):6008f0c8 A _CL -/usr/lib/libc.sa(__libc.o):6008f0cc A _CM -/usr/lib/libc.sa(__libc.o):6008f048 A _COLS -/usr/lib/libc.sa(__libc.o):6008f0d0 A _CR -/usr/lib/libc.sa(__libc.o):6008f0d4 A _CS -/usr/lib/libc.sa(__libc.o):6008f06c A _DA -/usr/lib/libc.sa(__libc.o):6008f070 A _DB -/usr/lib/libc.sa(__libc.o):6008f0d8 A _DC -/usr/lib/libc.sa(__libc.o):6008f0dc A _DL -/usr/lib/libc.sa(__libc.o):6008f19c A _DL_PARM -/usr/lib/libc.sa(__libc.o):6008f0e0 A _DM -/usr/lib/libc.sa(__libc.o):6008f0e4 A _DO -/usr/lib/libc.sa(__libc.o):6008f1a4 A _DOWN_PARM -/usr/lib/libc.sa(__libc.o):6008f03c A _Def_term -/usr/lib/libc.sa(__libc.o):6008f0e8 A _ED -/usr/lib/libc.sa(__libc.o):6008f0ec A _EI -/usr/lib/libc.sa(__libc.o):6008f074 A _EO -/usr/lib/libc.sa(__libc.o):6008f1b8 A _GT -/usr/lib/libc.sa(__libc.o):6008f078 A _HC -/usr/lib/libc.sa(__libc.o):6008f118 A _HO -/usr/lib/libc.sa(__libc.o):6008f07c A _HZ -/usr/lib/libc.sa(__libc.o):6008f11c A _IC -/usr/lib/libc.sa(__libc.o):6008f120 A _IM -/usr/lib/libc.sa(__libc.o):6008f080 A _IN -/usr/lib/libc.sa(__libc.o):6008f124 A _IP -/usr/lib/libc.sa(__libc.o):6008f0f0 A _K0 -/usr/lib/libc.sa(__libc.o):6008f0f4 A _K1 -/usr/lib/libc.sa(__libc.o):6008f0f8 A _K2 -/usr/lib/libc.sa(__libc.o):6008f0fc A _K3 -/usr/lib/libc.sa(__libc.o):6008f100 A _K4 -/usr/lib/libc.sa(__libc.o):6008f104 A _K5 -/usr/lib/libc.sa(__libc.o):6008f108 A _K6 -/usr/lib/libc.sa(__libc.o):6008f10c A _K7 -/usr/lib/libc.sa(__libc.o):6008f110 A _K8 -/usr/lib/libc.sa(__libc.o):6008f114 A _K9 -/usr/lib/libc.sa(__libc.o):6008f128 A _KD -/usr/lib/libc.sa(__libc.o):6008f12c A _KE -/usr/lib/libc.sa(__libc.o):6008f130 A _KH -/usr/lib/libc.sa(__libc.o):6008f134 A _KL -/usr/lib/libc.sa(__libc.o):6008f138 A _KR -/usr/lib/libc.sa(__libc.o):6008f13c A _KS -/usr/lib/libc.sa(__libc.o):6008f140 A _KU -/usr/lib/libc.sa(__libc.o):6008f1a8 A _LEFT_PARM -/usr/lib/libc.sa(__libc.o):6008f044 A _LINES -/usr/lib/libc.sa(__libc.o):6008f144 A _LL -/usr/lib/libc.sa(__libc.o):6008f148 A _MA -/usr/lib/libc.sa(__libc.o):6008f300 A _MCAppPath -/usr/lib/libc.sa(__libc.o):6008f084 A _MI -/usr/lib/libc.sa(__libc.o):6008f088 A _MS -/usr/lib/libc.sa(__libc.o):6008f030 A _My_term -/usr/lib/libc.sa(__libc.o):6008f08c A _NC -/usr/lib/libc.sa(__libc.o):6008f14c A _ND -/usr/lib/libc.sa(__libc.o):6008f150 A _NL -/usr/lib/libc.sa(__libc.o):6008f1bc A _NONL -/usr/lib/libc.sa(__libc.o):6008f090 A _NS -/usr/lib/libc.sa(__libc.o):6008f094 A _OS -/usr/lib/libc.sa(__libc.o):6008f1b0 A _PC -/usr/lib/libc.sa(__libc.o):6008f154 A _RC -/usr/lib/libc.sa(__libc.o):6008f1ac A _RIGHT_PARM -/usr/lib/libc.sa(__libc.o):6008f158 A _SC -/usr/lib/libc.sa(__libc.o):6008f15c A _SE -/usr/lib/libc.sa(__libc.o):6008f160 A _SF -/usr/lib/libc.sa(__libc.o):6008f164 A _SO -/usr/lib/libc.sa(__libc.o):6008f168 A _SR -/usr/lib/libc.sa(__libc.o):6008f16c A _TA -/usr/lib/libc.sa(__libc.o):6008f170 A _TE -/usr/lib/libc.sa(__libc.o):6008f174 A _TI -/usr/lib/libc.sa(__libc.o):6008f178 A _UC -/usr/lib/libc.sa(__libc.o):6008f17c A _UE -/usr/lib/libc.sa(__libc.o):6008f098 A _UL -/usr/lib/libc.sa(__libc.o):6008f180 A _UP -/usr/lib/libc.sa(__libc.o):6008f1c0 A _UPPERCASE -/usr/lib/libc.sa(__libc.o):6008f1a0 A _UP_PARM -/usr/lib/libc.sa(__libc.o):6008f188 A _US -/usr/lib/libc.sa(__libc.o):6008f18c A _VB -/usr/lib/libc.sa(__libc.o):6008f194 A _VE -/usr/lib/libc.sa(__libc.o):6008f190 A _VS -/usr/lib/libc.sa(__libc.o):6008f09c A _XB -/usr/lib/libc.sa(__libc.o):6008f0a0 A _XN -/usr/lib/libc.sa(__libc.o):6008f0a8 A _XS -/usr/lib/libc.sa(__libc.o):6008f0a4 A _XT -/usr/lib/libc.sa(__libc.o):6008f0ac A _XX -/usr/lib/libc.sa(__libc.o):6008f2a4 A __IO_file_jumps -/usr/lib/libc.sa(__libc.o):6008f1f4 A __IO_list_all -/usr/lib/libc.sa(__libc.o):6008f2a8 A __IO_proc_jumps -/usr/lib/libc.sa(__libc.o):6008f1ec A __IO_stderr_ -/usr/lib/libc.sa(__libc.o):6008f1e4 A __IO_stdin_ -/usr/lib/libc.sa(__libc.o):6008f1e8 A __IO_stdout_ -/usr/lib/libc.sa(__libc.o):6008f2ac A __IO_str_jumps -/usr/lib/libc.sa(__libc.o):6008f214 A ____brk_addr -/usr/lib/libc.sa(__libc.o):6008f01c A ___ctype_b -/usr/lib/libc.sa(__libc.o):6008f020 A ___ctype_tolower -/usr/lib/libc.sa(__libc.o):6008f024 A ___ctype_toupper -/usr/lib/libc.sa(__libc.o):6008f1fc A ___environ -/usr/lib/libc.sa(__libc.o):6008f250 A ___exit_funcs -/usr/lib/libc.sa(__libc.o):6008f2f0 A ___glob_closedir_hook -/usr/lib/libc.sa(__libc.o):6008f2f4 A ___glob_opendir_hook -/usr/lib/libc.sa(__libc.o):6008f2f8 A ___glob_readdir_hook -/usr/lib/libc.sa(__libc.o):6008f278 A ___ttyname -/usr/lib/libc.sa(__libc.o):6008f238 A __collate_info -/usr/lib/libc.sa(__libc.o):6008f23c A __ctype_info -/usr/lib/libc.sa(__libc.o):6008f028 A __echoit -/usr/lib/libc.sa(__libc.o):6008f034 A __endwin -/usr/lib/libc.sa(__libc.o):6008f288 A __gdbm_fetch_val -/usr/lib/libc.sa(__libc.o):6008f280 A __gdbm_file -/usr/lib/libc.sa(__libc.o):6008f284 A __gdbm_memory -/usr/lib/libc.sa(__libc.o):6008f240 A __monetary_info -/usr/lib/libc.sa(__libc.o):6008f234 A __null_auth -/usr/lib/libc.sa(__libc.o):6008f244 A __numeric_info -/usr/lib/libc.sa(__libc.o):6008f2ec A __obstack -/usr/lib/libc.sa(__libc.o):6008f1c8 A __pfast -/usr/lib/libc.sa(__libc.o):6008f02c A __rawmode -/usr/lib/libc.sa(__libc.o):6008f1dc A __res -/usr/lib/libc.sa(__libc.o):6008f04c A __res_iflg -/usr/lib/libc.sa(__libc.o):6008f050 A __res_lflg -/usr/lib/libc.sa(__libc.o):6008f270 A __res_opcodes -/usr/lib/libc.sa(__libc.o):6008f274 A __res_resultcodes -/usr/lib/libc.sa(__libc.o):6008f248 A __response_info -/usr/lib/libc.sa(__libc.o):6008f2fc A __sigintr -/usr/lib/libc.sa(__libc.o):6008f00c A __sys_errlist -/usr/lib/libc.sa(__libc.o):6008f010 A __sys_nerr -/usr/lib/libc.sa(__libc.o):6008f014 A __sys_siglist -/usr/lib/libc.sa(__libc.o):6008f24c A __time_info -/usr/lib/libc.sa(__libc.o):6008f05c A __tty -/usr/lib/libc.sa(__libc.o):6008f040 A __tty_ch -/usr/lib/libc.sa(__libc.o):6008f1cc A __unctrl -/usr/lib/libc.sa(__libc.o):6008f27c A __win -/usr/lib/libc.sa(__libc.o):6008f058 A _curscr -/usr/lib/libc.sa(__libc.o):6008f228 A _daylight -/usr/lib/libc.sa(__libc.o):6008f200 A _errno -/usr/lib/libc.sa(__libc.o):6008f1d0 A _gdbm_errno -/usr/lib/libc.sa(__libc.o):6008f28c A _gdbm_version -/usr/lib/libc.sa(__libc.o):6008f008 A _h_errlist -/usr/lib/libc.sa(__libc.o):6008f1d8 A _h_errno -/usr/lib/libc.sa(__libc.o):6008f2a0 A _h_nerr -/usr/lib/libc.sa(__libc.o):6008f1c4 A _normtty -/usr/lib/libc.sa(__libc.o):6008f204 A _optarg -/usr/lib/libc.sa(__libc.o):6008f20c A _opterr -/usr/lib/libc.sa(__libc.o):6008f208 A _optind -/usr/lib/libc.sa(__libc.o):6008f2e4 A _optopt -/usr/lib/libc.sa(__libc.o):6008f218 A _ospeed -/usr/lib/libc.sa(__libc.o):6008f26c A _re_max_failures -/usr/lib/libc.sa(__libc.o):6008f210 A _re_syntax_options -/usr/lib/libc.sa(__libc.o):6008f1e0 A _rexecoptions -/usr/lib/libc.sa(__libc.o):6008f230 A _rpc_createerr -/usr/lib/libc.sa(__libc.o):6008f25c A _stderr -/usr/lib/libc.sa(__libc.o):6008f254 A _stdin -/usr/lib/libc.sa(__libc.o):6008f258 A _stdout -/usr/lib/libc.sa(__libc.o):6008f054 A _stdscr -/usr/lib/libc.sa(__libc.o):6008f2e8 A _svc_fdset -/usr/lib/libc.sa(__libc.o):6008f224 A _timezone -/usr/lib/libc.sa(__libc.o):6008f21c A _tputs_baud_rate -/usr/lib/libc.sa(__libc.o):6008f038 A _ttytype -/usr/lib/libc.sa(__libc.o):6008f220 A _tzname diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.params b/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.params deleted file mode 100644 index 2947e285363..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.params +++ /dev/null @@ -1,6 +0,0 @@ -Name=libss -Text=0x66880000 -Data=0x00000000 -Jump=0x00001000 -GOT=0x00001000 -Version=1.0.0 diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.undefs b/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.undefs deleted file mode 100644 index 56d1fda6de9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.undefs +++ /dev/null @@ -1,2 +0,0 @@ -66885010 D __NEEDS_SHRLIB_libc_4 -66885028 D __NEEDS_SHRLIB_libet_1 diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.vars b/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.vars deleted file mode 100644 index 95cd8e47f2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/dll/jump.vars +++ /dev/null @@ -1,3 +0,0 @@ -00000020 K _ss_std_requests libss jump/std_rqs -00000004 D __ss_table libss jump/data -00000004 D __ss_pager_name libss jump/data diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/error.c b/gnu/usr.sbin/e2fsprogs/lib/ss/error.c deleted file mode 100644 index 7f2e96ff340..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/error.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 1987, 1988, 1989 by MIT Student Information Processing - * Board - * - * For copyright information, see copyright.h. - */ - -#include <stdio.h> - -/* - * I'm assuming that com_err.h includes varargs.h, which it does - * (right now). There really ought to be a way for me to include the - * file without worrying about whether com_err.h includes it or not, - * but varargs.h doesn't define anything that I can use as a flag, and - * gcc will lose if I try to include it twice and redefine stuff. - */ -#if !defined(__STDC__) || !defined(ibm032) || !defined(NeXT) -#define ss_error ss_error_external -#endif - -#include "copyright.h" -#include <com_err.h> -#include "ss_internal.h" - -#ifdef HAVE_STDARG_H -#include <stdarg.h> -#else -#include <vararg.h> -#endif - -#undef ss_error - -char * ss_name(sci_idx) - int sci_idx; -{ - register char *ret_val; - register ss_data *infop; - - infop = ss_info(sci_idx); - if (infop->current_request == (char const *)NULL) { - ret_val = malloc((unsigned) - (strlen(infop->subsystem_name)+1) - * sizeof(char)); - if (ret_val == (char *)NULL) - return((char *)NULL); - strcpy(ret_val, infop->subsystem_name); - return(ret_val); - } - else { - register char *cp; - register char const *cp1; - ret_val = malloc((unsigned)sizeof(char) * - (strlen(infop->subsystem_name)+ - strlen(infop->current_request)+ - 4)); - cp = ret_val; - cp1 = infop->subsystem_name; - while (*cp1) - *cp++ = *cp1++; - *cp++ = ' '; - *cp++ = '('; - cp1 = infop->current_request; - while (*cp1) - *cp++ = *cp1++; - *cp++ = ')'; - *cp = '\0'; - return(ret_val); - } -} - -#ifdef HAVE_STDARG_H -void ss_error (int sci_idx, long code, const char * fmt, ...) -#else -void ss_error (va_alist) - va_dcl -#endif -{ - register char *whoami; - va_list pvar; -#ifndef HAVE_STDARG_H - int sci_idx; - long code; - char * fmt; - va_start (pvar); - sci_idx = va_arg (pvar, int); - code = va_arg (pvar, long); - fmt = va_arg (pvar, char *); -#else - va_start (pvar, fmt); -#endif - whoami = ss_name (sci_idx); - com_err_va (whoami, code, fmt, pvar); - free (whoami); - va_end(pvar); -} - -void ss_perror (sci_idx, code, msg) /* for compatibility */ - int sci_idx; - long code; - char const *msg; -{ - ss_error (sci_idx, code, "%s", msg); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/execute_cmd.c b/gnu/usr.sbin/e2fsprogs/lib/ss/execute_cmd.c deleted file mode 100644 index 74b59690f4c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/execute_cmd.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 1987, 1988, 1989 by Massachusetts Institute of Technology - * - * For copyright info, see copyright.h. - */ - -#ifdef HAS_STDLIB_H -#include <stdlib.h> -#endif -#include "ss_internal.h" -#include "copyright.h" -#include <stdio.h> - -/* - * get_request(tbl, idx) - * - * Function: - * Gets the idx'th request from the request table pointed to - * by tbl. - * Arguments: - * tbl (ss_request_table *) - * pointer to request table - * idx (int) - * index into table - * Returns: - * (ss_request_entry *) - * pointer to request table entry - * Notes: - * Has been replaced by a macro. - */ - -#ifdef __SABER__ -/* sigh. saber won't deal with pointer-to-const-struct */ -static struct _ss_request_entry * get_request (tbl, idx) - ss_request_table * tbl; - int idx; -{ - struct _ss_request_table *tbl1 = (struct _ss_request_table *) tbl; - struct _ss_request_entry *e = (struct _ss_request_entry *) tbl1->requests; - return e + idx; -} -#else -#define get_request(tbl,idx) ((tbl) -> requests + (idx)) -#endif - -/* - * check_request_table(rqtbl, argc, argv, sci_idx) - * - * Function: - * If the command string in argv[0] is in the request table, execute - * the commands and return error code 0. Otherwise, return error - * code ss_et_command_not_found. - * Arguments: - * rqtbl (ss_request_table *) - * pointer to request table - * argc (int) - * number of elements in argv[] - * argv (char *[]) - * argument string array - * sci_idx (int) - * ss-internal index for subsystem control info structure - * Returns: - * (int) - * zero if command found, ss_et_command_not_found otherwise - * Notes: - */ - -static int check_request_table (rqtbl, argc, argv, sci_idx) - register ss_request_table *rqtbl; - int argc; - char *argv[]; - int sci_idx; -{ -#ifdef __SABER__ - struct _ss_request_entry *request; -#else - register ss_request_entry *request; -#endif - register ss_data *info; - register char const * const * name; - char *string = argv[0]; - int i; - - info = ss_info(sci_idx); - info->argc = argc; - info->argv = argv; - for (i = 0; (request = get_request(rqtbl, i))->command_names; i++) { - for (name = request->command_names; *name; name++) - if (!strcmp(*name, string)) { - info->current_request = request->command_names[0]; - (request->function)(argc, (const char *const *) argv, - sci_idx,info->info_ptr); - info->current_request = (char *)NULL; - return(0); - } - } - return(SS_ET_COMMAND_NOT_FOUND); -} - -/* - * really_execute_command(sci_idx, argc, argv) - * - * Function: - * Fills in the argc, argv values in the subsystem entry and - * call the appropriate routine. - * Arguments: - * sci_idx (int) - * ss-internal index for subsystem control info structure - * argc (int) - * number of arguments in argument list - * argv (char **[]) - * pointer to parsed argument list (may be reallocated - * on abbrev expansion) - * - * Returns: - * (int) - * Zero if successful, ss_et_command_not_found otherwise. - * Notes: - */ - -static int really_execute_command (sci_idx, argc, argv) - int sci_idx; - int argc; - char **argv[]; -{ - register ss_request_table **rqtbl; - register ss_data *info; - - info = ss_info(sci_idx); - - for (rqtbl = info->rqt_tables; *rqtbl; rqtbl++) { - if (check_request_table (*rqtbl, argc, *argv, sci_idx) == 0) - return(0); - } - return(SS_ET_COMMAND_NOT_FOUND); -} - -/* - * ss_execute_command(sci_idx, argv) - * - * Function: - * Executes a parsed command list within the subsystem. - * Arguments: - * sci_idx (int) - * ss-internal index for subsystem control info structure - * argv (char *[]) - * parsed argument list - * Returns: - * (int) - * Zero if successful, ss_et_command_not_found otherwise. - * Notes: - */ - -int ss_execute_command(sci_idx, argv) - int sci_idx; - register char *argv[]; -{ - register int i, argc; - char **argp; - - argc = 0; - for (argp = argv; *argp; argp++) - argc++; - argp = (char **)malloc((argc+1)*sizeof(char *)); - for (i = 0; i <= argc; i++) - argp[i] = argv[i]; - i = really_execute_command(sci_idx, argc, &argp); - free(argp); - return(i); -} - -/* - * ss_execute_line(sci_idx, line_ptr) - * - * Function: - * Parses and executes a command line within a subsystem. - * Arguments: - * sci_idx (int) - * ss-internal index for subsystem control info structure - * line_ptr (char *) - * Pointer to command line to be parsed. - * Returns: - * (int) - * Error code. - * Notes: - */ - -int ss_execute_line (sci_idx, line_ptr) - int sci_idx; - char *line_ptr; -{ - char **argv; - int argc; - - /* flush leading whitespace */ - while (line_ptr[0] == ' ' || line_ptr[0] == '\t') - line_ptr++; - - /* check if it should be sent to operating system for execution */ - if (*line_ptr == '!') { - if (ss_info(sci_idx)->flags.escape_disabled) - return SS_ET_ESCAPE_DISABLED; - else { - line_ptr++; - system(line_ptr); - return 0; - } - } - - /* parse it */ - argv = ss_parse(sci_idx, line_ptr, &argc); - if (argc == 0) - return 0; - - /* look it up in the request tables, execute if found */ - return really_execute_command (sci_idx, argc, &argv); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/help.c b/gnu/usr.sbin/e2fsprogs/lib/ss/help.c deleted file mode 100644 index 5a17164c2e6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/help.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright info, see copyright.h. - */ - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_ERRNO_H -#include <errno.h> -#else -extern int errno; -#endif -#include <fcntl.h> -#include <sys/param.h> -#include <sys/types.h> -#include <sys/file.h> -#ifdef NEED_SYS_FCNTL_H -/* just for O_* */ -#include <sys/fcntl.h> -#endif -#include <sys/wait.h> -#include "ss_internal.h" -#include "copyright.h" - -void ss_help (argc, argv, sci_idx, info_ptr) - int argc; - char const * const *argv; - int sci_idx; - pointer info_ptr; -{ - char *buffer; - char const *request_name; - int code; - int fd, child; - register int idx; - register ss_data *info; - - request_name = ss_current_request(sci_idx, &code); - if (code != 0) { - ss_perror(sci_idx, code, ""); - return; /* no ss_abort_line, if invalid invocation */ - } - if (argc == 1) { - ss_list_requests(argc, argv, sci_idx, info_ptr); - return; - } - 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); - if (info->info_dirs == (char **)NULL) { - ss_perror(sci_idx, SS_ET_NO_INFO_DIR, (char *)NULL); - return; - } - if (info->info_dirs[0] == (char *)NULL) { - ss_perror(sci_idx, SS_ET_NO_INFO_DIR, (char *)NULL); - return; - } - 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"); - fd = open(buffer, O_RDONLY); - free(buffer); - if (fd >= 0) - break; - } - 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; - } - switch (child = fork()) { - case -1: - ss_perror(sci_idx, errno, "Can't fork for pager"); - return; - case 0: - (void) dup2(fd, 0); /* put file on stdin */ - ss_page_stdin(); - default: - (void) close(fd); /* what can we do if it fails? */ - while (wait(0) != child) { - /* do nothing if wrong pid */ - }; - } -} - -#ifndef HAVE_DIRENT_H -#include <sys/dir.h> -#else -#include <dirent.h> -#endif - -void ss_add_info_dir(sci_idx, info_dir, code_ptr) - int sci_idx; - char *info_dir; - int *code_ptr; -{ - register ss_data *info; - DIR *d; - int n_dirs; - register char **dirs; - - info = ss_info(sci_idx); - if (info_dir == NULL && *info_dir) { - *code_ptr = SS_ET_NO_INFO_DIR; - return; - } - if ((d = opendir(info_dir)) == (DIR *)NULL) { - *code_ptr = errno; - return; - } - closedir(d); - dirs = info->info_dirs; - for (n_dirs = 0; dirs[n_dirs] != (char *)NULL; n_dirs++) - ; /* get number of non-NULL dir entries */ - dirs = (char **)realloc((char *)dirs, - (unsigned)(n_dirs + 2)*sizeof(char *)); - if (dirs == (char **)NULL) { - info->info_dirs = (char **)NULL; - *code_ptr = errno; - return; - } - info->info_dirs = dirs; - dirs[n_dirs + 1] = (char *)NULL; - dirs[n_dirs] = malloc((unsigned)strlen(info_dir)+1); - strcpy(dirs[n_dirs], info_dir); - *code_ptr = 0; -} - -void ss_delete_info_dir(sci_idx, info_dir, code_ptr) - int sci_idx; - char *info_dir; - int *code_ptr; -{ - register char **i_d; - register char **info_dirs; - - info_dirs = ss_info(sci_idx)->info_dirs; - for (i_d = info_dirs; *i_d; i_d++) { - if (!strcmp(*i_d, info_dir)) { - while (*i_d) { - *i_d = *(i_d+1); - i_d++; - } - *code_ptr = 0; - return; - } - } - *code_ptr = SS_ET_NO_INFO_DIR; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/invocation.c b/gnu/usr.sbin/e2fsprogs/lib/ss/invocation.c deleted file mode 100644 index c4aecf1095a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/invocation.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#ifdef HAS_STDLIB_H -#include <stdlib.h> -#endif -#include "ss_internal.h" -#include "copyright.h" -#define size sizeof(ss_data *) - -int ss_create_invocation(subsystem_name, version_string, info_ptr, - request_table_ptr, code_ptr) - const char *subsystem_name, *version_string; - void *info_ptr; - ss_request_table *request_table_ptr; - int *code_ptr; -{ - register int sci_idx; - register ss_data *new_table; - register ss_data **table; - - *code_ptr = 0; - table = _ss_table; - new_table = (ss_data *) malloc(sizeof(ss_data)); - - if (table == (ss_data **) NULL) { - table = (ss_data **) malloc(2 * size); - table[0] = table[1] = (ss_data *)NULL; - } - initialize_ss_error_table (); - - for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++) - ; - table = (ss_data **) realloc((char *)table, - ((unsigned)sci_idx+2)*size); - table[sci_idx+1] = (ss_data *) NULL; - table[sci_idx] = new_table; - - new_table->subsystem_name = subsystem_name; - new_table->subsystem_version = version_string; - new_table->argv = (char **)NULL; - new_table->current_request = (char *)NULL; - new_table->info_dirs = (char **)malloc(sizeof(char *)); - *new_table->info_dirs = (char *)NULL; - new_table->info_ptr = info_ptr; - new_table->prompt = malloc((unsigned)strlen(subsystem_name)+4); - strcpy(new_table->prompt, subsystem_name); - strcat(new_table->prompt, ": "); -#ifdef silly - new_table->abbrev_info = ss_abbrev_initialize("/etc/passwd", code_ptr); -#else - new_table->abbrev_info = NULL; -#endif - new_table->flags.escape_disabled = 0; - new_table->flags.abbrevs_disabled = 0; - new_table->rqt_tables = - (ss_request_table **) calloc(2, sizeof(ss_request_table *)); - *(new_table->rqt_tables) = request_table_ptr; - *(new_table->rqt_tables+1) = (ss_request_table *) NULL; - _ss_table = table; - return(sci_idx); -} - -void -ss_delete_invocation(sci_idx) - int sci_idx; -{ - register ss_data *t; - int ignored_code; - - t = ss_info(sci_idx); - free(t->prompt); - free((char *)t->rqt_tables); - while(t->info_dirs[0] != (char *)NULL) - ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code); - free((char *)t->info_dirs); - free((char *)t); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/list_rqs.c b/gnu/usr.sbin/e2fsprogs/lib/ss/list_rqs.c deleted file mode 100644 index 5a9abe50e98..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/list_rqs.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ -#include "copyright.h" -#include "ss_internal.h" -#include <signal.h> -#include <setjmp.h> -#include <sys/wait.h> - -typedef void sigret_t; - -#ifdef lint /* "lint returns a value which is sometimes ignored" */ -#define DONT_USE(x) x=x; -#else /* !lint */ -#define DONT_USE(x) ; -#endif /* lint */ - -static char const twentyfive_spaces[26] = - " "; -static char const NL[2] = "\n"; - -void ss_list_requests(argc, argv, sci_idx, info_ptr) - int argc; - char **argv; - int sci_idx; - pointer info_ptr; -{ - register ss_request_entry *entry; - register char const * const *name; - register int spacing; - register ss_request_table **table; - - char buffer[BUFSIZ]; - FILE *output; - int fd; -#ifdef POSIX_SIGNALS - sigset_t omask, igmask; -#else - int mask; -#endif - sigret_t (*func)(); -#ifndef NO_FORK - int waitb; -#endif - - DONT_USE(argc); - DONT_USE(argv); - -#ifdef POSIX_SIGNALS - sigemptyset(&igmask); - sigaddset(&igmask, SIGINT); - sigprocmask(SIG_BLOCK, &igmask, &omask); -#else - mask = sigblock(sigmask(SIGINT)); -#endif - func = signal(SIGINT, SIG_IGN); - fd = ss_pager_create(); - output = fdopen(fd, "w"); -#ifdef POSIX_SIGNALS - sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); -#else - sigsetmask(mask); -#endif - - fprintf (output, "Available %s requests:\n\n", - ss_info (sci_idx) -> subsystem_name); - - for (table = ss_info(sci_idx)->rqt_tables; *table; table++) { - entry = (*table)->requests; - for (; entry->command_names; entry++) { - spacing = -2; - buffer[0] = '\0'; - if (entry->flags & SS_OPT_DONT_LIST) - continue; - for (name = entry->command_names; *name; name++) { - register int len = strlen(*name); - strncat(buffer, *name, len); - spacing += len + 2; - if (name[1]) { - strcat(buffer, ", "); - } - } - if (spacing > 23) { - strcat(buffer, NL); - fputs(buffer, output); - spacing = 0; - buffer[0] = '\0'; - } - strncat(buffer, twentyfive_spaces, 25-spacing); - strcat(buffer, entry->info_string); - strcat(buffer, NL); - fputs(buffer, output); - } - } - fclose(output); -#ifndef NO_FORK - wait(&waitb); -#endif - (void) signal(SIGINT, func); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/listen.c b/gnu/usr.sbin/e2fsprogs/lib/ss/listen.c deleted file mode 100644 index 8e23547f1d2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/listen.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Listener loop for subsystem library libss.a. - * - * $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/ss/Attic/listen.c,v 1.1 1997/06/14 07:18:45 downsj Exp $ - * $Locker: $ - * - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include "copyright.h" -#include "ss_internal.h" -#include <stdio.h> -#include <setjmp.h> -#include <signal.h> -#include <sys/param.h> -#ifdef BSD -#include <sgtty.h> -#endif - -#ifndef lint -static char const rcs_id[] = - "$Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/ss/Attic/listen.c,v 1.1 1997/06/14 07:18:45 downsj Exp $"; -#endif - -typedef void sigret_t; - -static ss_data *current_info; -static jmp_buf listen_jmpb; - -static sigret_t print_prompt(int sig) -{ -#ifdef BSD - /* put input into a reasonable mode */ - struct sgttyb ttyb; - if (ioctl(fileno(stdin), TIOCGETP, &ttyb) != -1) { - if (ttyb.sg_flags & (CBREAK|RAW)) { - ttyb.sg_flags &= ~(CBREAK|RAW); - (void) ioctl(0, TIOCSETP, &ttyb); - } - } -#endif - (void) fputs(current_info->prompt, stdout); - (void) fflush(stdout); -} - -static sigret_t listen_int_handler(int sig) -{ - putc('\n', stdout); - signal(SIGINT, listen_int_handler); - longjmp(listen_jmpb, 1); -} - -int ss_listen (int sci_idx) -{ - char *cp; - ss_data *info; - sigret_t (*sig_int)(int), (*sig_cont)(int), (*old_sig_cont)(int); - char input[BUFSIZ]; - char buffer[BUFSIZ]; - char *end = buffer; -#ifdef POSIX_SIGNALS - sigset_t omask, igmask; -#else - int mask; -#endif - int code; - jmp_buf old_jmpb; - ss_data *old_info = current_info; - - current_info = info = ss_info(sci_idx); - sig_cont = (sigret_t (*)(int)) 0; - info->abort = 0; -#ifdef POSIX_SIGNALS - sigemptyset(&igmask); - sigaddset(&igmask, SIGINT); - sigprocmask(SIG_BLOCK, &igmask, &omask); -#else - mask = sigblock(sigmask(SIGINT)); -#endif - memcpy(old_jmpb, listen_jmpb, sizeof(jmp_buf)); - sig_int = signal(SIGINT, listen_int_handler); - setjmp(listen_jmpb); -#ifdef POSIX_SIGNALS - sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); -#else - (void) sigsetmask(mask); -#endif - while(!info->abort) { - print_prompt(0); - *end = '\0'; - old_sig_cont = sig_cont; - sig_cont = signal(SIGCONT, print_prompt); - if (sig_cont == print_prompt) - sig_cont = old_sig_cont; - if (fgets(input, BUFSIZ, stdin) != input) { - code = SS_ET_EOF; - goto egress; - } - cp = strchr(input, '\n'); - if (cp) { - *cp = '\0'; - if (cp == input) - continue; - } - (void) signal(SIGCONT, sig_cont); - for (end = input; *end; end++) - ; - - code = ss_execute_line (sci_idx, input); - if (code == SS_ET_COMMAND_NOT_FOUND) { - register char *c = input; - while (*c == ' ' || *c == '\t') - c++; - cp = strchr (c, ' '); - if (cp) - *cp = '\0'; - cp = strchr (c, '\t'); - if (cp) - *cp = '\0'; - ss_error (sci_idx, 0, - "Unknown request \"%s\". Type \"?\" for a request list.", - c); - } - } - code = 0; -egress: - (void) signal(SIGINT, sig_int); - memcpy(listen_jmpb, old_jmpb, sizeof(jmp_buf)); - current_info = old_info; - return code; -} - -void ss_abort_subsystem(int sci_idx, int code) -{ - ss_info(sci_idx)->abort = 1; - ss_info(sci_idx)->exit_status = code; - -} - -void ss_quit(int argc, const char * const *argv, int sci_idx, pointer infop) -{ - ss_abort_subsystem(sci_idx, 0); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/mit-sipb-copyright.h b/gnu/usr.sbin/e2fsprogs/lib/ss/mit-sipb-copyright.h deleted file mode 100644 index ffcfc380c8c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/mit-sipb-copyright.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - -Copyright 1987 by the Student Information Processing Board - of the Massachusetts Institute of Technology - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice -appear in all copies and that both that copyright notice and -this permission notice appear in supporting documentation, -and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. -M.I.T. and the M.I.T. S.I.P.B. make no representations about -the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -*/ - diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/mk_cmds.sh.in b/gnu/usr.sbin/e2fsprogs/lib/ss/mk_cmds.sh.in deleted file mode 100644 index 48660815dfc..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/mk_cmds.sh.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# - -DIR=@SS_DIR@ -AWK=@AWK@ -SED=@SED@ - -FILE=$1 -ROOT=`echo $1 | sed -e s/.ct$//` -BASE=`basename $ROOT` -TMP=ct$$.c - -${SED} -f ${DIR}/ct_c.sed ${FILE} \ - | ${AWK} -f ${DIR}/ct_c.awk rootname=${ROOT} outfile=${TMP} - - -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 diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/pager.c b/gnu/usr.sbin/e2fsprogs/lib/ss/pager.c deleted file mode 100644 index 1a707738569..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/pager.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Pager: Routines to create a "more" running out of a particular file - * descriptor. - * - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_ERRNO_H -#include <errno.h> -#else -extern int errno; -#endif - -#include "ss_internal.h" -#include "copyright.h" -#include <stdio.h> -#include <sys/types.h> -#include <sys/file.h> -#include <signal.h> - -static char MORE[] = "more"; -extern char *_ss_pager_name; -extern char *getenv(); - -/* - * this needs a *lot* of work.... - * - * run in same process - * handle SIGINT sensibly - * allow finer control -- put-page-break-here - */ - -#ifndef NO_FORK -int ss_pager_create() -{ - int filedes[2]; - - if (pipe(filedes) != 0) - return(-1); - - switch(fork()) { - case -1: - return(-1); - case 0: - /* - * Child; dup read half to 0, close all but 0, 1, and 2 - */ - if (dup2(filedes[0], 0) == -1) - exit(1); - ss_page_stdin(); - default: - /* - * Parent: close "read" side of pipe, return - * "write" side. - */ - (void) close(filedes[0]); - return(filedes[1]); - } -} -#else /* don't fork */ -int ss_pager_create() -{ - int fd; - fd = open("/dev/tty", O_WRONLY, 0); - return fd; -} -#endif - -void ss_page_stdin() -{ - int i; - for (i = 3; i < 32; i++) - (void) close(i); - (void) signal(SIGINT, SIG_DFL); - { -#ifdef POSIX_SIGNALS - sigset_t mask; - - sigprocmask(SIG_BLOCK, 0, &mask); - sigdelset(&mask, SIGINT); - sigprocmask(SIG_SETMASK, &mask, 0); -#else - int mask = sigblock(0); - mask &= ~sigmask(SIGINT); - sigsetmask(mask); -#endif - } - if (_ss_pager_name == (char *)NULL) { - if ((_ss_pager_name = getenv("PAGER")) == (char *)NULL) - _ss_pager_name = MORE; - } - (void) execlp(_ss_pager_name, _ss_pager_name, (char *) NULL); - { - /* minimal recovery if pager program isn't found */ - char buf[80]; - register int n; - while ((n = read(0, buf, 80)) > 0) - write(1, buf, n); - } - exit(errno); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/parse.c b/gnu/usr.sbin/e2fsprogs/lib/ss/parse.c deleted file mode 100644 index 80175d3a8ee..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/parse.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright info, see copyright.h. - */ - -#ifdef HAS_STDLIB_H -#include <stdlib.h> -#endif -#include <string.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include "ss_internal.h" -#include "copyright.h" - -enum parse_mode { WHITESPACE, TOKEN, QUOTED_STRING }; - -/* - * parse(line_ptr, argc_ptr) - * - * Function: - * Parses line, dividing at whitespace, into tokens, returns - * the "argc" and "argv" values. - * Arguments: - * line_ptr (char *) - * Pointer to text string to be parsed. - * argc_ptr (int *) - * Where to put the "argc" (number of tokens) value. - * Returns: - * argv (char **) - * Series of pointers to parsed tokens. - */ - -#define NEW_ARGV(old,n) (char **)realloc((char *)old,\ - (unsigned)(n+2)*sizeof(char*)) - -char **ss_parse (sci_idx, line_ptr, argc_ptr) - int sci_idx; - register char *line_ptr; - int *argc_ptr; -{ - register char **argv, *cp; - register int argc; - register enum parse_mode parse_mode; - - argv = (char **) malloc (sizeof(char *)); - if (argv == (char **)NULL) { - ss_error(sci_idx, errno, "Can't allocate storage"); - *argc_ptr = 0; - return(argv); - } - *argv = (char *)NULL; - - argc = 0; - - parse_mode = WHITESPACE; /* flushing whitespace */ - cp = line_ptr; /* cp is for output */ - while (1) { -#ifdef DEBUG - { - printf ("character `%c', mode %d\n", *line_ptr, parse_mode); - } -#endif - while (parse_mode == WHITESPACE) { - if (*line_ptr == '\0') - goto end_of_line; - if (*line_ptr == ' ' || *line_ptr == '\t') { - line_ptr++; - continue; - } - if (*line_ptr == '"') { - /* go to quoted-string mode */ - parse_mode = QUOTED_STRING; - cp = line_ptr++; - argv = NEW_ARGV (argv, argc); - argv[argc++] = cp; - argv[argc] = NULL; - } - else { - /* random-token mode */ - parse_mode = TOKEN; - cp = line_ptr; - argv = NEW_ARGV (argv, argc); - argv[argc++] = line_ptr; - argv[argc] = NULL; - } - } - while (parse_mode == TOKEN) { - if (*line_ptr == '\0') { - *cp++ = '\0'; - goto end_of_line; - } - else if (*line_ptr == ' ' || *line_ptr == '\t') { - *cp++ = '\0'; - line_ptr++; - parse_mode = WHITESPACE; - } - else if (*line_ptr == '"') { - line_ptr++; - parse_mode = QUOTED_STRING; - } - else { - *cp++ = *line_ptr++; - } - } - while (parse_mode == QUOTED_STRING) { - if (*line_ptr == '\0') { - ss_error (sci_idx, 0, - "Unbalanced quotes in command line"); - free (argv); - *argc_ptr = 0; - return NULL; - } - else if (*line_ptr == '"') { - if (*++line_ptr == '"') { - *cp++ = '"'; - line_ptr++; - } - else { - parse_mode = TOKEN; - } - } - else { - *cp++ = *line_ptr++; - } - } - } -end_of_line: - *argc_ptr = argc; -#ifdef DEBUG - { - int i; - printf ("argc = %d\n", argc); - for (i = 0; i <= argc; i++) - printf ("\targv[%2d] = `%s'\n", i, - argv[i] ? argv[i] : "<NULL>"); - } -#endif - return(argv); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/prompt.c b/gnu/usr.sbin/e2fsprogs/lib/ss/prompt.c deleted file mode 100644 index 05b112d1f7a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/prompt.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * prompt.c: Routines for retrieving and setting a prompt. - * - * $Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/ss/Attic/prompt.c,v 1.1 1997/06/14 07:18:45 downsj Exp $ - * $Locker: $ - * - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include "copyright.h" -#include <stdio.h> -#include "ss_internal.h" - -#ifdef __STDC__ -void ss_set_prompt(int sci_idx, char *new_prompt) -#else -void ss_set_prompt(sci_idx, new_prompt) - int sci_idx; - char *new_prompt; -#endif -{ - ss_info(sci_idx)->prompt = new_prompt; -} - -#ifdef __STDC__ -char *ss_get_prompt(int sci_idx) -#else -char *ss_get_prompt(sci_idx) - int sci_idx; -#endif -{ - return(ss_info(sci_idx)->prompt); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/request_tbl.c b/gnu/usr.sbin/e2fsprogs/lib/ss/request_tbl.c deleted file mode 100644 index e1cbfe8027f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/request_tbl.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif - -#include "copyright.h" -#include "ss_internal.h" - -#define ssrt ss_request_table /* for some readable code... */ - -void ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr) - int sci_idx; - ssrt *rqtbl_ptr; - int position; /* 1 -> becomes second... */ - int *code_ptr; -{ - register ss_data *info; - register int i, size; - - info = ss_info(sci_idx); - for (size=0; info->rqt_tables[size] != (ssrt *)NULL; size++) - ; - /* size == C subscript of NULL == #elements */ - size += 2; /* new element, and NULL */ - info->rqt_tables = (ssrt **)realloc((char *)info->rqt_tables, - (unsigned)size*sizeof(ssrt)); - if (info->rqt_tables == (ssrt **)NULL) { - *code_ptr = errno; - return; - } - if (position > size - 2) - position = size - 2; - - if (size > 1) - for (i = size - 2; i >= position; i--) - info->rqt_tables[i+1] = info->rqt_tables[i]; - - info->rqt_tables[position] = rqtbl_ptr; - info->rqt_tables[size-1] = (ssrt *)NULL; - *code_ptr = 0; -} - -void ss_delete_request_table(sci_idx, rqtbl_ptr, code_ptr) - int sci_idx; - ssrt *rqtbl_ptr; - int *code_ptr; -{ - register ss_data *info; - register ssrt **rt1, **rt2; - - *code_ptr = SS_ET_TABLE_NOT_FOUND; - info = ss_info(sci_idx); - rt1 = info->rqt_tables; - for (rt2 = rt1; *rt1; rt1++) { - if (*rt1 != rqtbl_ptr) { - *rt2++ = *rt1; - *code_ptr = 0; - } - } - *rt2 = (ssrt *)NULL; - return; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/requests.c b/gnu/usr.sbin/e2fsprogs/lib/ss/requests.c deleted file mode 100644 index c214213e30c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/requests.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Various minor routines... - * - * Copyright 1987, 1988, 1989 by MIT - * - * For copyright information, see copyright.h. - */ - -#include "copyright.h" -#include <stdio.h> -#include "ss_internal.h" - -#ifdef __STDC__ -#define DECLARE(name) void name(int argc,const char * const *argv, \ - int sci_idx, void *infop) -#else -#define DECLARE(name) void name(argc,argv,sci_idx,info)int argc,sci_idx;char **argv;void *infop; - -#endif - -/* - * ss_self_identify -- assigned by default to the "." request - */ -DECLARE(ss_self_identify) -{ - register ss_data *info = ss_info(sci_idx); - printf("%s version %s\n", info->subsystem_name, - info->subsystem_version); -} - -/* - * ss_subsystem_name -- print name of subsystem - */ -DECLARE(ss_subsystem_name) -{ - printf("%s\n", ss_info(sci_idx)->subsystem_name); -} - -/* - * ss_subsystem_version -- print version of subsystem - */ -DECLARE(ss_subsystem_version) -{ - printf("%s\n", ss_info(sci_idx)->subsystem_version); -} - -/* - * ss_unimplemented -- routine not implemented (should be - * set up as (dont_list,dont_summarize)) - */ -DECLARE(ss_unimplemented) -{ - ss_perror(sci_idx, SS_ET_UNIMPLEMENTED, ""); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/ss.h b/gnu/usr.sbin/e2fsprogs/lib/ss/ss.h deleted file mode 100644 index 104e0388d46..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/ss.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#ifndef _ss_h -#define _ss_h __FILE__ - -#include <ss/copyright.h> -#include <ss/ss_err.h> - -#ifdef __STDC__ -#define __SS_CONST const -#define __SS_PROTO (int, const char * const *, int, void *) -#else -#define __SS_CONST -#define __SS_PROTO () -#endif - -typedef __SS_CONST struct _ss_request_entry { - __SS_CONST char * __SS_CONST *command_names; /* whatever */ - void (* __SS_CONST function) __SS_PROTO; /* foo */ - __SS_CONST char * __SS_CONST info_string; /* NULL */ - int flags; /* 0 */ -} ss_request_entry; - -typedef __SS_CONST struct _ss_request_table { - int version; - ss_request_entry *requests; -} ss_request_table; - -#define SS_RQT_TBL_V2 2 - -typedef struct _ss_rp_options { /* DEFAULT VALUES */ - int version; /* SS_RP_V1 */ - void (*unknown) __SS_PROTO; /* call for unknown command */ - int allow_suspend; - int catch_int; -} ss_rp_options; - -#define SS_RP_V1 1 - -#define SS_OPT_DONT_LIST 0x0001 -#define SS_OPT_DONT_SUMMARIZE 0x0002 - -void ss_help __SS_PROTO; -#if 0 -char *ss_current_request(); /* This is actually a macro */ -#endif -#ifdef __STDC__ -char *ss_name(int sci_idx); -void ss_error (int, long, char const *, ...); -void ss_perror (int, long, char const *); -int ss_create_invocation(const char *, const char *, void *, - ss_request_table *, int *); -void ss_delete_invocation(int); -int ss_listen(int); -int ss_execute_line(int, char *); -void ss_add_request_table(int, ss_request_table *, int, int *); -void ss_delete_request_table(int, ss_request_table *, int *); -void ss_abort_subsystem(int sci_idx, int code); -void ss_quit(int argc, const char * const *argv, int sci_idx, void *infop); -void ss_self_identify(int argc, const char * const *argv, int sci_idx, void *infop); -void ss_subsystem_name(int argc, const char * const *argv, - int sci_idx, void *infop); -void ss_subsystem_version(int argc, const char * const *argv, - int sci_idx, void *infop); -void ss_unimplemented(int argc, const char * const *argv, - int sci_idx, void *infop); -#else -char *ss_name(); -void ss_error (); -void ss_perror (); -int ss_create_invocation(); -void ss_delete_invocation(); -int ss_listen(); -int ss_execute_line(); -void ss_add_request_table(); -void ss_delete_request_table(); -void ss_abort_subsystem(); -void ss_quit(); -void ss_self_identify(); -void ss_subsystem_name(); -void ss_subsystem_version(); -void ss_unimplemented(); -#endif -extern ss_request_table ss_std_requests; -#endif /* _ss_h */ diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/ss_err.et b/gnu/usr.sbin/e2fsprogs/lib/ss/ss_err.et deleted file mode 100644 index 80e9dfa4449..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/ss_err.et +++ /dev/null @@ -1,39 +0,0 @@ - error_table ss - -ec SS_ET_SUBSYSTEM_ABORTED, - "Subsystem aborted" - -ec SS_ET_VERSION_MISMATCH, - "Version mismatch" - -ec SS_ET_NULL_INV, - "No current invocation" - -ec SS_ET_NO_INFO_DIR, - "No info directory" - -ec SS_ET_COMMAND_NOT_FOUND, - "Command not found" - -ec SS_ET_LINE_ABORTED, - "Command line aborted" - -ec SS_ET_EOF, - "End-of-file reached" - -ec SS_ET_PERMISSION_DENIED, - "Permission denied" - -ec SS_ET_TABLE_NOT_FOUND, - "Request table not found" - -ec SS_ET_NO_HELP_FILE, - "No info available" - -ec SS_ET_ESCAPE_DISABLED, - "Shell escapes are disabled" - -ec SS_ET_UNIMPLEMENTED, - "Sorry, this request is not yet implemented" - - end diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/ss_internal.h b/gnu/usr.sbin/e2fsprogs/lib/ss/ss_internal.h deleted file mode 100644 index 3bd59872ad1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/ss_internal.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#ifndef _ss_ss_internal_h -#define _ss_ss_internal_h __FILE__ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#ifdef __STDC__ - -#define NOARGS void -#define PROTOTYPE(p) p -typedef void * pointer; - -#else - -#define NOARGS -#define const -#define volatile -#define PROTOTYPE(p) () -typedef char * pointer; - -#endif /* not __STDC__ */ - -#include "ss.h" - -#if defined(__GNUC__) -#define LOCAL_ALLOC(x) __builtin_alloca(x) -#define LOCAL_FREE(x) -#else -#if defined(vax) -#define LOCAL_ALLOC(x) alloca(x) -#define LOCAL_FREE(x) -extern pointer alloca PROTOTYPE((unsigned)); -#else -#if defined(__HIGHC__) /* Barf! */ -pragma on(alloca); -#define LOCAL_ALLOC(x) alloca(x) -#define LOCAL_FREE(x) -extern pointer alloca PROTOTYPE((unsigned)); -#else -/* no alloca? */ -#define LOCAL_ALLOC(x) malloc(x) -#define LOCAL_FREE(x) free(x) -#endif -#endif -#endif /* LOCAL_ALLOC stuff */ - -typedef char BOOL; - -typedef struct _ss_abbrev_entry { - char *name; /* abbrev name */ - char **abbrev; /* new tokens to insert */ - unsigned int beginning_of_line : 1; -} ss_abbrev_entry; - -typedef struct _ss_abbrev_list { - int n_abbrevs; - ss_abbrev_entry *first_abbrev; -} ss_abbrev_list; - -typedef struct { -/* char *path; */ - ss_abbrev_list abbrevs[127]; -} ss_abbrev_info; - -typedef struct _ss_data { /* init values */ - /* this subsystem */ - const char *subsystem_name; - const char *subsystem_version; - /* current request info */ - int argc; - char **argv; /* arg list */ - char const *current_request; /* primary name */ - /* info directory for 'help' */ - char **info_dirs; - /* to be extracted by subroutines */ - pointer info_ptr; /* (void *) NULL */ - /* for ss_listen processing */ - char *prompt; - ss_request_table **rqt_tables; - ss_abbrev_info *abbrev_info; - struct { - unsigned int escape_disabled : 1, - abbrevs_disabled : 1; - } flags; - /* to get out */ - int abort; /* exit subsystem */ - int exit_status; -} ss_data; - -#define CURRENT_SS_VERSION 1 - -#define ss_info(sci_idx) (_ss_table[sci_idx]) -#define ss_current_request(sci_idx,code_ptr) \ - (*code_ptr=0,ss_info(sci_idx)->current_request) -void ss_delete_info_dir PROTOTYPE((int sci_idx, char *info_dir, - int *code_ptr)); -int ss_execute_line PROTOTYPE((int sci_idx, char *line_ptr)); -char **ss_parse PROTOTYPE((int sci_idx, char *line_ptr, int *argc_ptr)); -ss_abbrev_info *ss_abbrev_initialize PROTOTYPE((char *, int *)); -void ss_page_stdin(NOARGS); - -extern ss_data **_ss_table; -extern char *ss_et_msgs[]; - -#ifdef USE_SIGPROCMASK -/* fake sigmask, sigblock, sigsetmask */ -#include <signal.h> -#define sigmask(x) (1L<<(x)-1) -#define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL) -static int _fake_sigstore; -#define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0)) -#endif -#endif /* _ss_internal_h */ diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/std_rqs.c b/gnu/usr.sbin/e2fsprogs/lib/ss/std_rqs.c deleted file mode 100644 index 704766d690e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/std_rqs.c +++ /dev/null @@ -1,108 +0,0 @@ -/* ./std_rqs.c - automatically generated from ./std_rqs.ct */ -#include <ss/ss.h> - -#ifndef __STDC__ -#define const -#endif - -static char const * const ssu00001[] = { -".", - (char const *)0 -}; -extern void ss_self_identify __SS_PROTO; -static char const * const ssu00002[] = { -"help", - (char const *)0 -}; -extern void ss_help __SS_PROTO; -static char const * const ssu00003[] = { -"list_help", - "lh", - (char const *)0 -}; -extern void ss_unimplemented __SS_PROTO; -static char const * const ssu00004[] = { -"list_requests", - "lr", - "?", - (char const *)0 -}; -extern void ss_list_requests __SS_PROTO; -static char const * const ssu00005[] = { -"quit", - "q", - (char const *)0 -}; -extern void ss_quit __SS_PROTO; -static char const * const ssu00006[] = { -"abbrev", - "ab", - (char const *)0 -}; -extern void ss_unimplemented __SS_PROTO; -static char const * const ssu00007[] = { -"execute", - "e", - (char const *)0 -}; -extern void ss_unimplemented __SS_PROTO; -static char const * const ssu00008[] = { -"?", - (char const *)0 -}; -extern void ss_unimplemented __SS_PROTO; -static char const * const ssu00009[] = { -"subsystem_name", - (char const *)0 -}; -extern void ss_subsystem_name __SS_PROTO; -static char const * const ssu00010[] = { -"subsystem_version", - (char const *)0 -}; -extern void ss_subsystem_version __SS_PROTO; -static ss_request_entry ssu00011[] = { - { ssu00001, - ss_self_identify, - "Identify the subsystem.", - 3 }, - { ssu00002, - ss_help, - "Display info on command or topic.", - 0 }, - { ssu00003, - ss_unimplemented, - "List topics for which help is available.", - 3 }, - { ssu00004, - ss_list_requests, - "List available commands.", - 0 }, - { ssu00005, - ss_quit, - "Leave the subsystem.", - 0 }, - { ssu00006, - ss_unimplemented, - "Enable/disable abbreviation processing of request lines.", - 3 }, - { ssu00007, - ss_unimplemented, - "Execute a UNIX command line.", - 3 }, - { ssu00008, - ss_unimplemented, - "Produce a list of the most commonly used requests.", - 3 }, - { ssu00009, - ss_subsystem_name, - "Return the name of this subsystem.", - 1 }, - { ssu00010, - ss_subsystem_version, - "Return the version of this subsystem.", - 1 }, - { 0, 0, 0, 0 } -}; - -ss_request_table ss_std_requests = { 2, ssu00011 }; diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/std_rqs.ct b/gnu/usr.sbin/e2fsprogs/lib/ss/std_rqs.ct deleted file mode 100644 index 500288a02ed..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/std_rqs.ct +++ /dev/null @@ -1,46 +0,0 @@ - command_table ss_std_requests; - - request ss_self_identify, "Identify the subsystem.", - ".", - (dont_list, dont_summarize); - - request ss_help, "Display info on command or topic.", - help; - - unimplemented - ss_list_help, - "List topics for which help is available.", - list_help, lh; - - request ss_list_requests, "List available commands.", - list_requests, lr, "?"; - - request ss_quit, "Leave the subsystem.", - quit, q; - - unimplemented - ss_abbrev, - "Enable/disable abbreviation processing of request lines.", - abbrev, ab; - - unimplemented - ss_execute, - "Execute a UNIX command line.", - execute, e; - - unimplemented - ss_summarize_requests, - "Produce a list of the most commonly used requests.", - "?"; - - request ss_subsystem_name, - "Return the name of this subsystem.", - subsystem_name, - (dont_list); - - request ss_subsystem_version, - "Return the version of this subsystem.", - subsystem_version, - (dont_list); - - end; diff --git a/gnu/usr.sbin/e2fsprogs/lib/ss/test_ss.c b/gnu/usr.sbin/e2fsprogs/lib/ss/test_ss.c deleted file mode 100644 index 6acd6aeee18..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/ss/test_ss.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - *------------------------------------------------------------------ - * - * $Source: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/ss/Attic/test_ss.c,v $ - * $Revision: 1.1 $ - * $Date: 1997/06/14 07:18:45 $ - * $State: Exp $ - * $Author: downsj $ - * $Locker: $ - * - * $Log: test_ss.c,v $ - * Revision 1.1 1997/06/14 07:18:45 downsj - * Initial revision - * - * Revision 1.1 1993/06/03 12:31:25 tytso - * Initial revision - * - * Revision 1.1 1991/12/21 16:41:47 eichin - * Initial revision - * - * Revision 1.1 1991/12/21 11:13:39 eichin - * Initial revision - * - * Revision 1.2 89/01/25 07:52:27 raeburn - * *** empty log message *** - * - * Revision 1.1 88/01/23 15:50:26 raeburn - * Initial revision - * - * - *------------------------------------------------------------------ - */ - -#ifndef lint -static char const rcsid_test_c[] = - "$Header: /cvs/OpenBSD/src/gnu/usr.sbin/e2fsprogs/lib/ss/Attic/test_ss.c,v 1.1 1997/06/14 07:18:45 downsj Exp $"; -#endif /* lint */ - -#include <stdio.h> -#include "ss.h" - -extern ss_request_table test_cmds; - -#define TRUE 1 -#define FALSE 0 - -static char def_subsystem_name[5] = "test"; -static char version [4] = "1.0"; -extern void ss_listen(); - -int main(argc, argv) - int argc; - char **argv; -{ - int code; - char *argv0 = argv[0]; - char *initial_request = (char *)NULL; - int quit = FALSE; /* quit after processing request */ - int sci_idx; - char *subsystem_name; - - subsystem_name = def_subsystem_name; - - for (; *argv; ++argv, --argc) { - printf("checking arg: %s\n", *argv); - if (!strcmp(*argv, "-prompt")) { - if (argc == 1) { - fprintf(stderr, - "No argument supplied with -prompt\n"); - exit(1); - } - argc--; argv++; - subsystem_name = *argv; - } - else if (!strcmp(*argv, "-request") || !strcmp(*argv, "-rq")) { - if (argc == 1) { - fprintf(stderr, - "No string supplied with -request.\n"); - exit(1); - } - argc--; argv++; - initial_request = *argv; - } - else if (!strcmp(*argv, "-quit")) - quit = TRUE; - else if (!strcmp(*argv, "-no_quit")) - quit = FALSE; - else if (**argv == '-') { - fprintf(stderr, "Unknown control argument %s\n", - *argv); - fprintf(stderr, - "Usage: %s [gateway] [ -prompt name ] [ -request name ] [ -quit ]\n", - argv0); - exit(1); - } - } - - sci_idx = ss_create_invocation(subsystem_name, version, - (char *)NULL, &test_cmds, &code); - if (code) { - ss_perror(sci_idx, code, "creating invocation"); - exit(1); - } - - (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &code); - if (code) { - ss_perror (sci_idx, code, "adding standard requests"); - exit (1); - } - - if (!quit) - printf("test version %s. Type '?' for a list of commands.\n\n", - version); - - if (initial_request != (char *)NULL) { - code = ss_execute_line(sci_idx, initial_request); - if (code != 0) - ss_perror(sci_idx, code, initial_request); - } - if (!quit || code) - (void) ss_listen (sci_idx, &code); - exit(0); -} - - -void test_cmd (argc, argv) - int argc; - char **argv; -{ - while (++argv, --argc) - fputs(*argv, stdout); - putchar ('\n'); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/substitute_sh.in b/gnu/usr.sbin/e2fsprogs/lib/substitute_sh.in deleted file mode 100644 index f80d4d9f8aa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/substitute_sh.in +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# substitute <source> <dest> - -AWK=@AWK@ -SED=@SED@ -ET_DIR=@ET_DIR@ -SS_DIR=@SS_DIR@ -E2FSPROGS_MONTH=@E2FSPROGS_MONTH@ -E2FSPROGS_YEAR=@E2FSPROGS_YEAR@ -E2FSPROGS_VERSION=@E2FSPROGS_VERSION@ -SIZEOF_LONG_LONG=@SIZEOF_LONG_LONG@ -SIZEOF_LONG=@SIZEOF_LONG@ -SIZEOF_INT=@SIZEOF_INT@ -SIZEOF_SHORT=@SIZEOF_SHORT@ - -MV=@MV@ -RM=@RM@ -CP=@CP@ - -@DO_SUBSTITUTE_SCRIPT@ diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/ChangeLog b/gnu/usr.sbin/e2fsprogs/lib/uuid/ChangeLog deleted file mode 100644 index 13bf8581b6a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/ChangeLog +++ /dev/null @@ -1,57 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Sun Mar 2 16:45:36 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (ELF_VERSION): Change version to be 1.1 - -Thu Feb 6 23:08:07 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * gen_uuid.c (uuid_generate): Set Multicast bit when picking a - random node_id, to prevent conflicts with IEEE 802 - addresses obtained from network cards. - -Wed Jan 1 23:51:09 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * unpack.c, pack.c: Include string.h, since we use memcpy(). - -Tue Dec 3 13:05:11 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * parse.c: Add #include of ctype.h and stdlib.h, to pull in the - required prototypes. - -Fri Oct 11 17:15:10 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (DLL_ADDRESS): Updated DLL address for libuuid. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Tue Aug 27 16:50:43 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * uuid/gen_uuid.c [HAVE_NET_IF_H] <net/if.h>: Include guarded. - [HAVE_NETINET_IN_H] <netinet/in.h>: Include guarded. - (get_node_id): Surround bulk of function with #ifdef HAVE_NET_IF_H. - -Tue Aug 27 16:50:16 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * gen_uuid.c (get_node_id): Add a specific ifdef for the HURD, - since it is broken w.r.t getting hardware addresses. diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/Makefile.in b/gnu/usr.sbin/e2fsprogs/lib/uuid/Makefile.in deleted file mode 100644 index a186f2ab612..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/Makefile.in +++ /dev/null @@ -1,122 +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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = ../.. -my_dir = lib/uuid -INSTALL = @INSTALL@ - -@MCONFIG@ - -all:: - -OBJS= clear.o \ - compare.o \ - copy.o \ - gen_uuid.o \ - isnull.o \ - pack.o \ - parse.o \ - unpack.o \ - unparse.o - -SRCS= $(srcdir)/clear.c \ - $(srcdir)/compare.c \ - $(srcdir)/copy.c \ - $(srcdir)/gen_uuid.c \ - $(srcdir)/isnull.c \ - $(srcdir)/pack.c \ - $(srcdir)/parse.c \ - $(srcdir)/unpack.c \ - $(srcdir)/unparse.c - -LIBRARY= libuuid -LIBDIR= uuid - -DLL_ADDRESS = 0x67900000 -DLL_JUMPSIZE = 0x1000 -DLL_GOTSIZE = 0x1000 -DLL_VERSION = 0.0 -DLL_IMAGE = libuuid -DLL_STUB = libuuid -DLL_MYDIR = uuid -DLL_INSTALL_DIR = $(libdir) - -ELF_VERSION = 1.1 -ELF_SO_VERSION = 1 -ELF_IMAGE = libuuid -ELF_MYDIR = uuid -ELF_INSTALL_DIR = $(libdir) -ELF_OTHER_LIBS = -lc - -BSDLIB_VERSION = 1.0 -BSDLIB_IMAGE = libuuid -BSDLIB_MYDIR = uuid -BSDLIB_INSTALL_DIR = $(libdir) - -@MAKEFILE_LIBRARY@ -@MAKEFILE_DLL@ -@MAKEFILE_ELF@ -@MAKEFILE_BSDLIB@ -@MAKEFILE_PROFILE@ -@MAKEFILE_CHECKER@ - -.c.o: - $(CC) $(ALL_CFLAGS) -c $< -o $@ -@PROFILE_CMT@ $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< -@CHECKER_CMT@ $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $< -@DLL_CMT@ (export JUMP_DIR=`pwd`/jump; $(CC) -B$(JUMP_PREFIX) $(ALL_CFLAGS) \ -@DLL_CMT@ -o jump/$*.o -c $<) -@ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< -@BSDLIB_CMT@ $(CC) $(ALL_CFLAGS) -fpic -o pic/$*.o -c $< - -all:: tst_uuid - -tst_uuid.o: $(srcdir)/tst_uuid.c - $(CC) $(ALL_CFLAGS) -c $(srcdir)/tst_uuid.c -o tst_uuid.o - -tst_uuid: tst_uuid.o $(LIBUUID) - $(CC) $(ALL_LDFLAGS) -o tst_uuid tst_uuid.o $(LIBUUID) - -installdirs:: - $(top_srcdir)/mkinstalldirs $(DESTDIR)$(ulibdir) \ - $(DESTDIR)$(includedir)/uuid - -install:: all installdirs - $(INSTALL_DATA) libuuid.a $(DESTDIR)$(ulibdir)/libuuid.a - $(CHMOD) 644 $(DESTDIR)$(ulibdir)/libuuid.a - -$(RANLIB) $(DESTDIR)$(ulibdir)/libuuid.a - $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/libuuid.a - $(INSTALL_DATA) $(srcdir)/uuid.h $(DESTDIR)$(includedir)/uuid/uuid.h - -uninstall:: - $(RM) -f $(ulibdir)/libuuid.a - -clean:: - $(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/* - $(RM) -f ../libuuid.a ../libuuid_p.a tst_uuid - -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 -# -clear.o: $(srcdir)/clear.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -compare.o: $(srcdir)/compare.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -copy.o: $(srcdir)/copy.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -gen_uuid.o: $(srcdir)/gen_uuid.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -isnull.o: $(srcdir)/isnull.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -pack.o: $(srcdir)/pack.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -parse.o: $(srcdir)/parse.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -unpack.o: $(srcdir)/unpack.c $(srcdir)/uuidP.h $(srcdir)/uuid.h -unparse.o: $(srcdir)/unparse.c $(srcdir)/uuidP.h $(srcdir)/uuid.h diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/clear.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/clear.c deleted file mode 100644 index 32e26d4fb2e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/clear.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * clear.c -- Clear a UUID - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include "string.h" - -#include "uuidP.h" - -void uuid_clear(uuid_t uu) -{ - memset(uu, 0, 16); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/compare.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/compare.c deleted file mode 100644 index 7bca4fa4828..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/compare.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * compare.c --- compare whether or not two UUID's are the same - * - * Returns 0 if the two UUID's are different, and 1 if they are the same. - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include "uuidP.h" - -int uuid_compare(uuid_t uu1, uuid_t uu2) -{ - unsigned char *cp1, *cp2; - int i; - - for (i=0, cp1 = uu1, cp2 = uu2; i < 16; i++) - if (*cp1++ != *cp2++) - return 0; - return 1; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/copy.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/copy.c deleted file mode 100644 index 5d0efc4aa7e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/copy.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * copy.c --- copy UUIDs - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include "uuidP.h" - -void uuid_copy(uuid_t uu1, uuid_t uu2) -{ - unsigned char *cp1, *cp2; - int i; - - for (i=0, cp1 = uu1, cp2 = uu2; i < 16; i++) - *cp1++ = *cp2++; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.funcs b/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.funcs deleted file mode 100644 index cd75bb8ff48..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.funcs +++ /dev/null @@ -1,9 +0,0 @@ -00000000 T _uuid_clear libuuid clear -00000000 T _uuid_compare libuuid compare -00000000 T _uuid_copy libuuid copy -00000000 T _uuid_generate libuuid gen_uuid -00000000 T _uuid_is_null libuuid isnull -00000000 T _uuid_pack libuuid pack -00000000 T _uuid_parse libuuid parse -00000000 T _uuid_unpack libuuid unpack -00000000 T _uuid_unparse libuuid unparse diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.ignore b/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.ignore deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.ignore +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.import b/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.import deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.import +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.params b/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.params deleted file mode 100644 index efd35138506..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.params +++ /dev/null @@ -1,6 +0,0 @@ -Name=libuuid -Text=0x67900000 -Data=0x00000000 -Jump=0x00001000 -GOT=0x00001000 -Version=0.0.0 diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.undefs b/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.undefs deleted file mode 100644 index 1fa6c91fb53..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.undefs +++ /dev/null @@ -1 +0,0 @@ -67903014 D __NEEDS_SHRLIB_libc_4 diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.vars b/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.vars deleted file mode 100644 index e69de29bb2d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/dll/jump.vars +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/gen_uuid.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/gen_uuid.c deleted file mode 100644 index a0c815b69d4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/gen_uuid.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * gen_uuid.c --- generate a DCE-compatible uuid - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#include <string.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/stat.h> -#include <sys/file.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#ifdef HAVE_SYS_SOCKIO_H -#include <sys/sockio.h> -#endif -#ifdef HAVE_NET_IF_H -#include <net/if.h> -#endif -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - -#include "uuidP.h" - -#ifdef HAVE_SRANDOM -#define srand(x) srandom(x) -#define rand() random() -#endif - -/* - * Generate a series of random bytes. Use /dev/urandom if possible, - * and if not, use srandom/random. - */ -static void get_random_bytes(void *buf, int nbytes) -{ - static int fd = -2; - int i; - char *cp = (char *) buf; - - if (fd == -2) { - fd = open("/dev/urandom", O_RDONLY); - srand((getpid() << 16) ^ getuid() ^ time(0)); - } - if (fd > 0) { - i = read(fd, cp, nbytes); - if (i == nbytes) - return; - if (i > 0) { - nbytes -= i; - cp += i; - } - } - for (i=0; i < nbytes; i++) - *cp++ = rand() & 0xFF; -} - -/* - * Get the ethernet hardware address, if we can find it... - */ -static int get_node_id(unsigned char *node_id) -{ -#ifdef HAVE_NET_IF_H - int sd; - struct ifreq ifr, *ifrp; - struct ifconf ifc; - char buf[1024]; - int n, i; - unsigned char *a; - -/* - * BSD 4.4 defines the size of an ifreq to be - * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len - * However, under earlier systems, sa_len isn't present, so the size is - * just sizeof(struct ifreq) - */ -#ifdef HAVE_SA_LEN -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#endif -#define ifreq_size(i) max(sizeof(struct ifreq),\ - sizeof((i).ifr_name)+(i).ifr_addr.sa_len) -#else -#define ifreq_size(i) sizeof(struct ifreq) -#endif /* HAVE_SA_LEN*/ - - sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sd < 0) { - return -1; - } - memset(buf, 0, sizeof(buf)); - ifc.ifc_len = sizeof(buf); - ifc.ifc_buf = buf; - if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { - close(sd); - return -1; - } - n = ifc.ifc_len; - for (i = 0; i < n; i+= ifreq_size(*ifr) ) { - ifrp = (struct ifreq *)((caddr_t) ifc.ifc_buf+i); - strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); -#ifdef SIOCGIFHWADDR - if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) - continue; - a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; -#else -#ifdef SIOCGENADDR - if (ioctl(sd, SIOCGENADDR, &ifr) < 0) - continue; - a = (unsigned char *) ifr.ifr_enaddr; -#else - /* - * XXX we don't have a way of getting the hardware - * address - */ - close(sd); - return 0; -#endif /* SIOCGENADDR */ -#endif /* SIOCGIFHWADDR */ - if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) - continue; - if (node_id) { - memcpy(node_id, a, 6); - close(sd); - return 1; - } - } - close(sd); -#endif - return 0; -} - -/* Assume that the gettimeofday() has microsecond granularity */ -#define MAX_ADJUSTMENT 10 - -static int get_clock(__u32 *clock_high, __u32 *clock_low, __u16 *ret_clock_seq) -{ - static int adjustment = 0; - static struct timeval last = {0, 0}; - static __u16 clock_seq; - struct timeval tv; - unsigned long long clock; - -try_again: - gettimeofday(&tv, 0); - if ((last.tv_sec == 0) && (last.tv_usec == 0)) { - get_random_bytes(&clock_seq, sizeof(clock_seq)); - clock_seq &= 0x1FFF; - last = tv; - last.tv_sec--; - } - if ((tv.tv_sec < last.tv_sec) || - ((tv.tv_sec == last.tv_sec) && - (tv.tv_usec < last.tv_usec))) { - clock_seq = (clock_seq+1) & 0x1FFF; - adjustment = 0; - } else if ((tv.tv_sec == last.tv_sec) && - (tv.tv_usec == last.tv_usec)) { - if (adjustment >= MAX_ADJUSTMENT) - goto try_again; - adjustment++; - } else - adjustment = 0; - - clock = tv.tv_usec*10 + adjustment; - clock += ((unsigned long long) tv.tv_sec)*10000000; - clock += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; - - *clock_high = clock >> 32; - *clock_low = clock; - *ret_clock_seq = clock_seq; - return 0; -} - -void uuid_generate(uuid_t out) -{ - static unsigned char node_id[6]; - static int has_init = 0; - struct uuid uu; - __u32 clock_mid; - - if (!has_init) { - if (get_node_id(node_id) <= 0) { - get_random_bytes(node_id, 6); - /* - * Set multicast bit, to prevent conflicts - * with IEEE 802 addresses obtained from - * network cards - */ - node_id[0] |= 0x80; - } - has_init = 1; - } - get_clock(&clock_mid, &uu.time_low, &uu.clock_seq); - uu.clock_seq |= 0x8000; - uu.time_mid = (__u16) clock_mid; - uu.time_hi_and_version = (clock_mid >> 16) | 0x1000; - memcpy(uu.node, node_id, 6); - uuid_pack(&uu, out); -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/isnull.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/isnull.c deleted file mode 100644 index 43b81f879e1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/isnull.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * isnull.c --- Check whether or not the UUID is null - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include "uuidP.h" - -/* Returns 1 if the uuid is the NULL uuid */ -int uuid_is_null(uuid_t uu) -{ - unsigned char *cp; - int i; - - for (i=0, cp = uu; i < 16; i++) - if (*cp++) - return 0; - return 1; -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/pack.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/pack.c deleted file mode 100644 index c4d03c8c432..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/pack.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Internal routine for packing UUID's - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <string.h> -#include "uuidP.h" - -void uuid_pack(struct uuid *uu, uuid_t ptr) -{ - __u32 tmp; - unsigned char *out = ptr; - - tmp = uu->time_low; - out[3] = (unsigned char) tmp; - tmp >>= 8; - out[2] = (unsigned char) tmp; - tmp >>= 8; - out[1] = (unsigned char) tmp; - tmp >>= 8; - out[0] = (unsigned char) tmp; - - tmp = uu->time_mid; - out[5] = (unsigned char) tmp; - tmp >>= 8; - out[4] = (unsigned char) tmp; - - tmp = uu->time_hi_and_version; - out[7] = (unsigned char) tmp; - tmp >>= 8; - out[6] = (unsigned char) tmp; - - tmp = uu->clock_seq; - out[9] = (unsigned char) tmp; - tmp >>= 8; - out[8] = (unsigned char) tmp; - - memcpy(out+10, uu->node, 6); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/parse.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/parse.c deleted file mode 100644 index 580c1fc2dc5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/parse.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * parse.c --- UUID parsing - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> - -#include "uuidP.h" - -int uuid_parse(char *in, uuid_t uu) -{ - struct uuid uuid; - int i; - char *cp, buf[3]; - - if (strlen(in) != 36) - return -1; - for (i=0, cp = in; i <= 36; i++,cp++) { - if ((i == 8) || (i == 13) || (i == 18) || - (i == 23)) - if (*cp == '-') - continue; - if (i== 36) - if (*cp == 0) - continue; - if (!isxdigit(*cp)) - return -1; - } - uuid.time_low = strtoul(in, NULL, 16); - uuid.time_mid = strtoul(in+9, NULL, 16); - uuid.time_hi_and_version = strtoul(in+14, NULL, 16); - uuid.clock_seq = strtoul(in+19, NULL, 16); - cp = in+24; - buf[2] = 0; - for (i=0; i < 6; i++) { - buf[0] = *cp++; - buf[1] = *cp++; - uuid.node[i] = strtoul(buf, NULL, 16); - } - - uuid_pack(&uuid, uu); - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/tst_uuid.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/tst_uuid.c deleted file mode 100644 index c60e9f810c3..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/tst_uuid.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * tst_uuid.c --- test program from the UUID library - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <linux/ext2_fs.h> - -#include "uuid.h" - -int -main(int argc, char *argv) -{ - uuid_t buf, tst; - char str[100]; - unsigned char *cp; - int i; - int failed = 0; - - uuid_generate(buf); - uuid_unparse(buf, str); - printf("UUID string = %s\n", str); - printf("UUID: "); - for (i=0, cp = (unsigned char *) &buf; i < 16; i++) { - printf("%02x", *cp++); - } - printf("\n"); - uuid_parse(str, tst); - if (uuid_compare(buf, tst)) - printf("UUID parse and compare succeeded.\n"); - else { - printf("UUID parse and compare failed!\n"); - failed++; - } - uuid_clear(tst); - if (uuid_is_null(tst)) - printf("UUID clear and is null succeeded.\n"); - else { - printf("UUID clear and is null failed!\n"); - failed++; - } - uuid_copy(buf, tst); - if (uuid_compare(buf, tst)) - printf("UUID copy and compare succeeded.\n"); - else { - printf("UUID copy and compare failed!\n"); - failed++; - } - if (failed) { - printf("%d failures.\n", failed); - exit(1); - } - return 0; -} - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/unpack.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/unpack.c deleted file mode 100644 index 97a9dd84048..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/unpack.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Internal routine for unpacking UUID - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <string.h> -#include "uuidP.h" - -void uuid_unpack(uuid_t in, struct uuid *uu) -{ - __u8 *ptr = in; - __u32 tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - tmp = (tmp << 8) | *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->time_low = tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->time_mid = tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->time_hi_and_version = tmp; - - tmp = *ptr++; - tmp = (tmp << 8) | *ptr++; - uu->clock_seq = tmp; - - memcpy(uu->node, ptr, 6); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/unparse.c b/gnu/usr.sbin/e2fsprogs/lib/uuid/unparse.c deleted file mode 100644 index ab904bc165e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/unparse.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * unparse.c -- convert a UUID to string - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> - -#include "uuidP.h" - -void uuid_unparse(uuid_t uu, char *out) -{ - struct uuid uuid; - - uuid_unpack(uu, &uuid); - sprintf(out, - "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, - uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, - uuid.node[0], uuid.node[1], uuid.node[2], - uuid.node[3], uuid.node[4], uuid.node[5]); -} - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/uuid.h b/gnu/usr.sbin/e2fsprogs/lib/uuid/uuid.h deleted file mode 100644 index 08f924c2bcd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/uuid.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Public include file for the UUID library - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -typedef unsigned char uuid_t[16]; - -/* clear.c */ -void uuid_clear(uuid_t uu); - -/* compare.c */ -int uuid_compare(uuid_t uu1, uuid_t uu2); - -/* copy.c */ -void uuid_copy(uuid_t uu1, uuid_t uu2); - -/* gen_uuid.c */ -void uuid_generate(uuid_t out); - -/* isnull.c */ -int uuid_is_null(uuid_t uu); - -/* parse.c */ -int uuid_parse(char *in, uuid_t uu); - -/* unparse.c */ -void uuid_unparse(uuid_t uu, char *out); - - - diff --git a/gnu/usr.sbin/e2fsprogs/lib/uuid/uuidP.h b/gnu/usr.sbin/e2fsprogs/lib/uuid/uuidP.h deleted file mode 100644 index 69f9af9959f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/lib/uuid/uuidP.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * uuid.h -- private header file for uuids - * - * Copyright (C) 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <sys/types.h> -#include <linux/types.h> - -#include "uuid.h" - -/* - * Offset between 15-Oct-1582 and 1-Jan-70 - */ -#define TIME_OFFSET_HIGH 0x01B21DD2 -#define TIME_OFFSET_LOW 0x13814000 - -struct uuid { - __u32 time_low; - __u16 time_mid; - __u16 time_hi_and_version; - __u16 clock_seq; - __u8 node[6]; -}; - - -/* - * prototypes - */ -void uuid_pack(struct uuid *uu, uuid_t ptr); -void uuid_unpack(uuid_t in, struct uuid *uu); - - - - diff --git a/gnu/usr.sbin/e2fsprogs/misc/ChangeLog b/gnu/usr.sbin/e2fsprogs/misc/ChangeLog deleted file mode 100644 index 7ad397a89a7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/ChangeLog +++ /dev/null @@ -1,454 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 24 09:52:47 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * mke2fs.c: Added new option -R, which specifies RAID options. - Currently the only supported RAID option is "stride" which - specifies the stripe width in RAID filesystem. This is - used to aid in the placement of the inode and block - bitmaps. - - * mke2fs.8.in, tune2fs.8.in: Added warnings that the sparse - superblock option isn't yet supported by most kernels. - -Wed Apr 23 22:42:51 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * mke2fs.c (PRS): Make the default filesystem revision be 0, not - 1. (Since some people are still worried about 1.2.13 - compatibility). - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:57:24 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * chattr.1.in: Updated man page so that the 'A' attribute is - specified everywhere. - - * chattr.c (usage): Added usage message for the 'A' attribute. - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Thu Apr 10 07:08:03 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * dumpe2fs.c (list_desc): List the offsets of the inode and block - bitmaps, and the inode table. List the block boundaries - for the groups. - -Sat Apr 5 11:55:52 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * tune2fs.c (main): Implement the -s flag allows the user to - set and reset the sparse superblock flag. - - * mke2fs.c (PRS): By default generate DYNAMIC revision - filesystems. The -s flag controls whether or not the - sparse superblock flag is set. - (PRS): Change to allow the user to specify the true - maximum number of blocks per group to reflect the - blocksize. - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Thu Mar 6 17:15:05 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * mke2fs.c (create_root_dir): Set the root directory's i_uid and - i_gid to be the real user and group id. - -Tue Mar 4 10:14:33 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * mke2fs.c (check_plausibility): Add more intelligent error - messages when the device doesn't exist. - -Sat Mar 1 10:43:32 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * fsck.c (main): Fix bug where the PATH environment variable isn't - set when it is unset. - -Tue Jan 14 12:30:45 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * mke2fs.c (write_inode_tables): Fixed bug in write_inode_tables - where a loop variable was getting reused in a nested loop. - This caused the inode table to not be correctly - initialized. - -Thu Jan 2 00:00:37 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * lsattr.c, chattr.c: Include string.h, since we use memcpy(). - - * findsuper.c: Use time_t for ctime(), not __u32. - -Sat Dec 28 23:39:18 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * badblocks.c: Adapted -vv modifications from Rik Faith so that - they frequently update the block number field. - - * badblocks.8.in: Document the optional start-block parameter - -Mon Oct 14 11:52:58 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * mke2fs.c: Updated to use new ext2fs_allocate_tables() function. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Mon Oct 7 00:56:24 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * chattr.1.in: Documented the 'A' (noatime) attribute. - - * dumpe2fs.c (main): Change EXT2_SWAP to EXT2_FLAG_SWAP for - consistency's sake. - -Sun Sep 22 16:18:47 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * chattr.c (decode_arg): Add support for the 'A' (noatime) flag. - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Sat Sep 7 07:34:11 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * tune2fs.c (main): Add support for new option -C, which sets the - current number of mounts. - (main): Allow the interval to be specified in seconds, - mostly for debugging. - -Tue Aug 27 17:27:43 1996 Miles Bader <miles@gnu.ai.mit.edu> - - * Makefile.in (SMANPAGES): Use @FSCK_MAN@ instead of fsck.8. - (SPROGS): Use @FSCK_PROG@ instead of fsck. - -Thu Aug 22 00:51:44 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * mke2fs.c (zap_bootblock): Don't do zap_bootblock on a - sparc. - -Tue Aug 20 00:15:46 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * chattr.c (main): Fixed bug so that chattr -v works. (Bug report - and fix sent by Charles Howes, chowes@eznet.ca) - -Fri Aug 9 11:52:42 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * tune2fs.8.in: - * tune2fs.c: Added support for the -L option which sets the volume - label, the -M option which sets the last mounted - directory, and the -U option which sets the filesystem UUID. - - * mke2fs.8.in: - * mke2fs.c: Added support for the -o option, which overrides the - creator OS. Generate a UUID for the filesystem, if - applicable. Added support for the -L option which sets - the volume label, and the -M option which sets the last - mounted directory. - -Sat Jun 22 17:43:17 1996 Remy Card <card@bbj.linux.eu.org> - - * chattr.c (decode_arg): Integrated Michael Nonweiler's fix to - avoid a segmentation fault when the "-v" option is used - and no version number is specified. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed May 15 21:15:43 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (fsck): fsck doesn't need to be linked with the ext2 - libraries. - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Thu Mar 7 03:43:20 1996 <tytso@rsts-11.mit.edu> - - * mke2fs.c (PRS): Add (for development only) support to - specify revision and inode size of the new filesystem. - -Tue Mar 5 03:51:35 1996 <tytso@rsts-11.mit.edu> - - * mke2fs.8.in: Fix a few minor typo's in the man page. - - * mke2fs.c (reserve_inodes): Add support for dynamic first inode - revision. - -Mon Feb 5 22:19:49 1996 <tytso@rsts-11.mit.edu> - - * fsck.c (check_all, PRS): Added new flag -P, which turns on the - parallel root option. This allows you to check the root - filesystem in parallel with the other filesystems. Note - that this is not the safest thing in the world to do, - since if the root filesystem is in doubt things like - the e2fsck executable might be corrupted! But some - sysadmins, who don't want to repartition the root - filesystem to be small and compact, may really want this - option turned on. - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Tue Oct 30 21:14:12 1995 <tytso@rsts-11.mit.edu> - - * mke2fs.c (check_plausibility): Add check to warn user if they - are trying to mke2fs the whole disk. (/dev/hda - vs. /dev/hda1) - -Fri Dec 15 19:09:56 1995 <tytso@rsts-11.mit.edu> - - * fsck.c (check_all): If we break out of the loop because we are - serializing and have just started at fsck we haven't - finished the pass. We need to go round again in case there - are more filesystems to be done in this pass. (Patch - submitted by Mike Jagdis) - -Sat Dec 9 10:07:16 1995 <tytso@rsts-11.mit.edu> - - * dumpe2fs.c (in_use): test_bit() was renamed to - ext2fs_test_bit(). - -Mon Oct 30 20:21:18 1995 <tytso@rsts-11.mit.edu> - - * fsck.c (fsck_device): Check fstype instead of type; this was a - stupid typo which caused coredumps in some cases. - -Thu Oct 26 12:05:18 1995 <tytso@rsts-11.mit.edu> - - * Makefile.in (install): Strip programs when they are installed. - -Fri Aug 18 15:10:40 1995 Theodore Y. Ts'o <tytso@dcl> - - * mke2fs.c (PRS): Move call of check_mount() from main() to PRS(), - so we do the check to see if the filesystem is mounted - *before* we try to determine the size of the device. - -Wed Sep 6 23:34:07 1995 Remy Card <card@bbj> - - * fsck.c (load_fs_info): Load the informations from /etc/fstab in - the same order. - -Thu Aug 17 22:33:09 1995 <tytso@rsts-11.mit.edu> - - * mke2fs.c (check_mount): Use the new ext2fs_check_if_mounted() - function to determine if the device is mounted. - - * mke2fs.c (PRS): Change call to use the new - ext2fs_get_device_size() function in order to determine - the size of the filesystem. Remove get_size() and - is_valid_offset(), which are no longer called. - -Fri Aug 11 08:26:24 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu> - - * fsck.c (fsck_device): Make sure fstype has been set by the user - and that it does not begin with "no" and the user has - specified exactly one type before using it as the type to - check. - -Fri Aug 11 14:17:18 1995 Remy Card <card@bbj> - - * badblocks.8: - * chattr.1: - * dumpe2fs.8: - * fsck.8: - * lsattr.1: - * mke2fs.8: - * mklost+found.8: - * tune2fs.8: Updated date and version number. - -Thu Aug 10 14:18:36 1995 Remy Card <card@bbj> - - * tune2fs.c: Fixed a bug which prevented the use of user and group - names with the -g and -u options. Thanks to Jean Christophe - ANDRE <progfou@mycrob.cafard.freenix.fr>. - - * mke2fs.8: - * tune2fs.8: Fixed a spelling error in Ted's name :-) - -Wed Aug 9 20:41:54 1995 Theodore Y. Ts'o <tytso@dcl> - - * mke2fs.c (count_blocks): Divide the size by - EXT2_BLOCK_SIZE(¶m), instead of assuming that the - blocksize is always 1024 bytes. - -Sat Aug 5 12:00:51 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu> - - * mke2fs.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. - - * chattr.c (chattr_dir_proc): - * lsattr.c (lsattr_dir_proc): Use malloc() instead of alloca() --- - alloca is not portable! - - * fsck.c (fsck_device): If the filesystem type is specified by the - user using the -t option, let it override the type in - /etc/fstab. - - * fsck.c (strdup): Don't build strdup() if the system defines it. - -Mon Jun 12 19:15:10 1995 Theodore Y. Ts'o (tytso@dcl) - - * chattr.c, lsattr.c: Include <sys/types.h> for <dirent.h>'s - benefit. - - * The $(UPROGS) go in bin, not sbin. - - * badblocks.c, chattr.c, dumpe2fs.c, fsck.c, lsattr.c, mke2fs.c, - tune2fs.c: Don't include <getopt.h> if it doesn't exist. - -Mon Jun 12 16:36:04 1995 Theodore Y. Ts'o <tytso@dcl> - - * badblocks.c, chattr.c, dumpe2fs.c, fsck.c, lsattr.c, mke2fs.c, - tune2fs.c: Only include getopt.h if HAVE_GETOPT_H is defined. - -Sat Jun 10 23:37:09 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu> - - * chattr.c: Include errno.h, since we use errno - - * fsck.c (load_fs_info): If HAVE_MNTENT_H is not defined, - explicitly initialize filesys_info to be NULL. - - * mke2fs.c: Include the stdio.h and errno.h header files - -Thu Jun 8 13:25:23 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> - - * mke2fs.c: Only include <linux/fs.h> if we can. - (get_size): Don't try to use the BLKGETSIZE ioctl unless it's defined. - (check_mount): Only check to see if the device is mounted if - HAVE_MNTENT_H is defined (by configure). - - * fsck.c (load_fs_info): Only try to get info about filesystems if - HAVE_MNTENT_H is defined (by configure). - (main): Allocate space for a new fsck_path instead of append to a - statically sized buffer. - (PRS): Use alloca to allocate the new path string, instead of - having a fixed size buffer (which was the wrong size anyway). - - * chattr.c (chattr_dir_proc): Use alloca to allocate space for a - filename instead of using a fixed-size buffer. - * lsattr.c (lsattr_dir_proc): Ditto. - * mklost+fond.c (main): Calculate the actual needed size for the - path buffer instead of using MAXPATHLEN (which not all systems have). - - * badblocks.c: Only include linux include files if we have them. - (flush_bufs): New function to flush a block device, optionally - syncing it first. This replaces other copies of this code. - (test_ro): Replace calls to ioctl with flush_bufs(). - (test_rw): Ditto. - - * Makefile.in: Rewritten to conform to GNU coding standards and - support separate compilation directories. - -Sat Mar 11 10:59:58 1995 Theodore Y. Ts'o <tytso@localhost> - - * mke2fs.c (main, zap_bootblock): Added new function - zap_bootblock() which clears the first 512 bytes of the - filesystem. This protects the filesystem from being - misidentified as a MS-DOS FAT filesystem. - - * badblocks.c (alarm_intr, test_ro, test_rw): Increase the space - allocated for printing the block numbers, so that the - display doesn't get corrupted when running badblocks on a - very large partition. - - * badblocks.c (do_test, test_ro, test_rw): Added missing cast to - ext2_loff_t, so that when checking a large device, - spurious seek errors aren't reported. - - * mke2fs.c (count_blocks): Declare mid to be of type ext2_loff_t - instead of type int, so that it works for filesystems - greater than 2 GB. (Fortunately count_blocks is only - called if the device does not support the BLKGETSIZE - ioctl, which most do.) - - * fsck.c (ignore): Add check to ignore filesystems with a pass - number of zero. (This check was accidentally deleted at - during 0.5b development.) - -Sat Dec 31 00:47:16 1994 <tytso@rsx-11.mit.edu> - - * mke2fs.c (new_table_block, alloc_tables, PRS, main): Add a new - option, -S, which only writes the superblock and group - descriptors. Useful for recovering when all of the - superblocks are corrupted somehow (as a last ditch - measure). - - Also, don't bother initializing the bitmap blocks in - alloc_tables(), since they will be overwritten at the end - anyway. (Should speed up mke2fs by a little.) - -Tue Dec 6 02:20:55 1994 <tytso@rsx-11.mit.edu> - - * fsck.c (main): Fix stupid typo where a null inst would be freed. - - * fsck.c (wait_one): Check WIFEXITED on status before trying to - extract the exit status. In other cases, return - FSCK_ERROR if the back end processor exited with a signal. - -Tue Nov 15 10:20:00 1994 Remy Card <card@bbj> - - * tune2fs.c (main): Fixed a bug which prevented the use of the - new options. - Added the `w' (week) suffix recognition in the check interval. - -Sun Nov 13 15:58:48 1994 (tytso@rsx-11) - - * fsck.c (load_fs_info): If the user has an obviously old - /etc/fstab file, issue a warning message and assume that - all partitions should be checked. - -Sat Nov 12 00:33:18 1994 (tytso@rsx-11) - - * dumpe2fs.c (list_desc): Update to new inode and block bitmap - structures. - - * mke2fs.c (create_root_dir): Create the root directory owned by - the effective uid. - -Mon Nov 7 22:04:37 1994 Remy Card <card@bbj> - - * tune2fs.c (main.c): Added support for new options: - -r reserved_blocks_count, -g reserved_gid, -u reserved_uid. - -Sun Aug 21 00:57:33 1994 Theodore Y. Ts'o (tytso@rt-11) - - * fsck.c (ignore): If the pass number is 0, ignore the filesystem. - -Wed Aug 17 21:55:03 1994 Remy Card (card@bbj) - - * badblocks.c (test_rw): Added verbose output like in the - read-only test. - - (do_test and test_rw): Use the llseek system call if available. - - * chattr.c: Added support for new attributes. - - * lsattr.c: Added support for long format. - - * mke2fs.c (usage): Fixed bogus usage message. - - (valid_offset): Use the llseek system call if available. - -Wed Aug 17 10:50:57 1994 Theodore Y. Ts'o (tytso@rt-11) - - * mke2fs.c (handle_bad_blocks): Check to see if a bad block is - where a backup superblock/group descriptor is stored. If so, - print a warning message and adjust the superblock counts so that - they are correct. (Otherwise, the bad block will get counted - twice and the # of free blocks count will be wrong.) - - (alloc_tables): Removed code which calcualated the free block - statistics, which was moved to lib/ext2fs/initialize.c. This - allows the bad block code to adjust the group descriptor - statistics if necessary. diff --git a/gnu/usr.sbin/e2fsprogs/misc/Makefile.in b/gnu/usr.sbin/e2fsprogs/misc/Makefile.in deleted file mode 100644 index b0d06a20d97..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/Makefile.in +++ /dev/null @@ -1,184 +0,0 @@ -# -# Standard e2fsprogs prologue.... -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = .. -my_dir = misc -INSTALL = @INSTALL@ - -@MCONFIG@ - -SPROGS= mke2fs badblocks tune2fs dumpe2fs @FSCK_PROG@ -USPROGS= mklost+found -SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \ - @FSCK_MAN@ - -UPROGS= chattr lsattr -UMANPAGES= chattr.1 lsattr.1 - -TUNE2FS_OBJS= tune2fs.o -MKLPF_OBJS= mklost+found.o -MKE2FS_OBJS= mke2fs.o -CHATTR_OBJS= chattr.o -LSATTR_OBJS= lsattr.o -DUMPE2FS_OBJS= dumpe2fs.o -BADBLOCKS_OBJS= badblocks.o -FSCK_OBJS= fsck.o - -SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklost+found.c $(srcdir)/mke2fs.c \ - $(srcdir)/chattr.c $(srcdir)/lsattr.c $(srcdir)/dumpe2fs.c \ - $(srcdir)/badblocks.c $(srcdir)/fsck.c - -LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) -DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR) - -STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) -STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) - -LIBS_E2P= $(LIBEXT2FS) $(LIBE2P) $(LIBCOM_ERR) -DEPLIBS_E2P= $(LIBEXT2FS) $(LIBE2P) $(LIBCOM_ERR) - -.c.o: - $(CC) -c $(ALL_CFLAGS) $< -o $@ - -all:: $(SPROGS) $(UPROGS) $(USPROGS) fix_substitute $(SMANPAGES) $(UMANPAGES) - -tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS_E2P) $(LIBUUID) - $(CC) $(ALL_LDFLAGS) -o tune2fs $(TUNE2FS_OBJS) $(LIBS_E2P) $(LIBUUID) - -mklost+found: $(MKLPF_OBJS) - $(CC) $(ALL_LDFLAGS) -o mklost+found $(MKLPF_OBJS) - -mke2fs: $(MKE2FS_OBJS) $(DEPLIBS) $(LIBUUID) - $(CC) $(ALL_LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS) $(LIBUUID) - -mke2fs.static: $(MKE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBUUID) - $(CC) $(ALL_LDFLAGS) -static -o mke2fs.static $(MKE2FS_OBJS) \ - $(STATIC_LIBS) $(STATIC_LIBUUID) - -resize2fs: resize2fs.o $(DEPLIBS) - $(CC) $(ALL_LDFLAGS) -o resize2fs resize2fs.o $(LIBS) - -chattr: $(CHATTR_OBJS) $(DEPLIBS_E2P) - $(CC) $(ALL_LDFLAGS) -o chattr $(CHATTR_OBJS) $(LIBS_E2P) - -lsattr: $(LSATTR_OBJS) $(DEPLIBS_E2P) - $(CC) $(ALL_LDFLAGS) -o lsattr $(LSATTR_OBJS) $(LIBS_E2P) - -dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS_E2P) - $(CC) $(ALL_LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS_E2P) - -fsck: $(FSCK_OBJS) - $(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) - -badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS) - $(CC) $(ALL_LDFLAGS) -o badblocks $(BADBLOCKS_OBJS) $(LIBS) - -fix_substitute: - -$(CHMOD) +x $(SUBSTITUTE) - -tune2fs.8: $(SUBSTITUTE) $(srcdir)/tune2fs.8.in - $(SUBSTITUTE) $(srcdir)/tune2fs.8.in tune2fs.8 - -mklost+found.8: $(SUBSTITUTE) $(srcdir)/mklost+found.8.in - $(SUBSTITUTE) $(srcdir)/mklost+found.8.in mklost+found.8 - -mke2fs.8: $(SUBSTITUTE) $(srcdir)/mke2fs.8.in - $(SUBSTITUTE) $(srcdir)/mke2fs.8.in mke2fs.8 - -dumpe2fs.8: $(SUBSTITUTE) $(srcdir)/dumpe2fs.8.in - $(SUBSTITUTE) $(srcdir)/dumpe2fs.8.in dumpe2fs.8 - -badblocks.8: $(SUBSTITUTE) $(srcdir)/badblocks.8.in - $(SUBSTITUTE) $(srcdir)/badblocks.8.in badblocks.8 - -fsck.8: $(SUBSTITUTE) $(srcdir)/fsck.8.in - $(SUBSTITUTE) $(srcdir)/fsck.8.in fsck.8 - -chattr.1: $(SUBSTITUTE) $(srcdir)/chattr.1.in - $(SUBSTITUTE) $(srcdir)/chattr.1.in chattr.1 - -lsattr.1: $(SUBSTITUTE) $(srcdir)/lsattr.1.in - $(SUBSTITUTE) $(srcdir)/lsattr.1.in lsattr.1 - -installdirs: - $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \ - $(DESTDIR)$(ubindir) $(DESTDIR)$(man1dir) \ - $(DESTDIR)$(cat1dir) $(DESTDIR)$(man8dir) $(DESTDIR)$(cat8dir) - -install: all $(SMANPAGES) $(UMANPAGES) installdirs - for i in $(SPROGS); do \ - $(INSTALL_PROGRAM) $$i $(DESTDIR)$(sbindir)/$$i; \ - $(STRIP) $(DESTDIR)$(sbindir)/$$i; \ - done - for i in $(USPROGS); do \ - $(INSTALL_PROGRAM) $$i $(DESTDIR)$(usbindir)/$$i; \ - $(STRIP) $(DESTDIR)$(usbindir)/$$i; \ - done - $(LN) -f $(DESTDIR)$(sbindir)/mke2fs $(DESTDIR)$(sbindir)/mkfs.ext2 - for i in $(UPROGS); do \ - $(INSTALL_PROGRAM) $$i $(DESTDIR)$(ubindir)/$$i; \ - $(STRIP) $(DESTDIR)$(ubindir)/$$i; \ - done - for i in $(SMANPAGES); do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(man8dir)/$$i; \ - done - for i in $(UMANPAGES); do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(man1dir)/$$i; \ - done - -uninstall: - for i in $(SPROGS); do \ - $(RM) -f $(sbindir)/$$i; \ - done - for i in $(USPROGS); do \ - $(RM) -f $(usbindir)/$$i; \ - done - $(RM) -f $(sbindir)/mkfs.ext2 - for i in $(UPROGS); do \ - $(RM) -f $(ubindir)/$$i; \ - done - for i in $(SMANPAGES); do \ - $(RM) -f $(man8dir)/$$i; \ - done - for i in $(UMANPAGES); do \ - $(RM) -f $(man1dir)/$$i; \ - done - -clean: - $(RM) -f $(SPROGS) $(USPROGS) $(UPROGS) $(UMANPAGES) $(SMANPAGES) \ - mke2fs.static \#* *.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 -# -tune2fs.o: $(srcdir)/tune2fs.c $(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 \ - $(top_srcdir)/lib/uuid/uuid.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../version.h -mklost+found.o: $(srcdir)/mklost+found.c $(srcdir)/../version.h -mke2fs.o: $(srcdir)/mke2fs.c $(top_srcdir)/lib/et/com_err.h \ - $(top_srcdir)/lib/uuid/uuid.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 -chattr.o: $(srcdir)/chattr.c $(top_srcdir)/lib/et/com_err.h \ - $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h -lsattr.o: $(srcdir)/lsattr.c $(top_srcdir)/lib/et/com_err.h \ - $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h -dumpe2fs.o: $(srcdir)/dumpe2fs.c $(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 \ - $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h -badblocks.o: $(srcdir)/badblocks.c $(top_srcdir)/lib/et/com_err.h \ - $(top_srcdir)/lib/ext2fs/io.h -fsck.o: $(srcdir)/fsck.c $(srcdir)/../version.h $(srcdir)/fsck.h diff --git a/gnu/usr.sbin/e2fsprogs/misc/badblocks.8.in b/gnu/usr.sbin/e2fsprogs/misc/badblocks.8.in deleted file mode 100644 index f5133188613..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/badblocks.8.in +++ /dev/null @@ -1,66 +0,0 @@ -.\" -*- nroff -*- -.TH BADBLOCKS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -badblocks \- search a device for bad blocks -.SH SYNOPSIS -.B badblocks -[ -.B \-b -block-size -] -[ -.B \-o -output_file -] -[ -.B \-v -] -[ -.B \-w -] -device -blocks-count [ start-block ] -.SH DESCRIPTION -.B badblocks -is used to search for bad blocks on a device (usually a disk partition). -.br -.I device -is the special file corresponding to the device (e.g /dev/hdXX). -.br -.I blocks-count -is the number of blocks on the device. -.SH OPTIONS -.TP -.I -b block-size -Specify the size of blocks in bytes. -.TP -.I -o output_file -Write the list of bad blocks to the specified file. Without this option, -.B badblocks -displays the list on its standard output. -.TP -.I -v -Verbose mode. -.TP -.I -w -Use write-mode test. With this option, -.B badblocks -scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on -every block of the device, reading every block and comparing the contents. -.SH WARNING -Never use the `-w' option on an device containing an existing file system. -This option erases data! -.SH AUTHOR -.B badblocks -has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer -of the ext2 fs. -.SH BUGS -I had no chance to make reals tests of this program since I use IDE drives -which remap bad blocks. I only made some tests on floppies. -.SH AVAILABILITY -.B badblocks -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BR e2fsck (8), -.BR mke2fs (8) diff --git a/gnu/usr.sbin/e2fsprogs/misc/badblocks.c b/gnu/usr.sbin/e2fsprogs/misc/badblocks.c deleted file mode 100644 index aba1d183d90..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/badblocks.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * badblocks.c - Bad blocks checker - * - * Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * Copyright 1995, 1996, 1997 by Theodore Ts'o - * - * This file is based on the minix file system programs fsck and mkfs - * written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi> - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* - * History: - * 93/05/26 - Creation from e2fsck - * 94/02/27 - Made a separate bad blocks checker - */ - -#include <errno.h> -#include <fcntl.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <sys/ioctl.h> -#include <sys/types.h> - -#if HAVE_LINUX_FS_H -#include <linux/fd.h> -#include <linux/fs.h> -#endif - -#include "et/com_err.h" -#include "ext2fs/io.h" - -const char * program_name = "badblocks"; - -int v_flag = 0; /* verbose */ -int w_flag = 0; /* do r/w test */ -int s_flag = 0; /* show progress of test */ - -static volatile void usage (void) -{ - fprintf (stderr, "Usage: %s [-b block_size] [-o output_file] [-svw] device blocks_count\n [start_count]\n", - program_name); - exit (1); -} - -static unsigned long currently_testing = 0; -static unsigned long num_blocks = 0; - -static void print_status(void) -{ - fprintf(stderr, "%9ld/%9ld", currently_testing, num_blocks); - fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); - fflush (stderr); -} - -static void alarm_intr (int alnum) -{ - signal (SIGALRM, alarm_intr); - alarm(1); - if (!num_blocks) - return; - fprintf(stderr, "%9ld/%9ld", currently_testing, num_blocks); - fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); - fflush (stderr); -} - -/* - * Perform a test of a block; return the number of blocks readable/writeable. - */ -static long do_test (int dev, char * buffer, int try, unsigned long block_size, - unsigned long current_block) -{ - long got; - - if (v_flag > 1) - print_status(); - - /* Seek to the correct loc. */ - if (ext2fs_llseek (dev, (ext2_loff_t) current_block * block_size, - SEEK_SET) != (ext2_loff_t) current_block * block_size) - com_err (program_name, errno, "during seek"); - - /* Try the read */ - got = read (dev, buffer, try * block_size); - if (got < 0) - got = 0; - if (got & (block_size - 1)) - fprintf (stderr, - "Weird value (%ld) in do_test: probably bugs\n", - got); - got /= block_size; - return got; -} - -static void flush_bufs (int dev, int sync) -{ - if (v_flag -#if !defined (BLKFLSBUF) && !defined (FDFLUSH) - && sync -#endif - ) - fprintf (stderr, "Flushing buffers\n"); - - if (sync && fsync (dev) == -1) - com_err (program_name, errno, "during fsync"); - -#ifdef BLKLSBUF - ioctl (dev, BLKFLSBUF, 0); /* In case this is a HD */ -#endif -#ifdef FDFLUSH - ioctl (dev, FDFLUSH, 0); /* In case this is floppy */ -#endif -} - -static void test_ro (int dev, unsigned long blocks_count, - unsigned long block_size, FILE * out, - unsigned long from_count) -{ -#define TEST_BUFFER_BLOCKS 16 - char * blkbuf; - int try; - long got; - - blkbuf = malloc (TEST_BUFFER_BLOCKS * block_size); - if (!blkbuf) - { - com_err (program_name, ENOMEM, "while allocating buffers"); - exit (1); - } - flush_bufs (dev, 0); - if (v_flag) { - fprintf (stderr, - "Checking for bad blocks in read-only mode\n"); - fprintf (stderr, "From block %lu to %lu\n", from_count, blocks_count); - } - try = TEST_BUFFER_BLOCKS; - currently_testing = from_count; - num_blocks = blocks_count; - if (s_flag || v_flag > 1) { - fprintf(stderr, "Checking for bad blocks (read-only test): "); - if (v_flag <= 1) - alarm_intr(SIGALRM); - } - while (currently_testing < blocks_count) - { - if (currently_testing + try > blocks_count) - try = blocks_count - currently_testing; - got = do_test (dev, blkbuf, try, block_size, currently_testing); - currently_testing += got; - if (got == try) { - try = TEST_BUFFER_BLOCKS; - continue; - } - else - try = 1; - if (got == 0) - fprintf (out, "%lu\n", currently_testing++); - } - num_blocks = 0; - alarm(0); - if (s_flag || v_flag > 1) - fprintf(stderr, "done \n"); - fflush (stderr); - free (blkbuf); -} - -static void test_rw (int dev, unsigned long blocks_count, - unsigned long block_size, FILE * out, - unsigned long from_count) -{ - int i; - char * buffer; - unsigned char pattern[] = {0xaa, 0x55, 0xff, 0x00}; - - buffer = malloc (2 * block_size); - if (!buffer) - { - com_err (program_name, ENOMEM, "while allocating buffers"); - exit (1); - } - - flush_bufs (dev, 0); - - if (v_flag) { - fprintf(stderr, - "Checking for bad blocks in read-write mode\n"); - fprintf(stderr, "From block %lu to %lu\n", - from_count, blocks_count); - } - for (i = 0; i < sizeof (pattern); i++) { - memset (buffer, pattern[i], block_size); - if (s_flag | v_flag) - fprintf (stderr, "Writing pattern 0x%08x: ", - *((int *) buffer)); - num_blocks = blocks_count; - currently_testing = from_count; - if (s_flag && v_flag <= 1) - alarm_intr(SIGALRM); - for (; - currently_testing < blocks_count; - currently_testing++) - { - if (ext2fs_llseek (dev, (ext2_loff_t) currently_testing * - block_size, SEEK_SET) != - (ext2_loff_t) currently_testing * block_size) - com_err (program_name, errno, - "during seek on block %d", - currently_testing); - if (v_flag > 1) - print_status(); - write (dev, buffer, block_size); - } - num_blocks = 0; - alarm (0); - if (s_flag | v_flag) - fprintf(stderr, "done \n"); - flush_bufs (dev, 1); - if (s_flag | v_flag) - fprintf (stderr, "Reading and comparing: "); - num_blocks = blocks_count; - currently_testing = from_count; - if (s_flag && v_flag <= 1) - alarm_intr(SIGALRM); - for (; - currently_testing < blocks_count; - currently_testing++) - { - if (ext2fs_llseek (dev, (ext2_loff_t) currently_testing * - block_size, SEEK_SET) != - (ext2_loff_t) currently_testing * block_size) - com_err (program_name, errno, - "during seek on block %d", - currently_testing); - if (v_flag > 1) - print_status(); - if (read (dev, buffer + block_size, block_size) < block_size) - fprintf (out, "%ld\n", currently_testing); - else if (memcmp (buffer, buffer + block_size, block_size)) - fprintf (out, "%ld\n", currently_testing); - } - num_blocks = 0; - alarm (0); - if (s_flag | v_flag) - fprintf(stderr, "done \n"); - flush_bufs (dev, 0); - } -} - -void main (int argc, char ** argv) -{ - char c; - char * tmp; - char * device_name; - char * output_file = NULL; - FILE * out; - unsigned long block_size = 1024; - unsigned long blocks_count, from_count; - int dev; - - setbuf(stdout, NULL); - setbuf(stderr, NULL); - if (argc && *argv) - program_name = *argv; - while ((c = getopt (argc, argv, "b:o:svw")) != EOF) { - switch (c) { - case 'b': - block_size = strtoul (optarg, &tmp, 0); - if (*tmp || block_size > 4096) { - com_err (program_name, 0, - "bad block size - %s", optarg); - exit (1); - } - break; - case 'o': - output_file = optarg; - break; - case 's': - s_flag = 1; - break; - case 'v': - v_flag++; - break; - case 'w': - w_flag = 1; - break; - default: - usage (); - } - } - if (optind > argc - 1) - usage (); - device_name = argv[optind++]; - if (optind > argc - 1) - usage (); - blocks_count = strtoul (argv[optind], &tmp, 0); - if (*tmp) - { - com_err (program_name, 0, "bad blocks count - %s", argv[optind]); - exit (1); - } - if (++optind <= argc-1) { - from_count = strtoul (argv[optind], &tmp, 0); - } else from_count = 0; - if (from_count >= blocks_count) { - com_err (program_name, 0, "bad blocks range: %lu-%lu", - from_count, blocks_count); - exit (1); - } - dev = open (device_name, w_flag ? O_RDWR : O_RDONLY); - if (dev == -1) - { - com_err (program_name, errno,"while trying to open %s", - device_name); - exit (1); - } - if (output_file && strcmp (output_file, "-") != 0) - { - out = fopen (output_file, "w"); - if (out == NULL) - { - com_err (program_name, errno,"while trying to open %s", - device_name); - exit (1); - } - } - else - out = stdout; - if (w_flag) - test_rw (dev, blocks_count, block_size, out, from_count); - else - test_ro (dev, blocks_count, block_size, out, from_count); - close (dev); - if (out != stdout) - fclose (out); -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/chattr.1.in b/gnu/usr.sbin/e2fsprogs/misc/chattr.1.in deleted file mode 100644 index af9d6a0359e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/chattr.1.in +++ /dev/null @@ -1,86 +0,0 @@ -.\" -*- nroff -*- -.TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -chattr \- change file attributes on a Linux second extended file system -.SH SYNOPSIS -.B chattr -[ -.B \-RV -] -[ -.B -v -version -] -[ -mode -] -.I files... -.SH DESCRIPTION -.B chattr -changes the files attributes on an second extended file system. -.PP -The format of a symbolic mode is +-=[ASacdisu]. -.PP -The operator `+' causes the selected attributes to be added to the -existing attributes of the files; `-' causes them to be removed; and -`=' causes them to be the only attributes that the files have. -.PP -The letters `ASacdisu' select the new attributes for the files: -don't update atime (A), synchronous updates (S), append only (a), -compressed (c), immutable (i), no dump (d), -secure deletion (s), and undeletable (u). -.SH OPTIONS -.TP -.I -R -Recursively change attributes of directories and their contents. -.TP -.I -V -Verbosely describe changed attributes. -.TP -.I -v version -Set the files version. -.SH ATTRIBUTES -When a file with the 'A' attribute set is modified, its atime record is -not modified. This avoid a certain amount of disk I/O for laptop -systems. - -A file with the `a' attribute set can only be open in append mode for writing. - -A file with the `c' attribute set is automatically compressed on the disk -by the kernel. A read from this file returns uncompressed data. A write to -this file compresses data before storing them on the disk. - -A file with the `d' attribute set is not candidate for backup when the -.BR dump (8) -program is run. - -A file with the `i' attribute cannot be modified: it cannot be deleted or -renamed, no link can be created to this file and no data can be written -to the file. Only the superuser can set or clear this attribute. - -When a file with the `s' attribute set is deleted, its blocks are zeroed and -written back to the disk. - -When a file with the `S' attribute set is modified, -the changes are written synchronously on the disk; this is equivalent to -the `sync' mount option applied to a subset of the files. - -When a file with the `u' attribute set is deleted, its contents is saved. -This allows the user to ask for its undeletion. - -.SH AUTHOR -.B chattr -has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer -of the ext2 fs. -.SH BUGS AND LIMITATIONS -As of ext2 fs 0.5a, the `c' and `u' attribute are not honoured by the kernel -code. As of the Linux 2.0 kernel, the 'A' attribute is not yet supported by -the kernel code. (The noatime code is still in testing.) -.PP -These attributes will be implemented in a future ext2 fs version. -.SH AVAILABILITY -.B chattr -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BR lsattr (1) diff --git a/gnu/usr.sbin/e2fsprogs/misc/chattr.c b/gnu/usr.sbin/e2fsprogs/misc/chattr.c deleted file mode 100644 index 60379a47390..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/chattr.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * chattr.c - Change file attributes on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - * 93/11/13 - Replace stat() calls by lstat() to avoid loops - * 94/02/27 - Integrated in Ted's distribution - */ - -#include <sys/types.h> -#include <dirent.h> -#include <fcntl.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <sys/param.h> -#include <sys/stat.h> -#include <linux/ext2_fs.h> - -#include "et/com_err.h" -#include "e2p/e2p.h" - -#include "../version.h" - -const char * program_name = "chattr"; - -int add = 0; -int rem = 0; -int set = 0; -int set_version = 0; - -unsigned long version; - -int recursive = 0; -int verbose = 0; - -unsigned long af; -unsigned long rf; -unsigned long sf; - -static void volatile fatal_error (const char * fmt_string, int errcode) -{ - fprintf (stderr, fmt_string, program_name); - exit (errcode); -} - -#define usage() fatal_error ("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \ - 1) - -static int decode_arg (int * i, int argc, char ** argv) -{ - char * p; - char * tmp; - - switch (argv[*i][0]) - { - case '-': - for (p = &argv[*i][1]; *p; p++) - switch (*p) - { - case 'R': - recursive = 1; - break; - case 'S': - rf |= EXT2_SYNC_FL; - rem = 1; - break; - case 'V': - verbose = 1; - break; -#ifdef EXT2_APPEND_FL - case 'a': - rf |= EXT2_APPEND_FL; - rem = 1; - break; -#endif -#ifdef EXT2_NOATIME_FL - case 'A': - rf |= EXT2_NOATIME_FL; - rem = 1; - break; -#endif - case 'c': - rf |= EXT2_COMPR_FL; - rem = 1; - break; -#ifdef EXT2_NODUMP_FL - case 'd': - rf |= EXT2_NODUMP_FL; - rem = 1; - break; -#endif -#ifdef EXT2_IMMUTABLE_FL - case 'i': - rf |= EXT2_IMMUTABLE_FL; - rem = 1; - break; -#endif - case 's': - rf |= EXT2_SECRM_FL; - rem = 1; - break; - case 'u': - rf |= EXT2_UNRM_FL; - rem = 1; - break; - case 'v': - (*i)++; - if (*i >= argc) - usage (); - version = strtol (argv[*i], &tmp, 0); - if (*tmp) - { - com_err (program_name, 0, - "bad version - %s\n", argv[*i]); - usage (); - } - set_version = 1; - break; - default: - fprintf (stderr, "%s: Unrecognized argument: %c\n", - program_name, *p); - usage (); - } - break; - case '+': - add = 1; - for (p = &argv[*i][1]; *p; p++) - switch (*p) - { - case 'S': - af |= EXT2_SYNC_FL; - break; -#ifdef EXT2_APPEND_FL - case 'a': - af |= EXT2_APPEND_FL; - break; -#endif -#ifdef EXT2_NOATIME_FL - case 'A': - af |= EXT2_NOATIME_FL; - break; -#endif - case 'c': - af |= EXT2_COMPR_FL; - break; -#ifdef EXT2_NODUMP_FL - case 'd': - af |= EXT2_NODUMP_FL; - break; -#endif -#ifdef EXT2_IMMUTABLE_FL - case 'i': - af |= EXT2_IMMUTABLE_FL; - break; -#endif - case 's': - af |= EXT2_SECRM_FL; - break; - case 'u': - af |= EXT2_UNRM_FL; - break; - default: - usage (); - } - break; - case '=': - set = 1; - for (p = &argv[*i][1]; *p; p++) - switch (*p) - { - case 'S': - sf |= EXT2_SYNC_FL; - break; -#ifdef EXT2_APPEND_FL - case 'a': - sf |= EXT2_APPEND_FL; - break; -#endif -#ifdef EXT2_NOATIME_FL - case 'A': - sf |= EXT2_NOATIME_FL; - break; -#endif - case 'c': - sf |= EXT2_COMPR_FL; - break; -#ifdef EXT2_NODUMP_FL - case 'd': - sf |= EXT2_NODUMP_FL; - break; -#endif -#ifdef EXT2_IMMUTABLE_FL - case 'i': - sf |= EXT2_IMMUTABLE_FL; - break; -#endif - case 's': - sf |= EXT2_SECRM_FL; - break; - case 'u': - sf |= EXT2_UNRM_FL; - break; - default: - usage (); - } - break; - default: - return EOF; - break; - } - return 1; -} - -static int chattr_dir_proc (const char *, struct dirent *, void *); - -static void change_attributes (const char * name) -{ - unsigned long flags; - struct stat st; - - if (lstat (name, &st) == -1) - { - com_err (program_name, errno, "while stating %s", name); - return; - } - if (set) - { - if (verbose) - { - printf ("Flags of %s set as ", name); - print_flags (stdout, sf, 0); - printf ("\n"); - } - if (fsetflags (name, sf) == -1) - perror (name); - } - else - { - if (fgetflags (name, &flags) == -1) - com_err (program_name, errno, - "while reading flags on %s", name); - else - { - if (rem) - flags &= ~rf; - if (add) - flags |= af; - if (verbose) - { - printf ("Flags of %s set as ", name); - print_flags (stdout, flags, 0); - printf ("\n"); - } - if (fsetflags (name, flags) == -1) - com_err (program_name, errno, - "while setting flags on %s", name); - } - } - if (set_version) - { - if (verbose) - printf ("Version of %s set as %lu\n", name, version); - if (fsetversion (name, version) == -1) - com_err (program_name, errno, - "while setting version on %s", name); - } - if (S_ISDIR(st.st_mode) && recursive) - iterate_on_dir (name, chattr_dir_proc, (void *) NULL); -} - -static int chattr_dir_proc (const char * dir_name, struct dirent * de, void * private) -{ - if (strcmp (de->d_name, ".") && strcmp (de->d_name, "..")) - { - char *path; - - path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1); - if (!path) - fatal_error("Couldn't allocate path variable " - "in chattr_dir_proc", 1); - sprintf (path, "%s/%s", dir_name, de->d_name); - change_attributes (path); - free(path); - } - return 0; -} - -void main (int argc, char ** argv) -{ - int i, j; - int end_arg = 0; - - fprintf (stderr, "chattr %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); - if (argc && *argv) - program_name = *argv; - i = 1; - while (i < argc && !end_arg) - { - if (decode_arg (&i, argc, argv) == EOF) - end_arg = 1; - else - i++; - } - if (i >= argc) - usage (); - if (set && (add || rem)) - { - fprintf (stderr, "= is incompatible with - and +\n"); - exit (1); - } - if (!(add || rem || set || set_version)) - { - fprintf (stderr, "Must use '-v', =, - or +\n"); - exit (1); - } - for (j = i; j < argc; j++) - change_attributes (argv[j]); -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/dumpe2fs.8.in b/gnu/usr.sbin/e2fsprogs/misc/dumpe2fs.8.in deleted file mode 100644 index 28fa320d905..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/dumpe2fs.8.in +++ /dev/null @@ -1,48 +0,0 @@ -.\" -*- nroff -*- -.\" 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 DUMPE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -dumpe2fs \- dump filesystem information -.SH SYNOPSIS -.B dumpe2fs -[ -.B -b -] -[ -.B -V -] -device -.SH DESCRIPTION -.BI dumpe2fs -prints the super block and blocks group information for the filesystem -present on -.I device. -.PP -.BI dumpe2fs -is similar to Berkeley's -.BI dumpfs -program for the BSD Fast File System. -.SH OPTIONS -.TP -.I -b -print the blocks which are reserved as bad in the filesystem. -.TP -.I -V -print the version number of dumpe2fs and exit. -.SH BUGS -You need to know the physical filesystem structure to understand the -output. -.SH AUTHOR -.B dumpe2fs -has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer -of the ext2 fs. -.SH AVAILABILITY -.B dumpe2fs -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BR e2fsck (8), -.BR mke2fs (8), -.BR tune2fs (8) diff --git a/gnu/usr.sbin/e2fsprogs/misc/dumpe2fs.c b/gnu/usr.sbin/e2fsprogs/misc/dumpe2fs.c deleted file mode 100644 index b71900e76f1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/dumpe2fs.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * dumpe2fs.c - List the control structures of a second - * extended filesystem - * - * Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * Copyright 1995, 1996, 1997 by Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* - * History: - * 94/01/09 - Creation - * 94/02/27 - Ported to use the ext2fs library - */ - -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs/ext2fs.h" -#include "e2p/e2p.h" - -#include "../version.h" - -#define in_use(m, x) (ext2fs_test_bit ((x), (m))) - -const char * program_name = "dumpe2fs"; -char * device_name = NULL; - -static volatile void usage (void) -{ - fprintf (stderr, "usage: %s [-bV] device\n", program_name); - exit (1); -} - -static void print_free (unsigned long group, char * bitmap, - unsigned long nbytes, unsigned long offset) -{ - int p = 0; - unsigned long i; - unsigned long j; - - for (i = 0; i < nbytes; i++) - if (!in_use (bitmap, i)) - { - if (p) - printf (", "); - if (i == nbytes - 1 || in_use (bitmap, i + 1)) - printf ("%lu", group * nbytes + i + offset); - else - { - for (j = i; j < nbytes && !in_use (bitmap, j); - j++) - ; - printf ("%lu-%lu", group * nbytes + i + offset, - group * nbytes + (j - 1) + offset); - i = j - 1; - } - p = 1; - } -} - -static void list_desc (ext2_filsys fs) -{ - unsigned long i; - blk_t group_blk, next_blk; - char * block_bitmap = fs->block_map->bitmap; - char * inode_bitmap = fs->inode_map->bitmap; - - printf ("\n"); - group_blk = fs->super->s_first_data_block; - for (i = 0; i < fs->group_desc_count; i++) { - next_blk = group_blk + fs->super->s_blocks_per_group; - if (next_blk > fs->super->s_blocks_count) - next_blk = fs->super->s_blocks_count; - printf ("Group %lu: (Blocks %u -- %u)\n", i, - group_blk, next_blk -1 ); - printf (" Block bitmap at %u (+%d), " - "Inode bitmap at %u (+%d)\n " - "Inode table at %u (+%d)\n", - fs->group_desc[i].bg_block_bitmap, - fs->group_desc[i].bg_block_bitmap - group_blk, - fs->group_desc[i].bg_inode_bitmap, - fs->group_desc[i].bg_inode_bitmap - group_blk, - fs->group_desc[i].bg_inode_table, - fs->group_desc[i].bg_inode_table - group_blk); - printf (" %d free blocks, %d free inodes, %d directories\n", - fs->group_desc[i].bg_free_blocks_count, - fs->group_desc[i].bg_free_inodes_count, - fs->group_desc[i].bg_used_dirs_count); - printf (" Free blocks: "); - print_free (i, block_bitmap, fs->super->s_blocks_per_group, - fs->super->s_first_data_block); - block_bitmap += fs->super->s_blocks_per_group / 8; - printf ("\n"); - printf (" Free inodes: "); - print_free (i, inode_bitmap, fs->super->s_inodes_per_group, 1); - inode_bitmap += fs->super->s_inodes_per_group / 8; - printf ("\n"); - group_blk = next_blk; - } -} - -static void list_bad_blocks(ext2_filsys fs) -{ - badblocks_list bb_list = 0; - badblocks_iterate bb_iter; - blk_t blk; - errcode_t retval; - - retval = ext2fs_read_bb_inode(fs, &bb_list); - if (retval) { - com_err("ext2fs_read_bb_inode", retval, ""); - exit(1); - } - retval = badblocks_list_iterate_begin(bb_list, &bb_iter); - if (retval) { - com_err("badblocks_list_iterate_begin", retval, - "while printing bad block list"); - exit(1); - } - if (badblocks_list_iterate(bb_iter, &blk)) - printf("Bad blocks: %d", blk); - while (badblocks_list_iterate(bb_iter, &blk)) - printf(", %d", blk); - badblocks_list_iterate_end(bb_iter); - printf("\n"); -} - -static void dump_bad_blocks(ext2_filsys fs) -{ - badblocks_list bb_list = 0; - badblocks_iterate bb_iter; - blk_t blk; - errcode_t retval; - - retval = ext2fs_read_bb_inode(fs, &bb_list); - if (retval) { - com_err("ext2fs_read_bb_inode", retval, ""); - exit(1); - } - retval = badblocks_list_iterate_begin(bb_list, &bb_iter); - if (retval) { - com_err("badblocks_list_iterate_begin", retval, - "while printing bad block list"); - exit(1); - } - while (badblocks_list_iterate(bb_iter, &blk)) - printf("%d\n", blk); - badblocks_list_iterate_end(bb_iter); -} - -static int i386_byteorder(void) -{ - int one = 1; - char *cp = (char *) &one; - - return (*cp == 1); -} - -void main (int argc, char ** argv) -{ - errcode_t retval; - ext2_filsys fs; - int print_badblocks = 0; - int big_endian; - char c; - - initialize_ext2_error_table(); - fprintf (stderr, "dumpe2fs %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); - if (argc && *argv) - program_name = *argv; - - while ((c = getopt (argc, argv, "bV")) != EOF) { - switch (c) { - case 'b': - print_badblocks++; - break; - case 'V': - /* Print version number and exit */ - fprintf(stderr, "\tUsing %s\n", - error_message(EXT2_ET_BASE)); - exit(0); - default: - usage (); - } - } - if (optind > argc - 1) - usage (); - device_name = argv[optind++]; - 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); - printf ("Couldn't find valid filesystem superblock.\n"); - exit (1); - } - if (print_badblocks) { - dump_bad_blocks(fs); - } else { - retval = ext2fs_read_bitmaps (fs); - if (retval) { - com_err (program_name, retval, - "while trying to read the bitmaps", - device_name); - ext2fs_close (fs); - exit (1); - } - big_endian = ((fs->flags & EXT2_FLAG_SWAP_BYTES) != 0); - if (!i386_byteorder()) - big_endian = !big_endian; - if (big_endian) - printf("Note: This is a byte-swapped filesystem\n"); - list_super (fs->super); - list_bad_blocks (fs); - list_desc (fs); - } - ext2fs_close (fs); - exit (0); -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/findsuper.c b/gnu/usr.sbin/e2fsprogs/misc/findsuper.c deleted file mode 100644 index 4cc3e40433b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/findsuper.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Well, here's my linux version of findsuper. - * I'm sure you coulda done it faster. :) - * IMHO there isn't as much interesting data to print in the - * linux superblock as there is in the SunOS superblock--disk geometry is - * not there...and linux seems to update the dates in all the superblocks. - * SunOS doesn't ever touch the backup superblocks after the fs is created, - * as far as I can tell, so the date is more interesting IMHO and certainly - * marks which superblocks are backup ones. - * - * This still doesn't handle disks >2G. - * - * I wanted to add msdos support, but I couldn't make heads or tails - * of the kernel include files to find anything I could look for in msdos. - * - * Reading every block of a Sun partition is fairly quick. Doing the - * same under linux (slower hardware I suppose) just isn't the same. - * It might be more useful to default to reading the first (second?) block - * on each cyl; however, if the disk geometry is wrong, this is useless. - * But ya could still get the cyl size to print the numbers as cyls instead - * of blocks... - * - * run this as (for example) - * findsuper /dev/hda - * findsuper /dev/hda 437760 1024 (my disk has cyls of 855*512) - * - * I suppose the next step is to figgure out a way to determine if - * the block found is the first superblock somehow, and if so, build - * a partition table from the superblocks found... but this is still - * useful as is. - * - * Steve - * ssd@nevets.oau.org - * ssd@mae.engr.ucf.edu - */ - -#include <stdio.h> -#include <stdlib.h> -#include <time.h> - -#include <linux/ext2_fs.h> - - -main(int argc, char *argv[]) -{ - int i; - int skiprate=512; /* one sector */ - long sk=0; /* limited to 2G filesystems!! */ - FILE *f; - char *s; - time_t tm; - - struct ext2_super_block ext2; - /* interesting fields: EXT2_SUPER_MAGIC - * s_blocks_count s_log_block_size s_mtime s_magic s_lastcheck */ - - if (argc<2) { - fprintf(stderr, - "Usage: findsuper device [skiprate [start]]\n"); - exit(1); - } - if (argc>2) - skiprate=atoi(argv[2]); - if (skiprate<512) { - fprintf(stderr, - "Do you really want to skip less than a sector??\n"); - exit(2); - } - if (argc>3) - sk=atol(argv[3]); - if (sk<0) { - fprintf(stderr,"Have to start at 0 or greater,not %ld\n",sk); - exit(1); - } - f=fopen(argv[1],"r"); - if (!f) { - perror(argv[1]); - exit(1); - } - - /* Now, go looking for the superblock ! */ - printf(" thisoff block fs_blk_sz blksz last_mount\n"); - for (;!feof(f) && (i=fseek(f,sk,SEEK_SET))!= -1; sk+=skiprate){ - if (i=fread(&ext2,sizeof(ext2),1, f)!=1) { - perror("read failed"); - } else if (ext2.s_magic == EXT2_SUPER_MAGIC){ - tm = ext2.s_mtime; - s=ctime(&tm); - s[24]=0; - printf("%9ld %9ld %9ld %5ld %s\n",sk,sk/1024,ext2.s_blocks_count,ext2.s_log_block_size,s); - } - } - printf("Failed on %d at %ld\n", i, sk); - fclose(f); -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/fsck.8.in b/gnu/usr.sbin/e2fsprogs/misc/fsck.8.in deleted file mode 100644 index a28f6dd40b9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/fsck.8.in +++ /dev/null @@ -1,189 +0,0 @@ -.\" -*- nroff -*- -.\" 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 FSCK 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -fsck \- check and repair a Linux file system -.SH SYNOPSIS -.B fsck -[ -.B \-AVRTNP -] -[ -.B \-s -] -[ -.B \-t -.I fstype -] -[ -.B fs-options -] -.I filesys [ ... ] -.SH DESCRIPTION -.B fsck -is used to check and optionally repair a Linux file system. -.I filesys -is either the device name (e.g. /dev/hda1, /dev/sdb2) or the mount point -(e.g. /, /usr, /home) for the file system. If this fsck has several -filesystems on different physical disk drives to check, this fsck will -try to run them in parallel. This reduces the total amount time it -takes to check all of the filesystems, since fsck takes advantage of the -parallelism of multiple disk spindles. -.PP -The exit code returned by -.B fsck -is the sum of the following conditions: -.br -\ 0\ \-\ No errors -.br -\ 1\ \-\ File system errors corrected -.br -\ 2\ \-\ System should be rebooted -.br -\ 4\ \-\ File system errors left uncorrected -.br -\ 8\ \-\ Operational error -.br -\ 16\ \-\ Usage or syntax error -.br -\ 128\ \-\ Shared library error -.br -The exit code returned when all file systems are checked using the -.B -A -option is the bit-wise OR of the exit codes for each -file system that is checked. -.PP -In actuality, -.B fsck -is simply a front-end for the various file system checkers -(\fBfsck\fR.\fIfstype\fR) available under Linux. The file -system-specific checker is searched for in /sbin first, then in /etc/fs -and /etc, and finally in the directories listed in the PATH environment -variable. Please see the file system-specific checker manual pages for -further details. -.SH OPTIONS -.TP -.B -A -Walk through the -.I /etc/fstab -file and try to check all file systems in one run. This option is -typically used from the -.I /etc/rc -system initalization file, instead of multiple commands for checking -a single file system. -.TP -.B -R -When checking all file systems with the -.B \-A -flag, skip the root file system (in case it's already mounted read-write). -.TP -.B -T -Don't show the title on startup. -.TP -.B -N -Don't execute, just show what would be done. -.TP -.B -P -When the -.B -A -flag is set, check the root filesystem in parallel with the other filesystems. -This is not the safest thing in the world to do, -since if the root filesystem is in doubt things like -the e2fsck executable might be corrupted! This option is mainly provided -for those sysadmins who don't want to repartition the root -filesystem to be small and compact (which is really the right solution). -.TP -.B -s -Serialize fsck operations. This is a good idea if you checking multiple -filesystems in and the checkers are in an interactive mode. (Note: -.B e2fsck -runs in an interactive mode by default. To make -.B e2fsck -run in a non-interactive mode, you must either specify the -.B -p -or -.B -a -option, if you wish for errors to be corrected automatically, or -the -.B -n -option if you do not.) -.TP -.B -V -Produce verbose output, including all file system-specific commands -that are executed. -.TP -.BI -t \ fstype -Specifies the type of file system to be checked. When the -.B \-A -flag is specified, only filesystems that match -.I fstype -are checked. If -.I fstype -is prefixed with -.B no -only filesystems whose filesystem do not match -.I fstype -are checked. -.sp -Normally, the filesystem type is deduced by searching for -.I filesys -in the -.I /etc/fstab -file and using the corresponding entry. -If the type can not be deduced, -.B fsck -will use the type specified by the -.B \-t -option if it specifies a unique filesystem type. If this type is not -available, the the default file system type -(currently ext2) is used. -.TP -.B fs-options -Any options which are not understood by -.BR fsck , -or which follow the -.B -- -option are treated as file system-specific options to be passed to the -file system-specific checker. -.PP -Currently, standardized file system-specific options are somewhat in -flux. Although not guaranteed, the following options are supported -by most file system checkers. -.TP -.B -a -Automatically repair the file system without any questions (use -this option with caution). Note that -.B e2fsck -supports -.B -a -for backwards compatibility only. This option is mapped to e2fsck's -.B -p -option which is safe to use, unlike the -.B -a -option that most file system checkers support. -.TP -.B -r -Interactively repair the filesystem (ask for confirmations). Note: It -is generally a bad idea to use this option if multiple fsck's are being -run in parallel. Also note that this is -.B e2fsck -default behavior; it supports this option for backwards compatibility -reasons only. -.SH AUTHOR -Theodore Ts'o (tytso@mit.edu) -.PP -The manual page was shamelessly adapted from David Engel and Fred van -Kempen's generic fsck front end program, which was in turn shamelessly -adapted from Remy Card's version for the ext2 file system. -.SH FILES -.IR /etc/fstab . -.SH SEE ALSO -.BR fstab (5), -.BR mkfs (8), -.BR fsck.minix (8), -.BR fsck.ext2 (8) -or -.BR e2fsck (8), -.BR fsck.xiafs (8). diff --git a/gnu/usr.sbin/e2fsprogs/misc/fsck.c b/gnu/usr.sbin/e2fsprogs/misc/fsck.c deleted file mode 100644 index 93e873772f5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/fsck.c +++ /dev/null @@ -1,793 +0,0 @@ -/* - * pfsck --- A generic, parallelizing front-end for the fsck program. - * It will automatically try to run fsck programs in parallel if the - * devices are on separate spindles. It is based on the same ideas as - * the generic front end for fsck by David Engel and Fred van Kempen, - * but it has been completely rewritten from scratch to support - * parallel execution. - * - * Written by Theodore Ts'o, <tytso@mit.edu> - * - * Usage: fsck [-AVRNTM] [-s] [-t fstype] [fs-options] device - * - * Miquel van Smoorenburg (miquels@drinkel.ow.org) 20-Oct-1994: - * o Changed -t fstype to behave like with mount when -A (all file - * systems) or -M (like mount) is specified. - * o fsck looks if it can find the fsck.type program to decide - * if it should ignore the fs type. This way more fsck programs - * can be added without changing this front-end. - * o -R flag skip root file system. - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/signal.h> -#include <sys/stat.h> -#include <limits.h> -#include <stdio.h> -#include <string.h> -#if HAVE_STDLIB_H -#include <stdlib.h> -#endif -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#if HAVE_MNTENT_H -#include <mntent.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#include <malloc.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif - -#include "../version.h" -#include "fsck.h" - -static const char *ignored_types[] = { - "ignore", - "iso9660", - "nfs", - "proc", - "sw", - "swap", - NULL -}; - -static const char *really_wanted[] = { - "minix", - "ext2", - "xiafs", - NULL -}; - -#ifdef DEV_DSK_DEVICES -static const char *base_devices[] = { - "/dev/dsk/hda", - "/dev/dsk/hdb", - "/dev/dsk/hdc", - "/dev/dsk/hdd", - "/dev/dsk/hd1a", - "/dev/dsk/hd1b", - "/dev/dsk/hd1c", - "/dev/dsk/hd1d", - "/dev/dsk/sda", - "/dev/dsk/sdb", - "/dev/dsk/sdc", - "/dev/dsk/sdd", - "/dev/dsk/sde", - "/dev/dsk/sdf", - "/dev/dsk/sdg", - NULL -}; -#else -static const char *base_devices[] = { - "/dev/hda", - "/dev/hdb", - "/dev/hdc", - "/dev/hdd", - "/dev/hd1a", - "/dev/hd1b", - "/dev/hd1c", - "/dev/hd1d", - "/dev/sda", - "/dev/sdb", - "/dev/sdc", - "/dev/sdd", - "/dev/sde", - "/dev/sdf", - "/dev/sdg", - NULL -}; -#endif - -/* - * Global variables for options - */ -char *devices[MAX_DEVICES]; -char *args[MAX_ARGS]; -int num_devices, num_args; - -int verbose = 0; -int doall = 0; -int noexecute = 0; -int serialize = 0; -int skip_root = 0; -int like_mount = 0; -int notitle = 0; -int parallel_root = 0; -char *progname; -char *fstype = NULL; -struct fs_info *filesys_info; -struct fsck_instance *instance_list; -const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc"; -char *fsck_path = 0; -static int ignore(struct fs_info *); - -#ifdef HAVE_STRDUP -#ifdef _POSIX_SOURCE -extern char *strdup(const char *s); -#endif -#else -static char *strdup(const char *s) -{ - char *ret; - - ret = malloc(strlen(s)+1); - if (ret) - strcpy(ret, s); - return ret; -} -#endif - -static void free_instance(struct fsck_instance *i) -{ - if (i->prog) - free(i->prog); - if (i->device) - free(i->device); - free(i); - return; -} - -/* - * Load the filesystem database from /etc/fstab - */ -static void load_fs_info(NOARGS) -{ -#if HAVE_MNTENT_H - FILE *mntfile; - struct mntent *mp; - struct fs_info *fs; - struct fs_info *fs_last = NULL; - int old_fstab = 1; - - filesys_info = NULL; - - /* Open the mount table. */ - if ((mntfile = setmntent(MNTTAB, "r")) == NULL) { - perror(MNTTAB); - exit(EXIT_ERROR); - } - - while ((mp = getmntent(mntfile)) != NULL) { - fs = malloc(sizeof(struct fs_info)); - memset(fs, 0, sizeof(struct fs_info)); - fs->device = strdup(mp->mnt_fsname); - fs->mountpt = strdup(mp->mnt_dir); - fs->type = strdup(mp->mnt_type); - fs->opts = strdup(mp->mnt_opts); - fs->freq = mp->mnt_freq; - fs->passno = mp->mnt_passno; - fs->next = NULL; - if (!filesys_info) - filesys_info = fs; - else - fs_last->next = fs; - fs_last = fs; - if (fs->passno) - old_fstab = 0; - } - - (void) endmntent(mntfile); - - if (old_fstab) { - fprintf(stderr, "\007\007\007" - "WARNING: Your /etc/fstab does not contain the fsck passno\n"); - fprintf(stderr, - " field. I will kludge around things for you, but you\n"); - fprintf(stderr, - " should fix your /etc/fstab file as soon as you can.\n\n"); - - for (fs = filesys_info; fs; fs = fs->next) { - fs->passno = 1; - } - } -#else - filesys_info = NULL; -#endif /* HAVE_MNTENT_H */ -} - -/* Lookup filesys in /etc/fstab and return the corresponding entry. */ -static struct fs_info *lookup(char *filesys) -{ - struct fs_info *fs; - - /* No filesys name given. */ - if (filesys == NULL) - return NULL; - - for (fs = filesys_info; fs; fs = fs->next) { - if (!strcmp(filesys, fs->device) || - !strcmp(filesys, fs->mountpt)) - break; - } - - return fs; -} - -/* Find fsck program for a given fs type. */ -static char *find_fsck(char *type) -{ - char *s; - const char *tpl; - static char prog[256]; - char *p = strdup(fsck_path); - struct stat st; - - /* Are we looking for a program or just a type? */ - tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s"); - - for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) { - sprintf(prog, tpl, s, type); - if (stat(prog, &st) == 0) break; - } - free(p); - return(s ? prog : NULL); -} - -/* - * Execute a particular fsck program, and link it into the list of - * child processes we are waiting for. - */ -static int execute(char *prog, char *device) -{ - char *s, *argv[80]; - int argc, i; - struct fsck_instance *inst; - pid_t pid; - - argv[0] = strdup(prog); - argc = 1; - - for (i=0; i <num_args; i++) - argv[argc++] = strdup(args[i]); - - argv[argc++] = strdup(device); - argv[argc] = 0; - - s = find_fsck(prog); - if (s == NULL) { - fprintf(stderr, "fsck: %s: not found\n", prog); - return ENOENT; - } - - if (verbose || noexecute) { - printf("[%s] ", s); - for (i=0; i < argc; i++) - printf("%s ", argv[i]); - printf("\n"); - } - if (noexecute) - return 0; - - /* Fork and execute the correct program. */ - if ((pid = fork()) < 0) { - perror("fork"); - return errno; - } else if (pid == 0) { - (void) execv(s, argv); - perror(argv[0]); - exit(EXIT_ERROR); - } - inst = malloc(sizeof(struct fsck_instance)); - if (!inst) - return ENOMEM; - memset(inst, 0, sizeof(struct fsck_instance)); - inst->pid = pid; - inst->prog = strdup(prog); - inst->device = strdup(device); - inst->next = instance_list; - instance_list = inst; - - return 0; -} - -/* - * Wait for one child process to exit; when it does, unlink it from - * the list of executing child processes, and return it. - */ -static struct fsck_instance *wait_one(NOARGS) -{ - int status; - int sig; - struct fsck_instance *inst, *prev; - pid_t pid; - - if (!instance_list) - return NULL; - -retry: - pid = wait(&status); - if (pid < 0) { - if ((errno == EINTR) || (errno == EAGAIN)) - goto retry; - if (errno == ECHILD) { - fprintf(stderr, - "%s: wait: No more child process?!?\n", - progname); - return NULL; - } - perror("wait"); - goto retry; - } - for (prev = 0, inst = instance_list; - inst; - prev = inst, inst = inst->next) { - if (inst->pid == pid) - break; - } - if (!inst) { - printf("Unexpected child process %d, status = 0x%x\n", - pid, status); - goto retry; - } - if (WIFEXITED(status)) - status = WEXITSTATUS(status); - else if (WIFSIGNALED(status)) { - sig = WTERMSIG(status); - if (sig == SIGINT) { - status = EXIT_UNCORRECTED; - } else { - printf("Warning... %s for device %s exited " - "with signal %d.\n", - inst->prog, inst->device, sig); - status = EXIT_ERROR; - } - } else { - printf("%s %s: status is %x, should never happen.\n", - inst->prog, inst->device, status); - status = EXIT_ERROR; - } - inst->exit_status = status; - if (prev) - prev->next = inst->next; - else - instance_list = inst->next; - return inst; -} - -/* - * Wait until all executing child processes have exited; return the - * logical OR of all of their exit code values. - */ -static int wait_all(NOARGS) -{ - struct fsck_instance *inst; - int global_status = 0; - - while (instance_list) { - inst = wait_one(); - if (!inst) - break; - global_status |= inst->exit_status; - free_instance(inst); - } - return global_status; -} - -/* - * Run the fsck program on a particular device - * - * If the type is specified using -t, and it isn't prefixed with "no" - * (as in "noext2") and only one filesystem type is specified, then - * use that type regardless of what is specified in /etc/fstab. - * - * If the type isn't specified by the user, then use either the type - * specified in /etc/fstab, or DEFAULT_FSTYPE. - */ -static void fsck_device(char *device) -{ - const char *type = 0; - struct fs_info *fsent; - int retval; - char prog[80]; - - if (fstype && strncmp(fstype, "no", 2) && !strchr(fstype, ',')) - type = fstype; - - if ((fsent = lookup(device))) { - device = fsent->device; - if (!type) - type = fsent->type; - } - if (!type) - type = DEFAULT_FSTYPE; - - sprintf(prog, "fsck.%s", type); - retval = execute(prog, device); - if (retval) { - fprintf(stderr, "%s: Error %d while executing %s for %s\n", - progname, retval, prog, device); - } -} - -/* See if filesystem type matches the list. */ -static int fs_match(char *type, char *fs_type) -{ - int ret = 0, negate = 0; - char list[128]; - char *s; - - if (!fs_type) return(1); - - if (strncmp(fs_type, "no", 2) == 0) { - fs_type += 2; - negate = 1; - } - strcpy(list, fs_type); - s = strtok(list, ","); - while(s) { - if (strcmp(s, type) == 0) { - ret = 1; - break; - } - s = strtok(NULL, ","); - } - return(negate ? !ret : ret); -} - - -/* Check if we should ignore this filesystem. */ -static int ignore(struct fs_info *fs) -{ - const char *cp; - const char **ip; - int wanted = 0; - - /* - * If the pass number is 0, ignore it. - */ - if (fs->passno == 0) - return 1; - - /* - * If a specific fstype is specified, and it doesn't match, - * ignore it. - */ - if (!fs_match(fs->type, fstype)) return 1; - - /* Noauto never matches. */ - for (cp = strtok(fs->opts, ","); cp != NULL; cp = strtok(NULL, ",")) { - if (!strcmp(cp, "noauto")) - return 1; - } - - /* Are we ignoring this type? */ - for(ip = ignored_types; *ip; ip++) - if (strcmp(fs->type, *ip) == 0) return(1); - - /* Do we really really want to check this fs? */ - for(ip = really_wanted; *ip; ip++) - if (strcmp(fs->type, *ip) == 0) { - wanted = 1; - break; - } - - /* See if the <fsck.fs> program is available. */ - if (find_fsck(fs->type) == NULL) { - if (wanted) - fprintf(stderr, "fsck: cannot check %s: fsck.%s not found\n", - fs->device, fs->type); - return(1); - } - - /* We can and want to check this file system type. */ - return 0; -} - -/* - * Return the "base device" given a particular device; this is used to - * assure that we only fsck one partition on a particular drive at any - * one time. Otherwise, the disk heads will be seeking all over the - * place. - */ -static const char *base_device(char *device) -{ - const char **base; - - for (base = base_devices; *base; base++) { - if (!strncmp(*base, device, strlen(*base))) - return *base; - } - return device; -} - -/* - * Returns TRUE if a partition on the same disk is already being - * checked. - */ -static int device_already_active(char *device) -{ - struct fsck_instance *inst; - const char *base; - - base = base_device(device); - - for (inst = instance_list; inst; inst = inst->next) { - if (!strcmp(base, base_device(inst->device))) - return 1; - } - - return 0; -} - -/* Check all file systems, using the /etc/fstab table. */ -static int check_all(NOARGS) -{ - struct fs_info *fs = NULL; - struct fsck_instance *inst; - int status = EXIT_OK; - int not_done_yet = 1; - int passno = 0; - int pass_done; - - if (verbose) - printf("Checking all file systems.\n"); - - /* - * Find and check the root filesystem first. - */ - if (!parallel_root) { - for (fs = filesys_info; fs; fs = fs->next) { - if (!strcmp(fs->mountpt, "/")) - break; - } - if (fs && !skip_root && !ignore(fs)) { - fsck_device(fs->device); - fs->flags |= FLAG_DONE; - status |= wait_all(); - if (status > EXIT_NONDESTRUCT) - return status; - } - } - if (fs) fs->flags |= FLAG_DONE; - - /* - * Mark filesystems that should be ignored as done. - */ - for (fs = filesys_info; fs; fs = fs->next) { - if (ignore(fs)) - fs->flags |= FLAG_DONE; - } - - while (not_done_yet) { - not_done_yet = 0; - pass_done = 1; - - for (fs = filesys_info; fs; fs = fs->next) { - if (fs->flags & FLAG_DONE) - continue; - /* - * If the filesystem's pass number is higher - * than the current pass number, then we don't - * do it yet. - */ - if (fs->passno > passno) { - not_done_yet++; - continue; - } - /* - * If a filesystem on a particular device has - * already been spawned, then we need to defer - * this to another pass. - */ - if (device_already_active(fs->device)) { - pass_done = 0; - continue; - } - /* - * Spawn off the fsck process - */ - fsck_device(fs->device); - fs->flags |= FLAG_DONE; - - if (serialize) { - pass_done = 0; - break; /* Only do one filesystem at a time */ - - } - } - inst = wait_one(); - if (inst) { - status |= inst->exit_status; - free_instance(inst); - } - if (pass_done) { - status |= wait_all(); - if (verbose) - printf("----------------------------------\n"); - passno++; - } else - not_done_yet++; - } - status |= wait_all(); - return status; -} - -static void usage(NOARGS) -{ - fprintf(stderr, - "Usage: fsck [-AV] [-t fstype] [fs-options] filesys\n"); - exit(EXIT_USAGE); -} - -static void PRS(int argc, char *argv[]) -{ - int i, j; - char *arg; - char options[128]; - int opt = 0; - int opts_for_fsck = 0; - - num_devices = 0; - num_args = 0; - instance_list = 0; - - progname = argv[0]; - - load_fs_info(); - - for (i=1; i < argc; i++) { - arg = argv[i]; - if (!arg) - continue; - if (arg[0] == '/') { - if (num_devices >= MAX_DEVICES) { - fprintf(stderr, "%s: too many devices\n", - progname); - exit(1); - } - devices[num_devices++] = strdup(arg); - continue; - } - if (arg[0] != '-') { - if (num_args >= MAX_ARGS) { - fprintf(stderr, "%s: too many arguments\n", - progname); - exit(1); - } - args[num_args++] = strdup(arg); - continue; - } - for (j=1; arg[j]; j++) { - if (opts_for_fsck) { - options[++opt] = arg[j]; - continue; - } - switch (arg[j]) { - case 'A': - doall++; - break; - case 'V': - verbose++; - break; - case 'N': - noexecute++; - break; - case 'R': - skip_root++; - break; - case 'T': - notitle++; - break; - case 'M': - like_mount++; - break; - case 'P': - parallel_root++; - break; - case 's': - serialize++; - break; - case 't': - if (arg[j+1]) { - fstype = strdup(arg+j+1); - goto next_arg; - } - if ((i+1) < argc) { - i++; - fstype = strdup(argv[i]); - goto next_arg; - } - usage(); - break; - case '-': - opts_for_fsck++; - break; - default: - options[++opt] = arg[j]; - break; - } - } - next_arg: - if (opt) { - options[0] = '-'; - options[++opt] = '\0'; - if (num_args >= MAX_ARGS) { - fprintf(stderr, - "%s: too many arguments\n", - progname); - exit(1); - } - args[num_args++] = strdup(options); - opt = 0; - } - } -} - -int main(int argc, char *argv[]) -{ - int i; - int status = 0; - char *oldpath = getenv("PATH"); - - PRS(argc, argv); - - if (!notitle) - printf("Parallelizing fsck version %s (%s)\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE); - - /* Update our search path to include uncommon directories. */ - if (oldpath) { - fsck_path = malloc (strlen (fsck_prefix_path) + 1 + - strlen (oldpath) + 1); - strcpy (fsck_path, fsck_prefix_path); - strcat (fsck_path, ":"); - strcat (fsck_path, oldpath); - } else { - fsck_path = strdup(fsck_prefix_path); - } - - /* If -A was specified ("check all"), do that! */ - if (doall) - return check_all(); - - for (i = 0 ; i < num_devices; i++) { - fsck_device(devices[i]); - if (serialize) { - struct fsck_instance *inst; - - inst = wait_one(); - if (inst) { - status |= inst->exit_status; - free_instance(inst); - } - } - } - status |= wait_all(); - free(fsck_path); - return status; -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/fsck.h b/gnu/usr.sbin/e2fsprogs/misc/fsck.h deleted file mode 100644 index 3e13e9c9060..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/fsck.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * fsck.h - */ - -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - -#ifndef DEFAULT_FSTYPE -#define DEFAULT_FSTYPE "ext2" -#endif - -#define MAX_DEVICES 32 -#define MAX_ARGS 32 - -#define EXIT_OK 0 -#define EXIT_NONDESTRUCT 1 -#define EXIT_DESTRUCT 2 -#define EXIT_UNCORRECTED 4 -#define EXIT_ERROR 8 -#define EXIT_USAGE 16 -#define EXIT_LIBRARY 128 - -/* - * Internal structure for mount tabel entries. - */ - -struct fs_info { - char *device; - char *mountpt; - char *type; - char *opts; - int freq; - int passno; - int flags; - struct fs_info *next; -}; - -#define FLAG_DONE 1 - -/* - * Structure to allow exit codes to be stored - */ -struct fsck_instance { - int pid; - int flags; - int exit_status; - char * prog; - char * device; - struct fsck_instance *next; -}; - - - diff --git a/gnu/usr.sbin/e2fsprogs/misc/lsattr.1.in b/gnu/usr.sbin/e2fsprogs/misc/lsattr.1.in deleted file mode 100644 index 1a3bdffde0b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/lsattr.1.in +++ /dev/null @@ -1,40 +0,0 @@ -.\" -*- nroff -*- -.TH LSATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -lsattr \- list file attributes on a Linux second extended file system -.SH SYNOPSIS -.B lsattr -[ -.B \-Radv -] -[ -files... -] -.SH DESCRIPTION -.B lsattr -lists the file attributes on a second extended file system. -.SH OPTIONS -.TP -.I -R -Recursively list attributes of directories and their contents. -.TP -.I -a -List all files in directories, including files that start with `.'. -.TP -.I -d -List directories like other files, rather than listing their contents. -.TP -.I -v -List the files version. -.SH AUTHOR -.B lsattr -has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer -of the ext2 fs. -.SH BUGS -There are none :-). -.SH AVAILABILITY -.B lsattr -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BR chattr (1) diff --git a/gnu/usr.sbin/e2fsprogs/misc/lsattr.c b/gnu/usr.sbin/e2fsprogs/misc/lsattr.c deleted file mode 100644 index 60d60f0db2c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/lsattr.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * lsattr.c - List file attributes on an ext2 file system - * - * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * This file can be redistributed under the terms of the GNU General - * Public License - */ - -/* - * History: - * 93/10/30 - Creation - * 93/11/13 - Replace stat() calls by lstat() to avoid loops - * 94/02/27 - Integrated in Ted's distribution - */ - -#include <sys/types.h> -#include <dirent.h> -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#include <fcntl.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#else -extern int optind; -extern char *optarg; -#endif -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <sys/param.h> -#include <sys/stat.h> -#include <linux/ext2_fs.h> - -#include "et/com_err.h" -#include "e2p/e2p.h" - -#include "../version.h" - -const char * program_name = "lsattr"; - -int all = 0; -int d_opt = 0; -int l_opt = 0; -int recursive = 0; -int v_opt = 0; - -static void volatile usage (void) -{ - fprintf (stderr, "Usage: %s [-Radlv] [files...]\n", program_name); - exit (1); -} - -static void list_attributes (const char * name) -{ - unsigned long flags; - unsigned long version; - - if (fgetflags (name, &flags) == -1) - com_err (program_name, errno, "While reading flags on %s", - name); - else if (fgetversion (name, &version) == -1) - com_err (program_name, errno, "While reading version on %s", - name); - else - { - if (v_opt) - printf ("%5lu ", version); - print_flags (stdout, flags, l_opt); - printf (" %s\n", name); - } -} - -static int lsattr_dir_proc (const char *, struct dirent *, void *); - -static void lsattr_args (const char * name) -{ - struct stat st; - - if (lstat (name, &st) == -1) - com_err (program_name, errno, "while stating %s", name); - else - { - if (S_ISDIR(st.st_mode) && !d_opt) - iterate_on_dir (name, lsattr_dir_proc, (void *) NULL); - else - list_attributes (name); - } -} - -static int lsattr_dir_proc (const char * dir_name, struct dirent * de, void * private) -{ - struct stat st; - char *path; - - path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1); - - sprintf (path, "%s/%s", dir_name, de->d_name); - if (lstat (path, &st) == -1) - perror (path); - else { - if (de->d_name[0] != '.' || all) { - list_attributes (path); - if (S_ISDIR(st.st_mode) && recursive && - strcmp(de->d_name, ".") && - strcmp(de->d_name, "..")) { - printf ("\n%s:\n", path); - iterate_on_dir (path, lsattr_dir_proc, - (void *) NULL); - printf ("\n"); - } - } - } - free(path); - return 0; -} - -void main (int argc, char ** argv) -{ - char c; - int i; - - fprintf (stderr, "lsattr %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); - if (argc && *argv) - program_name = *argv; - while ((c = getopt (argc, argv, "Radlv")) != EOF) - switch (c) - { - case 'R': - recursive = 1; - break; - case 'a': - all = 1; - break; - case 'd': - d_opt = 1; - break; - case 'l': - l_opt = 1; - break; - case 'v': - v_opt = 1; - break; - default: - usage (); - } - - if (optind > argc - 1) - lsattr_args ("."); - else - for (i = optind; i < argc; i++) - lsattr_args (argv[i]); -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/mke2fs.8.in b/gnu/usr.sbin/e2fsprogs/misc/mke2fs.8.in deleted file mode 100644 index de08f440561..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/mke2fs.8.in +++ /dev/null @@ -1,188 +0,0 @@ -.\" -*- nroff -*- -.\" 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 MKE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -mke2fs \- create a Linux second extended file system -.SH SYNOPSIS -.B mke2fs -[ -.B \-c -| -.\" .B \-t -.\" test -.\" | -.B \-l -.I filename -] -[ -.B \-b -.I block-size -] -[ -.B \-f -.I fragment-size -] -[ -.B \-i -.I bytes-per-inode -] -[ -.B \-m -.I reserved-blocks-percentage -] -[ -.B \-o -.I creator-os -] -[ -.B \-q -] -[ -.B \-r fs-revision-level -] -[ -.B -R raid_options -] -[ -.B -s sparse-super-flag -] -[ -.B \-v -] -[ -.B \-F -] -[ -.B \-L -.I volume-label -] -[ -.B \-M -.I last-mounted-directory -] -[ -.B \-S -] -.I device -[ -.I blocks-count -] -.SH DESCRIPTION -.B mke2fs -is used to create a Linux second extended file system on a device (usually -a disk partition). -.br -.I device -is the special file corresponding to the device (e.g /dev/hdXX). -.br -.I blocks-count -is the number of blocks on the device. If omitted, -.B mke2fs -automagically figures the file system size. -.SH OPTIONS -.TP -.I -b block-size -Specify the size of blocks in bytes. -.TP -.I -c -Check the device for bad blocks before creating the file system, using a -fast read-only test. -.TP -.I -f fragment-size -Specify the size of fragments in bytes. -.TP -.I -i bytes-per-inode -Specify the bytes/inode ratio. -.B mke2fs -creates an inode for every -.I bytes-per-inode -bytes of space on the disk. This value defaults to 4096 bytes. -.I bytes-per-inode -must be at least 1024. -.TP -.I -l filename -Read the bad blocks list from -.I filename -\. -.TP -.I -m reserved-blocks-percentage -Specify the percentage of reserved blocks for the super-user. This value -defaults to 5%. -.\" .TP -.\" .I -t test -.\" Check the device for bad blocks before creating the file system -.\" using the specified test. -.TP -.I -o -Manually override the default value of the "creator os" field of the -filesystem. Normally the creator field is set by default to the native OS -of the mke2fs executable. -.TP -.I -q -Quiet execution. Useful if mke2fs is run in a script. -.TP -.I -s sparse-super-flag -If sparse-super-flag is 1, then turn on the sparse superblock flag. -If 0, then turn off the sparse superblock flag. (Currently, the sparse -superblock flag defaults to off.) -.B Warning: -The Linux 2.0 kernel does not properly support this feature. Neither do -all Linux 2.1 kernels; please don't use this unless you know what you're -doing! -.TP -.I -v -Verbose execution. -.TP -.I -F -Force mke2fs to run, even if the specified device is not a -block special device. -.TP -.I -L -Set the volume label for the filesystem. -.TP -.I -M -Set the last mounted directory for the filesystem. This might be useful -for the sake of utilities that key off of the last mounted directory to -determine where the filesytem should be mounted. -.TP -.I -r revision -Set the filesystem revision for the new filesystem. Note that 1.2 -kernels only support revision 0 filesystems. -.TP -.I -R raid_options -Set raid-related options for the filesystem. Raid options are common -separated, and may take an argument using the equals ('=') sign. -Currently the only supported argument is -.I stride -which takes as its argument the number of blocks in a RAID stripe. -.TP -.I -S -Write superblock and group descriptors only. This is useful if all of -the superblock and backup superblocks are corrupted, and a last-ditch -recovery method is desired. It causes mke2fs to reinitialize the -superblock and group descriptors, while not touching the inode table -and the block and inode bitmaps. The -.B e2fsck -program should be run immediately after this option is used, and there -is no guarantee that any data will be salvageable. -.SH AUTHOR -This version of -.B mke2fs -has been written by Theodore Ts'o <tytso@mit.edu>. -.SH BUGS -.B mke2fs -accepts the -f option but currently ignores it because the second -extended file system does not support fragments yet. -.br -There may be some other ones. Please, report them to the author. -.SH AVAILABILITY -.B mke2fs -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BT badblocks (8), -.BR dumpe2fs (8), -.BR e2fsck (8), -.BR tune2fs (8) diff --git a/gnu/usr.sbin/e2fsprogs/misc/mke2fs.c b/gnu/usr.sbin/e2fsprogs/misc/mke2fs.c deleted file mode 100644 index 554124664a3..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/mke2fs.c +++ /dev/null @@ -1,897 +0,0 @@ -/* - * mke2fs.c - Make a ext2fs filesystem. - * - * Copyright (C) 1994, 1995, 1996, 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* Usage: mke2fs [options] device - * - * The device may be a block device or a image of one, but this isn't - * enforced (but it's not much fun on a character device :-). - */ - -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <ctype.h> -#include <termios.h> -#include <time.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_ERRNO_H -#include <errno.h> -#endif -#ifdef HAVE_MNTENT_H -#include <mntent.h> -#endif -#include <malloc.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <stdio.h> - -#ifdef HAVE_LINUX_FS_H -#include <linux/fs.h> -#endif -#include <linux/ext2_fs.h> -#ifdef HAVE_LINUX_MAJOR_H -#include <linux/major.h> -#endif - -#include "et/com_err.h" -#include "uuid/uuid.h" -#include "ext2fs/ext2fs.h" -#include "../version.h" - -#define STRIDE_LENGTH 8 - -#ifndef sparc -#define ZAP_BOOTBLOCK -#endif - -extern int isatty(int); -extern FILE *fpopen(const char *cmd, const char *mode); - -const char * program_name = "mke2fs"; -const char * device_name = NULL; - -/* Command line options */ -int cflag = 0; -int verbose = 0; -int quiet = 0; -int super_only = 0; -int force = 0; -char *bad_blocks_filename = 0; -__u32 fs_stride = 0; - -struct ext2_super_block param; -char *creator_os = NULL; -char *volume_label = NULL; -char *mount_dir = NULL; - -static void usage(NOARGS) -{ - fprintf(stderr, "Usage: %s [-c|-t|-l filename] [-b block-size] " - "[-f fragment-size]\n\t[-i bytes-per-inode] " - "[-m reserved-blocks-percentage] [-qvS]\n\t" - "[-o creator-os] [-g blocks-per-group] [-L volume-label]\n\t" - "[-M last-mounted-directory] [-r fs-revision] [-R raid_opts]\n\t" - "device [blocks-count]\n", - program_name); - exit(1); -} - -static int log2(int arg) -{ - int l = 0; - - arg >>= 1; - while (arg) { - l++; - arg >>= 1; - } - return l; -} - -static void check_plausibility(NOARGS) -{ -#ifdef HAVE_LINUX_MAJOR_H - int val; - struct stat s; - - val = stat(device_name, &s); - - if(val == -1) { - printf("Could not stat %s --- %s\n", device_name, - error_message(errno)); - if (errno == ENOENT) - printf("\nThe device apparently does not exist; " - "did yo specify it correctly?\n"); - exit(1); - } - if(!S_ISBLK(s.st_mode)) { - printf("%s is not a block special device.\n", device_name); - printf("Proceed anyway? (y,n) "); - if (getchar() != 'y') - exit(1); - return; - } - if ((MAJOR(s.st_rdev) == HD_MAJOR && MINOR(s.st_rdev)%64 == 0) || - (MAJOR(s.st_rdev) == SCSI_DISK_MAJOR && - MINOR(s.st_rdev)%16 == 0)) { - printf("%s is entire device, not just one partition!\n", - device_name); - printf("Proceed anyway? (y,n) "); - if (getchar() != 'y') - exit(1); - return; - } -#endif -} - -static void check_mount(NOARGS) -{ - errcode_t retval; - int mount_flags; - - retval = ext2fs_check_if_mounted(device_name, &mount_flags); - if (retval) { - com_err("ext2fs_check_if_mount", retval, - "while determining whether %s is mounted.", - device_name); - return; - } - if (!(mount_flags & EXT2_MF_MOUNTED)) - return; - - fprintf(stderr, "%s is mounted; will not make a filesystem here!\n", - device_name); - exit(1); -} - -/* - * Helper function for read_bb_file and test_disk - */ -static void invalid_block(ext2_filsys fs, blk_t blk) -{ - printf("Bad block %u out of range; ignored.\n", blk); - return; -} - -/* - * Reads the bad blocks list from a file - */ -static void read_bb_file(ext2_filsys fs, badblocks_list *bb_list, - const char *bad_blocks_file) -{ - FILE *f; - errcode_t retval; - - f = fopen(bad_blocks_file, "r"); - if (!f) { - com_err("read_bad_blocks_file", errno, - "while trying to open %s", bad_blocks_file); - exit(1); - } - retval = ext2fs_read_bb_FILE(fs, f, bb_list, invalid_block); - fclose (f); - if (retval) { - com_err("ext2fs_read_bb_FILE", retval, - "while reading in list of bad blocks from file"); - exit(1); - } -} - -/* - * Runs the badblocks program to test the disk - */ -static void test_disk(ext2_filsys fs, badblocks_list *bb_list) -{ - FILE *f; - errcode_t retval; - char buf[1024]; - - sprintf(buf, "badblocks %s%s %d", quiet ? "" : "-s ", - fs->device_name, - fs->super->s_blocks_count); - if (verbose) - printf("Running command: %s\n", buf); - f = popen(buf, "r"); - if (!f) { - com_err("popen", errno, - "while trying run '%s'", buf); - exit(1); - } - retval = ext2fs_read_bb_FILE(fs, f, bb_list, invalid_block); - pclose(f); - if (retval) { - com_err("ext2fs_read_bb_FILE", retval, - "while processing list of bad blocks from program"); - exit(1); - } -} - -static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list) -{ - int i, j; - int must_be_good; - blk_t blk; - badblocks_iterate bb_iter; - errcode_t retval; - blk_t group_block; - int group; - int group_bad; - - if (!bb_list) - return; - - /* - * The primary superblock and group descriptors *must* be - * good; if not, abort. - */ - must_be_good = fs->super->s_first_data_block + 1 + fs->desc_blocks; - for (i = fs->super->s_first_data_block; i <= must_be_good; i++) { - if (badblocks_list_test(bb_list, i)) { - fprintf(stderr, "Block %d in primary superblock/group " - "descriptor area bad.\n", i); - fprintf(stderr, "Blocks %d through %d must be good " - "in order to build a filesystem.\n", - fs->super->s_first_data_block, must_be_good); - fprintf(stderr, "Aborting....\n"); - exit(1); - } - } - - /* - * See if any of the bad blocks are showing up in the backup - * superblocks and/or group descriptors. If so, issue a - * warning and adjust the block counts appropriately. - */ - group_block = fs->super->s_first_data_block + - fs->super->s_blocks_per_group; - group_bad = 0; - - for (i = 1; i < fs->group_desc_count; i++) { - for (j=0; j < fs->desc_blocks+1; j++) { - if (badblocks_list_test(bb_list, group_block + - j)) { - if (!group_bad) - fprintf(stderr, -"Warning: the backup superblock/group descriptors at block %d contain\n" -" bad blocks.\n\n", - group_block); - group_bad++; - group = ext2fs_group_of_blk(fs, group_block+j); - fs->group_desc[group].bg_free_blocks_count++; - fs->super->s_free_blocks_count++; - } - } - group_block += fs->super->s_blocks_per_group; - } - - /* - * Mark all the bad blocks as used... - */ - retval = badblocks_list_iterate_begin(bb_list, &bb_iter); - if (retval) { - com_err("badblocks_list_iterate_begin", retval, - "while marking bad blocks as used"); - exit(1); - } - while (badblocks_list_iterate(bb_iter, &blk)) - ext2fs_mark_block_bitmap(fs->block_map, blk); - badblocks_list_iterate_end(bb_iter); -} - -static void write_inode_tables(ext2_filsys fs) -{ - errcode_t retval; - blk_t blk; - int i, j, num, count; - char *buf; - - buf = malloc(fs->blocksize * STRIDE_LENGTH); - if (!buf) { - com_err("malloc", ENOMEM, "while allocating zeroizing buffer"); - exit(1); - } - memset(buf, 0, fs->blocksize * STRIDE_LENGTH); - - if (!quiet) - printf("Writing inode tables: "); - for (i = 0; i < fs->group_desc_count; i++) { - if (!quiet) - printf("%4d/%4ld", i, fs->group_desc_count); - - blk = fs->group_desc[i].bg_inode_table; - num = fs->inode_blocks_per_group; - - for (j=0; j < num; j += STRIDE_LENGTH, blk += STRIDE_LENGTH) { - if (num-j > STRIDE_LENGTH) - count = STRIDE_LENGTH; - else - count = num - j; - retval = io_channel_write_blk(fs->io, blk, count, buf); - if (retval) - printf("Warning: could not write %d blocks " - "in inode table starting at %d: %s\n", - count, blk, error_message(retval)); - } - if (!quiet) - printf("\b\b\b\b\b\b\b\b\b"); - } - free(buf); - if (!quiet) - printf("done \n"); -} - -static void create_root_dir(ext2_filsys fs) -{ - errcode_t retval; - struct ext2_inode inode; - - retval = ext2fs_mkdir(fs, EXT2_ROOT_INO, EXT2_ROOT_INO, 0); - if (retval) { - com_err("ext2fs_mkdir", retval, "while creating root dir"); - exit(1); - } - if (geteuid()) { - retval = ext2fs_read_inode(fs, EXT2_ROOT_INO, &inode); - if (retval) { - com_err("ext2fs_read_inode", retval, - "while reading root inode"); - exit(1); - } - inode.i_uid = getuid(); - if (inode.i_uid) - inode.i_gid = getgid(); - retval = ext2fs_write_inode(fs, EXT2_ROOT_INO, &inode); - if (retval) { - com_err("ext2fs_write_inode", retval, - "while setting root inode ownership"); - exit(1); - } - } -} - -static void create_lost_and_found(ext2_filsys fs) -{ - errcode_t retval; - ino_t ino; - const char *name = "lost+found"; - int i; - - retval = ext2fs_mkdir(fs, EXT2_ROOT_INO, 0, name); - if (retval) { - com_err("ext2fs_mkdir", retval, "while creating /lost+found"); - exit(1); - } - - retval = ext2fs_lookup(fs, EXT2_ROOT_INO, name, strlen(name), 0, &ino); - if (retval) { - com_err("ext2_lookup", retval, "while looking up /lost+found"); - exit(1); - } - - for (i=1; i < EXT2_NDIR_BLOCKS; i++) { - retval = ext2fs_expand_dir(fs, ino); - if (retval) { - com_err("ext2fs_expand_dir", retval, - "while expanding /lost+found"); - exit(1); - } - } -} - -static void create_bad_block_inode(ext2_filsys fs, badblocks_list bb_list) -{ - errcode_t retval; - - ext2fs_mark_inode_bitmap(fs->inode_map, EXT2_BAD_INO); - fs->group_desc[0].bg_free_inodes_count--; - fs->super->s_free_inodes_count--; - retval = ext2fs_update_bb_inode(fs, bb_list); - if (retval) { - com_err("ext2fs_update_bb_inode", retval, - "while setting bad block inode"); - exit(1); - } - -} - -static void reserve_inodes(ext2_filsys fs) -{ - ino_t i; - int group; - - for (i = EXT2_ROOT_INO + 1; i < EXT2_FIRST_INODE(fs->super); i++) { - ext2fs_mark_inode_bitmap(fs->inode_map, i); - group = ext2fs_group_of_ino(fs, i); - fs->group_desc[group].bg_free_inodes_count--; - fs->super->s_free_inodes_count--; - } - ext2fs_mark_ib_dirty(fs); -} - -#ifdef ZAP_BOOTBLOCK -static void zap_bootblock(ext2_filsys fs) -{ - char buf[512]; - int retval; - - memset(buf, 0, 512); - - retval = io_channel_write_blk(fs->io, 0, -512, buf); - if (retval) - printf("Warning: could not erase block 0: %s\n", - error_message(retval)); -} -#endif - - -static void show_stats(ext2_filsys fs) -{ - struct ext2fs_sb *s = (struct ext2fs_sb *) fs->super; - char buf[80]; - blk_t group_block; - int i, col_left; - - if (param.s_blocks_count != s->s_blocks_count) - printf("warning: %d blocks unused.\n\n", - param.s_blocks_count - s->s_blocks_count); - - switch (fs->super->s_creator_os) { - case EXT2_OS_LINUX: printf ("Linux"); break; - case EXT2_OS_HURD: printf ("GNU/hurd"); break; - case EXT2_OS_MASIX: printf ("Masix"); break; - default: printf ("(unknown os)"); - } - printf (" ext2 filesystem format\n"); - memset(buf, 0, sizeof(buf)); - strncpy(buf, s->s_volume_name, sizeof(s->s_volume_name)); - printf("Filesystem label=%s\n", buf); - printf("%u inodes, %u blocks\n", s->s_inodes_count, - s->s_blocks_count); - printf("%u blocks (%2.2f%%) reserved for the super user\n", - s->s_r_blocks_count, - 100.0 * s->s_r_blocks_count / s->s_blocks_count); - printf("First data block=%u\n", s->s_first_data_block); - printf("Block size=%u (log=%u)\n", fs->blocksize, - s->s_log_block_size); - printf("Fragment size=%u (log=%u)\n", fs->fragsize, - s->s_log_frag_size); - printf("%lu block group%s\n", fs->group_desc_count, - (fs->group_desc_count > 1) ? "s" : ""); - printf("%u blocks per group, %u fragments per group\n", - s->s_blocks_per_group, s->s_frags_per_group); - printf("%u inodes per group\n", s->s_inodes_per_group); - - if (fs->group_desc_count == 1) { - printf("\n"); - return; - } - - printf("Superblock backups stored on blocks: "); - group_block = s->s_first_data_block; - col_left = 0; - for (i = 1; i < fs->group_desc_count; i++) { - group_block += s->s_blocks_per_group; - if (!ext2fs_bg_has_super(fs, i)) - continue; - if (!col_left--) { - printf("\n\t"); - col_left = 8; - } - printf("%u", group_block); - if (i != fs->group_desc_count - 1) - printf(", "); - } - printf("\n\n"); -} - -#ifndef HAVE_STRCASECMP -static int strcasecmp (char *s1, char *s2) -{ - while (*s1 && *s2) { - int ch1 = *s1++, ch2 = *s2++; - if (isupper (ch1)) - ch1 = tolower (ch1); - if (isupper (ch2)) - ch2 = tolower (ch2); - if (ch1 != ch2) - return ch1 - ch2; - } - return *s1 ? 1 : *s2 ? -1 : 0; -} -#endif - -/* - * Set the S_CREATOR_OS field. Return true if OS is known, - * otherwise, 0. - */ -static int set_os(struct ext2_super_block *sb, char *os) -{ - if (isdigit (*os)) - sb->s_creator_os = atoi (os); - else if (strcasecmp(os, "linux") == 0) - sb->s_creator_os = EXT2_OS_LINUX; - else if (strcasecmp(os, "GNU") == 0 || strcasecmp(os, "hurd") == 0) - sb->s_creator_os = EXT2_OS_HURD; - else if (strcasecmp(os, "masix") == 0) - sb->s_creator_os = EXT2_OS_MASIX; - else - return 0; - return 1; -} - -#define PATH_SET "PATH=/sbin" - -static parse_raid_opts(const char *opts) -{ - char *buf, *token, *next, *p, *arg; - int len; - int raid_usage = 0; - - len = strlen(opts); - buf = malloc(len+1); - if (!buf) { - fprintf(stderr, "Couldn't allocate memory to parse " - "raid options!\n"); - exit(1); - } - strcpy(buf, opts); - for (token = buf; token && *token; token = next) { - p = strchr(token, ','); - next = 0; - if (p) { - *p = 0; - next = p+1; - } - arg = strchr(token, '='); - if (arg) { - *arg = 0; - arg++; - } - if (strcmp(token, "stride") == 0) { - if (!arg) { - raid_usage++; - continue; - } - fs_stride = strtoul(arg, &p, 0); - if (*p || (fs_stride == 0)) { - fprintf(stderr, "Invalid stride parameter.\n"); - raid_usage++; - continue; - } - } else - raid_usage++; - } - if (raid_usage) { - fprintf(stderr, "\nBad raid options specified.\n\n" - "Raid options are separated by commas, " - "and may take an argument which\n" - "\tis set off by an equals ('=') sign.\n\n" - "Valid raid options are:\n" - "\tstride=<stride length in blocks>\n\n"); - exit(1); - } -} - - - -static void PRS(int argc, char *argv[]) -{ - char c; - int size; - char * tmp; - blk_t max = 8192; - int inode_ratio = 4096; - int reserved_ratio = 5; - errcode_t retval; - int sparse_option = -1; - char *oldpath = getenv("PATH"); - struct ext2fs_sb *param_ext2 = (struct ext2fs_sb *) ¶m; - char *raid_opts = 0; - - /* Update our PATH to include /sbin */ - if (oldpath) { - char *newpath; - - newpath = malloc(sizeof (PATH_SET) + 1 + strlen (oldpath)); - strcpy (newpath, PATH_SET); - strcat (newpath, ":"); - strcat (newpath, oldpath); - putenv (newpath); - } else - putenv (PATH_SET); - - setbuf(stdout, NULL); - setbuf(stderr, NULL); - initialize_ext2_error_table(); - memset(¶m, 0, sizeof(struct ext2_super_block)); - - fprintf (stderr, "mke2fs %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); - if (argc && *argv) - program_name = *argv; - while ((c = getopt (argc, argv, - "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:")) != EOF) - switch (c) { - case 'b': - size = strtoul(optarg, &tmp, 0); - if (size < 1024 || size > 4096 || *tmp) { - com_err(program_name, 0, "bad block size - %s", - optarg); - exit(1); - } - param.s_log_block_size = - log2(size >> EXT2_MIN_BLOCK_LOG_SIZE); - max = size * 8; - break; - case 'c': - case 't': /* Check for bad blocks */ - cflag = 1; - break; - case 'f': - size = strtoul(optarg, &tmp, 0); - if (size < 1024 || size > 4096 || *tmp) { - com_err(program_name, 0, "bad fragment size - %s", - optarg); - exit(1); - } - param.s_log_frag_size = - log2(size >> EXT2_MIN_BLOCK_LOG_SIZE); - printf("Warning: fragments not supported. " - "Ignoring -f option\n"); - break; - case 'g': - param.s_blocks_per_group = strtoul(optarg, &tmp, 0); - if (*tmp) { - com_err(program_name, 0, - "Illegal number for blocks per group"); - exit(1); - } - if ((param.s_blocks_per_group % 8) != 0) { - com_err(program_name, 0, - "blocks per group must be multiple of 8"); - exit(1); - } - break; - case 'i': - inode_ratio = strtoul(optarg, &tmp, 0); - if (inode_ratio < 1024 || inode_ratio > 256 * 1024 || - *tmp) { - com_err(program_name, 0, "bad inode ratio - %s", - optarg); - exit(1); - } - break; - case 'l': - bad_blocks_filename = malloc(strlen(optarg)+1); - if (!bad_blocks_filename) { - com_err(program_name, ENOMEM, - "in malloc for bad_blocks_filename"); - exit(1); - } - strcpy(bad_blocks_filename, optarg); - break; - case 'm': - reserved_ratio = strtoul(optarg, &tmp, 0); - if (reserved_ratio > 50 || *tmp) { - com_err(program_name, 0, - "bad reserved blocks percent - %s", - optarg); - exit(1); - } - break; - case 'o': - creator_os = optarg; - break; - case 'r': - param.s_rev_level = atoi(optarg); - break; - case 's': - sparse_option = atoi(optarg); - break; -#ifdef EXT2_DYNAMIC_REV - case 'I': - param.s_inode_size = atoi(optarg); - break; -#endif - case 'v': - verbose = 1; - break; - case 'q': - quiet = 1; - break; - case 'F': - force = 1; - break; - case 'L': - volume_label = optarg; - break; - case 'M': - mount_dir = optarg; - break; - case 'R': - raid_opts = optarg; - break; - case 'S': - super_only = 1; - break; - default: - usage(); - } - if (optind == argc) - usage(); - device_name = argv[optind]; - optind++; - if (optind < argc) { - param.s_blocks_count = strtoul(argv[optind++], &tmp, 0); - if (*tmp) { - com_err(program_name, 0, "bad blocks count - %s", - argv[optind - 1]); - exit(1); - } - } - if (optind < argc) - usage(); - - if (raid_opts) - parse_raid_opts(raid_opts); - - if (!force) - check_plausibility(); - check_mount(); - - param.s_log_frag_size = param.s_log_block_size; - - if (!param.s_blocks_count) { - retval = ext2fs_get_device_size(device_name, - EXT2_BLOCK_SIZE(¶m), - ¶m.s_blocks_count); - if (retval) { - com_err(program_name, retval, - "while trying to determine filesystem size"); - exit(1); - } - } - - if (param.s_blocks_per_group) { - if (param.s_blocks_per_group < 256 || - param.s_blocks_per_group > max || *tmp) { - com_err(program_name, 0, - "blocks per group count out of range"); - exit(1); - } - } - - /* - * Calculate number of inodes based on the inode ratio - */ - param.s_inodes_count = - ((long long) param.s_blocks_count * EXT2_BLOCK_SIZE(¶m)) - / inode_ratio; - - /* - * Calculate number of blocks to reserve - */ - param.s_r_blocks_count = (param.s_blocks_count * reserved_ratio) / 100; - - /* - * If we are using revision #1, use the sparse super feature - * by default - */ -#ifdef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER - if ((sparse_option == 1) -#ifdef EXT2_DYNAMIC_REV - || (param.s_rev_level >= EXT2_DYNAMIC_REV) && (!sparse_option) -#endif - ) - param_ext2->s_feature_ro_compat |= - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER; -#endif -} - -int main (int argc, char *argv[]) -{ - errcode_t retval = 0; - ext2_filsys fs; - badblocks_list bb_list = 0; - struct ext2fs_sb *s; - - PRS(argc, argv); - - /* - * Initialize the superblock.... - */ - retval = ext2fs_initialize(device_name, 0, ¶m, - unix_io_manager, &fs); - if (retval) { - com_err(device_name, retval, "while setting up superblock"); - exit(1); - } - - /* - * Generate a UUID for it... - */ - s = (struct ext2fs_sb *) fs->super; - uuid_generate(s->s_uuid); - - /* - * Override the creator OS, if applicable - */ - if (creator_os && !set_os(fs->super, creator_os)) { - com_err (program_name, 0, "unknown os - %s", creator_os); - exit(1); - } - - /* - * Set the volume label... - */ - if (volume_label) { - memset(s->s_volume_name, 0, sizeof(s->s_volume_name)); - strncpy(s->s_volume_name, volume_label, - sizeof(s->s_volume_name)); - } - - /* - * Set the last mount directory - */ - if (mount_dir) { - memset(s->s_last_mounted, 0, sizeof(s->s_last_mounted)); - strncpy(s->s_last_mounted, mount_dir, - sizeof(s->s_last_mounted)); - } - - if (!quiet) - show_stats(fs); - - if (bad_blocks_filename) - read_bb_file(fs, &bb_list, bad_blocks_filename); - if (cflag) - test_disk(fs, &bb_list); - - handle_bad_blocks(fs, bb_list); - fs->stride = fs_stride; - retval = ext2fs_allocate_tables(fs); - if (retval) { - com_err(program_name, retval, - "while trying to allocate filesystem tables"); - exit(1); - } - if (super_only) { - fs->super->s_state |= EXT2_ERROR_FS; - fs->flags &= ~(EXT2_FLAG_IB_DIRTY|EXT2_FLAG_BB_DIRTY); - } else { - write_inode_tables(fs); - create_root_dir(fs); - create_lost_and_found(fs); - reserve_inodes(fs); - create_bad_block_inode(fs, bb_list); -#ifdef ZAP_BOOTBLOCK - zap_bootblock(fs); -#endif - } - - if (!quiet) - printf("Writing superblocks and " - "filesystem accounting information: "); - ext2fs_close(fs); - if (!quiet) - printf("done\n"); - return 0; -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/mklost+found.8.in b/gnu/usr.sbin/e2fsprogs/misc/mklost+found.8.in deleted file mode 100644 index bb192ec1967..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/mklost+found.8.in +++ /dev/null @@ -1,33 +0,0 @@ -.\" -*- nroff -*- -.\" 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 MKLOST+FOUND 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -mklost+found \- create a lost+found directory on a mounted Linux -second extended file system -.SH SYNOPSIS -.B mklost+found -.SH DESCRIPTION -.B mklost+found -is used to create a lost+found directory in the current working directory -on a Linux second extended file system. -.br -.B mklost+found -pre-allocates disk blocks to the directory to make it usable by -.B e2fsck -.SH OPTIONS -There are none. -.SH AUTHOR -.B mklost+found -has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer -of the ext2 fs. -.SH BUGS -There are none :-) -.SH AVAILABILITY -.B mklost+found -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BR e2fsck (8), -.BR mke2fs (8) diff --git a/gnu/usr.sbin/e2fsprogs/misc/mklost+found.c b/gnu/usr.sbin/e2fsprogs/misc/mklost+found.c deleted file mode 100644 index 2a960c452fa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/mklost+found.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * mklost+found.c - Creates a directory lost+found on a mounted second - * extended file system - * - * Copyright (C) 1992, 1993 Remy Card <card@masi.ibp.fr> - * - * This file can be redistributed under the terms of the GNU General - * Public License - */ - -/* - * History: - * 93/04/22 - Creation - */ - -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <sys/param.h> -#include <sys/stat.h> - -#include <linux/ext2_fs.h> - -#include "../version.h" - -#define LPF "lost+found" - -void main (int argc, char ** argv) -{ - char name [EXT2_NAME_LEN]; - char path [sizeof (LPF) + 1 + 256]; - struct stat st; - int i, j; - int d; - - fprintf (stderr, "mklost+found %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); - if (argc != 1) { - fprintf (stderr, "Usage: mklost+found\n"); - exit(1); - } - if (mkdir (LPF, 0755) == -1) { - perror ("mkdir"); - exit(1); - } - - i = 0; - memset (name, 'x', 252); - do { - sprintf (name + 252, "%02d", i); - strcpy (path, LPF); - strcat (path, "/"); - strcat (path, name); - if ((d = creat (path, 0644)) == -1) { - perror ("creat"); - exit (1); - } - i++; - close (d); - if (stat (LPF, &st) == -1) { - perror ("stat"); - exit (1); - } - } while (st.st_size <= (EXT2_NDIR_BLOCKS - 1) * st.st_blksize); - for (j = 0; j < i; j++) { - sprintf (name + 252, "%02d", j); - strcpy (path, LPF); - strcat (path, "/"); - strcat (path, name); - if (unlink (path) == -1) { - perror ("unlink"); - exit (1); - } - } - exit (0); -} diff --git a/gnu/usr.sbin/e2fsprogs/misc/tune2fs.8.in b/gnu/usr.sbin/e2fsprogs/misc/tune2fs.8.in deleted file mode 100644 index e65f3b5386b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/tune2fs.8.in +++ /dev/null @@ -1,154 +0,0 @@ -.\" Revision 1.0 93/06/3 23:00 chk -.\" Initial revision -.\" -.\" -.TH TUNE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" -.SH NAME -tune2fs \- adjust tunable filesystem parameters on second extended filesystems -.SH SYNOPSIS -.B tune2fs -[ -.B -l -] -[ -.B -c -.I max-mount-counts -] -[ -.B -e -.I errors-behavior -] -[ -.B -i -.I interval-between-checks -] -[ -.B -m -.I reserved-blocks-percentage -] -[ -.B -r -.I reserved-blocks-count -] -[ -.B -s sparse-super-flag -] -[ -.B -u -.I user -] -[ -.B -g -.I group -] -[ -.B -C -.I mount-count -] -[ -.B -L -.I volume-name -] -[ -.B -M -.I last-mounted-directory -] -[ -.B -U -.I UUID -] -device -.SH DESCRIPTION -.BI tune2fs -adjusts tunable filesystem parameters on a Linux second extended filesystem. -.PP -.B Never use tune2fs on a read/write mounted filesystem to change parameters! -.PP -.SH OPTIONS -.TP -.I -c max-mount-counts -adjust the maximal mounts count between two filesystem checks. -.TP -.I -e errors-behavior -change the behavior of the kernel code when errors are detected. -.I errors-behavior -can be one of the followings: -.br -\ continue\ \ Continue normal execution. -.br -\ remount-ro\ Remount the filesystem read-only. -.br -\ panic\ \ Causes a kernel panic. -.TP -.I -g group -set the user group which can benefit from the reserved blocks. -.br -.I group -can be a numerical gid or a group name. -.TP -.I -i interval-between-checks[d|m|w] -adjust the maximal time between two filesystem checks. -No postfix or `d' result in days, `m' in months, and `w' in weeks. -A value of zero will disable the timedependent checking. -.TP -.I -l -list the contents of the filesystem superblock. -.TP -.I -m reserved-blocks-percentage -adjust the reserved blocks percentage on the given device. -.TP -.I -r reserved-blocks-count -adjust the reserved blocks count on the given device. -.TP -.I -s sparse_super_flag -sets and resets the sparse_superblock flag. The sparse_superblock feature -saves space on really big filesystems. -.B Warning: -The Linux 2.0 kernel does not properly support this feature. Neither do -all Linux 2.1 kernels; please don't use this unless you know what you're -doing! -.TP -.I -u user -set the user who can benefit from the reserved blocks. -.I user -can be a numerical uid or a user name. -.IP -.I -C mount-count -set the number of times the filesystem has been mounted. -.TP -.I -L volume-label -set the volume label of the filesystem. -.TP -.I -M last-mounted-directory -set the last-mounted direcctory for the filesystem. -.TP -.I -U UUID -set the UUID of the filesystem. A sample UUID looks like this: -"c1b9d5a2-f162-11cf-9ece-0020afc76f16". The uuid may also be "null", -which will set the filesystem UUID to the null UUID. The uuid may also -be "random", which will generate a new random UUID for the filesystem. -.PP -.SH BUGS -We didn't find any bugs yet. Perhaps there are bugs but it's unlikely. -.PP -.SH WARNING -.B Use this utility on your own risk. You're modifying filesystems. -.SH AUTHOR -.B tune2fs -has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer -of the ext2 fs. -.br -.B tune2fs -uses the ext2fs library written by Theodore Ts'o <tytso@mit.edu>. -.br -This manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>. -.br -Timedependent checking was added by Uwe Ohse <uwe@tirka.gun.de>. -.SH AVAILABILITY -.B tune2fs -is available for anonymous ftp from ftp.ibp.fr and tsx-11.mit.edu in -/pub/linux/packages/ext2fs. -.SH SEE ALSO -.BR dumpe2fs (8), -.BR e2fsck (8), -.BR mke2fs (8) diff --git a/gnu/usr.sbin/e2fsprogs/misc/tune2fs.c b/gnu/usr.sbin/e2fsprogs/misc/tune2fs.c deleted file mode 100644 index 2cd43a63cc4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/misc/tune2fs.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * tune2fs.c - Change the file system parameters on - * an unmounted second extended file system - * - * Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr> - * Laboratoire MASI, Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * Copyright 1995, 1996, 1997 by Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -/* - * History: - * 93/06/01 - Creation - * 93/10/31 - Added the -c option to change the maximal mount counts - * 93/12/14 - Added -l flag to list contents of superblock - * M.J.E. Mol (marcel@duteca.et.tudelft.nl) - * F.W. ten Wolde (franky@duteca.et.tudelft.nl) - * 93/12/29 - Added the -e option to change errors behavior - * 94/02/27 - Ported to use the ext2fs library - * 94/03/06 - Added the checks interval from Uwe Ohse (uwe@tirka.gun.de) - */ - -#include <fcntl.h> -#include <grp.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#include <pwd.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <sys/types.h> - -#include <linux/ext2_fs.h> - -#include "ext2fs/ext2fs.h" -#include "et/com_err.h" -#include "uuid/uuid.h" -#include "e2p/e2p.h" - -#include "../version.h" - -const char * program_name = "tune2fs"; -char * device_name = NULL; -char * new_label = NULL; -char * new_last_mounted = NULL; -char * new_UUID = NULL; -int c_flag = 0; -int C_flag = 0; -int e_flag = 0; -int g_flag = 0; -int i_flag = 0; -int l_flag = 0; -int L_flag = 0; -int m_flag = 0; -int M_flag = 0; -int r_flag = 0; -int s_flag = -1; -int u_flag = 0; -int U_flag = 0; -int max_mount_count, mount_count; -unsigned long interval; -unsigned long reserved_ratio = 0; -unsigned long reserved_blocks = 0; -unsigned short errors; -unsigned long resgid = 0; -unsigned long resuid = 0; - -#ifndef HAVE_STRCASECMP -static int strcasecmp (char *s1, char *s2) -{ - while (*s1 && *s2) { - int ch1 = *s1++, ch2 = *s2++; - if (isupper (ch1)) - ch1 = tolower (ch1); - if (isupper (ch2)) - ch2 = tolower (ch2); - if (ch1 != ch2) - return ch1 - ch2; - } - return *s1 ? 1 : *s2 ? -1 : 0; -} -#endif - -static volatile void usage (void) -{ - fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] " - "[-g group]\n" - "\t[-i interval[d|m|w]] [-l] [-s] [-m reserved-blocks-percent]\n" - "\t[-r reserved-blocks-count] [-u user] [-C mount-count]\n" - "\t[-L volume-label] [-M last-mounted-dir] [-U UUID] " - "device\n", program_name); - exit (1); -} - -void main (int argc, char ** argv) -{ - char c; - char * tmp; - errcode_t retval; - ext2_filsys fs; - struct ext2fs_sb *sb; - struct group * gr; - struct passwd * pw; - int open_flag = 0; - - fprintf (stderr, "tune2fs %s, %s for EXT2 FS %s, %s\n", - E2FSPROGS_VERSION, E2FSPROGS_DATE, - EXT2FS_VERSION, EXT2FS_DATE); - if (argc && *argv) - program_name = *argv; - initialize_ext2_error_table(); - while ((c = getopt (argc, argv, "c:e:g:i:lm:r:s:u:C:L:M:U:")) != EOF) - switch (c) - { - case 'c': - max_mount_count = strtoul (optarg, &tmp, 0); - if (*tmp || max_mount_count > 16000) - { - com_err (program_name, 0, - "bad mounts count - %s", - optarg); - usage (); - } - c_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'C': - mount_count = strtoul (optarg, &tmp, 0); - if (*tmp || mount_count > 16000) - { - com_err (program_name, 0, - "bad mounts count - %s", - optarg); - usage (); - } - C_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'e': - if (strcmp (optarg, "continue") == 0) - errors = EXT2_ERRORS_CONTINUE; - else if (strcmp (optarg, "remount-ro") == 0) - errors = EXT2_ERRORS_RO; - else if (strcmp (optarg, "panic") == 0) - errors = EXT2_ERRORS_PANIC; - else - { - com_err (program_name, 0, - "bad error behavior - %s", - optarg); - usage (); - } - e_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'g': - resgid = strtoul (optarg, &tmp, 0); - if (*tmp) - { - gr = getgrnam (optarg); - if (gr == NULL) - tmp = optarg; - else { - resgid = gr->gr_gid; - *tmp =0; - } - } - if (*tmp) - { - com_err (program_name, 0, - "bad gid/group name - %s", - optarg); - usage (); - } - g_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'i': - interval = strtoul (optarg, &tmp, 0); - switch (*tmp) { - case 's': - tmp++; - break; - case '\0': - case 'd': - case 'D': /* days */ - interval *= 86400; - if (*tmp != '\0') - tmp++; - break; - case 'm': - case 'M': /* months! */ - interval *= 86400 * 30; - tmp++; - break; - case 'w': - case 'W': /* weeks */ - interval *= 86400 * 7; - tmp++; - break; - } - if (*tmp || interval > (365 * 86400)) - { - com_err (program_name, 0, - "bad interval - %s", optarg); - usage (); - } - i_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'l': - l_flag = 1; - break; - case 'L': - new_label = optarg; - L_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'm': - reserved_ratio = strtoul (optarg, &tmp, 0); - if (*tmp || reserved_ratio > 50) - { - com_err (program_name, 0, - "bad reserved block ratio - %s", - optarg); - usage (); - } - m_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'M': - new_last_mounted = optarg; - M_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'r': - reserved_blocks = strtoul (optarg, &tmp, 0); - if (*tmp) - { - com_err (program_name, 0, - "bad reserved blocks count - %s", - optarg); - usage (); - } - r_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 's': - s_flag = atoi(optarg); - open_flag = EXT2_FLAG_RW; - break; - case 'u': - resuid = strtoul (optarg, &tmp, 0); - if (*tmp) - { - pw = getpwnam (optarg); - if (pw == NULL) - tmp = optarg; - else { - resuid = pw->pw_uid; - *tmp = 0; - } - } - if (*tmp) - { - com_err (program_name, 0, - "bad uid/user name - %s", - optarg); - usage (); - } - u_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - case 'U': - new_UUID = optarg; - U_flag = 1; - open_flag = EXT2_FLAG_RW; - break; - default: - usage (); - } - if (optind < argc - 1 || optind == argc) - usage (); - if (!open_flag && !l_flag) - usage(); - device_name = argv[optind]; - retval = ext2fs_open (device_name, open_flag, 0, 0, - unix_io_manager, &fs); - if (retval) - { - com_err (program_name, retval, "while trying to open %s", - device_name); - printf("Couldn't find valid filesystem superblock.\n"); - exit(1); - } - sb = (struct ext2fs_sb *) fs->super; - - if (c_flag) { - fs->super->s_max_mnt_count = max_mount_count; - ext2fs_mark_super_dirty(fs); - printf ("Setting maximal mount count to %d\n", - max_mount_count); - } - if (C_flag) { - fs->super->s_mnt_count = mount_count; - ext2fs_mark_super_dirty(fs); - printf ("Setting current mount count to %d\n", mount_count); - } - if (e_flag) { - fs->super->s_errors = errors; - ext2fs_mark_super_dirty(fs); - printf ("Setting error behavior to %d\n", errors); - } - if (g_flag) -#ifdef EXT2_DEF_RESGID - { - fs->super->s_def_resgid = resgid; - ext2fs_mark_super_dirty(fs); - printf ("Setting reserved blocks gid to %lu\n", resgid); - } -#else - com_err (program_name, 0, - "The -g option is not supported by this version -- " - "Recompile with a newer kernel"); -#endif - if (i_flag) - { - fs->super->s_checkinterval = interval; - ext2fs_mark_super_dirty(fs); - printf ("Setting interval between check %lu seconds\n", interval); - } - if (m_flag) - { - fs->super->s_r_blocks_count = (fs->super->s_blocks_count / 100) - * reserved_ratio; - ext2fs_mark_super_dirty(fs); - printf ("Setting reserved blocks percentage to %lu (%u blocks)\n", - reserved_ratio, fs->super->s_r_blocks_count); - } - if (r_flag) - { - if (reserved_blocks >= fs->super->s_blocks_count) - { - com_err (program_name, 0, - "reserved blocks count is too big (%ul)", - reserved_blocks); - exit (1); - } - fs->super->s_r_blocks_count = reserved_blocks; - ext2fs_mark_super_dirty(fs); - printf ("Setting reserved blocks count to %lu\n", - reserved_blocks); - } - if (s_flag == 1) { -#ifdef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER - if (sb->s_feature_ro_compat & - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) - fprintf(stderr, "\nThe filesystem already " - " has spare superblocks.\n"); - else { - sb->s_feature_ro_compat |= - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER; - fs->super->s_state &= ~EXT2_VALID_FS; - ext2fs_mark_super_dirty(fs); - printf("\nSparse superblock flag set. " - "Please run e2fsck on the filesystem.\n"); - } -#else /* !EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER */ - com_err (program_name, 0, - "The -s option is not supported by this version -- " - "Recompile with a newer kernel"); -#endif /* EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER */ - } - if (s_flag == 0) { -#ifdef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER - if (!(sb->s_feature_ro_compat & - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) - fprintf(stderr, "\nThe filesystem already " - " does not support spare superblocks.\n"); - else { - sb->s_feature_ro_compat &= - ~EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER; - fs->super->s_state &= ~EXT2_VALID_FS; - fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; - ext2fs_mark_super_dirty(fs); - printf("\nSparse superblock flag cleared. " - "Please run e2fsck on the filesystem.\n"); - } -#else /* !EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER */ - com_err (program_name, 0, - "The -s option is not supported by this version -- " - "Recompile with a newer kernel"); -#endif /* EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER */ - } - - if (u_flag) -#ifdef EXT2_DEF_RESUID - { - fs->super->s_def_resuid = resuid; - ext2fs_mark_super_dirty(fs); - printf ("Setting reserved blocks uid to %lu\n", resuid); - } -#else - com_err (program_name, 0, - "The -u option is not supported by this version -- " - "Recompile with a newer kernel"); -#endif - if (L_flag) { - memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name)); - strncpy(sb->s_volume_name, new_label, - sizeof(sb->s_volume_name)); - ext2fs_mark_super_dirty(fs); - } - if (M_flag) { - memset(sb->s_last_mounted, 0, sizeof(sb->s_last_mounted)); - strncpy(sb->s_last_mounted, new_last_mounted, - sizeof(sb->s_last_mounted)); - ext2fs_mark_super_dirty(fs); - } - if (U_flag) { - if (strcasecmp(new_UUID, "null") == 0) { - uuid_clear(sb->s_uuid); - } else if (strcasecmp(new_UUID, "random") == 0) { - uuid_generate(sb->s_uuid); - } else if (uuid_parse(new_UUID, sb->s_uuid)) { - com_err(program_name, 0, "Invalid UUID format\n"); - exit(1); - } - ext2fs_mark_super_dirty(fs); - } - - if (l_flag) - list_super (fs->super); - ext2fs_close (fs); - exit (0); -} diff --git a/gnu/usr.sbin/e2fsprogs/mkinstalldirs b/gnu/usr.sbin/e2fsprogs/mkinstalldirs deleted file mode 100644 index 0801ec2c966..00000000000 --- a/gnu/usr.sbin/e2fsprogs/mkinstalldirs +++ /dev/null @@ -1,32 +0,0 @@ -#! /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 diff --git a/gnu/usr.sbin/e2fsprogs/tests/ChangeLog b/gnu/usr.sbin/e2fsprogs/tests/ChangeLog deleted file mode 100644 index d668efda13a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/ChangeLog +++ /dev/null @@ -1,123 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 26 09:29:25 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * e_icount_normal, e_icount_opt: New tests which validate the - icount abstraction. - - * test_script.in: New feature; an argument of a single character - means do all the tests in that series. - -Tue Mar 18 15:11:04 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * test_config (LANG): Set the language to be C so that the brel - and irel tests don't fail. - -Wed Mar 12 13:32:05 1997 Theodore Y. Ts'o <tytso@mit.edu> - - * Release of E2fsprogs version 1.07 - -Thu Mar 6 23:23:07 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * f_misstable: New test case which checks what happens when the - inode table for a block group is missing - - * f_reconnect: New test case which makes sure a simple - disconnected inode is properly handled. - -Mon Dec 2 09:33:31 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * test_script.in: Add error checking to make sure a requested test - exists. - -Tue Oct 15 00:10:37 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * f_bbinode: New test case which exercises what happens when a bad - block appears in the inode table. - -Tue Oct 8 02:02:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.06 - -Mon Oct 7 07:52:41 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * f_preen: New test case which makes sure that e2fsck -p won't - bash the backup superblock in case of a corrupted master - superblock. - - * test_script.in: Let the environment variable TEST_CONFIG to - override the location of the test_config file. Move - definition of TMP_DIR to test_config. - - * test_config: Add new defnitions for mke2fs, dumpe2fs, tune2fs, - lsattr, and chattr. - -Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.05 - -Mon Sep 9 23:09:47 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Makefile.in (check): Add explicit ./ to test_script invokation, - since not all people will have "." in their path. - -Tue Sep 3 15:13:05 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * test_config (PAGER): Unset pager to prevent debugfs forking a - pager, since the escape sequences confuse the expect - script. - -Sun May 19 23:37:35 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * test_script: New feature; second optional argument allows - developers to only run one test case. - - * f_crashdisk: New test case which contains a patently illegal - superblock with a valid magic number. - -Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.04 - -Wed May 15 21:41:29 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * f_illibitmap/expect.1, f_illbbitmap/expect.1: Changed - expected output to reflect hint which e2fsck will print when - there is a illegal block in the block group - descriptors, pointing at a block bitmap, inode bitmap, - or block in the inode table. - -Wed Mar 27 00:33:40 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.03 - -Wed Jan 31 11:06:08 1996 <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.02 - -Mon Sep 4 23:06:06 1995 Remy Card <card@bbj> - - * Makefile.in (clean, distclean): Use the -f option when removing - files. - -Fri Aug 11 10:10:30 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu> - - * test_script: Count up the number of passed and failed tests by - tallying the *.ok and *.failed files. - - * run_e2fsck: Create foo.ok and foo.failed files when tests - succeed or fail, respectively. - - * test_config (TZ): Set the timezone to be GMT, so that test - results are consistent. - diff --git a/gnu/usr.sbin/e2fsprogs/tests/Makefile.in b/gnu/usr.sbin/e2fsprogs/tests/Makefile.in deleted file mode 100644 index 5e04dc8f49c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/Makefile.in +++ /dev/null @@ -1,33 +0,0 @@ -# -# Makefile for the tests directory -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = .. -my_dir = tests -INSTALL = @INSTALL@ - -@MCONFIG@ - -all:: @DO_TEST_SUITE@ - -test_script: test_script.in Makefile - @echo "Creating test_script..." - @echo "#!/bin/sh" > test_script - @echo "SRCDIR=@srcdir@" >> test_script - @cat $(srcdir)/test_script.in >> test_script - @chmod +x test_script - -check:: test_script - @echo "Running e2fsprogs test suite..." - @echo " " - @./test_script - -clean:: - $(RM) -f *.log *.new *.failed *.ok test.img test_script - -distclean:: clean - $(RM) -f Makefile - diff --git a/gnu/usr.sbin/e2fsprogs/tests/README b/gnu/usr.sbin/e2fsprogs/tests/README deleted file mode 100644 index 73e26817fbd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/README +++ /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/gnu/usr.sbin/e2fsprogs/tests/defaults/e_script b/gnu/usr.sbin/e2fsprogs/tests/defaults/e_script deleted file mode 100644 index d1f460be14e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/defaults/e_script +++ /dev/null @@ -1,47 +0,0 @@ -# -# Default script for testing the relocation library routines -# (irel -- inode relocation and brel -- block relocation) -# - -if [ -f $test_dir/setup ]; then - . $test_dir/setup -fi - -if [ "$class"x = x ]; then - class=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\1/'` - instance=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\2/'` -fi -if [ "$OUT"x = x ]; then - OUT=$test_name.log -fi -if [ "$EXPECT"x = x ]; then - EXPECT=$SRCDIR/progs/test_data/expect.$class -fi - -if [ "$class" = irel ]; then - TEST_PROG=$TEST_REL -elif [ "$class" = brel ]; then - TEST_PROG=$TEST_REL -elif [ "$class" = icount ]; then - TEST_PROG=$TEST_ICOUNT -else - TEST_PROG=/bin/cat -fi - -cat $SRCDIR/progs/test_data/$instance.setup $SRCDIR/progs/test_data/test.$class \ - | $TEST_PROG -f - > $OUT 2>&1 - -cmp -s $EXPECT $OUT -status=$? - -rm -f $test_name.failed $test_name.ok - -if [ "$status" = 0 ] ; then - echo "ok" - touch $test_name.ok -else - echo "failed" - diff -c $EXPECT $OUT > $test_name.failed -fi - -unset EXPECT OUT class instance diff --git a/gnu/usr.sbin/e2fsprogs/tests/defaults/f_script b/gnu/usr.sbin/e2fsprogs/tests/defaults/f_script deleted file mode 100644 index 7a3b34f8085..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/defaults/f_script +++ /dev/null @@ -1 +0,0 @@ -. $cmd_dir/run_e2fsck diff --git a/gnu/usr.sbin/e2fsprogs/tests/e_brel_bma/name b/gnu/usr.sbin/e2fsprogs/tests/e_brel_bma/name deleted file mode 100644 index d745587349b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/e_brel_bma/name +++ /dev/null @@ -1 +0,0 @@ -block relocation table using the memory array implementation diff --git a/gnu/usr.sbin/e2fsprogs/tests/e_icount_normal/name b/gnu/usr.sbin/e2fsprogs/tests/e_icount_normal/name deleted file mode 100644 index eafa80204e5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/e_icount_normal/name +++ /dev/null @@ -1 +0,0 @@ -inode counting abstraction optimized for storing inode counts diff --git a/gnu/usr.sbin/e2fsprogs/tests/e_icount_opt/name b/gnu/usr.sbin/e2fsprogs/tests/e_icount_opt/name deleted file mode 100644 index 5b6b1a56fcd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/e_icount_opt/name +++ /dev/null @@ -1 +0,0 @@ -inode counting abstraction optimized for counting diff --git a/gnu/usr.sbin/e2fsprogs/tests/e_irel_ima/name b/gnu/usr.sbin/e2fsprogs/tests/e_irel_ima/name deleted file mode 100644 index 6efd72e5555..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/e_irel_ima/name +++ /dev/null @@ -1 +0,0 @@ -inode relocation table using the memory array implementation diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/expect.1 deleted file mode 100644 index f92e2b62f69..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/expect.1 +++ /dev/null @@ -1,24 +0,0 @@ -Filesystem did not have a UUID; generating one. - -../e2fsck/e2fsck: Illegal indirect block found while reading bad blocks inode
-This doesn't bode well, but we'll try to go on... -Pass 1: Checking inodes, blocks, and sizes -Bad block inode has illegal block(s). Clear? yes - -Illegal block #1 (101) in bad block inode. CLEARED. -Illegal block #2 (103) in bad block inode. CLEARED. -Illegal block #3 (234523) in bad block inode. CLEARED. -Illegal block #-1 (200) in bad block inode. CLEARED. -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: +50. FIXED -Free blocks count wrong for group 0 (78, counted=77). FIXED -Free blocks count wrong (78, counted=77). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (0.0% non-contiguous), 23/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/expect.2 deleted file mode 100644 index fda217d2ff7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 23/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/image.gz Binary files differdeleted file mode 100644 index fe39b7fe28e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/name b/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/name deleted file mode 100644 index ab20f389284..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badbblocks/name +++ /dev/null @@ -1 +0,0 @@ -illegal blocks in bad block inode diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_baddir/expect.1 deleted file mode 100644 index f8f025586dd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/expect.1 +++ /dev/null @@ -1,48 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Inode 12, i_size is 182, should be 1024. Fix? yes - -Inode 13 is a zero-length directory. Clear? yes - -Pass 2: Checking directory structure -Entry 'zero' in / (2) has deleted/unused inode 13. Clear? yes - -Entry 'foo/bar' in / (2) has illegal characters in its name. -Fix? yes - -Entry 'root' in /test (14) is a link to the root inode. -Clear? yes - -Entry 'badino' in /test (14) has bad inode #: 123456. -Clear? yes - -Entry 'dot' in /test (14) is a link to '.' Clear? yes - -Directory inode 12, block 0, offset 0: directory corrupted -Salvage? yes - -Missing '.' in directory inode 12. -Fix? yes - -Missing '..' in directory inode 12. -Fix? yes - -Pass 3: Checking directory connectivity -'..' in /block.h (12) is <The NULL inode> (0), should be / (2). -Fix? yes - -Pass 4: Checking reference counts -Inode 12 ref count is 1, should be 2. Fix? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -22. FIXED -Free blocks count wrong (74, counted=75). FIXED -Inode bitmap differences: -13. FIXED -Directories count wrong for group #0 (5, counted=4). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 14/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_baddir/expect.2 deleted file mode 100644 index e848eff327a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 14/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_baddir/image.gz Binary files differdeleted file mode 100644 index 9d593fe50f2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/name b/gnu/usr.sbin/e2fsprogs/tests/f_baddir/name deleted file mode 100644 index 98222215705..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddir/name +++ /dev/null @@ -1 +0,0 @@ -corrupted directory entries diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/expect.1 deleted file mode 100644 index 77b8f8cf86a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/expect.1 +++ /dev/null @@ -1,57 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Missing '.' in directory inode 12. -Fix? yes - -Missing '..' in directory inode 12. -Fix? yes - -First entry 'X' (inode=11) in directory inode 13 (/b) should be '.' -Fix? yes - -Missing '..' in directory inode 14. -Fix? yes - -Second entry 'XX' (inode=11) in directory inode 15 should be '..' -Fix? yes - -'.' directory entry in directory inode 17 is not NULL terminated -Fix? yes - -'..' directory entry in directory inode 17 is not NULL terminated -Fix? yes - -Missing '.' in directory inode 16. -Fix? yes - -Missing '..' in directory inode 16. -Fix? yes - -Pass 3: Checking directory connectivity -'..' in /a (12) is <The NULL inode> (0), should be / (2). -Fix? yes - -'..' in /c (14) is <The NULL inode> (0), should be / (2). -Fix? yes - -'..' in /d (15) is <The NULL inode> (0), should be / (2). -Fix? yes - -'..' in /e (16) is <The NULL inode> (0), should be / (2). -Fix? yes - -'..' in /f (17) is <The NULL inode> (0), should be / (2). -Fix? yes - -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (70, counted=71). FIXED -Free blocks count wrong (70, counted=71). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 18/32 files (0.0% non-contiguous), 29/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/expect.2 deleted file mode 100644 index 8b3523cb420..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 18/32 files (0.0% non-contiguous), 29/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/image.gz Binary files differdeleted file mode 100644 index 8ed90c5d6aa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/name b/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/name deleted file mode 100644 index c13ba7573fd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_baddotdir/name +++ /dev/null @@ -1 +0,0 @@ -bad '.' and '..' entries diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_badinode/expect.1 deleted file mode 100644 index b2da205f9ea..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/expect.1 +++ /dev/null @@ -1,27 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Inode 12 (/motd) has a bad mode (0110444). -Clear? yes - -i_fsize for inode 13 (/timings) is 4, should be zero. -Clear? yes - -i_file_acl for inode 13 (/timings) is 39, should be zero. -Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -25. FIXED -Free blocks count wrong for group 0 (76, counted=77). FIXED -Free blocks count wrong (76, counted=77). FIXED -Free inodes count wrong for group #0 (19, counted=20). FIXED -Free inodes count wrong (19, counted=20). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 12/32 files (0.0% non-contiguous), 23/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_badinode/expect.2 deleted file mode 100644 index 628a376a2f9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 12/32 files (0.0% non-contiguous), 23/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_badinode/image.gz Binary files differdeleted file mode 100644 index 7b3ccd2a77f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/name b/gnu/usr.sbin/e2fsprogs/tests/f_badinode/name deleted file mode 100644 index 38ee2d9b541..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badinode/name +++ /dev/null @@ -1 +0,0 @@ -corrupted inode entries diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/expect.1 deleted file mode 100644 index bca07d2bf87..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/expect.1 +++ /dev/null @@ -1,27 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -The primary superblock (1) is on the bad block list. - -If the block is really bad, the filesystem can not be fixed. -You can clear the this block from the bad block list -and hope that block is really OK, but there are no guarantees. - -Clear (and hope for the best)? yes - -Block 2 in the primary group descriptors is on the bad block list - -If the block is really bad, the filesystem can not be fixed. -You can clear the this block from the bad block list -and hope that block is really OK, but there are no guarantees. - -Clear (and hope for the best)? yes - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/expect.2 deleted file mode 100644 index a821f878397..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/image.gz Binary files differdeleted file mode 100644 index 7aeb6110f35..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/name b/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/name deleted file mode 100644 index dacce312f67..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badprimary/name +++ /dev/null @@ -1 +0,0 @@ -bad blocks in the primary superblock and group descriptors diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_badroot/expect.1 deleted file mode 100644 index cd73a334e7a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/expect.1 +++ /dev/null @@ -1,36 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Root inode is not a directory. Clear? yes - -Pass 2: Checking directory structure -Entry '..' in ??? (11) has deleted/unused inode 2. Clear? yes - -Pass 3: Checking directory connectivity -Root inode not allocated. Allocate? yes - -Unconnected directory inode 11 (...) -Connect to /lost+found? yes - -/lost+found not found. Create? yes - -Pass 4: Checking reference counts -Inode 11 ref count is 3, should be 2. Fix? yes - -Unattached inode 12 -Connect to /lost+found? yes - -Inode 12 ref count is 2, should be 1. Fix? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (77, counted=76). FIXED -Free blocks count wrong (77, counted=76). FIXED -Free inodes count wrong for group #0 (20, counted=19). FIXED -Directories count wrong for group #0 (2, counted=3). FIXED -Free inodes count wrong (20, counted=19). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 13/32 files (0.0% non-contiguous), 24/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_badroot/expect.2 deleted file mode 100644 index cab021a796d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 13/32 files (0.0% non-contiguous), 24/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_badroot/image.gz Binary files differdeleted file mode 100644 index 72980a35403..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/name b/gnu/usr.sbin/e2fsprogs/tests/f_badroot/name deleted file mode 100644 index 399e4f29f0c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badroot/name +++ /dev/null @@ -1 +0,0 @@ -file in root directory inode diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_badtable/expect.1 deleted file mode 100644 index 11bbc970a6d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/expect.1 +++ /dev/null @@ -1,31 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Group 0's block bitmap (3) is bad. Relocate? yes - -Group 0's inode bitmap (4) is bad. Relocate? yes - -Relocating group 0's block bitmap from 3 to 9... -Relocating group 0's inode bitmap from 4 to 10... -Pass 2: Checking directory structure -Entry 'lost+found' in / (2) points to inode (11) located in a bad block. -Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Inode 2 ref count is 3, should be 2. Fix? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -11 -12 -13 -14 -15 -16 -17 -18 -19 -20. FIXED -Free blocks count wrong for group 0 (78, counted=88). FIXED -Free blocks count wrong (78, counted=88). FIXED -Inode bitmap differences: +12 +13 +14 +15 +16 +25 +26 +27 +28 +29 +30 +31 +32. FIXED -Free inodes count wrong for group #0 (21, counted=8). FIXED -Directories count wrong for group #0 (2, counted=1). FIXED -Free inodes count wrong (21, counted=8). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 24/32 files (0.0% non-contiguous), 12/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_badtable/expect.2 deleted file mode 100644 index 37ab1082470..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 24/32 files (0.0% non-contiguous), 12/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_badtable/image.gz Binary files differdeleted file mode 100644 index 48dbac156de..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/name b/gnu/usr.sbin/e2fsprogs/tests/f_badtable/name deleted file mode 100644 index e4a8baeab55..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_badtable/name +++ /dev/null @@ -1 +0,0 @@ -bad blocks in bitmaps and inode table diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/expect.1 deleted file mode 100644 index 8dcbc4f5e01..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/expect.1 +++ /dev/null @@ -1,46 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Group 0's inode bitmap (4) is bad. Relocate? yes - -Relocating group 0's inode bitmap from 4 to 43... -Duplicate blocks found... invoking duplicate block passes. -Pass 1B: Rescan for duplicate/bad blocks -Duplicate/bad block(s) in inode 2: 21 -Duplicate/bad block(s) in inode 11: 9 10 11 12 13 14 15 16 17 18 19 20 -Duplicate/bad block(s) in inode 12: 25 26 -Pass 1C: Scan directories for inodes with dup blocks. -Pass 1D: Reconciling duplicate blocks -(There are 3 inodes containing duplicate/bad blocks.) - -File /termcap (inode #12, mod time Sun Jan 2 08:29:13 1994) - has 2 duplicate block(s), shared with 1 file(s): - <The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994) -Clone duplicate/bad blocks? yes - - -File /lost+found (inode #11, mod time Sun Jan 2 08:28:40 1994) - has 12 duplicate block(s), shared with 1 file(s): - <The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994) -Clone duplicate/bad blocks? yes - - -File / (inode #2, mod time Sun Jan 2 08:29:13 1994) - has 1 duplicate block(s), shared with 1 file(s): - <The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994) -Clone duplicate/bad blocks? yes - - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: +43. FIXED -Free blocks count wrong for group 0 (57, counted=41). FIXED -Free blocks count wrong (57, counted=41). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 12/32 files (0.0% non-contiguous), 59/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/expect.2 deleted file mode 100644 index 92491da814b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 12/32 files (8.3% non-contiguous), 59/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/image.gz Binary files differdeleted file mode 100644 index 3b0138166fa..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/name b/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/name deleted file mode 100644 index 8843fbb06de..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbfile/name +++ /dev/null @@ -1 +0,0 @@ -bad blocks in files diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/expect.1 deleted file mode 100644 index 91de7461e47..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/expect.1 +++ /dev/null @@ -1,41 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Entry 'a6' in / (2) points to inode (17) located in a bad block. -Clear? yes - -Entry 'a7' in / (2) points to inode (18) located in a bad block. -Clear? yes - -Entry 'a8' in / (2) points to inode (19) located in a bad block. -Clear? yes - -Entry 'b1' in / (2) points to inode (20) located in a bad block. -Clear? yes - -Entry 'b2' in / (2) points to inode (21) located in a bad block. -Clear? yes - -Entry 'b3' in / (2) points to inode (22) located in a bad block. -Clear? yes - -Entry 'b4' in / (2) points to inode (23) located in a bad block. -Clear? yes - -Entry 'b5' in / (2) points to inode (24) located in a bad block. -Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -83. FIXED -Free blocks count wrong for group 0 (1962, counted=1965). FIXED -Free blocks count wrong (1962, counted=1965). FIXED -Inode bitmap differences: +41 +42 +43 +44 +45 +46 +47 +48. FIXED -Free inodes count wrong for group #0 (485, counted=477). FIXED -Free inodes count wrong (485, counted=477). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 35/512 files (0.0% non-contiguous), 83/2048 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/expect.2 deleted file mode 100644 index c65289d2dd9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 35/512 files (0.0% non-contiguous), 83/2048 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/image.gz Binary files differdeleted file mode 100644 index 34dcf487e28..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/name b/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/name deleted file mode 100644 index c5db3e5b863..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bbinode/name +++ /dev/null @@ -1 +0,0 @@ -bad blocks in inode table diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/expect.1 deleted file mode 100644 index 9b15ea2b704..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/expect.1 +++ /dev/null @@ -1,15 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: +12 -20 +41 -50. FIXED -Inode bitmap differences: +11 -15. FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (9.1% non-contiguous), 22/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/expect.2 deleted file mode 100644 index 73d1c27bde3..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (9.1% non-contiguous), 22/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/image.gz Binary files differdeleted file mode 100644 index 1c533ebc95a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/name b/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/name deleted file mode 100644 index a309bfafd5b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_bitmaps/name +++ /dev/null @@ -1 +0,0 @@ -corrupted inode and block bitmaps diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/expect.1 deleted file mode 100644 index 95fb2eef408..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/expect.1 +++ /dev/null @@ -1,9 +0,0 @@ -../e2fsck/e2fsck: The ext2 superblock is corrupt while trying to open ./test.img
- -The superblock could not be read or does not describe a correct ext2 -filesystem. If the device is valid and it really contains an ext2 -filesystem (and not swap or ufs or something else), then the superblock -is corrupt, and you might try running e2fsck with an alternate superblock: - e2fsck -b 8193 <device> - -Exit status is 8 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/image.gz Binary files differdeleted file mode 100644 index 060e7a0d5ef..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/name b/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/name deleted file mode 100644 index 5ba8a6007c1..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/name +++ /dev/null @@ -1 +0,0 @@ -Superblock with illegal values diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/script b/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/script deleted file mode 100644 index 8ab2b9c6105..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_crashdisk/script +++ /dev/null @@ -1,2 +0,0 @@ -ONE_PASS_ONLY="true" -. $cmd_dir/run_e2fsck diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/expect.1 deleted file mode 100644 index f53c0e1d22e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/expect.1 +++ /dev/null @@ -1,14 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Entry 'quux' in /foo (12) is a link to directory /bar (13). -Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 13/32 files (0.0% non-contiguous), 24/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/expect.2 deleted file mode 100644 index cab021a796d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 13/32 files (0.0% non-contiguous), 24/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/image.gz Binary files differdeleted file mode 100644 index 2e8def47347..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/name b/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/name deleted file mode 100644 index 30dbdce02d0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dirlink/name +++ /dev/null @@ -1 +0,0 @@ -directory hard links diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_dup/expect.1 deleted file mode 100644 index 082c5454b9a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup/expect.1 +++ /dev/null @@ -1,36 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Duplicate blocks found... invoking duplicate block passes. -Pass 1B: Rescan for duplicate/bad blocks -Duplicate/bad block(s) in inode 12: 25 26 -Duplicate/bad block(s) in inode 13: 25 26 -Pass 1C: Scan directories for inodes with dup blocks. -Pass 1D: Reconciling duplicate blocks -(There are 2 inodes containing duplicate/bad blocks.) - -File /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) - has 2 duplicate block(s), shared with 1 file(s): - /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993) -Clone duplicate/bad blocks? yes - - -File /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993) - has 2 duplicate block(s), shared with 1 file(s): - /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) -Duplicated blocks already reassigned or cloned. - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (44, counted=60). FIXED -Free blocks count wrong (62, counted=60). FIXED -Padding at end of block bitmap is not set. Fix? yes - - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 13/16 files (7.7% non-contiguous), 40/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_dup/expect.2 deleted file mode 100644 index d1530c2c8de..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 13/16 files (7.7% non-contiguous), 40/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_dup/image.gz Binary files differdeleted file mode 100644 index 3e04690ed17..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup/name b/gnu/usr.sbin/e2fsprogs/tests/f_dup/name deleted file mode 100644 index 6296b83f63e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup/name +++ /dev/null @@ -1 +0,0 @@ -blocks claimed by two different files diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_dup2/expect.1 deleted file mode 100644 index f9962952ad5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/expect.1 +++ /dev/null @@ -1,44 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Duplicate blocks found... invoking duplicate block passes. -Pass 1B: Rescan for duplicate/bad blocks -Duplicate/bad block(s) in inode 12: 25 26 -Duplicate/bad block(s) in inode 13: 25 26 57 58 -Duplicate/bad block(s) in inode 14: 57 58 -Pass 1C: Scan directories for inodes with dup blocks. -Pass 1D: Reconciling duplicate blocks -(There are 3 inodes containing duplicate/bad blocks.) - -File /pass1.c (inode #14, mod time Tue Sep 21 04:28:37 1993) - has 2 duplicate block(s), shared with 1 file(s): - /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) -Clone duplicate/bad blocks? yes - - -File /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) - has 4 duplicate block(s), shared with 2 file(s): - /pass1.c (inode #14, mod time Tue Sep 21 04:28:37 1993) - /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993) -Clone duplicate/bad blocks? yes - - -File /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993) - has 2 duplicate block(s), shared with 1 file(s): - /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) -Duplicated blocks already reassigned or cloned. - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (8, counted=22). FIXED -Free blocks count wrong (26, counted=22). FIXED -Padding at end of block bitmap is not set. Fix? yes - - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 16/16 files (6.3% non-contiguous), 78/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_dup2/expect.2 deleted file mode 100644 index 0508b0955e9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 16/16 files (12.5% non-contiguous), 78/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_dup2/image.gz Binary files differdeleted file mode 100644 index e9b853d6f45..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/name b/gnu/usr.sbin/e2fsprogs/tests/f_dup2/name deleted file mode 100644 index 3d636e0b8f6..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dup2/name +++ /dev/null @@ -1 +0,0 @@ -blocks claimed by three different files diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/expect.1 deleted file mode 100644 index 1adda3b38de..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/expect.1 +++ /dev/null @@ -1,37 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Duplicate blocks found... invoking duplicate block passes. -Pass 1B: Rescan for duplicate/bad blocks -Duplicate/bad block(s) in inode 12: 3 4 6 -Pass 1C: Scan directories for inodes with dup blocks. -Pass 1D: Reconciling duplicate blocks -(There are 1 inodes containing duplicate/bad blocks.) - -File /foo (inode #12, mod time Thu Apr 28 17:57:53 1994) - has 3 duplicate block(s), shared with 1 file(s): - <filesystem metadata> -Clone duplicate/bad blocks? yes - - -Pass 2: Checking directory structure -Directory inode 12, block 1, offset 0: directory corrupted -Salvage? yes - -Directory inode 12, block 2, offset 0: directory corrupted -Salvage? yes - -Directory inode 12, block 3, offset 0: directory corrupted -Salvage? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (77, counted=74). FIXED -Free blocks count wrong (77, counted=74). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 12/32 files (8.3% non-contiguous), 26/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/expect.2 deleted file mode 100644 index 6f6d1db7927..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 12/32 files (0.0% non-contiguous), 26/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/image.gz Binary files differdeleted file mode 100644 index 5514de43c5e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/name b/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/name deleted file mode 100644 index 84124c9ae24..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupfsblks/name +++ /dev/null @@ -1 +0,0 @@ -blocks claimed by a file and bitmaps or inode tables diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/expect.1 deleted file mode 100644 index 61603bffc50..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/expect.1 +++ /dev/null @@ -1,27 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Duplicate blocks found... invoking duplicate block passes. -Pass 1B: Rescan for duplicate/bad blocks -Duplicate/bad block(s) in inode 12: 2 3 1 -Pass 1C: Scan directories for inodes with dup blocks. -Pass 1D: Reconciling duplicate blocks -(There are 1 inodes containing duplicate/bad blocks.) - -File /termcap (inode #12, mod time Sun Jan 2 08:29:13 1994) - has 3 duplicate block(s), shared with 1 file(s): - <filesystem metadata> -Clone duplicate/bad blocks? yes - - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -29 -30 -31. FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 12/32 files (8.3% non-contiguous), 39/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/expect.2 deleted file mode 100644 index 8735c4e36f5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 12/32 files (8.3% non-contiguous), 39/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/image.gz Binary files differdeleted file mode 100644 index d919e07aeb0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/name b/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/name deleted file mode 100644 index 560a707e68d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_dupsuper/name +++ /dev/null @@ -1 +0,0 @@ -blocks claimed by a file and superblock or group descriptors diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/expect.1 deleted file mode 100644 index f2beea6221c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/expect.1 +++ /dev/null @@ -1,16 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (44, counted=63). FIXED -Padding at end of block bitmap is not set. Fix? yes - - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 12/16 files (0.0% non-contiguous), 37/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/expect.2 deleted file mode 100644 index 8109f9958d8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 12/16 files (0.0% non-contiguous), 37/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/image.gz Binary files differdeleted file mode 100644 index cb20d0a20ff..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/name b/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/name deleted file mode 100644 index b63b6d71762..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_end-bitmap/name +++ /dev/null @@ -1 +0,0 @@ -corruption at end of block bitmap diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_expand/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_expand/expect.1 deleted file mode 100644 index 86aba903225..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_expand/expect.1 +++ /dev/null @@ -1,531 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Root inode is not a directory. Clear? yes - -Pass 2: Checking directory structure -Entry '..' in ??? (11) has deleted/unused inode 2. Clear? yes - -Pass 3: Checking directory connectivity -Root inode not allocated. Allocate? yes - -Unconnected directory inode 11 (...) -Connect to /lost+found? yes - -/lost+found not found. Create? yes - -Pass 4: Checking reference counts -Inode 11 ref count is 3, should be 2. Fix? yes - -Unattached inode 12 -Connect to /lost+found? yes - -Inode 12 ref count is 2, should be 1. Fix? yes - -Unattached inode 13 -Connect to /lost+found? yes - -Inode 13 ref count is 2, should be 1. Fix? yes - -Unattached inode 14 -Connect to /lost+found? yes - -Inode 14 ref count is 2, should be 1. Fix? yes - -Unattached inode 15 -Connect to /lost+found? yes - -Inode 15 ref count is 2, should be 1. Fix? yes - -Unattached inode 16 -Connect to /lost+found? yes - -Inode 16 ref count is 2, should be 1. Fix? yes - -Unattached inode 17 -Connect to /lost+found? yes - -Inode 17 ref count is 2, should be 1. Fix? yes - -Unattached inode 18 -Connect to /lost+found? yes - -Inode 18 ref count is 2, should be 1. Fix? yes - -Unattached inode 19 -Connect to /lost+found? yes - -Inode 19 ref count is 2, should be 1. Fix? yes - -Unattached inode 20 -Connect to /lost+found? yes - -Inode 20 ref count is 2, should be 1. Fix? yes - -Unattached inode 21 -Connect to /lost+found? yes - -Inode 21 ref count is 2, should be 1. Fix? yes - -Unattached inode 22 -Connect to /lost+found? yes - -Inode 22 ref count is 2, should be 1. Fix? yes - -Unattached inode 23 -Connect to /lost+found? yes - -Inode 23 ref count is 2, should be 1. Fix? yes - -Unattached inode 24 -Connect to /lost+found? yes - -Inode 24 ref count is 2, should be 1. Fix? yes - -Unattached inode 25 -Connect to /lost+found? yes - -Inode 25 ref count is 2, should be 1. Fix? yes - -Unattached inode 26 -Connect to /lost+found? yes - -Inode 26 ref count is 2, should be 1. Fix? yes - -Unattached inode 27 -Connect to /lost+found? yes - -Inode 27 ref count is 2, should be 1. Fix? yes - -Unattached inode 28 -Connect to /lost+found? yes - -Inode 28 ref count is 2, should be 1. Fix? yes - -Unattached inode 29 -Connect to /lost+found? yes - -Inode 29 ref count is 2, should be 1. Fix? yes - -Unattached inode 30 -Connect to /lost+found? yes - -Inode 30 ref count is 2, should be 1. Fix? yes - -Unattached inode 31 -Connect to /lost+found? yes - -Inode 31 ref count is 2, should be 1. Fix? yes - -Unattached inode 32 -Connect to /lost+found? yes - -Inode 32 ref count is 2, should be 1. Fix? yes - -Unattached inode 33 -Connect to /lost+found? yes - -Inode 33 ref count is 2, should be 1. Fix? yes - -Unattached inode 34 -Connect to /lost+found? yes - -Inode 34 ref count is 2, should be 1. Fix? yes - -Unattached inode 35 -Connect to /lost+found? yes - -Inode 35 ref count is 2, should be 1. Fix? yes - -Unattached inode 36 -Connect to /lost+found? yes - -Inode 36 ref count is 2, should be 1. Fix? yes - -Unattached inode 37 -Connect to /lost+found? yes - -Inode 37 ref count is 2, should be 1. Fix? yes - -Unattached inode 38 -Connect to /lost+found? yes - -Inode 38 ref count is 2, should be 1. Fix? yes - -Unattached inode 39 -Connect to /lost+found? yes - -Inode 39 ref count is 2, should be 1. Fix? yes - -Unattached inode 40 -Connect to /lost+found? yes - -Inode 40 ref count is 2, should be 1. Fix? yes - -Unattached inode 41 -Connect to /lost+found? yes - -Inode 41 ref count is 2, should be 1. Fix? yes - -Unattached inode 42 -Connect to /lost+found? yes - -Inode 42 ref count is 2, should be 1. Fix? yes - -Unattached inode 43 -Connect to /lost+found? yes - -Inode 43 ref count is 2, should be 1. Fix? yes - -Unattached inode 44 -Connect to /lost+found? yes - -Inode 44 ref count is 2, should be 1. Fix? yes - -Unattached inode 45 -Connect to /lost+found? yes - -Inode 45 ref count is 2, should be 1. Fix? yes - -Unattached inode 46 -Connect to /lost+found? yes - -Inode 46 ref count is 2, should be 1. Fix? yes - -Unattached inode 47 -Connect to /lost+found? yes - -Inode 47 ref count is 2, should be 1. Fix? yes - -Unattached inode 48 -Connect to /lost+found? yes - -Inode 48 ref count is 2, should be 1. Fix? yes - -Unattached inode 49 -Connect to /lost+found? yes - -Inode 49 ref count is 2, should be 1. Fix? yes - -Unattached inode 50 -Connect to /lost+found? yes - -Inode 50 ref count is 2, should be 1. Fix? yes - -Unattached inode 51 -Connect to /lost+found? yes - -Inode 51 ref count is 2, should be 1. Fix? yes - -Unattached inode 52 -Connect to /lost+found? yes - -Inode 52 ref count is 2, should be 1. Fix? yes - -Unattached inode 53 -Connect to /lost+found? yes - -Inode 53 ref count is 2, should be 1. Fix? yes - -Unattached inode 54 -Connect to /lost+found? yes - -Inode 54 ref count is 2, should be 1. Fix? yes - -Unattached inode 55 -Connect to /lost+found? yes - -Inode 55 ref count is 2, should be 1. Fix? yes - -Unattached inode 56 -Connect to /lost+found? yes - -Inode 56 ref count is 2, should be 1. Fix? yes - -Unattached inode 57 -Connect to /lost+found? yes - -Inode 57 ref count is 2, should be 1. Fix? yes - -Unattached inode 58 -Connect to /lost+found? yes - -Inode 58 ref count is 2, should be 1. Fix? yes - -Unattached inode 59 -Connect to /lost+found? yes - -Inode 59 ref count is 2, should be 1. Fix? yes - -Unattached inode 60 -Connect to /lost+found? yes - -Inode 60 ref count is 2, should be 1. Fix? yes - -Unattached inode 61 -Connect to /lost+found? yes - -Inode 61 ref count is 2, should be 1. Fix? yes - -Unattached inode 62 -Connect to /lost+found? yes - -Inode 62 ref count is 2, should be 1. Fix? yes - -Unattached inode 63 -Connect to /lost+found? yes - -Inode 63 ref count is 2, should be 1. Fix? yes - -Unattached inode 64 -Connect to /lost+found? yes - -Inode 64 ref count is 2, should be 1. Fix? yes - -Unattached inode 65 -Connect to /lost+found? yes - -Inode 65 ref count is 2, should be 1. Fix? yes - -Unattached inode 66 -Connect to /lost+found? yes - -Inode 66 ref count is 2, should be 1. Fix? yes - -Unattached inode 67 -Connect to /lost+found? yes - -Inode 67 ref count is 2, should be 1. Fix? yes - -Unattached inode 68 -Connect to /lost+found? yes - -Inode 68 ref count is 2, should be 1. Fix? yes - -Unattached inode 69 -Connect to /lost+found? yes - -Inode 69 ref count is 2, should be 1. Fix? yes - -Unattached inode 70 -Connect to /lost+found? yes - -Inode 70 ref count is 2, should be 1. Fix? yes - -Unattached inode 71 -Connect to /lost+found? yes - -Inode 71 ref count is 2, should be 1. Fix? yes - -Unattached inode 72 -Connect to /lost+found? yes - -Inode 72 ref count is 2, should be 1. Fix? yes - -Unattached inode 73 -Connect to /lost+found? yes - -Inode 73 ref count is 2, should be 1. Fix? yes - -Unattached inode 74 -Connect to /lost+found? yes - -Inode 74 ref count is 2, should be 1. Fix? yes - -Unattached inode 75 -Connect to /lost+found? yes - -Inode 75 ref count is 2, should be 1. Fix? yes - -Unattached inode 76 -Connect to /lost+found? yes - -Inode 76 ref count is 2, should be 1. Fix? yes - -Unattached inode 77 -Connect to /lost+found? yes - -Inode 77 ref count is 2, should be 1. Fix? yes - -Unattached inode 78 -Connect to /lost+found? yes - -Inode 78 ref count is 2, should be 1. Fix? yes - -Unattached inode 79 -Connect to /lost+found? yes - -Inode 79 ref count is 2, should be 1. Fix? yes - -Unattached inode 80 -Connect to /lost+found? yes - -Inode 80 ref count is 2, should be 1. Fix? yes - -Unattached inode 81 -Connect to /lost+found? yes - -Inode 81 ref count is 2, should be 1. Fix? yes - -Unattached inode 82 -Connect to /lost+found? yes - -Inode 82 ref count is 2, should be 1. Fix? yes - -Unattached inode 83 -Connect to /lost+found? yes - -Inode 83 ref count is 2, should be 1. Fix? yes - -Unattached inode 84 -Connect to /lost+found? yes - -Inode 84 ref count is 2, should be 1. Fix? yes - -Unattached inode 85 -Connect to /lost+found? yes - -Inode 85 ref count is 2, should be 1. Fix? yes - -Unattached inode 86 -Connect to /lost+found? yes - -Inode 86 ref count is 2, should be 1. Fix? yes - -Unattached inode 87 -Connect to /lost+found? yes - -Inode 87 ref count is 2, should be 1. Fix? yes - -Unattached inode 88 -Connect to /lost+found? yes - -Inode 88 ref count is 2, should be 1. Fix? yes - -Unattached inode 89 -Connect to /lost+found? yes - -Inode 89 ref count is 2, should be 1. Fix? yes - -Unattached inode 90 -Connect to /lost+found? yes - -Inode 90 ref count is 2, should be 1. Fix? yes - -Unattached inode 91 -Connect to /lost+found? yes - -Inode 91 ref count is 2, should be 1. Fix? yes - -Unattached inode 92 -Connect to /lost+found? yes - -Inode 92 ref count is 2, should be 1. Fix? yes - -Unattached inode 93 -Connect to /lost+found? yes - -Inode 93 ref count is 2, should be 1. Fix? yes - -Unattached inode 94 -Connect to /lost+found? yes - -No room in lost+found directory. Expand? yes - -Inode 94 ref count is 2, should be 1. Fix? yes - -Unattached inode 95 -Connect to /lost+found? yes - -Inode 95 ref count is 2, should be 1. Fix? yes - -Unattached inode 96 -Connect to /lost+found? yes - -Inode 96 ref count is 2, should be 1. Fix? yes - -Unattached inode 97 -Connect to /lost+found? yes - -Inode 97 ref count is 2, should be 1. Fix? yes - -Unattached inode 98 -Connect to /lost+found? yes - -Inode 98 ref count is 2, should be 1. Fix? yes - -Unattached inode 99 -Connect to /lost+found? yes - -Inode 99 ref count is 2, should be 1. Fix? yes - -Unattached inode 100 -Connect to /lost+found? yes - -Inode 100 ref count is 2, should be 1. Fix? yes - -Unattached inode 101 -Connect to /lost+found? yes - -Inode 101 ref count is 2, should be 1. Fix? yes - -Unattached inode 102 -Connect to /lost+found? yes - -Inode 102 ref count is 2, should be 1. Fix? yes - -Unattached inode 103 -Connect to /lost+found? yes - -Inode 103 ref count is 2, should be 1. Fix? yes - -Unattached inode 104 -Connect to /lost+found? yes - -Inode 104 ref count is 2, should be 1. Fix? yes - -Unattached inode 105 -Connect to /lost+found? yes - -Inode 105 ref count is 2, should be 1. Fix? yes - -Unattached inode 106 -Connect to /lost+found? yes - -Inode 106 ref count is 2, should be 1. Fix? yes - -Unattached inode 107 -Connect to /lost+found? yes - -Inode 107 ref count is 2, should be 1. Fix? yes - -Unattached inode 108 -Connect to /lost+found? yes - -Inode 108 ref count is 2, should be 1. Fix? yes - -Unattached inode 109 -Connect to /lost+found? yes - -Inode 109 ref count is 2, should be 1. Fix? yes - -Unattached inode 110 -Connect to /lost+found? yes - -Inode 110 ref count is 2, should be 1. Fix? yes - -Unattached inode 111 -Connect to /lost+found? yes - -Inode 111 ref count is 2, should be 1. Fix? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (56, counted=55). FIXED -Free blocks count wrong (56, counted=55). FIXED -Free inodes count wrong for group #0 (89, counted=88). FIXED -Directories count wrong for group #0 (2, counted=3). FIXED -Free inodes count wrong (89, counted=88). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 112/200 files (0.0% non-contiguous), 145/200 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_expand/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_expand/expect.2 deleted file mode 100644 index 533d55599ee..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_expand/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 112/200 files (0.9% non-contiguous), 145/200 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_expand/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_expand/image.gz Binary files differdeleted file mode 100644 index 4e9ac84ad77..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_expand/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_expand/name b/gnu/usr.sbin/e2fsprogs/tests/f_expand/name deleted file mode 100644 index feebe0fcdc3..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_expand/name +++ /dev/null @@ -1 +0,0 @@ -expanding lost+found diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_holedir/expect.1 deleted file mode 100644 index 05e0cbbcc91..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/expect.1 +++ /dev/null @@ -1,26 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Inode 11 has illegal block(s). Clear? yes - -Illegal block #6 (200) in inode 11. CLEARED. -Inode 11, i_size is 12288, should be 11264. Fix? yes - -Inode 11, i_blocks is 24, should be 16. Fix? yes - -Pass 2: Checking directory structure -Directory inode 11 has an unallocated block #0. Allocate? yes - -Directory inode 11 has an unallocated block #3. Allocate? yes - -Directory inode 11 has an unallocated block #6. Allocate? yes - -Directory inode 11 has an unallocated block #11. Allocate? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (9.1% non-contiguous), 22/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_holedir/expect.2 deleted file mode 100644 index a821f878397..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_holedir/image.gz Binary files differdeleted file mode 100644 index ee26ab8d754..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/name b/gnu/usr.sbin/e2fsprogs/tests/f_holedir/name deleted file mode 100644 index 411f656f5a8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_holedir/name +++ /dev/null @@ -1 +0,0 @@ -directory with holes and illegal blocks diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/expect.1 deleted file mode 100644 index d22dbf2a21e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/expect.1 +++ /dev/null @@ -1,28 +0,0 @@ -Note: if there is several inode or block bitmap blocks -which require relocation, or one part of the inode table -which must be moved, you may wish to try running e2fsck -with the '-b 8193' option first. The problem may lie only -with the primary block group descriptor, and the backup -block group descriptor may be OK. - -Block bitmap for group 0 is not in group. (block 4096) -Relocate? yes - -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Relocating group 0's block bitmap to 4... -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21. FIXED -Inode bitmap differences: -12 -13 -14 -15 -16 -17 -18 -19 -20 -21. FIXED -Padding at end of block bitmap is not set. Fix? yes - - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/expect.2 deleted file mode 100644 index a821f878397..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/image.gz Binary files differdeleted file mode 100644 index fb16ebc4797..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/name b/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/name deleted file mode 100644 index 5ed4f59136e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illbbitmap/name +++ /dev/null @@ -1 +0,0 @@ -illegal block bitmap diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/expect.1 deleted file mode 100644 index 4e4d996cba0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/expect.1 +++ /dev/null @@ -1,25 +0,0 @@ -Note: if there is several inode or block bitmap blocks -which require relocation, or one part of the inode table -which must be moved, you may wish to try running e2fsck -with the '-b 8193' option first. The problem may lie only -with the primary block group descriptor, and the backup -block group descriptor may be OK. - -Inode bitmap for group 0 is not in group. (block 4000) -Relocate? yes - -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Relocating group 0's inode bitmap to 4... -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Inode bitmap differences: +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11. FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/expect.2 deleted file mode 100644 index a821f878397..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/image.gz Binary files differdeleted file mode 100644 index 3e0892d483b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/name b/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/name deleted file mode 100644 index bac40035b71..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illibitmap/name +++ /dev/null @@ -1 +0,0 @@ -illegal inode bitmap diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_illitable/expect.1 deleted file mode 100644 index 42ee2ae4d00..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/expect.1 +++ /dev/null @@ -1,38 +0,0 @@ -Note: if there is several inode or block bitmap blocks -which require relocation, or one part of the inode table -which must be moved, you may wish to try running e2fsck -with the '-b 8193' option first. The problem may lie only -with the primary block group descriptor, and the backup -block group descriptor may be OK. - -Inode table for group 0 is not in group. (block 40000) -WARNING: SEVERE DATA LOSS POSSIBLE. -Relocate? yes - -../e2fsck/e2fsck: A block group is missing an inode table while reading bad blocks inode
-This doesn't bode well, but we'll try to go on... -Pass 1: Checking inodes, blocks, and sizes -Relocating group 0's inode table to 5... -Restarting e2fsck from the beginning... -Pass 1: Checking inodes, blocks, and sizes -Root inode is not a directory. Clear? yes - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Root inode not allocated. Allocate? yes - -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21. FIXED -Free blocks count wrong for group 0 (78, counted=90). FIXED -Free blocks count wrong (78, counted=90). FIXED -Inode bitmap differences: -11. FIXED -Free inodes count wrong for group #0 (21, counted=22). FIXED -Directories count wrong for group #0 (2, counted=1). FIXED -Free inodes count wrong (21, counted=22). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 10/32 files (0.0% non-contiguous), 10/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_illitable/expect.2 deleted file mode 100644 index 86ea8590aea..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 10/32 files (0.0% non-contiguous), 10/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_illitable/image.gz Binary files differdeleted file mode 100644 index 1b0219422ed..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/name b/gnu/usr.sbin/e2fsprogs/tests/f_illitable/name deleted file mode 100644 index 631e73be7ba..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_illitable/name +++ /dev/null @@ -1 +0,0 @@ -illegal inode table diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/expect.1 deleted file mode 100644 index fd491d50bed..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/expect.1 +++ /dev/null @@ -1,39 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Inode 12 has illegal block(s). Clear? yes - -Illegal block #12 (778398818) in inode 12. CLEARED. -Illegal block #13 (1768444960) in inode 12. CLEARED. -Illegal block #14 (1752375411) in inode 12. CLEARED. -Illegal block #15 (1684829551) in inode 12. CLEARED. -Illegal block #16 (1886349344) in inode 12. CLEARED. -Illegal block #17 (1819633253) in inode 12. CLEARED. -Illegal block #18 (1663072620) in inode 12. CLEARED. -Illegal block #19 (1735287144) in inode 12. CLEARED. -Illegal block #20 (1310731877) in inode 12. CLEARED. -Illegal block #21 (560297071) in inode 12. CLEARED. -Illegal block #22 (543512352) in inode 12. CLEARED. -Too many illegal blocks in inode 12. -Clear inode? yes - -Restarting e2fsck from the beginning... -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Entry 'termcap' in / (2) has deleted/unused inode 12. Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -44 -45. FIXED -Free blocks count wrong for group 0 (41, counted=58). FIXED -Free blocks count wrong (41, counted=58). FIXED -Inode bitmap differences: -12. FIXED -Free inodes count wrong for group #0 (20, counted=21). FIXED -Free inodes count wrong (20, counted=21). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (0.0% non-contiguous), 42/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/expect.2 deleted file mode 100644 index b83f4e6a4b0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 42/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/image.gz Binary files differdeleted file mode 100644 index 9386a9e9be8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/name b/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/name deleted file mode 100644 index 16b77c10f47..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lotsbad/name +++ /dev/null @@ -1 +0,0 @@ -too many illegal blocks in inode diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_lpf/expect.1 deleted file mode 100644 index 3803029a12c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/expect.1 +++ /dev/null @@ -1,41 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Inode 13 is in use, but has dtime set. Fix? yes - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Unattached inode 13 -Connect to /lost+found? yes - -/lost+found not found. Create? yes - -Inode 13 ref count is 2, should be 1. Fix? yes - -Unattached inode 14 -Connect to /lost+found? yes - -Inode 14 ref count is 2, should be 1. Fix? yes - -Unattached inode 15 -Connect to /lost+found? yes - -Inode 15 ref count is 2, should be 1. Fix? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: +22 +23 +49 +57 +58. FIXED -Free blocks count wrong for group 0 (25, counted=33). FIXED -Free blocks count wrong (39, counted=33). FIXED -Inode bitmap differences: +13. FIXED -Free inodes count wrong for group #0 (2, counted=0). FIXED -Directories count wrong for group #0 (1, counted=2). FIXED -Free inodes count wrong (2, counted=0). FIXED -Padding at end of block bitmap is not set. Fix? yes - - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 16/16 files (12.5% non-contiguous), 67/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_lpf/expect.2 deleted file mode 100644 index 36110ee0386..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 16/16 files (12.5% non-contiguous), 67/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_lpf/image.gz Binary files differdeleted file mode 100644 index 2a71bcf7c0d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/name b/gnu/usr.sbin/e2fsprogs/tests/f_lpf/name deleted file mode 100644 index ac2dbab4673..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_lpf/name +++ /dev/null @@ -1 +0,0 @@ -missing lost+found diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/expect.1 deleted file mode 100644 index 32b2a15c855..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/expect.1 +++ /dev/null @@ -1,35 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Inode 14 has illegal block(s). Clear? yes - -Illegal block #2 (4294901760) in inode 14. CLEARED. -Illegal block #3 (4294901760) in inode 14. CLEARED. -Illegal block #4 (4294901760) in inode 14. CLEARED. -Illegal block #5 (4294901760) in inode 14. CLEARED. -Illegal block #6 (4294901760) in inode 14. CLEARED. -Illegal block #7 (4294901760) in inode 14. CLEARED. -Illegal block #8 (4294901760) in inode 14. CLEARED. -Illegal block #9 (4294901760) in inode 14. CLEARED. -Illegal block #10 (4294901760) in inode 14. CLEARED. -Inode 14, i_blocks is 18, should be 4. Fix? yes - -Pass 2: Checking directory structure -i_file_acl for inode 14 (/MAKEDEV) is 4294901760, should be zero. -Clear? yes - -i_dir_acl for inode 14 (/MAKEDEV) is 4294901760, should be zero. -Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -43 -44 -45 -46 -47 -48 -49. FIXED -Free blocks count wrong for group 0 (68, counted=75). FIXED -Free blocks count wrong (68, counted=75). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 29/32 files (3.4% non-contiguous), 25/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/expect.2 deleted file mode 100644 index 1fffb022483..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 29/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/image.gz Binary files differdeleted file mode 100644 index 630a68985f9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/name b/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/name deleted file mode 100644 index f1485eae01a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_messy_inode/name +++ /dev/null @@ -1 +0,0 @@ -bad file and directory acl pointers diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_misstable/expect.1 deleted file mode 100644 index 83514548bf9..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/expect.1 +++ /dev/null @@ -1,36 +0,0 @@ -Group descriptors look bad... trying backup blocks... -Inode table for group 1 is not in group. (block 0) -WARNING: SEVERE DATA LOSS POSSIBLE. -Relocate? yes - -Pass 1: Checking inodes, blocks, and sizes -Relocating group 1's inode table to 8197... -Restarting e2fsck from the beginning... -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Entry 'etc' in / (2) has deleted/unused inode 1505. Clear? yes - -Entry 'cache' in / (2) has deleted/unused inode 1514. Clear? yes - -Entry 'a' in / (2) has deleted/unused inode 1515. Clear? yes - -Entry 'b' in / (2) has deleted/unused inode 1516. Clear? yes - -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Inode 2 ref count is 8, should be 4. Fix? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Block bitmap differences: -8385 -8386 -8387 -8388 -8389 -8390 -8391 -8392 -8393 -8394 -8395 -8396 -8397 -8398 -8399 -8400 -8401 -8402 -8403 -8404 -8405. FIXED -Free blocks count wrong for group 0 (7987, counted=7984). FIXED -Free blocks count wrong (11602, counted=11599). FIXED -Inode bitmap differences: -1505 -1506 -1507 -1508 -1509 -1510 -1511 -1512 -1513 -1514 -1515 -1516. FIXED -Free inodes count wrong for group #0 (1493, counted=1489). FIXED -Directories count wrong for group #0 (2, counted=3). FIXED -Free inodes count wrong (2997, counted=2993). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 15/3008 files (0.0% non-contiguous), 401/12000 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_misstable/expect.2 deleted file mode 100644 index e8cd21a35fd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 15/3008 files (0.0% non-contiguous), 401/12000 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_misstable/image.gz Binary files differdeleted file mode 100644 index b2aca9d333b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/name b/gnu/usr.sbin/e2fsprogs/tests/f_misstable/name deleted file mode 100644 index 10a1adca575..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_misstable/name +++ /dev/null @@ -1 +0,0 @@ -missing inode table diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/expect.1 deleted file mode 100644 index 872224705ac..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/expect.1 +++ /dev/null @@ -1,19 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Root inode has dtime set (probably due to old mke2fs). Fix? yes - -Inode 11 is in use, but has dtime set. Fix? yes - -Inode 15 is in use, but has dtime set. Fix? yes - -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Unattached zero-length inode 15. Clear? yes - -Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 15/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/expect.2 deleted file mode 100644 index 10455d70b5e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 15/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/image.gz Binary files differdeleted file mode 100644 index 6b7412cdf3e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/name b/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/name deleted file mode 100644 index bf2202ac051..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_mke2fs2b/name +++ /dev/null @@ -1 +0,0 @@ -mke2fs version 0.2b created filesystem diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_noroot/expect.1 deleted file mode 100644 index cef02279d9f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/expect.1 +++ /dev/null @@ -1,40 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Inode 15 is in use, but has dtime set. Fix? yes - -Pass 2: Checking directory structure -Entry '..' in /lost+found (11) has deleted/unused inode 2. Clear? yes - -Entry '..' in /foo (12) has deleted/unused inode 2. Clear? yes - -Pass 3: Checking directory connectivity -Root inode not allocated. Allocate? yes - -Unconnected directory inode 11 (...) -Connect to /lost+found? yes - -/lost+found not found. Create? yes - -Unconnected directory inode 12 (...) -Connect to /lost+found? yes - -Pass 4: Checking reference counts -Inode 11 ref count is 3, should be 2. Fix? yes - -Inode 12 ref count is 4, should be 3. Fix? yes - -Unattached zero-length inode 15. Clear? yes - -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (75, counted=74). FIXED -Free blocks count wrong (75, counted=74). FIXED -Free inodes count wrong for group #0 (17, counted=16). FIXED -Directories count wrong for group #0 (4, counted=5). FIXED -Free inodes count wrong (17, counted=16). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 16/32 files (0.0% non-contiguous), 26/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_noroot/expect.2 deleted file mode 100644 index 5ea5bc71886..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 16/32 files (0.0% non-contiguous), 26/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_noroot/image.gz Binary files differdeleted file mode 100644 index 0a87e9963b2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/name b/gnu/usr.sbin/e2fsprogs/tests/f_noroot/name deleted file mode 100644 index a70ebc29e79..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_noroot/name +++ /dev/null @@ -1 +0,0 @@ -missing root directory diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/expect.1 deleted file mode 100644 index 6f44d891b1e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/expect.1 +++ /dev/null @@ -1,11 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/2048 files (0.0% non-contiguous), 274/8193 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/expect.2 deleted file mode 100644 index 44856c0402b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/2048 files (0.0% non-contiguous), 274/8193 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/image.gz Binary files differdeleted file mode 100644 index 06b67c7a73a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/name b/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/name deleted file mode 100644 index 3da66af84b2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_okgroup/name +++ /dev/null @@ -1 +0,0 @@ -8193 block long filesystem diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/expect.1 deleted file mode 100644 index d0f47ebd40b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/expect.1 +++ /dev/null @@ -1,18 +0,0 @@ -Filesystem did not have a UUID; generating one. - -Pass 1: Checking inodes, blocks, and sizes -Group 0's inode bitmap at 3 conflicts with some other fs block. -Relocate? yes - -Relocating group 0's inode bitmap from 3 to 4... -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Inode bitmap differences: -12 -13 -14 -15 -16 -17 -18 -19 -20 -21. FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/expect.2 deleted file mode 100644 index a821f878397..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 11/32 files (0.0% non-contiguous), 22/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/image.gz Binary files differdeleted file mode 100644 index 60b6b2ea3dd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/name b/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/name deleted file mode 100644 index 8ab604088ff..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_overfsblks/name +++ /dev/null @@ -1 +0,0 @@ -overlapping inode and block bitmaps diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_preen/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_preen/expect.1 deleted file mode 100644 index 824b0ecb0e5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_preen/expect.1 +++ /dev/null @@ -1,12 +0,0 @@ -which require relocation, or one part of the inode table -which must be moved, you may wish to try running e2fsck -with the '-b 8193' option first. The problem may lie only -with the primary block group descriptor, and the backup -block group descriptor may be OK. - -test_filesys: Block bitmap for group 0 is not in group. (block 0) - - -test_filesys: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. - (i.e., without -a or -p options) -Exit status is 4 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_preen/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_preen/expect.2 deleted file mode 100644 index 9d30709d7fe..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_preen/expect.2 +++ /dev/null @@ -1,18 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (8042, counted=7614). FIXED -Free blocks count wrong for group 1 (170, counted=169). FIXED -Free blocks count wrong (8212, counted=7783). FIXED -Free inodes count wrong for group #0 (1053, counted=1052). FIXED -Free inodes count wrong for group #1 (1064, counted=1063). FIXED -Directories count wrong for group #1 (0, counted=1). FIXED -Free inodes count wrong (2117, counted=2115). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 13/2128 files (0.0% non-contiguous), 717/8500 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_preen/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_preen/image.gz Binary files differdeleted file mode 100644 index 3aa7ca04b7b..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_preen/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_preen/name b/gnu/usr.sbin/e2fsprogs/tests/f_preen/name deleted file mode 100644 index 35a54888ef2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_preen/name +++ /dev/null @@ -1 +0,0 @@ -preen should't destroy backup superblocks diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_preen/script b/gnu/usr.sbin/e2fsprogs/tests/f_preen/script deleted file mode 100644 index 40ed11c3d9a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_preen/script +++ /dev/null @@ -1,4 +0,0 @@ -FSCK_OPT=-pf -SECOND_FSCK_OPT=-yfb8193 - -. $cmd_dir/run_e2fsck diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/expect.1 deleted file mode 100644 index 331d8b3d141..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/expect.1 +++ /dev/null @@ -1,24 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Unattached inode 12 -Connect to /lost+found? yes - -Inode 12 ref count is 2, should be 1. Fix? yes - -Unattached inode 13 -Connect to /lost+found? yes - -Inode 13 ref count is 2, should be 1. Fix? yes - -Unattached inode 14 -Connect to /lost+found? yes - -Inode 14 ref count is 2, should be 1. Fix? yes - -Pass 5: Checking group summary information - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 14/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/expect.2 deleted file mode 100644 index e848eff327a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 14/32 files (0.0% non-contiguous), 25/100 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/image.gz Binary files differdeleted file mode 100644 index 56b92c39450..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/name b/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/name deleted file mode 100644 index c09c23fbe4a..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_reconnect/name +++ /dev/null @@ -1 +0,0 @@ -simple disconnected file inode diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/debugfs.cmd b/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/debugfs.cmd deleted file mode 100644 index df583b24113..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/debugfs.cmd +++ /dev/null @@ -1,5 +0,0 @@ -ls -stat sym -stat double-indirect-test -cat fluff -quit diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/expect b/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/expect deleted file mode 100644 index 640c3143c32..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/expect +++ /dev/null @@ -1,133 +0,0 @@ -Swapfs test -e2fsck -yf -N test_filesys -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks -Exit status is 0 -e2fsck -Sy -N test_filesys -Pass 0: Doing byte-swap of filesystem -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks -Exit status is 0 -Running debugfs.... -debugfs: ls -2 (12) . 2 (12) .. 11 (20) lost+found 12 (16) fluff -13 (28) indirect-fluff-test 14 (28) double-indirect-test 15 (20) sym -16 (24) long-sym-test 17 (864) dir-test -debugfs: stat sym -Inode: 15 Type: symlink Mode: 0777 Flags: 0x0 Version: 1 -User: 0 Group: 0 Size: 5 -File ACL: 0 Directory ACL: 0 -Links: 1 Blockcount: 0 -Fragment: Address: 0 Number: 0 Size: 0 -ctime: 0x322737e2 -- Fri Aug 30 18:50:10 1996 -atime: 0x322737e2 -- Fri Aug 30 18:50:10 1996 -mtime: 0x322737e2 -- Fri Aug 30 18:50:10 1996 -Fast_link_dest: fluff -debugfs: stat double-indirect-test -Inode: 14 Type: regular Mode: 0644 Flags: 0x0 Version: 1 -User: 0 Group: 0 Size: 348960 -File ACL: 0 Directory ACL: 0 -Links: 1 Blockcount: 688 -Fragment: Address: 0 Number: 0 Size: 0 -ctime: 0x322488cf -- Wed Aug 28 17:58:39 1996 -atime: 0x322488cf -- Wed Aug 28 17:58:39 1996 -mtime: 0x322488cf -- Wed Aug 28 17:58:39 1996 -BLOCKS: -70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 -TOTAL: 344 - -debugfs: cat fluff -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip - -debugfs: quit -Exit status is 0 -e2fsck -yf -N test_filesys -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks -Exit status is 0 -e2fsck -sy -N test_filesys -Pass 0: Doing byte-swap of filesystem -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks -Exit status is 0 -Running debugfs.... -debugfs: ls -2 (12) . 2 (12) .. 11 (20) lost+found 12 (16) fluff -13 (28) indirect-fluff-test 14 (28) double-indirect-test 15 (20) sym -16 (24) long-sym-test 17 (864) dir-test -debugfs: stat sym -Inode: 15 Type: symlink Mode: 0777 Flags: 0x0 Version: 1 -User: 0 Group: 0 Size: 5 -File ACL: 0 Directory ACL: 0 -Links: 1 Blockcount: 0 -Fragment: Address: 0 Number: 0 Size: 0 -ctime: 0x322737e2 -- Fri Aug 30 18:50:10 1996 -atime: 0x322737e2 -- Fri Aug 30 18:50:10 1996 -mtime: 0x322737e2 -- Fri Aug 30 18:50:10 1996 -Fast_link_dest: fluff -debugfs: stat double-indirect-test -Inode: 14 Type: regular Mode: 0644 Flags: 0x0 Version: 1 -User: 0 Group: 0 Size: 348960 -File ACL: 0 Directory ACL: 0 -Links: 1 Blockcount: 688 -Fragment: Address: 0 Number: 0 Size: 0 -ctime: 0x322488cf -- Wed Aug 28 17:58:39 1996 -atime: 0x322488cf -- Wed Aug 28 17:58:39 1996 -mtime: 0x322488cf -- Wed Aug 28 17:58:39 1996 -BLOCKS: -70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 -TOTAL: 344 - -debugfs: cat fluff -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip -yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip - -debugfs: quit -Exit status is 0 -e2fsck -yf -N test_filesys -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/image.gz Binary files differdeleted file mode 100644 index ab6f4982965..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/name b/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/name deleted file mode 100644 index b4520ba52fd..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/name +++ /dev/null @@ -1 +0,0 @@ -checking the e2fsck swapfs functionality diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/script b/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/script deleted file mode 100644 index 69e51e69b71..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_swapfs/script +++ /dev/null @@ -1,71 +0,0 @@ -IMAGE=$test_dir/image.gz -VERIFY_FSCK_OPT=-yf -SWAP_FSCK_OPT=-Sy -NATIVE_FSCK_OPT=-sy -OUT=$test_name.log -EXP=$test_dir/expect - -gunzip < $IMAGE > $TMPFILE - -echo "Swapfs test" > $OUT - -echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new -$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 -status=$? -echo Exit status is $status >> $OUT.new -sed -e '2d' $OUT.new >> $OUT - -echo e2fsck $SWAP_FSCK_OPT -N test_filesys > $OUT.new -$FSCK $SWAP_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 -status=$? -echo Exit status is $status >> $OUT.new -sed -e '2d' $OUT.new >> $OUT - -echo Running debugfs.... >> $OUT -$DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE >> $OUT 2>&1 -status=$? -echo Exit status is $status >> $OUT - -echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new -$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 -status=$? -echo Exit status is $status >> $OUT.new -sed -e '2d' $OUT.new >> $OUT - -echo e2fsck $NATIVE_FSCK_OPT -N test_filesys > $OUT.new -$FSCK $NATIVE_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 -status=$? -echo Exit status is $status >> $OUT.new -sed -e '2d' $OUT.new >> $OUT - -echo Running debugfs.... >> $OUT -$DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE >> $OUT 2>&1 -status=$? -echo Exit status is $status >> $OUT - -echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new -$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1 -status=$? -echo Exit status is $status >> $OUT.new -sed -e '2d' $OUT.new >> $OUT -rm -f $OUT.new - -rm $TMPFILE - -# -# Do the verification -# - -rm -f $test_name.ok $test_name.failed -cmp -s $OUT $EXP -status=$? - -if [ "$status" = 0 ] ; then - echo "ok" - touch $test_name.ok -else - echo "failed" - diff -c $EXP $OUT > $test_name.failed -fi - -unset IMAGE VERIFY_FSCK_OPT SWAP_FSCK_OPT NATIVE_FSCK_OPT OUT EXP diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/expect.1 deleted file mode 100644 index c066e8c4847..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/expect.1 +++ /dev/null @@ -1,16 +0,0 @@ -Group descriptors look bad... trying backup blocks... -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (7987, counted=7982). FIXED -Free blocks count wrong (11602, counted=11597). FIXED -Free inodes count wrong for group #0 (1493, counted=1488). FIXED -Free inodes count wrong (2997, counted=2992). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 16/3008 files (0.0% non-contiguous), 403/12000 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/expect.2 deleted file mode 100644 index a833aefc6ec..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 16/3008 files (0.0% non-contiguous), 403/12000 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/image.gz Binary files differdeleted file mode 100644 index 755493cf646..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/name b/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/name deleted file mode 100644 index ccb3b969c2e..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_group/name +++ /dev/null @@ -1 +0,0 @@ -fallback for damaged group descriptors diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/expect.1 b/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/expect.1 deleted file mode 100644 index ff9e1b3b311..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/expect.1 +++ /dev/null @@ -1,16 +0,0 @@ -Couldn't find ext2 superblock, trying backup blocks... -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -Fix summary information? yes - -Free blocks count wrong for group 0 (7987, counted=7982). FIXED -Free blocks count wrong (11602, counted=11597). FIXED -Free inodes count wrong for group #0 (1493, counted=1488). FIXED -Free inodes count wrong (2997, counted=2992). FIXED - -test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** -test_filesys: 16/3008 files (0.0% non-contiguous), 403/12000 blocks -Exit status is 1 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/expect.2 b/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/expect.2 deleted file mode 100644 index a833aefc6ec..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/expect.2 +++ /dev/null @@ -1,7 +0,0 @@ -Pass 1: Checking inodes, blocks, and sizes -Pass 2: Checking directory structure -Pass 3: Checking directory connectivity -Pass 4: Checking reference counts -Pass 5: Checking group summary information -test_filesys: 16/3008 files (0.0% non-contiguous), 403/12000 blocks -Exit status is 0 diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/image.gz b/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/image.gz Binary files differdeleted file mode 100644 index eea9140194f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/image.gz +++ /dev/null diff --git a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/name b/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/name deleted file mode 100644 index 5d999841e21..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/f_zero_super/name +++ /dev/null @@ -1 +0,0 @@ -fallback for damaged superblock diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/ChangeLog b/gnu/usr.sbin/e2fsprogs/tests/progs/ChangeLog deleted file mode 100644 index 31e34c186f5..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/ChangeLog +++ /dev/null @@ -1,16 +0,0 @@ -Thu Apr 24 12:16:42 1997 Theodre Ts'o <tytso@localhost.mit.edu> - - * Release of E2fsprogs version 1.10 - -Thu Apr 17 12:23:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.09 - -Fri Apr 11 18:56:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * Release of E2fsprogs version 1.08 - -Wed Mar 26 15:38:52 1997 Theodore Ts'o <tytso@rsts-11.mit.edu> - - * test_icount.c: New file which tests the icount abstraction. - diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/Makefile.in b/gnu/usr.sbin/e2fsprogs/tests/progs/Makefile.in deleted file mode 100644 index 434ec21bf2f..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/Makefile.in +++ /dev/null @@ -1,67 +0,0 @@ -# -# Standard e2fsprogs prologue.... -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -top_builddir = ../.. -my_dir = tests/progs -INSTALL = @INSTALL@ - -@MCONFIG@ - -MK_CMDS= ../../lib/ss/mk_cmds - -PROGS= test_rel test_icount - -TEST_REL_OBJS= test_rel.o test_rel_cmds.o - -TEST_ICOUNT_OBJS= test_icount.o test_icount_cmds.o - -SRCS= $(srcdir)/test_rel.c - -LIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) -DEPLIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) - -.c.o: - $(CC) -c $(ALL_CFLAGS) $< -o $@ - -all:: $(PROGS) - -test_rel: $(TEST_REL_OBJS) $(DEPLIBS) - $(LD) $(ALL_LDFLAGS) -o test_rel $(TEST_REL_OBJS) $(LIBS) - -test_rel_cmds.c: test_rel_cmds.ct - $(MK_CMDS) $(srcdir)/test_rel_cmds.ct - -test_icount: $(TEST_ICOUNT_OBJS) $(DEPLIBS) - $(LD) $(ALL_LDFLAGS) -o test_icount $(TEST_ICOUNT_OBJS) $(LIBS) - -test_icount_cmds.c: test_icount_cmds.ct - $(MK_CMDS) $(srcdir)/test_icount_cmds.ct - -clean: - $(RM) -f $(PROGS) test_rel_cmds.c test_icount_cmds.c \ - \#* *.s *.o *.a *~ core - -install: - -check: - -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 -# -test_rel.o: $(srcdir)/test_rel.c $(top_srcdir)/lib/et/com_err.h \ - $(top_srcdir)/lib/ss/ss.h $(top_srcdir)/lib/ss/copyright.h \ - $(top_builddir)/lib/ss/ss_err.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 $(top_srcdir)/lib/ext2fs/irel.h \ - $(top_srcdir)/lib/ext2fs/brel.h $(srcdir)/test_rel.h - diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/bma.setup b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/bma.setup deleted file mode 100644 index f47e511c9fc..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/bma.setup +++ /dev/null @@ -1 +0,0 @@ --bma_create test 23 diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.brel b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.brel deleted file mode 100644 index 5117bbfff84..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.brel +++ /dev/null @@ -1,41 +0,0 @@ -test_rel: brel_dump -test_rel: brel_put 2 11 -test_rel: brel_put 1 10 -test_rel: brel_put 3 9 -test_rel: brel_put 1 10 4 128 -test_rel: brel_put 23 12 -test_rel: brel_put 24 13 -brel_put: Invalid argument while calling ext2fs_brel_put
-test_rel: brel_get 24 -brel_get: Invalid argument while calling ext2fs_brel_get
-test_rel: brel_delete 24 -brel_delete: Invalid argument while calling ext2fs_brel_delete
-test_rel: brel_get 5 -brel_get: No such file or directory while calling ext2fs_brel_get
-test_rel: brel_get 3 -Old= 3, New= 9, Owner= 0:0 -test_rel: brel_get 1 -Old= 1, New= 10, Owner= 4:128 -test_rel: brel_start_iter -test_rel: brel_next -Old= 1, New= 10, Owner= 4:128 -test_rel: brel_next -Old= 2, New= 11, Owner= 0:0 -test_rel: brel_next -Old= 3, New= 9, Owner= 0:0 -test_rel: brel_next -No more entries! -test_rel: brel_delete 2 -test_rel: brel_delete 2 -brel_delete: No such file or directory while calling ext2fs_brel_delete
-test_rel: brel_delete 5 -brel_delete: No such file or directory while calling ext2fs_brel_delete
-test_rel: brel_move 1 2 -test_rel: brel_delete 1 -brel_delete: No such file or directory while calling ext2fs_brel_delete
-test_rel: brel_move 1 4 -brel_move: No such file or directory while calling ext2fs_brel_move
-test_rel: brel_move 2 5 -test_rel: brel_dump -Old= 3, New= 9, Owner= 0:0 -Old= 5, New= 10, Owner= 4:128 diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.icount b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.icount deleted file mode 100644 index fedbaaa1992..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.icount +++ /dev/null @@ -1,191 +0,0 @@ -test_icount: validate -Icount structure successfully validated -test_icount: store 0 -usage: store inode counttest_icount: fetch 0 -fetch: Invalid argument while calling ext2fs_icount_fetch
-test_icount: increment 0 -increment: Invalid argument while calling ext2fs_icount_increment
-test_icount: decrement 0 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: store 20001 -usage: store inode counttest_icount: fetch 20001 -fetch: Invalid argument while calling ext2fs_icount_fetch
-test_icount: increment 20001 -increment: Invalid argument while calling ext2fs_icount_increment
-test_icount: decrement 20001 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: validate -Icount structure successfully validated -test_icount: fetch 1 -Count is 0 -test_icount: store 1 1 -test_icount: fetch 1 -Count is 1 -test_icount: store 1 2 -test_icount: fetch 1 -Count is 2 -test_icount: store 1 3 -test_icount: fetch 1 -Count is 3 -test_icount: store 1 1 -test_icount: fetch 1 -Count is 1 -test_icount: store 1 0 -test_icount: fetch 1 -Count is 0 -test_icount: fetch 20000 -Count is 0 -test_icount: store 20000 0 -test_icount: fetch 20000 -Count is 0 -test_icount: store 20000 3 -test_icount: fetch 20000 -Count is 3 -test_icount: store 20000 0 -test_icount: fetch 20000 -Count is 0 -test_icount: store 20000 42 -test_icount: fetch 20000 -Count is 42 -test_icount: store 20000 1 -test_icount: fetch 20000 -Count is 1 -test_icount: store 20000 0 -test_icount: fetch 20000 -Count is 0 -test_icount: get_size -Size of icount is: 5 -test_icount: decrement 2 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: increment 2 -Count is now 1 -test_icount: fetch 2 -Count is 1 -test_icount: increment 2 -Count is now 2 -test_icount: fetch 2 -Count is 2 -test_icount: increment 2 -Count is now 3 -test_icount: fetch 2 -Count is 3 -test_icount: increment 2 -Count is now 4 -test_icount: fetch 2 -Count is 4 -test_icount: decrement 2 -Count is now 3 -test_icount: fetch 2 -Count is 3 -test_icount: decrement 2 -Count is now 2 -test_icount: fetch 2 -Count is 2 -test_icount: decrement 2 -Count is now 1 -test_icount: fetch 2 -Count is 1 -test_icount: decrement 2 -Count is now 0 -test_icount: decrement 2 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: store 3 1 -test_icount: increment 3 -Count is now 2 -test_icount: fetch 3 -Count is 2 -test_icount: decrement 3 -Count is now 1 -test_icount: fetch 3 -Count is 1 -test_icount: decrement 3 -Count is now 0 -test_icount: store 4 0 -test_icount: fetch 4 -Count is 0 -test_icount: increment 4 -Count is now 1 -test_icount: increment 4 -Count is now 2 -test_icount: fetch 4 -Count is 2 -test_icount: decrement 4 -Count is now 1 -test_icount: decrement 4 -Count is now 0 -test_icount: store 4 42 -test_icount: store 4 0 -test_icount: increment 4 -Count is now 1 -test_icount: increment 4 -Count is now 2 -test_icount: increment 4 -Count is now 3 -test_icount: decrement 4 -Count is now 2 -test_icount: decrement 4 -Count is now 1 -test_icount: decrement 4 -Count is now 0 -test_icount: decrement 4 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: decrement 4 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: store 5 4 -test_icount: decrement 5 -Count is now 3 -test_icount: decrement 5 -Count is now 2 -test_icount: decrement 5 -Count is now 1 -test_icount: decrement 5 -Count is now 0 -test_icount: decrement 5 -decrement: Invalid argument while calling ext2fs_icount_increment
-test_icount: get_size -Size of icount is: 105 -test_icount: validate -Icount structure successfully validated -test_icount: store 10 10 -test_icount: store 20 20 -test_icount: store 30 30 -test_icount: store 40 40 -test_icount: store 50 50 -test_icount: store 60 60 -test_icount: store 70 70 -test_icount: store 80 80 -test_icount: store 90 90 -test_icount: store 100 100 -test_icount: store 15 15 -test_icount: store 25 25 -test_icount: store 35 35 -test_icount: store 45 45 -test_icount: store 55 55 -test_icount: store 65 65 -test_icount: store 75 75 -test_icount: store 85 85 -test_icount: store 95 95 -test_icount: dump -10: 10 -15: 15 -20: 20 -25: 25 -30: 30 -35: 35 -40: 40 -45: 45 -50: 50 -55: 55 -60: 60 -65: 65 -70: 70 -75: 75 -80: 80 -85: 85 -90: 90 -95: 95 -100: 100 -test_icount: get_size -Size of icount is: 105 -test_icount: validate -Icount structure successfully validated diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.irel b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.irel deleted file mode 100644 index 9d4443d9f10..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/expect.irel +++ /dev/null @@ -1,62 +0,0 @@ -test_rel: irel_dump -test_rel: irel_put 2 11 3 -test_rel: irel_put 1 10 2 -test_rel: irel_put 3 9 1 -test_rel: irel_add_ref 1 4 128 -test_rel: irel_add_ref 1 5 64 -test_rel: irel_add_ref 1 6 512 -irel_add_ref: No space left on device while calling ext2fs_irel_add_ref
-test_rel: irel_put 1 8 3 -test_rel: irel_add_ref 1 6 512 -test_rel: irel_add_ref 2 4 64 -test_rel: irel_put 23 12 1 -test_rel: irel_put 24 13 1 -irel_put: Invalid argument while calling ext2fs_irel_put
-test_rel: irel_get 24 -irel_get: Invalid argument while calling ext2fs_irel_get
-test_rel: irel_delete 24 -irel_delete: Invalid argument while calling ext2fs_irel_delete
-test_rel: irel_get 3 -Old= 3, New= 9, Original=3, Max_refs=1 -test_rel: irel_get 1 -Old= 1, New= 8, Original=1, Max_refs=3 - 4:128, 5:64, 6:512 -test_rel: irel_start_iter -test_rel: irel_next -Old= 1, New= 8, Original=1, Max_refs=3 - 4:128, 5:64, 6:512 -test_rel: irel_next -Old= 2, New= 11, Original=2, Max_refs=3 - 4:64 -test_rel: irel_next -Old= 3, New= 9, Original=3, Max_refs=1 -test_rel: irel_next -No more entries! -test_rel: irel_delete 2 -test_rel: irel_delete 2 -irel_delete: No such file or directory while calling ext2fs_irel_delete
-test_rel: irel_delete 4 -irel_delete: No such file or directory while calling ext2fs_irel_delete
-test_rel: irel_move 1 2 -test_rel: irel_dump -Old= 2, New= 8, Original=1, Max_refs=3 - 4:128, 5:64, 6:512 -Old= 3, New= 9, Original=3, Max_refs=1 -test_rel: irel_delete 4 -irel_delete: No such file or directory while calling ext2fs_irel_delete
-test_rel: irel_move 1 4 -irel_move: No such file or directory while calling ext2fs_irel_move
-test_rel: irel_move 2 4 -test_rel: irel_dump -Old= 3, New= 9, Original=3, Max_refs=1 -Old= 4, New= 8, Original=1, Max_refs=3 - 4:128, 5:64, 6:512 -test_rel: irel_get_by_orig 3 -Old= 3, New= 9, Original=3, Max_refs=1 -test_rel: irel_get_by_orig 1 -Old= 4, New= 8, Original=1, Max_refs=3 - 4:128, 5:64, 6:512 -test_rel: irel_get_by_orig 5 -irel_get_by_orig: No such file or directory while calling ext2fs_irel_get_by_orig
-test_rel: irel_get_by_orig 2 -irel_get_by_orig: No such file or directory while calling ext2fs_irel_get_by_orig
diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/ima.setup b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/ima.setup deleted file mode 100644 index f4116065abb..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/ima.setup +++ /dev/null @@ -1 +0,0 @@ --ima_create test 23 diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/normal.setup b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/normal.setup deleted file mode 100644 index dfc6c413662..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/normal.setup +++ /dev/null @@ -1 +0,0 @@ --create diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/opt.setup b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/opt.setup deleted file mode 100644 index 79458b0a71c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/opt.setup +++ /dev/null @@ -1 +0,0 @@ --create -i diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.brel b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.brel deleted file mode 100644 index 6605452f746..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.brel +++ /dev/null @@ -1,47 +0,0 @@ -# -# This is the test script for the block relocation table. -# -# Copyright 1997 by Theodore Ts'o. This file may be redistributed -# under the terms of the GNU Public License. -# -# -brel_dump -brel_put 2 11 -brel_put 1 10 -brel_put 3 9 -brel_put 1 10 4 128 -# -# Test boundary cases for brel_put -# -brel_put 23 12 -brel_put 24 13 -# -# Test other boundary cases -# -brel_get 24 -brel_delete 24 -# -# Test getting existing and non-existent entries -# -brel_get 5 -brel_get 3 -brel_get 1 -# -# Test the iterator functions -# -brel_start_iter -brel_next -brel_next -brel_next -brel_next -# -# Test delete and move -# -brel_delete 2 -brel_delete 2 -brel_delete 5 -brel_move 1 2 -brel_delete 1 -brel_move 1 4 -brel_move 2 5 -brel_dump diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.icount b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.icount deleted file mode 100644 index ea611db3eeb..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.icount +++ /dev/null @@ -1,136 +0,0 @@ -# -# This is the test script for the icount abstraction -# -# Copyright 1997 by Theodore Ts'o. This file may be redistributed -# under the terms of the GNU Public License. -# -# -# First let's test the boundary cases for illegal arguments -# -validate -store 0 -fetch 0 -increment 0 -decrement 0 -store 20001 -fetch 20001 -increment 20001 -decrement 20001 -validate -# -# OK, now let's test fetch and store. We also test the boundary cases -# for legal inodes here. -# -fetch 1 -store 1 1 -fetch 1 -store 1 2 -fetch 1 -store 1 3 -fetch 1 -store 1 1 -fetch 1 -store 1 0 -fetch 1 -fetch 20000 -store 20000 0 -fetch 20000 -store 20000 3 -fetch 20000 -store 20000 0 -fetch 20000 -store 20000 42 -fetch 20000 -store 20000 1 -fetch 20000 -store 20000 0 -fetch 20000 -get_size -# -# Time to test increment. First increment from 0 (previously unreferenced) -# -decrement 2 -increment 2 -fetch 2 -increment 2 -fetch 2 -increment 2 -fetch 2 -increment 2 -fetch 2 -decrement 2 -fetch 2 -decrement 2 -fetch 2 -decrement 2 -fetch 2 -decrement 2 -decrement 2 -# -# Store 1 then test... -# -store 3 1 -increment 3 -fetch 3 -decrement 3 -fetch 3 -decrement 3 -# -# Store 0 then test -# -store 4 0 -fetch 4 -increment 4 -increment 4 -fetch 4 -decrement 4 -decrement 4 -# -# Store something, then store 0, then test... -# -store 4 42 -store 4 0 -increment 4 -increment 4 -increment 4 -decrement 4 -decrement 4 -decrement 4 -decrement 4 -decrement 4 -# -# store something, then decrement to zero -# -store 5 4 -decrement 5 -decrement 5 -decrement 5 -decrement 5 -decrement 5 -# -# Test insert -# -get_size -validate -store 10 10 -store 20 20 -store 30 30 -store 40 40 -store 50 50 -store 60 60 -store 70 70 -store 80 80 -store 90 90 -store 100 100 -store 15 15 -store 25 25 -store 35 35 -store 45 45 -store 55 55 -store 65 65 -store 75 75 -store 85 85 -store 95 95 -dump -get_size -validate diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.irel b/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.irel deleted file mode 100644 index 6c338bc334d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_data/test.irel +++ /dev/null @@ -1,69 +0,0 @@ -# -# This is the test script for the inode relocation table. -# -# Copyright 1997 by Theodore Ts'o. This file may be redistributed -# under the terms of the GNU Public License. -# -# -irel_dump -irel_put 2 11 3 -irel_put 1 10 2 -irel_put 3 9 1 -irel_add_ref 1 4 128 -irel_add_ref 1 5 64 -# -# Check to see what happens if we add too many references -# -irel_add_ref 1 6 512 -# -# Try resizing the number of references and retry the add -# -irel_put 1 8 3 -irel_add_ref 1 6 512 -# -irel_add_ref 2 4 64 -# -# Test boundary cases of irel_put -# -irel_put 23 12 1 -irel_put 24 13 1 -# -# Test other boundary cases.... -# -irel_get 24 -irel_delete 24 -# -# Test retrivals -# -irel_get 3 -irel_get 1 -# -# Test the iterator functions -# -irel_start_iter -irel_next -irel_next -irel_next -irel_next -# -# Now try the delete function, on existing and non-existent entries -# -irel_delete 2 -irel_delete 2 -irel_delete 4 -# -# Move tests... -# -irel_move 1 2 -irel_dump -irel_delete 4 -irel_move 1 4 -irel_move 2 4 -# -# Get by orig tests -# -irel_dump -irel_get_by_orig 3 -irel_get_by_orig 1 -irel_get_by_orig 5 -irel_get_by_orig 2 diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount.c b/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount.c deleted file mode 100644 index 588e90f30cb..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount.c +++ /dev/null @@ -1,361 +0,0 @@ -/* - * test_icount.c - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#include <fcntl.h> - -#include <linux/ext2_fs.h> - -#include <et/com_err.h> -#include <ss/ss.h> -#include <ext2fs/ext2fs.h> -#include <ext2fs/irel.h> -#include <ext2fs/brel.h> - -extern ss_request_table test_cmds; - -#include "test_icount.h" - -ext2_filsys test_fs; -ext2_icount_t test_icount; - -/* - * Helper function which assures that the icount structure is valid - */ -static int check_icount(char *request) -{ - if (test_icount) - return 0; - com_err(request, 0, "The icount structure must be allocated."); - return 1; -} - -/* - * Helper function which parses an inode number. - */ -static int parse_inode(const char *request, const char *desc, - const char *str, ino_t *ino) -{ - char *tmp; - - *ino = strtoul(str, &tmp, 0); - if (*tmp) { - com_err(request, 0, "Bad %s - %s", desc, str); - return 1; - } - return 0; -} - -void do_create_icount(int argc, char **argv) -{ - errcode_t retval; - char *progname; - int flags = 0; - ino_t size = 5; - - progname = *argv; - argv++; argc --; - - if (argc && !strcmp("-i", *argv)) { - flags |= EXT2_ICOUNT_OPT_INCREMENT; - argv++; argc--; - } - if (argc) { - if (parse_inode(progname, "icount size", argv[0], &size)) - return; - argv++; argc--; - } -#if 0 - printf("Creating icount... flags=%d, size=%d\n", flags, (int) size); -#endif - retval = ext2fs_create_icount(test_fs, flags, (int) size, - &test_icount); - if (retval) { - com_err(progname, retval, "while creating icount"); - return; - } -} - -void do_free_icount(int argc, char **argv) -{ - if (check_icount(argv[0])) - return; - - ext2fs_free_icount(test_icount); - test_icount = 0; -} - -void do_fetch(int argc, char **argv) -{ - const char *usage = "usage: %s inode"; - errcode_t retval; - ino_t ino; - __u16 count; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (check_icount(argv[0])) - return; - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - retval = ext2fs_icount_fetch(test_icount, ino, &count); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_icount_fetch"); - return; - } - printf("Count is %u\n", count); -} - -void do_increment(int argc, char **argv) -{ - const char *usage = "usage: %s inode"; - errcode_t retval; - ino_t ino; - __u16 count; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (check_icount(argv[0])) - return; - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - retval = ext2fs_icount_increment(test_icount, ino, &count); - if (retval) { - com_err(argv[0], retval, - "while calling ext2fs_icount_increment"); - return; - } - printf("Count is now %u\n", count); -} - -void do_decrement(int argc, char **argv) -{ - const char *usage = "usage: %s inode"; - errcode_t retval; - ino_t ino; - __u16 count; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (check_icount(argv[0])) - return; - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - retval = ext2fs_icount_decrement(test_icount, ino, &count); - if (retval) { - com_err(argv[0], retval, - "while calling ext2fs_icount_increment"); - return; - } - printf("Count is now %u\n", count); -} - -void do_store(int argc, char **argv) -{ - const char *usage = "usage: %s inode count"; - errcode_t retval; - ino_t ino; - ino_t count; - - if (argc < 3) { - printf(usage, argv[0]); - return; - } - if (check_icount(argv[0])) - return; - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - if (parse_inode(argv[0], "count", argv[2], &count)) - return; - if (count > 65535) { - printf("Count too large.\n"); - return; - } - retval = ext2fs_icount_store(test_icount, ino, (__u16) count); - if (retval) { - com_err(argv[0], retval, - "while calling ext2fs_icount_store"); - return; - } -} - -void do_dump(int argc, char **argv) -{ - errcode_t retval; - ino_t i; - __u16 count; - - if (check_icount(argv[0])) - return; - for (i=1; i <= test_fs->super->s_inodes_count; i++) { - retval = ext2fs_icount_fetch(test_icount, i, &count); - if (retval) { - com_err(argv[0], retval, - "while fetching icount for %lu", i); - return; - } - if (count) - printf("%lu: %u\n", i, count); - } -} - -void do_validate(int argc, char **argv) -{ - errcode_t retval; - ino_t size; - - if (check_icount(argv[0])) - return; - retval = ext2fs_icount_validate(test_icount, stdout); - if (retval) { - com_err(argv[0], retval, "while validating icount structure"); - return; - } - printf("Icount structure successfully validated\n"); -} - -void do_get_size(int argc, char **argv) -{ - errcode_t retval; - ino_t size; - - if (check_icount(argv[0])) - return; - size = ext2fs_get_icount_size(test_icount); - printf("Size of icount is: %u\n", size); -} - -static int source_file(const char *cmd_file, int sci_idx) -{ - FILE *f; - char buf[256]; - char *cp; - int exit_status = 0; - int retval; - int noecho; - - if (strcmp(cmd_file, "-") == 0) - f = stdin; - else { - f = fopen(cmd_file, "r"); - if (!f) { - perror(cmd_file); - exit(1); - } - } - setbuf(stdout, NULL); - setbuf(stderr, NULL); - while (!feof(f)) { - if (fgets(buf, sizeof(buf), f) == NULL) - break; - if (buf[0] == '#') - continue; - noecho = 0; - if (buf[0] == '-') { - noecho = 1; - buf[0] = ' '; - } - cp = strchr(buf, '\n'); - if (cp) - *cp = 0; - cp = strchr(buf, '\r'); - if (cp) - *cp = 0; - if (!noecho) - printf("test_icount: %s\n", buf); - retval = ss_execute_line(sci_idx, buf); - if (retval) { - ss_perror(sci_idx, retval, buf); - exit_status++; - } - } - return exit_status; -} - -void main(int argc, char **argv) -{ - int retval; - int sci_idx; - const char *usage = "Usage: test_icount [-R request] [-f cmd_file]"; - char c; - char *request = 0; - int exit_status = 0; - char *cmd_file = 0; - struct ext2_super_block param; - - initialize_ext2_error_table(); - - /* - * Create a sample filesystem structure - */ - memset(¶m, 0, sizeof(struct ext2_super_block)); - param.s_blocks_count = 80000; - param.s_inodes_count = 20000; - retval = ext2fs_initialize("/dev/null", 0, ¶m, - unix_io_manager, &test_fs); - if (retval) { - com_err("/dev/null", retval, "while setting up test fs"); - exit(1); - } - - while ((c = getopt (argc, argv, "wR:f:")) != EOF) { - switch (c) { - case 'R': - request = optarg; - break; - case 'f': - cmd_file = optarg; - break; - default: - com_err(argv[0], 0, usage); - return; - } - } - sci_idx = ss_create_invocation("test_icount", "0.0", (char *) NULL, - &test_cmds, &retval); - if (retval) { - ss_perror(sci_idx, retval, "creating invocation"); - exit(1); - } - - (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &retval); - if (retval) { - ss_perror(sci_idx, retval, "adding standard requests"); - exit (1); - } - if (request) { - retval = 0; - retval = ss_execute_line(sci_idx, request); - if (retval) { - ss_perror(sci_idx, retval, request); - exit_status++; - } - } else if (cmd_file) { - exit_status = source_file(cmd_file, sci_idx); - } else { - ss_listen(sci_idx); - } - - exit(exit_status); -} - diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount.h b/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount.h deleted file mode 100644 index 9678a6885f4..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount.h +++ /dev/null @@ -1,7 +0,0 @@ -void do_create_icount(int argc, char **argv); -void do_free_icount(int argc, char **argv); -void do_fetch(int argc, char **argv); -void do_increment(int argc, char **argv); -void do_decrement(int argc, char **argv); -void do_store(int argc, char **argv); -void do_get_size(int argc, char **argv); diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount_cmds.ct b/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount_cmds.ct deleted file mode 100644 index c3cc6f4018c..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_icount_cmds.ct +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (C) 1997 Theodore Ts'o. This file may be redistributed -# under the terms of the GNU Public License. -# -command_table test_cmds; - -# -# Icount table commands -# -request do_create_icount, "Create an icount structure", - create_icount, create; - -request do_free_icount, "Free an icount structure", - free_icount, free; - -request do_fetch, "Fetch an icount entry", - fetch; - -request do_increment, "Increment an icount entry", - increment, inc; - -request do_decrement, "Decrement an icount entry", - decrement, dec; - -request do_store, "Store an icount entry", - store; - -request do_get_size, "Get the size of the icount structure", - get_size; - -request do_dump, "Dump the icount structure", - dump; - -request do_validate, "Validate the icount structure", - validate, check; - -end; diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel.c b/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel.c deleted file mode 100644 index 2dfb473bc56..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel.c +++ /dev/null @@ -1,762 +0,0 @@ -/* - * test_rel.c - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif -#include <fcntl.h> - -#include <linux/ext2_fs.h> - -#include <et/com_err.h> -#include <ss/ss.h> -#include <ext2fs/ext2fs.h> -#include <ext2fs/irel.h> -#include <ext2fs/brel.h> - -#include "test_rel.h" - -extern ss_request_table test_cmds; - -ext2_irel irel = NULL; -ext2_brel brel = NULL; - -/* - * Helper function which parses an inode number. - */ -static int parse_inode(const char *request, const char *desc, - const char *str, ino_t *ino) -{ - char *tmp; - - *ino = strtoul(str, &tmp, 0); - if (*tmp) { - com_err(request, 0, "Bad %s - %s", desc, str); - return 1; - } - return 0; -} - -/* - * Helper function which parses a block number. - */ -static int parse_block(const char *request, const char *desc, - const char *str, blk_t *blk) -{ - char *tmp; - - *blk = strtoul(str, &tmp, 0); - if (*tmp) { - com_err(request, 0, "Bad %s - %s", desc, str); - return 1; - } - return 0; -} - -/* - * Helper function which assures that a brel table is open - */ -static int check_brel(char *request) -{ - if (brel) - return 0; - com_err(request, 0, "A block relocation table must be open."); - return 1; -} - -/* - * Helper function which assures that an irel table is open - */ -static int check_irel(char *request) -{ - if (irel) - return 0; - com_err(request, 0, "An inode relocation table must be open."); - return 1; -} - -/* - * Helper function which displays a brel entry - */ -static void display_brel_entry(blk_t old, - struct ext2_block_relocate_entry *ent) -{ - printf("Old= %u, New= %u, Owner= %u:%u\n", old, ent->new, - ent->owner.block_ref, ent->offset); -} - -/* - * Helper function which displays an irel entry - */ -static void display_irel_entry(ino_t old, - struct ext2_inode_relocate_entry *ent, - int do_refs) -{ - struct ext2_inode_reference ref; - errcode_t retval; - int first = 1; - - printf("Old= %lu, New= %lu, Original=%lu, Max_refs=%u\n", old, - ent->new, ent->orig, ent->max_refs); - if (!do_refs) - return; - - retval = ext2fs_irel_start_iter_ref(irel, old); - if (retval) { - printf("\tCouldn't get references: %s\n", - error_message(retval)); - return; - } - while (1) { - retval = ext2fs_irel_next_ref(irel, &ref); - if (retval) { - printf("(%s) ", error_message(retval)); - break; - } - if (ref.block == 0) - break; - if (first) { - fputc('\t', stdout); - first = 0; - } else - printf(", "); - printf("%u:%u", ref.block, ref.offset); - } - if (!first) - fputc('\n', stdout); -} - -/* - * These are the actual command table procedures - */ -void do_brel_ma_create(int argc, char **argv) -{ - const char *usage = "Usage: %s name max_blocks\n"; - errcode_t retval; - blk_t max_blk; - - if (argc < 3) { - printf(usage, argv[0]); - return; - } - if (parse_block(argv[0], "max_blocks", argv[2], &max_blk)) - return; - retval = ext2fs_brel_memarray_create(argv[1], max_blk, &brel); - if (retval) { - com_err(argv[0], retval, "while opening memarray brel"); - return; - } - return; -} - -void do_brel_free(int argc, char **argv) -{ - if (check_brel(argv[0])) - return; - ext2fs_brel_free(brel); - brel = NULL; - return; -} - -void do_brel_put(int argc, char **argv) -{ - const char *usage = "usage: %s old_block new_block [owner] [offset]"; - errcode_t retval; - struct ext2_block_relocate_entry ent; - blk_t old, new, offset=0, owner=0; - - if (check_brel(argv[0])) - return; - - if (argc < 3) { - printf(usage, argv[0]); - return; - } - if (parse_block(argv[0], "old block", argv[1], &old)) - return; - if (parse_block(argv[0], "new block", argv[2], &new)) - return; - if (argc > 3 && - parse_block(argv[0], "owner block", argv[3], &owner)) - return; - if (argc > 4 && - parse_block(argv[0], "offset", argv[4], &offset)) - return; - if (offset > 65535) { - printf("Offset too large.\n"); - return; - } - ent.new = new; - ent.offset = (__u16) offset; - ent.flags = 0; - ent.owner.block_ref = owner; - - retval = ext2fs_brel_put(brel, old, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_put"); - return; - } - return; -} - -void do_brel_get(int argc, char **argv) -{ - const char *usage = "%s block"; - errcode_t retval; - struct ext2_block_relocate_entry ent; - blk_t blk; - - if (check_brel(argv[0])) - return; - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (parse_block(argv[0], "block", argv[1], &blk)) - return; - retval = ext2fs_brel_get(brel, blk, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_get"); - return; - } - display_brel_entry(blk, &ent); - return; -} - -void do_brel_start_iter(int argc, char **argv) -{ - errcode_t retval; - - if (check_brel(argv[0])) - return; - - retval = ext2fs_brel_start_iter(brel); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_start_iter"); - return; - } - return; -} - -void do_brel_next(int argc, char **argv) -{ - errcode_t retval; - struct ext2_block_relocate_entry ent; - blk_t blk; - - if (check_brel(argv[0])) - return; - - retval = ext2fs_brel_next(brel, &blk, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_next"); - return; - } - if (blk == 0) { - printf("No more entries!\n"); - return; - } - display_brel_entry(blk, &ent); - return; -} - -void do_brel_dump(int argc, char **argv) -{ - errcode_t retval; - struct ext2_block_relocate_entry ent; - blk_t blk; - - if (check_brel(argv[0])) - return; - - retval = ext2fs_brel_start_iter(brel); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_start_iter"); - return; - } - - while (1) { - retval = ext2fs_brel_next(brel, &blk, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_next"); - return; - } - if (blk == 0) - break; - - display_brel_entry(blk, &ent); - } - return; -} - -void do_brel_move(int argc, char **argv) -{ - const char *usage = "%s old_block new_block"; - errcode_t retval; - blk_t old, new; - - if (check_brel(argv[0])) - return; - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (parse_block(argv[0], "old block", argv[1], &old)) - return; - if (parse_block(argv[0], "new block", argv[2], &new)) - return; - - retval = ext2fs_brel_move(brel, old, new); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_move"); - return; - } - return; -} - -void do_brel_delete(int argc, char **argv) -{ - const char *usage = "%s block"; - errcode_t retval; - blk_t blk; - - if (check_brel(argv[0])) - return; - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (parse_block(argv[0], "block", argv[1], &blk)) - return; - - retval = ext2fs_brel_delete(brel, blk); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_brel_delete"); - return; - } -} - -void do_irel_ma_create(int argc, char **argv) -{ - const char *usage = "Usage: %s name max_inode\n"; - errcode_t retval; - ino_t max_ino; - - if (argc < 3) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "max_inodes", argv[2], &max_ino)) - return; - retval = ext2fs_irel_memarray_create(argv[1], max_ino, &irel); - if (retval) { - com_err(argv[0], retval, "while opening memarray irel"); - return; - } - return; -} - -void do_irel_free(int argc, char **argv) -{ - if (check_irel(argv[0])) - return; - - ext2fs_irel_free(irel); - irel = NULL; - return; -} - -void do_irel_put(int argc, char **argv) -{ - const char *usage = "%s old new max_refs"; - struct ext2_inode_relocate_entry ent; - errcode_t retval; - ino_t old, new, max_refs; - - if (check_irel(argv[0])) - return; - - if (argc < 4) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "old inode", argv[1], &old)) - return; - if (parse_inode(argv[0], "new inode", argv[2], &new)) - return; - if (parse_inode(argv[0], "max_refs", argv[3], &max_refs)) - return; - if (max_refs > 65535) { - printf("max_refs too big\n"); - return; - } - ent.new = new; - ent.max_refs = (__u16) max_refs; - ent.flags = 0; - - retval = ext2fs_irel_put(irel, old, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_put"); - return; - } - return; -} - -void do_irel_get(int argc, char **argv) -{ - const char *usage = "%s inode"; - struct ext2_inode_relocate_entry ent; - errcode_t retval; - ino_t old; - - if (check_irel(argv[0])) - return; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "inode", argv[1], &old)) - return; - - retval = ext2fs_irel_get(irel, old, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_get"); - return; - } - display_irel_entry(old, &ent, 1); - return; -} - -void do_irel_get_by_orig(int argc, char **argv) -{ - const char *usage = "%s orig_inode"; - errcode_t retval; - struct ext2_inode_relocate_entry ent; - ino_t orig, old; - - if (check_irel(argv[0])) - return; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "original inode", argv[1], &orig)) - return; - - retval = ext2fs_irel_get_by_orig(irel, orig, &old, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_get_by_orig"); - return; - } - display_irel_entry(old, &ent, 1); - return; -} - -void do_irel_start_iter(int argc, char **argv) -{ - errcode_t retval; - - if (check_irel(argv[0])) - return; - - retval = ext2fs_irel_start_iter(irel); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_start_iter"); - return; - } - return; -} - -void do_irel_next(int argc, char **argv) -{ - errcode_t retval; - struct ext2_inode_relocate_entry ent; - ino_t old; - - if (check_irel(argv[0])) - return; - - retval = ext2fs_irel_next(irel, &old, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_next"); - return; - } - if (old == 0) { - printf("No more entries!\n"); - return; - } - display_irel_entry(old, &ent, 1); - return; -} - -void do_irel_dump(int argc, char **argv) -{ - errcode_t retval; - struct ext2_inode_relocate_entry ent; - ino_t ino; - - if (check_irel(argv[0])) - return; - - retval = ext2fs_irel_start_iter(irel); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_start_iter"); - return; - } - - while (1) { - retval = ext2fs_irel_next(irel, &ino, &ent); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_next"); - return; - } - if (ino == 0) - break; - - display_irel_entry(ino, &ent, 1); - } - return; -} - -void do_irel_add_ref(int argc, char **argv) -{ - const char *usage = "%s inode block offset"; - errcode_t retval; - struct ext2_inode_reference ref; - blk_t block, offset; - ino_t ino; - - - if (check_irel(argv[0])) - return; - - if (argc < 4) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - if (parse_block(argv[0], "block", argv[2], &block)) - return; - if (parse_block(argv[0], "offset", argv[3], &offset)) - return; - if (offset > 65535) { - printf("Offset too big.\n"); - return; - } - ref.block = block; - ref.offset = offset; - - retval = ext2fs_irel_add_ref(irel, ino, &ref); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_add_ref"); - return; - } - return; -} - -void do_irel_start_iter_ref(int argc, char **argv) -{ - const char *usage = "%s inode"; - errcode_t retval; - ino_t ino; - - if (check_irel(argv[0])) - return; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - retval = ext2fs_irel_start_iter_ref(irel, ino); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_start_iter_ref"); - return; - } - return; -} - -void do_irel_next_ref(int argc, char **argv) -{ - struct ext2_inode_reference ref; - errcode_t retval; - - if (check_irel(argv[0])) - return; - - retval = ext2fs_irel_next_ref(irel, &ref); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_next_ref"); - return; - } - printf("Inode reference: %u:%u\n", ref.block, ref.offset); - return; -} - -void do_irel_move(int argc, char **argv) -{ - const char *usage = "%s old new"; - errcode_t retval; - ino_t old, new; - - if (check_irel(argv[0])) - return; - - if (argc < 3) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "old inode", argv[1], &old)) - return; - if (parse_inode(argv[0], "new inode", argv[2], &new)) - return; - - retval = ext2fs_irel_move(irel, old, new); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_move"); - return; - } - return; -} - -void do_irel_delete(int argc, char **argv) -{ - const char *usage = "%s inode"; - errcode_t retval; - ino_t ino; - - if (check_irel(argv[0])) - return; - - if (argc < 2) { - printf(usage, argv[0]); - return; - } - if (parse_inode(argv[0], "inode", argv[1], &ino)) - return; - - retval = ext2fs_irel_delete(irel, ino); - if (retval) { - com_err(argv[0], retval, "while calling ext2fs_irel_delete"); - return; - } - return; -} - -static int source_file(const char *cmd_file, int sci_idx) -{ - FILE *f; - char buf[256]; - char *cp; - int exit_status = 0; - int retval; - int noecho; - - if (strcmp(cmd_file, "-") == 0) - f = stdin; - else { - f = fopen(cmd_file, "r"); - if (!f) { - perror(cmd_file); - exit(1); - } - } - setbuf(stdout, NULL); - setbuf(stderr, NULL); - while (!feof(f)) { - if (fgets(buf, sizeof(buf), f) == NULL) - break; - if (buf[0] == '#') - continue; - noecho = 0; - if (buf[0] == '-') { - noecho = 1; - buf[0] = ' '; - } - cp = strchr(buf, '\n'); - if (cp) - *cp = 0; - cp = strchr(buf, '\r'); - if (cp) - *cp = 0; - if (!noecho) - printf("test_rel: %s\n", buf); - retval = ss_execute_line(sci_idx, buf); - if (retval) { - ss_perror(sci_idx, retval, buf); - exit_status++; - } - } - return exit_status; -} - -void main(int argc, char **argv) -{ - int retval; - int sci_idx; - const char *usage = "Usage: test_rel [-R request] [-f cmd_file]"; - char c; - char *request = 0; - int exit_status = 0; - char *cmd_file = 0; - - initialize_ext2_error_table(); - - while ((c = getopt (argc, argv, "wR:f:")) != EOF) { - switch (c) { - case 'R': - request = optarg; - break; - case 'f': - cmd_file = optarg; - break; - default: - com_err(argv[0], 0, usage); - return; - } - } - sci_idx = ss_create_invocation("test_rel", "0.0", (char *) NULL, - &test_cmds, &retval); - if (retval) { - ss_perror(sci_idx, retval, "creating invocation"); - exit(1); - } - - (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &retval); - if (retval) { - ss_perror(sci_idx, retval, "adding standard requests"); - exit (1); - } - if (request) { - retval = 0; - retval = ss_execute_line(sci_idx, request); - if (retval) { - ss_perror(sci_idx, retval, request); - exit_status++; - } - } else if (cmd_file) { - exit_status = source_file(cmd_file, sci_idx); - } else { - ss_listen(sci_idx); - } - - exit(exit_status); -} - diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel.h b/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel.h deleted file mode 100644 index be864c9c2e8..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * test_rel.h - * - * Copyright (C) 1997 Theodore Ts'o. - * - * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. - * %End-Header% - */ - - - -void do_brel_ma_create(int argc, char **argv); -void do_brel_free(int argc, char **argv); -void do_brel_put(int argc, char **argv); -void do_brel_get(int argc, char **argv); -void do_brel_start_iter(int argc, char **argv); -void do_brel_next(int argc, char **argv); -void do_brel_dump(int argc, char **argv); -void do_brel_move(int argc, char **argv); -void do_brel_delete(int argc, char **argv); -void do_irel_ma_create(int argc, char **argv); -void do_irel_free(int argc, char **argv); -void do_irel_put(int argc, char **argv); -void do_irel_get(int argc, char **argv); -void do_irel_get_by_orig(int argc, char **argv); -void do_irel_start_iter(int argc, char **argv); -void do_irel_next(int argc, char **argv); -void do_irel_dump(int argc, char **argv); -void do_irel_add_ref(int argc, char **argv); -void do_irel_start_iter_ref(int argc, char **argv); -void do_irel_next_ref(int argc, char **argv); -void do_irel_move(int argc, char **argv); -void do_irel_delete(int argc, char **argv); diff --git a/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel_cmds.ct b/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel_cmds.ct deleted file mode 100644 index 5ed6ae21f47..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/progs/test_rel_cmds.ct +++ /dev/null @@ -1,82 +0,0 @@ -# -# Copyright (C) 1997 Theodore Ts'o. This file may be redistributed -# under the terms of the GNU Public License. -# -command_table test_cmds; - -# -# Block relocation table commands -# - -request do_brel_ma_create, "Open a memory array block relocation table", - brel_ma_create, bma_create; - -request do_brel_free, "Free a block relocation table", - brel_free, bfree; - -request do_brel_put, "Add or modify a block relocation entry", - brel_put, bput; - -request do_brel_get, "Get a block relocation entry", - brel_get, bget; - -request do_brel_start_iter, "Start iterating over the block table", - brel_start_iter, bstart; - -request do_brel_next, "Get the next block relocation entry", - brel_next, bnext; - -request do_brel_dump, "Dump the block relocation table", - brel_dump, bdump; - -request do_brel_move, "Move an entry in the block relocation table", - brel_move, bmove; - -request do_brel_delete, "Delete an entry in the block relocation table", - brel_delete, bdelete, bdel; - -# -# Inode relocation table commands -# - -request do_irel_ma_create, "Open a memory array inode relocation table", - irel_ma_create, ima_create; - -request do_irel_free, "Free an inode relocation table", - irel_free, ifree; - -request do_irel_put, "Add or modify an inode relocation entry", - irel_put, iput; - -request do_irel_get, "Get an inode relocation entry", - irel_get, iget; - -request do_irel_get_by_orig, - "Get an inode relocation entry by its original number", - irel_get_by_orig, igetorig, igeto; - -request do_irel_start_iter, "Start iterating over the inode table", - irel_start_iter, istart; - -request do_irel_next, "Get the next block relocation entry", - irel_next, inext; - -request do_irel_dump, "Dump the inode relocation table", - irel_dump, idump; - -request do_irel_add_ref, "Add a reference to an inode entry", - irel_add_ref, iaddref, iaddr; - -request do_irel_start_iter_ref, "Start iterating over references to an inode", - irel_start_iter_ref, istartref, istartr; - -request do_irel_next_ref, "Get the next reference for an inode entry", - irel_next_ref, inextref, inextr; - -request do_irel_move, "Move an entry in the inode relocation table", - irel_move, imove; - -request do_irel_delete, "Delete an entry in the inode relocation table", - irel_delete, idelete, idel; - -end; diff --git a/gnu/usr.sbin/e2fsprogs/tests/run_e2fsck b/gnu/usr.sbin/e2fsprogs/tests/run_e2fsck deleted file mode 100644 index 91277e1915d..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/run_e2fsck +++ /dev/null @@ -1,73 +0,0 @@ -if [ "$IMAGE"x = x ]; then - IMAGE=$test_dir/image.gz -fi - -if [ "$FSCK_OPT"x = x ]; then - FSCK_OPT=-yf -fi - -if [ "$SECOND_FSCK_OPT"x = x ]; then - SECOND_FSCK_OPT=-yf -fi - -if [ "$OUT1"x = x ]; then - OUT1=$test_name.1.log -fi - -if [ "$OUT2"x = x ]; then - OUT2=$test_name.2.log -fi - -if [ "$EXP1"x = x ]; then - EXP1=$test_dir/expect.1 -fi - -if [ "$EXP2"x = x ]; then - EXP2=$test_dir/expect.2 -fi - -gunzip < $IMAGE > $TMPFILE - -$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1 -status=$? -echo Exit status is $status >> $OUT1.new -sed -e '1d' $OUT1.new > $OUT1 -rm -f $OUT1.new - -if [ "$ONE_PASS_ONLY" != "true" ]; then - $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 - status=$? - echo Exit status is $status >> $OUT2.new - sed -e '1d' $OUT2.new > $OUT2 - rm -f $OUT2.new -fi - -rm $TMPFILE - -if [ "$SKIP_VERIFY" != "true" ] ; then - rm -f $test_name.ok $test_name.failed - cmp -s $OUT1 $EXP1 - status1=$? - if [ "$ONE_PASS_ONLY" != "true" ]; then - cmp -s $OUT2 $EXP2 - status2=$? - else - status2=0 - fi - - if [ "$status1" = 0 -a "$status2" = 0 ] ; then - echo "ok" - touch $test_name.ok - else - echo "failed" - diff -c $EXP1 $OUT1 > $test_name.failed - if [ "$ONE_PASS_ONLY" != "true" ]; then - diff -c $EXP2 $OUT2 >> $test_name.failed - fi - fi -fi - -if [ "$SKIP_CLEANUP" != "true" ] ; then - unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 ONE_PASS_ONLY -fi - diff --git a/gnu/usr.sbin/e2fsprogs/tests/test_config b/gnu/usr.sbin/e2fsprogs/tests/test_config deleted file mode 100644 index e1d2df7eaa0..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/test_config +++ /dev/null @@ -1,21 +0,0 @@ -# -# Test configuration -# - -FSCK=../e2fsck/e2fsck -MKE2FS=../misc/mke2fs -DUMPE2FS=../misc/dumpe2fs -TUNE2FS=../misc/tune2fs -CHATTR=../misc/chattr -LSATTR=../misc/lsattr -DEBUGFS=../debugfs/debugfs -TEST_REL=../tests/progs/test_rel -TEST_ICOUNT=../tests/progs/test_icount -LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss -TMPFILE=./test.img -export LD_LIBRARY_PATH -TZ=GMT -export TZ -LANG=C -export LANG -unset PAGER diff --git a/gnu/usr.sbin/e2fsprogs/tests/test_script.in b/gnu/usr.sbin/e2fsprogs/tests/test_script.in deleted file mode 100644 index fb6a84861a2..00000000000 --- a/gnu/usr.sbin/e2fsprogs/tests/test_script.in +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# Test script for e2fsck -# - -if test "$1"x = x ; then - TESTS=$SRCDIR/[a-zA-Z]_* -else - TESTS= - for i - do - case $i in - [a-zA-Z]) TESTS="$TESTS $SRCDIR/${i}_*" ;; - *) TESTS="$TESTS $SRCDIR/$i" ;; - esac - done -fi - -cmd_dir=$SRCDIR - -if test "$TEST_CONFIG"x = x; then - TEST_CONFIG=$SRCDIR/test_config -fi - -. $TEST_CONFIG - -for test_dir in $TESTS -do - test_name=`echo $test_dir | sed -e 's;.*/;;'` - if [ ! -d $test_dir ] ; then - echo "The test '$test_name' does not exist." - continue; - fi - if [ -f $test_dir/name ]; then - test_description=`cat $test_dir/name` - echo -n "$test_name: $test_description: " - else - echo -n "$test_name: " - fi - if [ -f $test_dir/script ]; then - . $test_dir/script - else - test_base=`echo $test_name | sed -e 's/_.*//'` - default_script=$SRCDIR/defaults/${test_base}_script - if [ -f $default_script ]; then - . $SRCDIR/defaults/${test_base}_script - else - echo "Missing test script!" - fi - fi -done - -num_ok=`ls *.ok 2>/dev/null | wc -l` -num_failed=`ls *.failed 2>/dev/null | wc -l` - -echo "$num_ok tests succeeded $num_failed tests failed" - diff --git a/gnu/usr.sbin/e2fsprogs/version.h b/gnu/usr.sbin/e2fsprogs/version.h deleted file mode 100644 index 593e11acdc7..00000000000 --- a/gnu/usr.sbin/e2fsprogs/version.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * version.h --- controls the version number printed by the e2fs - * programs. - * - * Copyright 1995, 1996, 1997 by Theodore Ts'o. This file may be - * redistributed under the GNU Public License. - */ - -#define E2FSPROGS_VERSION "1.10" -#define E2FSPROGS_DATE "24-Apr-97" |