Import Upstream version 1.45.5

This commit is contained in:
openKylinBot 2022-05-13 20:16:34 +08:00
commit 25e53619ae
2189 changed files with 508453 additions and 0 deletions

237
.gitignore vendored Normal file
View File

@ -0,0 +1,237 @@
autom4te.cache
build
build.profiled
build.static
FILES
^core
*~
patches
Makefile
*.bak
*.diff
*.dSYM
*.o
*.a
*.orig
*.patch
*.pc
*.rej
*.swp
00[0-9][1-9]*.patch
MCONFIG
asm_types.h
config.log
config.status
cscope.*
debugfs/extent_cmds.c
debugfs/debug_cmds.c
debugfs/debugfs
debugfs/debugfs.8
debugfs/extent_cmds.c
debugfs/tst_set_fields
doc/libext2fs.aux
doc/libext2fs.cp
doc/libext2fs.dvi
doc/libext2fs.fn
doc/libext2fs.fns
doc/libext2fs.info
doc/libext2fs.ky
doc/libext2fs.log
doc/libext2fs.pg
doc/libext2fs.toc
doc/libext2fs.tp
doc/libext2fs.vr
e2fsck/crc32table.h
e2fsck/e2fsck
e2fsck/e2fsck.8
e2fsck/e2fsck.conf.5
e2fsck/e2fsck.shared
e2fsck/e2fsck.static
e2fsck/gen_crc32table
e2fsck/prof_err.c
e2fsck/prof_err.h
e2fsck/tst_crc32
e2fsck/tst_problem
e2fsck/tst_refcount
e2fsck/tst_region
e2fsprogs.spec
ext2ed/ext2ed.conf
ext2ed/ext2ed.8
intl/charset.alias
intl/libgnuintl.h
intl/libintl.a
intl/libintl.h
intl/ref-add.sed
intl/ref-del.sed
lib/blkid/blkid.h
lib/blkid/blkid.pc
lib/blkid/blkid_types.h
lib/blkid/libblkid.3
lib/blkid/subdirs
lib/blkid/test_probe
lib/blkid/tests/*.ok
lib/blkid/tests/*.out
lib/blkid/tests/tmp
lib/blkid/tst_cache
lib/blkid/tst_dev
lib/blkid/tst_devname
lib/blkid/tst_devno
lib/blkid/tst_getsize
lib/blkid/tst_probe
lib/blkid/tst_read
lib/blkid/tst_resolve
lib/blkid/tst_save
lib/blkid/tst_tag
lib/blkid/tst_types
lib/config.h
lib/dirpaths.h
lib/e2p/e2p.pc
lib/e2p/subdirs
lib/e2p/tst_feature
lib/e2p/tst_ostype
lib/et/com_err.pc
lib/et/compile_et
lib/et/subdirs
lib/ext2fs/crc32c_table.h
lib/ext2fs/debug_cmds.c
lib/ext2fs/ext2_err.c
lib/ext2fs/ext2_err.et
lib/ext2fs/ext2_err.h
lib/ext2fs/ext2_types.h
lib/ext2fs/ext2fs.pc
lib/ext2fs/extent_cmds.c
lib/ext2fs/gen_crc32ctable
lib/ext2fs/subdirs
lib/ext2fs/tst_badblocks
lib/ext2fs/tst_bitmaps
lib/ext2fs/tst_bitmaps_cmd.c
lib/ext2fs/tst_bitmaps_out
lib/ext2fs/tst_bitops
lib/ext2fs/tst_cmds.c
lib/ext2fs/tst_csum
lib/ext2fs/tst_crc32c
lib/ext2fs/tst_digest_encode
lib/ext2fs/tst_getsectsize
lib/ext2fs/tst_getsize
lib/ext2fs/tst_icount
lib/ext2fs/tst_inline
lib/ext2fs/tst_inline_data
lib/ext2fs/tst_inode_size
lib/ext2fs/tst_iscan
lib/ext2fs/tst_libext2fs
lib/ext2fs/tst_sha256
lib/ext2fs/tst_sha512
lib/ext2fs/tst_super_size
lib/ext2fs/tst_types
lib/quota/subdirs
lib/ss/mk_cmds
lib/ss/ss.pc
lib/ss/ss_err.c
lib/ss/ss_err.h
lib/ss/std_rqs.c
lib/ss/subdirs
lib/ss/test.diff
lib/ss/test_cmd.c
lib/ss/test_out
lib/ss/test_ss
lib/support/prof_err.c
lib/support/prof_err.h
lib/support/subdirs
lib/uuid/subdirs
lib/uuid/tst_uuid
lib/uuid/uuid.3
lib/uuid/uuid.h
lib/uuid/uuid.pc
lib/uuid/uuid_clear.3
lib/uuid/uuid_compare.3
lib/uuid/uuid_copy.3
lib/uuid/uuid_generate.3
lib/uuid/uuid_is_null.3
lib/uuid/uuid_parse.3
lib/uuid/uuid_time
lib/uuid/uuid_time.3
lib/uuid/uuid_types.h
lib/uuid/uuid_unparse.3
misc/badblocks
misc/badblocks.8
misc/base_device
misc/base_device.out
misc/blkid
misc/blkid.8
misc/chattr
misc/chattr.1
misc/default_profile.c
misc/dumpe2fs
misc/dumpe2fs.8
misc/e2freefrag
misc/e2freefrag.8
misc/e2fuzz
misc/e2image
misc/e2image.8
misc/e2initrd_helper
misc/e2label.8
misc/e2mmpstatus
misc/e2mmpstatus.8
misc/e2undo
misc/e2undo.8
misc/e4crypt
misc/e4crypt.8
misc/e4defrag
misc/e4defrag.8
misc/ext4.5
misc/filefrag
misc/filefrag.8
misc/findfs.8
misc/findsuper
misc/fsck
misc/fsck.8
misc/fuse2fs
misc/fuse2fs.1
misc/logsave
misc/logsave.8
misc/lsattr
misc/lsattr.1
misc/mke2fs
misc/mke2fs.8
misc/mke2fs.conf.5
misc/mke2fs.conf
misc/mklost+found
misc/mklost+found.8
misc/prof_err.c
misc/prof_err.h
misc/profile.h
misc/tune2fs
misc/tune2fs.8
misc/uuidd
misc/uuidd.8
misc/uuidgen
misc/uuidgen.1
ncscope.*
parse-types.log
po/Makefile.in
po/POTFILES
public_config.h
resize/resize2fs
resize/resize2fs.8
resize/test_extent
resize/test_extent.out
tags
TAGS
tests/progs/test_icount
tests/progs/test_icount_cmds.c
tests/progs/crcsum
tests/*.ok
tests/*.failed
tests/*.log
tests/*.tmp
tests/*.slow
tests/test_data.tmp
tests/mke2fs.conf
tests/test_script
tests/test_one
util/dirpaths.h
util/gen-tarball
util/install-symlink
util/subst
util/subst.conf
Meta

4
.missing-copyright Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
find . -type f \! -name \*~ \! -exec grep -q Begin-Header \{\} \; -print \
| grep -v ^./build

20
.release-checklist Normal file
View File

@ -0,0 +1,20 @@
1) Do "make depend" if necessary
2) "make check"!!!
3) Use "git log" to assemble release notes.
4) Run "(cd po; make e2fsprogs.pot-update)" to update the translation template.
5) Update files which contain version information
version.h
README
RELEASE-NOTES
e2fsprogs.lsm
e2fsprogs.spec
doc/libext2fs.texinfo (three places)
6) Make source distribution
7) Adjust sizes in e2fsprogs-VER.lsm; rebuild source files; rebuild RPM files

435
ABOUT-NLS Normal file
View File

@ -0,0 +1,435 @@
Notes on the Free Translation Project
*************************************
Free software is going international! The Free Translation Project
is a way to get maintainers of free software, translators, and users all
together, so that will gradually become able to speak many languages.
A few packages already provide translations for their messages.
If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site. But you do _not_
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.
Installers will find here some useful hints. These notes also
explain how users should proceed for getting the programs to use the
available translations. They tell how people wanting to contribute and
work at translations should contact the appropriate team.
When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used. The information can be found in the
`intl/VERSION' file, in internationalized packages.
Quick configuration advice
==========================
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed. So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias, message inheritance, automatic
charset conversion or plural form handling) as the implementation here.
It is also not possible to offer this additional functionality on top
of a `catgets' implementation. Future versions of GNU `gettext' will
very likely convey even more functionality. So it might be a good idea
to change to GNU `gettext' as soon as possible.
So you need _not_ provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.
INSTALL Matters
===============
Some packages are "localizable" when properly installed; the
programs they contain can be made to speak your own native language.
Most such packages use GNU `gettext'. Other packages have their own
ways to internationalization, predating GNU `gettext'.
By default, this package will be installed to allow translation of
messages. It will automatically detect whether the system already
provides the GNU `gettext' functions. If not, the GNU `gettext' own
library will be used. This library is wholly contained within this
package, usually in the `intl/' subdirectory, so prior installation of
the GNU `gettext' package is _not_ required. Installers may use
special options at configuration time for changing the default
behaviour. The commands:
./configure --with-included-gettext
./configure --disable-nls
will respectively bypass any pre-existing `gettext' to use the
internationalizing routines provided within this package, or else,
_totally_ disable translation of messages.
When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this. This might be not what is desirable. You
should use the more recent version of the GNU `gettext' library. I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use
./configure --with-included-gettext
to prevent auto-detection.
The configuration process will not test for the `catgets' function
and therefore it will not be used. The reason is that even an
emulation of `gettext' on top of `catgets' could not provide all the
extensions of the GNU `gettext' library.
Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package. However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.
Using This Package
==================
As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
and `CC' is an ISO 3166 two-letter country code. For example, let's
suppose that you speak German and live in Germany. At the shell
prompt, merely execute `setenv LANG de_DE' (in `csh'),
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
This can be done from your `.login' or `.profile' file, once and for
all.
You might think that the country code specification is redundant.
But in fact, some languages have dialects in different countries. For
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
country code serves to distinguish the dialects.
The locale naming convention of `LL_CC', with `LL' denoting the
language and `CC' denoting the country, is the one use on systems based
on GNU libc. On other systems, some variations of this scheme are
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
locales supported by your system for your country by running the command
`locale -a | grep '^LL''.
Not all programs have translations for all languages. By default, an
English message is shown in place of a nonexistent translation. If you
understand other languages, you can set up a priority list of languages.
This is done through a different environment variable, called
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
for the purpose of message handling, but you still need to have `LANG'
set to the primary language; this is required by other parts of the
system libraries. For example, some Swedish users who would rather
read translations in German than English for when Swedish is not
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
In the `LANGUAGE' environment variable, but not in the `LANG'
environment variable, `LL_CC' combinations can be abbreviated as `LL'
to denote the language's main dialect. For example, `de' is equivalent
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
(Portuguese as spoken in Portugal) in this context.
Translating Teams
=================
For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list. The up-to-date list of
teams can be found at the Free Translation Project's homepage,
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
area.
If you'd like to volunteer to _work_ at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is _not_ the same as the list itself, it has
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members are expected to participate
_actively_ in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation@iro.umontreal.ca' to reach the
coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology in use. Proven linguistic skill are praised more than
programming skill, here.
Available Packages
==================
Languages are not equally supported in all packages. The following
matrix shows the current state of internationalization, as of August
2002. The matrix shows, in regard of each package, for which languages
PO files have been submitted to translation coordination, with a
translation percentage of at least 50%.
Ready PO files be bg ca cs da de el en eo es et fi fr
+----------------------------------------+
a2ps | [] [] [] [] |
ap-utils | |
bash | [] [] [] [] |
bfd | [] [] |
binutils | [] [] |
bison | [] [] [] [] |
clisp | |
clisp | [] [] [] [] |
clisplow | |
cpio | [] [] [] [] |
darkstat | () |
diffutils | [] [] [] [] [] [] |
enscript | [] [] |
error | [] [] [] |
fetchmail | [] () [] [] [] () |
fileutils | [] [] [] [] [] |
findutils | [] [] [] [] [] [] |
flex | [] [] [] [] [] |
gas | [] [] |
gawk | [] [] [] |
gcal | [] [] |
gcc | [] [] |
gettext | [] [] [] [] [] |
gnupg | [] [] [] [] [] [] [] |
gprof | [] [] |
gpsdrive | () () () () () |
grep | [] [] [] [] [] [] [] [] |
gretl | [] |
gthumb | () () () |
hello | [] [] [] [] [] [] [] [] [] |
id-utils | [] [] [] |
indent | [] [] [] [] [] |
jpilot | () [] [] [] |
jwhois | [] [] |
kbd | [] [] [] |
ld | [] [] |
libc | [] [] [] [] [] [] [] [] |
libiconv | [] [] [] [] |
lifelines | () () |
lilypond | [] [] |
lingoteach | [] [] |
lingoteach_lessons| () () |
lynx | [] [] [] [] [] |
m4 | [] [] [] [] [] |
make | [] [] [] [] |
man-db | [] () () [] () () |
mysecretdiary | [] [] [] |
nano | [] () [] [] [] [] |
nano_1_0 | [] () [] [] [] [] |
opcodes | [] [] [] |
parted | [] [] [] [] [] |
ptx | [] [] [] [] [] [] [] |
python | |
recode | [] [] [] [] [] [] |
sed | [] [] [] [] [] [] [] [] [] [] |
sh-utils | [] [] [] [] |
sharutils | [] [] [] [] [] [] [] |
sketch | () [] () |
soundtracker | [] [] [] |
sp | [] |
tar | [] [] [] [] [] [] |
texinfo | [] [] [] [] [] |
textutils | [] [] [] [] [] |
util-linux | [] [] [] [] [] [] |
vorbis-tools | [] |
wastesedge | |
wdiff | [] [] [] [] [] [] |
wget | [] [] [] [] [] [] [] [] [] [] |
+----------------------------------------+
be bg ca cs da de el en eo es et fi fr
0 2 19 10 30 44 9 1 12 44 17 6 53
gl he hr hu id it ja ko lv nb nl nn
+-------------------------------------+
a2ps | () () [] |
ap-utils | |
bash | [] |
bfd | [] |
binutils | [] |
bison | [] [] [] [] |
clisp | |
clisp | [] |
clisplow | |
cpio | [] [] [] [] |
darkstat | |
diffutils | [] [] [] [] [] |
enscript | [] [] |
error | [] |
fetchmail | [] |
fileutils | [] [] [] |
findutils | [] [] [] [] [] [] [] [] |
flex | [] |
gas | |
gawk | [] |
gcal | |
gcc | [] |
gettext | [] [] |
gnupg | [] [] [] [] |
gprof | [] |
gpsdrive | [] () () |
grep | [] [] [] [] [] [] [] |
gretl | |
gthumb | () () |
hello | [] [] [] [] [] [] [] [] [] [] [] [] |
id-utils | [] [] |
indent | [] [] [] [] |
jpilot | () () |
jwhois | [] [] |
kbd | |
ld | |
libc | [] [] [] [] |
libiconv | [] [] [] |
lifelines | |
lilypond | [] |
lingoteach | [] |
lingoteach_lessons| |
lynx | [] [] [] [] |
m4 | [] [] [] [] |
make | [] [] [] [] [] [] |
man-db | () () |
mysecretdiary | [] |
nano | [] [] [] [] |
nano_1_0 | [] [] [] [] [] |
opcodes | [] [] |
parted | [] [] [] |
ptx | [] [] [] [] [] |
python | |
recode | [] [] [] |
sed | [] [] [] [] [] [] [] [] |
sh-utils | [] [] [] |
sharutils | [] [] [] |
sketch | () |
soundtracker | [] [] |
sp | |
tar | [] [] [] [] [] [] |
texinfo | [] [] [] |
textutils | [] [] [] [] |
util-linux | () [] |
vorbis-tools | [] |
wastesedge | |
wdiff | [] [] [] |
wget | [] [] [] [] [] [] |
+-------------------------------------+
gl he hr hu id it ja ko lv nb nl nn
23 9 12 19 16 13 26 9 1 7 19 3
no pl pt pt_BR ru sk sl sv tr uk zh_CN zh_TW
+----------------------------------------------+
a2ps | () () () [] [] [] [] [] | 10
ap-utils | () | 0
bash | [] | 6
bfd | [] [] | 5
binutils | [] [] | 5
bison | [] [] [] [] | 12
clisp | | 0
clisp | | 5
clisplow | | 0
cpio | [] [] [] [] | 12
darkstat | [] [] () () | 2
diffutils | [] [] [] [] [] [] | 17
enscript | [] [] [] [] | 8
error | [] [] [] | 7
fetchmail | () () [] | 6
fileutils | [] [] [] [] [] [] | 14
findutils | [] [] [] [] [] [] [] | 21
flex | [] [] [] | 9
gas | [] | 3
gawk | [] [] | 6
gcal | [] [] | 4
gcc | [] | 4
gettext | [] [] [] [] [] [] | 13
gnupg | [] [] [] | 14
gprof | [] [] | 5
gpsdrive | [] [] | 3
grep | [] [] [] [] [] | 20
gretl | | 1
gthumb | () () [] | 1
hello | [] [] [] [] [] [] [] | 28
id-utils | [] [] [] [] | 9
indent | [] [] [] [] [] | 14
jpilot | () () [] [] | 5
jwhois | [] () () [] [] | 7
kbd | [] [] | 5
ld | [] [] | 4
libc | [] [] [] [] [] [] | 18
libiconv | [] [] [] [] [] | 12
lifelines | [] | 1
lilypond | [] | 4
lingoteach | [] [] | 5
lingoteach_lessons| () | 0
lynx | [] [] [] [] | 13
m4 | [] [] [] [] | 13
make | [] [] [] [] [] | 15
man-db | | 3
mysecretdiary | [] [] [] | 7
nano | [] [] [] [] | 13
nano_1_0 | [] [] [] [] | 14
opcodes | [] [] [] | 8
parted | [] [] [] [] | 12
ptx | [] [] [] [] [] [] [] | 19
python | | 0
recode | [] [] [] [] [] [] | 15
sed | [] [] [] [] [] [] | 24
sh-utils | [] [] | 9
sharutils | [] [] [] [] | 14
sketch | [] () [] | 4
soundtracker | [] | 6
sp | | 1
tar | [] [] [] [] [] [] [] | 19
texinfo | [] [] | 10
textutils | [] [] [] [] [] | 14
util-linux | [] [] [] | 10
vorbis-tools | [] | 3
wastesedge | | 0
wdiff | [] [] [] [] [] | 14
wget | [] [] [] [] [] [] [] [] | 24
+----------------------------------------------+
37 teams no pl pt pt_BR ru sk sl sv tr uk zh_CN zh_TW
68 domains 4 15 2 28 28 12 10 49 43 4 1 9 609
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.
If August 2002 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
matrix with full percentage details can be found at
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
Using `gettext' in new packages
===============================
If you are writing a freely available program and want to
internationalize it you are welcome to use GNU `gettext' in your
package. Of course you have to respect the GNU Library General Public
License which covers the use of the GNU `gettext' library. This means
in particular that even non-free programs can use `libintl' as a shared
library, whereas only free software can use `libintl' as a static
library or use modified versions of `libintl'.
Once the sources are changed appropriately and the setup can handle
to use of `gettext' the only thing missing are the translations. The
Free Translation Project is also available for packages which are not
developed inside the GNU project. Therefore the information given above
applies also for every other Free Software Project. Contact
`translation@iro.umontreal.ca' to make the `.pot' files available to
the translation teams.

28
Android.bp Normal file
View File

@ -0,0 +1,28 @@
// Copyright 2017 The Android Open Source Project
cc_defaults {
name: "e2fsprogs-defaults",
cflags: ["-Wall", "-Werror"],
target: {
darwin: {
// Still has unfixed/unsuppressed warnings.
cflags: ["-Wno-error"],
},
windows: {
cflags: [
"-Wno-typedef-redefinition",
"-Wno-unused-parameter",
"-Wno-unused-variable",
],
},
},
}
subdirs = [
"contrib",
"debugfs",
"e2fsck",
"lib",
"misc",
"resize",
]

52
CleanSpec.mk Normal file
View File

@ -0,0 +1,52 @@
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libext2_uuid_intermediates)
$(call add-clean-step, rm -rf $(TARGET_RECOVERY_OUT)/root/sbin)

69
INSTALL Normal file
View File

@ -0,0 +1,69 @@
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 ELF shared libraries, add the option
--enable-elf-shlibs. If you wish to build profiling libraries, add
the option --enable-profile.
Note that if you are building on an older system (i.e., a 2.4
kernel and/or glibc 2.2), the use of thread local storage will probably
cause programs that use the uuid library to core dump. To disable
thread local storage, use the configure option --disable-tls.
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 like 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.

53
INSTALL.elfbin Normal file
View File

@ -0,0 +1,53 @@
NOTE: This is the ELF version of the binary distribution. If you have
a DLL system, please compile e2fsprogs from sources yourself. (In
fact, in general you're better off compiling e2fsprogs from sources
instead of using precompiled binaries.)
Also please note that these binaries assume the use of the GNU Libc.
If you're still using libc5, you'll need build e2fsprogs from source.
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.13-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 like 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

332
MCONFIG.in Normal file
View File

@ -0,0 +1,332 @@
# Beginning of file MCONFIG
all::
check::
fullcheck::
SHELL = /bin/sh
COMPRESS_EXT = gz bz2 bz Z
prefix = @prefix@
root_prefix = @root_prefix@
exec_prefix = @exec_prefix@
root_bindir = @root_bindir@
root_sbindir = @root_sbindir@
root_libdir = @root_libdir@
datarootdir = @datarootdir@
bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
datadir= @datadir@
localedir = $(datadir)/locale
root_sysconfdir= @root_sysconfdir@
includedir = @includedir@
mandir = @mandir@
man1dir = $(mandir)/man1
man3dir = $(mandir)/man3
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
infodir = @infodir@
datadir = @datadir@
pkgconfigdir = $(libdir)/pkgconfig
pkglibdir = $(libdir)/e2fsprogs
HAVE_UDEV = @have_udev@
UDEV_RULES_DIR = @pkg_udev_rules_dir@
HAVE_CROND = @have_crond@
CROND_DIR = @crond_dir@
HAVE_SYSTEMD = @have_systemd@
SYSTEMD_SYSTEM_UNIT_DIR = @systemd_system_unit_dir@
@SET_MAKE@
@ifGNUmake@ V =
@ifGNUmake@ ifeq ($(strip $(V)),)
@ifGNUmake@ # E = @echo
@ifGNUmake@ # ES = echo
@ifGNUmake@ # Q = @
@ifGNUmake@ E = @E@
@ifGNUmake@ ES = @ES@
@ifGNUmake@ Q = @Q@
@ifGNUmake@ else
@ifGNUmake@ E = @\#
@ifGNUmake@ ES = \#
@ifGNUmake@ Q =
@ifGNUmake@ endif
@ifNotGNUmake@ E = @E@
@ifNotGNUmake@ ES = @ES@
@ifNotGNUmake@ Q = @Q@
@ifGNUmake@ CHECK=sparse
@ifGNUmake@ CHECK_OPTS=-Wsparse-all -Wno-transparent-union -Wno-return-void -Wno-undef -Wno-non-pointer-null
@ifGNUmake@ CPPCHECK=cppcheck
@ifGNUmake@ CPPCHECK_OPTS=--force --enable=all --quiet
@ifGNUmake@ ifeq ("$(C)", "2")
@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS) -Wbitwise -D__CHECK_ENDIAN__
@ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
@ifGNUmake@ else
@ifGNUmake@ ifeq ("$(C)", "1")
@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS)
@ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
@ifGNUmake@ else
@ifGNUmake@ CHECK_CMD=@true
@ifGNUmake@ CPPCHECK_CMD=@true
@ifGNUmake@ endif
@ifGNUmake@ endif
@ifNotGNUmake@ CHECK_CMD=true
@ifNotGNUmake@ CPPCHECK_CMD=true
SANITIZER_CFLAGS = @lto_cflags@ @ubsan_cflags@ @addrsan_cflags@ @threadsan_cflags@
SANITIZER_LDFLAGS = @lto_ldflags@ @ubsan_ldflags@ @addrsan_ldflags@ @threadsan_ldflags@
CC = @CC@
BUILD_CC = @BUILD_CC@
CFLAGS = @CFLAGS@
CFLAGS_SHLIB = @CFLAGS_SHLIB@
CFLAGS_STLIB = @CFLAGS_STLIB@
CPPFLAGS = @INCLUDES@
ALL_CFLAGS = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
ALL_CFLAGS_SHLIB = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS_SHLIB) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
ALL_CFLAGS_STLIB = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS_STLIB) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
LDFLAGS = $(SANITIZER_LDFLAGS) @LDFLAGS@
LDFLAGS_SHLIB = $(SANITIZER_LDFLAGS) @LDFLAGS_SHLIB@
ALL_LDFLAGS = $(LDFLAGS) @LDFLAG_DYNAMIC@
LDFLAGS_STATIC = $(SANITIZER_LDFLAGS) @LDFLAGS_STATIC@
BUILD_CFLAGS = $(SANITIZER_CFLAGS) @BUILD_CFLAGS@
BUILD_LDFLAGS = $(SANITIZER_LDFLAGS) @BUILD_LDFLAGS@
RDYNAMIC = @RDYNAMIC@
LINK_BUILD_FLAGS = @LINK_BUILD_FLAGS@
LINK_INSTALL_FLAGS = @LINK_INSTALL_FLAGS@
RM = @RM@
LN = @LN@
LN_S = @LN_S@
MV = @MV@
CP = @CP@
CHMOD = @CHMOD@
AR = @AR@
AWK = @AWK@
SED = @SED@
PERL = @PERL@
RANLIB = @RANLIB@
STRIP = @STRIP@
LD = $(PURE) @CC@
ARUPD = $(AR) r
ARGEN = $(AR) rc
LDCONFIG = @LDCONFIG@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
MKDIR_P = @MKDIR_P@
#
# Library definitions
#
LIB = $(top_builddir)/lib
LIBSS = $(LIB)/libss@LIB_EXT@ @PRIVATE_LIBS_CMT@ @DLOPEN_LIB@
LIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@ @PRIVATE_LIBS_CMT@ @SEM_INIT_LIB@
LIBE2P = $(LIB)/libe2p@LIB_EXT@
LIBEXT2FS = $(LIB)/libext2fs@LIB_EXT@
LIBUUID = @LIBUUID@ @SOCKET_LIB@
LIBMAGIC = @MAGIC_LIB@
LIBFUSE = @FUSE_LIB@
LIBSUPPORT = $(LIBINTL) $(LIB)/libsupport@STATIC_LIB_EXT@
LIBBLKID = @LIBBLKID@ @PRIVATE_LIBS_CMT@ $(LIBUUID)
LIBINTL = @LIBINTL@
SYSLIBS = @LIBS@
DEPLIBSS = $(LIB)/libss@LIB_EXT@
DEPLIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@
DEPLIBUUID = @DEPLIBUUID@
DEPLIBSUPPORT = $(LIB)/libsupport@STATIC_LIB_EXT@
DEPLIBBLKID = @DEPLIBBLKID@ @PRIVATE_LIBS_CMT@ $(DEPLIBUUID)
TESTENV = LD_LIBRARY_PATH="$(LIB):$${LD_LIBRARY_PATH}" DYLD_LIBRARY_PATH="$(LIB):$${DYLD_LIBRARY_PATH}"
STATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@ @DLOPEN_LIB@
STATIC_LIBCOM_ERR = $(LIB)/libcom_err@STATIC_LIB_EXT@ @SEM_INIT_LIB@
STATIC_LIBE2P = $(LIB)/libe2p@STATIC_LIB_EXT@
STATIC_LIBEXT2FS = $(LIB)/libext2fs@STATIC_LIB_EXT@
STATIC_LIBUUID = @STATIC_LIBUUID@ @SOCKET_LIB@
STATIC_LIBSUPPORT = $(LIBINTL) $(LIBSUPPORT)
STATIC_LIBBLKID = @STATIC_LIBBLKID@ $(STATIC_LIBUUID)
DEPSTATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@
DEPSTATIC_LIBCOM_ERR = $(LIB)/libcom_err@STATIC_LIB_EXT@
DEPSTATIC_LIBUUID = @DEPSTATIC_LIBUUID@
DEPSTATIC_LIBSUPPORT = $(DEPLIBSUPPORT)
DEPSTATIC_LIBBLKID = @DEPSTATIC_LIBBLKID@ $(DEPSTATIC_LIBUUID)
PROFILED_LIBSS = $(LIB)/libss@PROFILED_LIB_EXT@ @DLOPEN_LIB@
PROFILED_LIBCOM_ERR = $(LIB)/libcom_err@PROFILED_LIB_EXT@ @SEM_INIT_LIB@
PROFILED_LIBE2P = $(LIB)/libe2p@PROFILED_LIB_EXT@
PROFILED_LIBEXT2FS = $(LIB)/libext2fs@PROFILED_LIB_EXT@
PROFILED_LIBUUID = @PROFILED_LIBUUID@ @SOCKET_LIB@
PROFILED_LIBSUPPORT = $(LIBINTL) $(LIB)/libsupport@PROFILED_LIB_EXT@
PROFILED_LIBBLKID = @PROFILED_LIBBLKID@ $(PROFILED_LIBUUID)
DEPPROFILED_LIBSS = $(LIB)/libss@PROFILED_LIB_EXT@
DEPPROFILED_LIBCOM_ERR = $(LIB)/libcom_err@PROFILED_LIB_EXT@
DEPPROFILED_LIBUUID = @PROFILED_LIBUUID@
DEPPROFILED_LIBSUPPORT = $(PROFILED_LIBSUPPORT)
DEPPROFILED_LIBBLKID = @PROFILED_LIBBLKID@ $(DEPPROFILED_LIBUUID)
#
# A fast substitution command for fixing up man pages, shell scripts, etc.
#
SUBST_CONF=$(top_builddir)/util/subst.conf
SUBSTITUTE= $(top_builddir)/util/subst -f $(SUBST_CONF)
SUBSTITUTE_UPTIME= $(top_builddir)/util/subst -t -f $(SUBST_CONF)
DEP_SUBSTITUTE= $(top_builddir)/util/subst $(SUBST_CONF)
$(top_builddir)/util/subst:
cd $(top_builddir)/util ; $(MAKE) subst
#
# Script for generating utf8data.h
#
MKUTF8DATA=$(top_builddir)/util/mkutf8data
$(top_builddir)/util/mkutf8data:
$(MAKE) -C $(top_builddir)/util mkutf8data
#
# Script for installing symlinks (for shared libraries)
#
$(top_builddir)/util/install-symlink: $(top_srcdir)/util/install-symlink.in \
$(top_builddir)/config.status
cd $(top_builddir); CONFIG_FILES=util/install-symlink ./config.status
chmod +x $(top_builddir)/util/install-symlink
$(top_builddir)/util/symlinks:
cd $(top_builddir)/util ; $(MAKE) symlinks
INSTALL_SYMLINK = /bin/sh $(top_builddir)/util/install-symlink \
@SYMLINK_RELATIVE@ \
--symlinks=$(top_builddir)/util/symlinks
DEP_INSTALL_SYMLINK = $(top_builddir)/util/install-symlink \
$(top_builddir)/util/symlinks
#
# Warning flags
#
# Run make gcc-wall to do a build with warning messages.
#
#
WFLAGS= -std=gnu99 -D_XOPEN_SOURCE=600 -D_GNU_SOURCE $(WFLAGS_EXTRA) \
-Wall -W -Wwrite-strings -Wpointer-arith \
-Wcast-qual -Wcast-align -Wno-variadic-macros \
-Wstrict-prototypes -Wmissing-prototypes \
-Wformat-security -Wformat-nonliteral \
-Wmissing-format-attribute -O2 -Wstrict-aliasing \
-Wnested-externs -Winline -DNO_INLINE_FUNCS -Wshadow \
-UENABLE_NLS
gcc-wall-new:
($(MAKE) CFLAGS_WARN="$(WFLAGS)" > /dev/null) 2>&1
gcc-wall:
$(MAKE) clean > /dev/null
$(MAKE) gcc-wall-new
static-check:
($(MAKE) C=1 V=1 CFLAGS="$(ALL_CFLAGS) $(WFLAGS)") 2>&1
static-check-all:
$(MAKE) clean > /dev/null
$(MAKE) static-check
#
# 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
#
# Autoconf magic...
#
DEP_LIB_MAKEFILES = $(top_srcdir)/lib/Makefile.library \
$(top_srcdir)/lib/Makefile.elf-lib \
$(top_srcdir)/lib/Makefile.bsd-lib \
$(top_srcdir)/lib/Makefile.darwin-lib \
$(top_srcdir)/lib/Makefile.solaris-lib \
$(top_srcdir)/lib/Makefile.profile
$(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/config.h: $(top_srcdir)/lib/config.h.in \
$(top_builddir)/config.status
cd $(top_builddir); CONFIG_FILES=lib/config.h ./config.status
$(top_builddir)/lib/dirpaths.h: $(DEP_SUBSTITUTE) $(top_srcdir)/lib/dirpaths.h.in
$(E) " SUBST $@"
$(Q) $(SUBSTITUTE) $(top_srcdir)/lib/dirpaths.h.in $@
$(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
$(top_builddir)/util/subst.conf: $(top_srcdir)/util/subst.conf.in \
$(top_builddir)/config.status
cd $(top_builddir); CONFIG_FILES=util/subst.conf ./config.status
Makefile: $(srcdir)/Makefile.in $(top_builddir)/MCONFIG \
$(DEP_MAKEFILE) $(top_builddir)/config.status
cd $(top_builddir); CONFIG_FILES=$(my_dir)/Makefile ./config.status
@MAINTAINER_CMT@$(top_srcdir)/configure: $(top_srcdir)/configure.ac
@MAINTAINER_CMT@ cd $(top_srcdir) && autoheader && autoconf
coverage.txt: Makefile $(SRCS)
if test -n "$(SRCS)"; then \
gcov -s $(top_srcdir) -o . $(SRCS) > coverage.txt 2>&1 ; \
fi
clean::
$(RM) -f *.gcda *.gcov *.gcno coverage.txt
#
# Make depend magic...
#
.depend: Makefile $(SRCS) $(top_srcdir)/depfix.sed $(top_srcdir)/wordwrap.pl
if test -n "$(SRCS)" ; then \
$(CC) -M $(ALL_CFLAGS) $(DEPEND_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' \
-e '/^ *\\$$/d' | \
$(PERL) $(top_srcdir)/wordwrap.pl > .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; \
if cmp -s $(srcdir)/Makefile.in $(srcdir)/Makefile.in.new ; then \
$(RM) $(srcdir)/Makefile.in.new ; \
else \
$(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \
$(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \
fi ; else :; fi
# End of file MCONFIG

163
Makefile.in Normal file
View File

@ -0,0 +1,163 @@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
top_builddir = .
my_dir = .
INSTALL = @INSTALL@
@MCONFIG@
% : %.sh
@RESIZER_CMT@RESIZE_DIR= resize
@DEBUGFS_CMT@DEBUGFS_DIR= debugfs
@UUID_CMT@UUID_LIB_SUBDIR= lib/uuid
@BLKID_CMT@BLKID_LIB_SUBDIR= lib/blkid
@E2SCRUB_CMT@E2SCRUB_DIR= scrub
@ALL_CMT@SUPPORT_LIB_SUBDIR= lib/support
@ALL_CMT@E2P_LIB_SUBDIR= lib/e2p
@ALL_CMT@EXT2FS_LIB_SUBDIR= lib/ext2fs
LIB_SUBDIRS=lib/et lib/ss $(E2P_LIB_SUBDIR) $(UUID_LIB_SUBDIR) \
$(BLKID_LIB_SUBDIR) $(SUPPORT_LIB_SUBDIR) $(EXT2FS_LIB_SUBDIR) intl
PROG_SUBDIRS=e2fsck $(DEBUGFS_DIR) misc $(RESIZE_DIR) tests/progs po \
$(E2SCRUB_DIR)
SUBDIRS=util $(LIB_SUBDIRS) $(PROG_SUBDIRS) tests
SUBS= util/subst.conf lib/config.h $(top_builddir)/lib/dirpaths.h \
lib/ext2fs/ext2_types.h lib/blkid/blkid_types.h lib/uuid/uuid_types.h
TAR=tar
all:: subs
$(MAKE) libs
@ALL_CMT@ $(MAKE) progs
@ALL_CMT@ $(MAKE) docs
subs: $(DEP_SUBSTITUTE)
@for i in $(SUBS) ; do if test -d `dirname $$i` ; \
then $(MAKE) $$i || exit $$? ; fi ; done
@(if test -d lib/et ; then cd lib/et && $(MAKE) compile_et; fi)
@(if test -d lib/ext2fs ; then cd lib/ext2fs && $(MAKE) ext2_err.h; fi)
@(if test -d lib/support ; then cd lib/support && $(MAKE) prof_err.h; fi)
progs: all-progs-recursive
libs: all-libs-recursive
all-progs-recursive all-libs-recursive:: subs
rpm:
sh contrib/build-rpm
docs:
-@test -d doc && cd doc && $(MAKE) libext2fs.info
install-doc-libs:
-@test -d doc && cd doc && $(MAKE) install-doc-libs
uninstall-doc-libs:
-@test -d doc && cd doc && $(MAKE) uninstall-doc-libs
clean-doc:
-@test -d doc && cd doc && $(MAKE) clean
distclean-doc:
-test -d doc && cd doc && $(MAKE) distclean
install: subs all-libs-recursive install-progs-recursive \
install-shlibs-libs-recursive install-doc-libs
@SUBSET_CMT@ $(MAKE) install-libs
install-strip: subs all-libs-recursive install-strip-progs-recursive \
install-shlibs-strip-libs-recursive install-doc-libs
uninstall: uninstall-progs-recursive uninstall-shlibs-libs-recursive uninstall-doc-libs
install-libs: install-libs-recursive
uninstall-libs: uninstall-libs-recursive
coverage.txt: coverage.txt-recursive
check-recursive: all
TAGS clean-recursive distclean-recursive depend-recursive fullcheck-recursive \
check-recursive mostlyclean-recursive realclean-recursive \
coverage.txt-recursive:
@for subdir in $(SUBDIRS); do \
if test -d $$subdir ; then \
target=`echo $@|$(SED) 's/-recursive//'`; \
echo making $$target in $$subdir; \
(cd $$subdir && $(MAKE) $$target) || exit 1; \
fi ; \
done
all-progs-recursive install-progs-recursive install-strip-progs-recursive \
uninstall-progs-recursive coverage.txt-progs-recursive:: all-libs-recursive
@ALL_CMT@all-progs-recursive install-progs-recursive install-strip-progs-recursive \
@ALL_CMT@ uninstall-progs-recursive coverage.txt-progs-recursive:: all-libs-recursive
@ALL_CMT@ @for subdir in $(PROG_SUBDIRS); do \
@ALL_CMT@ if test -d $$subdir ; then \
@ALL_CMT@ target=`echo $@|$(SED) 's/-progs-recursive//'`; \
@ALL_CMT@ echo making $$target in $$subdir; \
@ALL_CMT@ (cd $$subdir && $(MAKE) $$target) || exit 1; \
@ALL_CMT@ fi ; \
@ALL_CMT@ done
all-libs-recursive install-libs-recursive install-strip-libs-recursive \
uninstall-libs-recursive install-shlibs-libs-recursive \
install-shlibs-strip-libs-recursive uninstall-shlibs-libs-recursive \
coverage.txt-libs-recursive::
@for subdir in $(LIB_SUBDIRS); do \
if test -d $$subdir ; then \
target=`echo $@|$(SED) 's/-libs-recursive//'`; \
echo making $$target in $$subdir; \
(cd $$subdir && $(MAKE) $$target) || exit 1; \
fi ; \
done
mostlyclean: mostlyclean-recursive mostlyclean-local
clean:: clean-recursive clean-local clean-doc
$(RM) -f $(SUBS)
distclean: distclean-doc distclean-recursive
$(RM) -rf autom4te.cache ext2ed/Makefile po/stamp-po \
asm_types.h config.log public_config.h parse-types.log
$(MAKE) distclean-local
realclean: realclean-recursive realclean-local
depend:: depend-recursive
lib/ext2fs/ext2_types.h: $(DEP_SUBSTITUTE) asm_types.h \
$(srcdir)/lib/ext2fs/ext2_types.h.in
cd $(top_builddir); CONFIG_FILES=./lib/ext2fs/ext2_types.h ./config.status
lib/blkid/blkid_types.h: $(DEP_SUBSTITUTE) asm_types.h \
$(srcdir)/lib/blkid/blkid_types.h.in
cd $(top_builddir); CONFIG_FILES=./lib/blkid/blkid_types.h ./config.status
lib/uuid/uuid_types.h: $(DEP_SUBSTITUTE) asm_types.h \
$(srcdir)/lib/uuid/uuid_types.h.in
cd $(top_builddir); CONFIG_FILES=./lib/uuid/uuid_types.h ./config.status
mostlyclean-local:
$(RM) -f \#* *~ *.orig core MAKELOG
clean-local: mostlyclean-local
distclean-local: clean-local
$(RM) -f $(SUBS) $(SUBST_CONF) \
config.status config.log config.cache MCONFIG Makefile \
$(srcdir)/TAGS $(srcdir)/Makefile.in.old
realclean-local: distclean-local
$(RM) -f configure
check:: all check-recursive
fullcheck:: all fullcheck-recursive

849
NOTICE Normal file
View File

@ -0,0 +1,849 @@
This package, the EXT2 filesystem utilities, are made available under
the GNU Public License version 2, with the exception of the lib/ext2fs
and lib/e2p libraries, which are made available under the GNU Library
General Public License Version 2, the lib/uuid library which is made
available under a BSD-style license and the lib/et and lib/ss
libraries which are made available under an MIT-style license. Please
see lib/uuid/COPYING for more details for the license for the files
comprising the libuuid library, and the source file headers of the
libet and libss libraries for more information.
The most recent officially distributed version can be found at
http://e2fsprogs.sourceforge.net. 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 (i.e., either
using the "WIP" test distributions or one from the hg or git
repository from the development branch, please contact me
(tytso@mit.edu) before you ship. The release schedules for this
package are flexible, if you give me enough lead time.
Theodore Ts'o
23-June-2007
----------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 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 Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision 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 generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
----------------------------------------------------------------------
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision 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 generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

19
README Normal file
View File

@ -0,0 +1,19 @@
This is the new version (1.45.5) of the second extended file
system management programs.
From time to time, I release new versions of e2fsprogs, to fix
bugs and to make the utilities more robust. You can always find
information about the latest version at the the e2fsprogs web page,
which is:
http://e2fsprogs.sourceforge.net
The INSTALL file has instructions on building and installing
e2fsprogs. Provisions for building Red Hat RPMs and Debian dpkg files
are supplied as well.
In case of bugs in these programs, please contact Ted Ts'o at
tytso@mit.edu or tytso@alum.mit.edu. See the e2fsck man page for
suggestions of what sort of information to include when submitting bug
reports for these programs.

1
RELEASE-NOTES Symbolic link
View File

@ -0,0 +1 @@
doc/RelNotes/v1.45.5.txt

35
SHLIBS Normal file
View File

@ -0,0 +1,35 @@
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

39
SUBMITTING-PATCHES Normal file
View File

@ -0,0 +1,39 @@
Like the Linux kernel, submitted e2fsprogs patches now require the
following "sign-off" procedure:
The sign-off is a simple line at the end of the explanation for the
patch, which certifies that you wrote it or otherwise have the right to
pass it on as a open-source patch. The rules are pretty simple: if you
can certify the below:
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
then you just add a line saying
Signed-off-by: Random J Developer <random@developer.example.org>

178
acinclude.m4 Normal file
View File

@ -0,0 +1,178 @@
# from http://autoconf-archive.cryp.to/ax_tls.html
#
# This was licensed under the GPL with the following exception:
#
# As a special exception, the respective Autoconf Macro's copyright
# owner gives unlimited permission to copy, distribute and modify the
# configure scripts that are the output of Autoconf when processing
# the Macro. You need not follow the terms of the GNU General Public
# License when using or distributing such scripts, even though
# portions of the text of the Macro appear in them. The GNU General
# Public License (GPL) does govern all other use of the material that
# constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the
# Autoconf Macro released by the Autoconf Macro Archive. When you make
# and distribute a modified version of the Autoconf Macro, you may
# extend this special exception to the GPL to apply to your modified
# version as well.
#
AC_DEFUN([AX_TLS], [
AC_MSG_CHECKING(for thread local storage (TLS) class)
AC_CACHE_VAL(ac_cv_tls, [
ax_tls_keywords="__thread __declspec(thread) none"
for ax_tls_keyword in $ax_tls_keywords; do
case $ax_tls_keyword in
none) ac_cv_tls=none ; break ;;
*)
AC_TRY_COMPILE(
[#include <stdlib.h>
static void
foo(void) {
static ] $ax_tls_keyword [ int bar;
exit(1);
}],
[],
[ac_cv_tls=$ax_tls_keyword ; break],
ac_cv_tls=none
)
esac
done
])
if test "$ac_cv_tls" != "none"; then
dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here])
AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
fi
AC_MSG_RESULT($ac_cv_tls)
])
# ===========================================================================
# http://www.nongnu.org/autoconf-archive/check_gnu_make.html
# ===========================================================================
#
# SYNOPSIS
#
# CHECK_GNU_MAKE()
#
# DESCRIPTION
#
# This macro searches for a GNU version of make. If a match is found, the
# makefile variable `ifGNUmake' is set to the empty string, otherwise it
# is set to "#". This is useful for including a special features in a
# Makefile, which cannot be handled by other versions of make. The
# variable _cv_gnu_make_command is set to the command to invoke GNU make
# if it exists, the empty string otherwise.
#
# Here is an example of its use:
#
# Makefile.in might contain:
#
# # A failsafe way of putting a dependency rule into a makefile
# $(DEPEND):
# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
#
# CHECK_GNU_MAKE()
# AC_OUTPUT(Makefile)
#
# Then perhaps to cause gnu make to override any other make, we could do
# something like this (note that GNU make always looks for GNUmakefile
# first):
#
# if ! test x$_cv_gnu_make_command = x ; then
# mv Makefile GNUmakefile
# echo .DEFAULT: > Makefile ;
# echo \ $_cv_gnu_make_command \$@ >> Makefile;
# fi
#
# Then, if any (well almost any) other make is called, and GNU make also
# exists, then the other make wraps the GNU make.
#
# LICENSE
#
# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
#
# Note: Modified by Ted Ts'o to add @ifNotGNUMake@
AC_DEFUN(
[CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
_cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
if test -n "$FORCE_NATIVE_MAKE" ; then
MAKES="make"
else
MAKES="make gmake gnumake"
fi
for a in "$MAKE" $MAKES ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
) ;
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
if test "x$_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
ifNotGNUmake='#' ;
else
ifGNUmake='#' ;
ifNotGNUmake='' ;
AC_MSG_RESULT("Not found");
fi
AC_SUBST(ifGNUmake)
AC_SUBST(ifNotGNUmake)
] )
# AX_CHECK_MOUNT_OPT: an autoconf macro to check for generic filesystem-
# agnostic 'mount' options. Written by Nicholas Clark. Looks for constants in
# sys/mount.h to predict whether the 'mount' utility will support a specific
# mounting option.
#
# This macro can be used to check for the presence of 'nodev' (or other mount
# options), which isn't uniformly implemented in the BSD family at the time of
# this writing. Tested on FreeBSD, NetBSD, OpenBSD, and Linux.
#
# Usage:
#
# AX_CHECK_MOUNT_OPT(option)
#
# Defines HAVE_MOUNT_$OPTION (in uppercase) if the option exists, and sets
# ac_cv_mount_$option (in original case) otherwise.
#
# Copyright (c) 2018 Nicholas Clark <nicholas.clark@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty or attribution requirement.
AC_DEFUN([AX_CHECK_MOUNT_OPT], [__AX_CHECK_MOUNT_OPT(m4_tolower([$1]),m4_toupper([$1]))])
AC_DEFUN([__AX_CHECK_MOUNT_OPT],
[
AS_ECHO_N("checking for mount '$1' option... ")
AC_TRY_COMPILE(
[#include <sys/mount.h>],
[void *temp = (void *)(MS_$2); (void) temp;],
[AC_DEFINE(HAVE_MOUNT_$2, 1, [Define to 1 if mount supports $1.])
AS_VAR_SET(ac_cv_mount_$1, yes)
AS_ECHO("yes")],
[AC_TRY_COMPILE(
[#include <sys/mount.h>],
[void *temp = (void *)(MNT_$2); (void) temp;],
[AC_DEFINE(HAVE_MOUNT_$2, 1, [Define to 1 if mount supports $1.])
AS_VAR_SET(ac_cv_mount_$1, yes)
AS_ECHO("yes")],
[AS_VAR_SET(ac_cv_mount_$1, no)
AS_ECHO("no")]
)]
)
])

4330
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

1667
config/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

684
config/config.rpath Executable file
View File

@ -0,0 +1,684 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2014 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a '.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's _LT_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
;;
icc* | ifort*)
wl='-Wl,'
;;
lf95*)
wl='-Wl,'
;;
nagfor*)
wl='-Wl,-Wl,,'
;;
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
xl* | bgxl* | bgf* | mpixl*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ F* | *Sun*Fortran*)
wl=
;;
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
newsos6)
;;
*nto* | *qnx*)
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
case $cc_basename in
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
wl='-Qoption ld '
;;
*)
wl='-Wl,'
;;
esac
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
wl='-Wl,'
;;
sysv4*MP*)
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
wl='-Wl,'
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix[3-9]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
case "$host_cpu" in
powerpc)
;;
m68k)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
esac
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
haiku*)
;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix[4-9]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
case "$host_cpu" in
powerpc)
;;
m68k)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
esac
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
:
else
ld_shlibs=no
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd2.[01]*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
*nto* | *qnx*)
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
# linker has special search rules.
library_names_spec= # the last element of library_names_spec in libtool.m4
libname_spec='lib$name'
case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix[4-9]*)
library_names_spec='$libname$shrext'
;;
amigaos*)
case "$host_cpu" in
powerpc*)
library_names_spec='$libname$shrext' ;;
m68k)
library_names_spec='$libname.a' ;;
esac
;;
beos*)
library_names_spec='$libname$shrext'
;;
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32* | cegcc*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
darwin* | rhapsody*)
shrext=.dylib
library_names_spec='$libname$shrext'
;;
dgux*)
library_names_spec='$libname$shrext'
;;
freebsd[23].*)
library_names_spec='$libname$shrext$versuffix'
;;
freebsd* | dragonfly*)
library_names_spec='$libname$shrext'
;;
gnu*)
library_names_spec='$libname$shrext'
;;
haiku*)
library_names_spec='$libname$shrext'
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
library_names_spec='$libname$shrext'
;;
interix[3-9]*)
library_names_spec='$libname$shrext'
;;
irix5* | irix6* | nonstopux*)
library_names_spec='$libname$shrext'
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
library_names_spec='$libname$shrext'
;;
netbsd*)
library_names_spec='$libname$shrext'
;;
newsos6)
library_names_spec='$libname$shrext'
;;
*nto* | *qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
library_names_spec='$libname$shrext$versuffix'
;;
os2*)
libname_spec='$name'
shrext=.dll
library_names_spec='$libname.a'
;;
osf3* | osf4* | osf5*)
library_names_spec='$libname$shrext'
;;
rdos*)
;;
solaris*)
library_names_spec='$libname$shrext'
;;
sunos4*)
library_names_spec='$libname$shrext$versuffix'
;;
sysv4 | sysv4.3*)
library_names_spec='$libname$shrext'
;;
sysv4*MP*)
library_names_spec='$libname$shrext'
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
tpf*)
library_names_spec='$libname$shrext'
;;
uts4*)
library_names_spec='$libname$shrext'
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1793
config/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

238
config/install-sh Executable file
View File

@ -0,0 +1,238 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

11249
config/ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

40
config/mkinstalldirs Executable file
View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

127
config/parse-types.sh Executable file
View File

@ -0,0 +1,127 @@
#!/bin/sh
cat > sed.script << "EOF"
/^#/d
/^$/d
s/__extension__ //
s/typedef \(.*\) __u\([1-9]*\);/#define __U\2_TYPEDEF \1/
s/typedef \(.*\) __s\([1-9]*\);/#define __S\2_TYPEDEF \1/
EOF
if test -z "$CC"; then
CC=gcc
fi
if test -z "$CPP"; then
CPP="$CC -E"
fi
/bin/echo -n "checking for __uNN types... "
# can't check [ -f /usr/include/asm/types.h ] directly, since
# the include path might be different if cross-compiling
if echo '#include <asm/types.h>' | $CPP - 2> parse-types.log | \
sed -f sed.script | grep '^#' > asm_types.h; then
echo "using <asm/types.h>"
else
echo "using generic types"
fi
rm sed.script
cp asm_types.h asm_types.c
cat >> asm_types.c <<EOF
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
#ifdef __U8_TYPEDEF
if (sizeof(__U8_TYPEDEF) != 1) {
printf("Sizeof(__U8__TYPEDEF) is %d should be 1\n",
(int) sizeof(__U8_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __U8_TYPEDEF not defined
#endif
#ifdef __S8_TYPEDEF
if (sizeof(__S8_TYPEDEF) != 1) {
printf("Sizeof(_S8__TYPEDEF) is %d should be 1\n",
(int) sizeof(__S8_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __S8_TYPEDEF not defined
#endif
#ifdef __U16_TYPEDEF
if (sizeof(__U16_TYPEDEF) != 2) {
printf("Sizeof(__U16__TYPEDEF) is %d should be 2\n",
(int) sizeof(__U16_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __U16_TYPEDEF not defined
#endif
#ifdef __S16_TYPEDEF
if (sizeof(__S16_TYPEDEF) != 2) {
printf("Sizeof(__S16__TYPEDEF) is %d should be 2\n",
(int) sizeof(__S16_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __S16_TYPEDEF not defined
#endif
#ifdef __U32_TYPEDEF
if (sizeof(__U32_TYPEDEF) != 4) {
printf("Sizeof(__U32__TYPEDEF) is %d should be 4\n",
(int) sizeof(__U32_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __U32_TYPEDEF not defined
#endif
#ifdef __S32_TYPEDEF
if (sizeof(__S32_TYPEDEF) != 4) {
printf("Sizeof(__S32__TYPEDEF) is %d should be 4\n",
(int) sizeof(__S32_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __S32_TYPEDEF not defined
#endif
#ifdef __U64_TYPEDEF
if (sizeof(__U64_TYPEDEF) != 8) {
printf("Sizeof(__U64__TYPEDEF) is %d should be 8\n",
(int) sizeof(__U64_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __U64_TYPEDEF not defined
#endif
#ifdef __S64_TYPEDEF
if (sizeof(__S64_TYPEDEF) != 8) {
printf("Sizeof(__S64__TYPEDEF) is %d should be 8\n",
(int) sizeof(__S64_TYPEDEF));
exit(1);
}
#elif defined(__linux__)
#warning __S64_TYPEDEF not defined
#endif
return 0;
}
EOF
${BUILD_CC-${CC-gcc}} -o asm_types asm_types.c
if ./asm_types
then
true
else
if [ "${CROSS_COMPILE}" != "1" ]; then
echo "Problem detected with asm_types.h"
echo "" > asm_types.h
fi
fi
rm asm_types.c asm_types

16114
configure vendored Executable file

File diff suppressed because it is too large Load Diff

1767
configure.ac Normal file

File diff suppressed because it is too large Load Diff

19
contrib/Android.bp Normal file
View File

@ -0,0 +1,19 @@
// Copyright 2017 The Android Open Source Project
subdirs = ["android"]
//########################################################################
// Build add_ext4_encrypt
cc_binary {
name: "add_ext4_encrypt",
host_supported: true,
defaults: ["e2fsprogs-defaults"],
srcs: ["add_ext4_encrypt.c"],
shared_libs: [
"libext2fs",
"libext2_com_err",
],
system_shared_libs: ["libc", "libdl"],
}

View File

@ -0,0 +1,64 @@
/*
* Basic program to add ext4 encryption to a file system
*
* Copyright 2015, Google, Inc.
*
* %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 <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <ext2fs/ext2_fs.h>
#include <ext2fs/ext2fs.h>
int main (int argc, char *argv[])
{
errcode_t retval = 0;
ext2_filsys fs;
setbuf(stdout, NULL);
setbuf(stderr, NULL);
initialize_ext2_error_table();
if (argc != 2) {
fprintf(stderr, "%s: Usage <device|filesystem>\n", argv[0]);
exit(1);
}
retval = ext2fs_open(argv[1], EXT2_FLAG_RW, 0, 0,
unix_io_manager, &fs);
if (retval) {
com_err(argv[0], retval, "while trying to open '%s'",
argv[1]);
exit(1);
}
if (!ext2fs_has_feature_encrypt(fs->super)) {
ext2fs_set_feature_encrypt(fs->super);
fs->super->s_encrypt_algos[0] =
EXT4_ENCRYPTION_MODE_AES_256_XTS;
fs->super->s_encrypt_algos[1] =
EXT4_ENCRYPTION_MODE_AES_256_CTS;
ext2fs_mark_super_dirty(fs);
printf("Ext4 encryption enabled on %s\n", argv[1]);
} else
printf("Ext4 encryption already enabled on %s\n", argv[1]);
retval = ext2fs_close(fs);
if (retval) {
com_err(argv[0], retval, "while trying to close '%s'",
argv[1]);
exit(1);
}
return (0);
}

View File

@ -0,0 +1,69 @@
// Copyright 2017 The Android Open Source Project
//##########################################################################
// Build e2fsdroid
cc_binary {
name: "e2fsdroid",
host_supported: true,
recovery_available: true,
defaults: ["e2fsprogs-defaults"],
srcs: [
"e2fsdroid.c",
"block_range.c",
"fsmap.c",
"block_list.c",
"base_fs.c",
"perms.c",
"basefs_allocator.c",
],
target: {
host: {
static_libs: [
"libext2_com_err",
"libext2_misc",
"libext2fs",
"libsparse",
"libz",
"libcutils",
"libbase",
"libselinux",
"libcrypto",
"liblog",
],
sanitize: {
address: false, // http://b/68387795 - heap overflow in e2fsdroid
},
},
android: {
shared_libs: [
"libext2fs",
"libext2_com_err",
"libext2_misc",
"libcutils",
"libbase",
"libselinux",
"libcrypto",
],
},
},
stl: "libc++_static",
}
//##########################################################################
// Build ext2simg
cc_binary {
name: "ext2simg",
host_supported: true,
defaults: ["e2fsprogs-defaults"],
srcs: ["ext2simg.c"],
shared_libs: [
"libext2fs",
"libext2_com_err",
"libsparse",
"libz",
],
}

205
contrib/android/base_fs.c Normal file
View File

@ -0,0 +1,205 @@
#include "base_fs.h"
#include <stdio.h>
#define BASE_FS_VERSION "Base EXT4 version 1.0"
struct base_fs {
FILE *file;
const char *mountpoint;
struct basefs_entry entry;
};
static FILE *basefs_open(const char *file)
{
char *line = NULL;
size_t len;
FILE *f = fopen(file, "r");
if (!f)
return NULL;
if (getline(&line, &len, f) == -1 || !line)
goto err_getline;
if (strncmp(line, BASE_FS_VERSION, strlen(BASE_FS_VERSION)))
goto err_header;
free(line);
return f;
err_header:
free(line);
err_getline:
fclose(f);
return NULL;
}
static struct basefs_entry *basefs_readline(FILE *f, const char *mountpoint,
int *err)
{
char *line = NULL, *saveptr1, *saveptr2, *block_range, *block;
int offset;
size_t len;
struct basefs_entry *entry = NULL;
blk64_t range_start, range_end;
if (getline(&line, &len, f) == -1) {
if (feof(f))
goto end;
goto err_getline;
}
entry = calloc(1, sizeof(*entry));
if (!entry)
goto err_alloc;
/*
* With BASEFS version 1.0, a typical line looks like this:
* /bin/mke2fs 5000-5004,8000,9000-9990
*/
if (sscanf(line, "%ms%n", &entry->path, &offset) != 1)
goto err_sscanf;
len = strlen(mountpoint);
memmove(entry->path, entry->path + len, strlen(entry->path) - len + 1);
while (line[offset] == ' ')
++offset;
block_range = strtok_r(line + offset, ",\n", &saveptr1);
while (block_range) {
block = strtok_r(block_range, "-", &saveptr2);
if (!block)
break;
range_start = atoll(block);
block = strtok_r(NULL, "-", &saveptr2);
range_end = block ? atoll(block) : range_start;
add_blocks_to_range(&entry->blocks, range_start, range_end);
block_range = strtok_r(NULL, ",\n", &saveptr1);
}
end:
*err = 0;
free(line);
return entry;
err_sscanf:
free(entry);
err_alloc:
free(line);
err_getline:
*err = 1;
return NULL;
}
static void free_base_fs_entry(void *e)
{
struct basefs_entry *entry = e;
if (entry) {
free(entry->path);
free(entry);
}
}
struct ext2fs_hashmap *basefs_parse(const char *file, const char *mountpoint)
{
int err;
struct ext2fs_hashmap *entries = NULL;
struct basefs_entry *entry;
FILE *f = basefs_open(file);
if (!f)
return NULL;
entries = ext2fs_hashmap_create(ext2fs_djb2_hash, free_base_fs_entry, 1024);
if (!entries)
goto end;
while ((entry = basefs_readline(f, mountpoint, &err)))
ext2fs_hashmap_add(entries, entry, entry->path,
strlen(entry->path));
if (err) {
fclose(f);
ext2fs_hashmap_free(entries);
return NULL;
}
end:
fclose(f);
return entries;
}
static void *init(const char *file, const char *mountpoint)
{
struct base_fs *params = malloc(sizeof(*params));
if (!params)
return NULL;
params->mountpoint = mountpoint;
params->file = fopen(file, "w+");
if (!params->file) {
free(params);
return NULL;
}
if (fwrite(BASE_FS_VERSION"\n", 1, strlen(BASE_FS_VERSION"\n"),
params->file) != strlen(BASE_FS_VERSION"\n")) {
fclose(params->file);
free(params);
return NULL;
}
return params;
}
static int start_new_file(char *path, ext2_ino_t ino EXT2FS_ATTR((unused)),
struct ext2_inode *inode, void *data)
{
struct base_fs *params = data;
params->entry.path = LINUX_S_ISREG(inode->i_mode) ? path : NULL;
return 0;
}
static int add_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk64_t blocknr,
int metadata, void *data)
{
struct base_fs *params = data;
if (params->entry.path && !metadata)
add_blocks_to_range(&params->entry.blocks, blocknr, blocknr);
return 0;
}
static int inline_data(void *inline_data EXT2FS_ATTR((unused)),
void *data EXT2FS_ATTR((unused)))
{
return 0;
}
static int end_new_file(void *data)
{
struct base_fs *params = data;
if (!params->entry.path)
return 0;
if (fprintf(params->file, "%s%s ", params->mountpoint,
params->entry.path) < 0
|| write_block_ranges(params->file, params->entry.blocks.head, ",")
|| fwrite("\n", 1, 1, params->file) != 1)
return -1;
delete_block_ranges(&params->entry.blocks);
return 0;
}
static int cleanup(void *data)
{
struct base_fs *params = data;
fclose(params->file);
free(params);
return 0;
}
struct fsmap_format base_fs_format = {
.init = init,
.start_new_file = start_new_file,
.add_block = add_block,
.inline_data = inline_data,
.end_new_file = end_new_file,
.cleanup = cleanup,
};

17
contrib/android/base_fs.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef BASE_FS_H
# define BASE_FS_H
# include "fsmap.h"
# include "hashmap.h"
# include "block_range.h"
struct basefs_entry {
char *path;
struct block_range_list blocks;
};
extern struct fsmap_format base_fs_format;
struct ext2fs_hashmap *basefs_parse(const char *file, const char *mountpoint);
#endif /* !BASE_FS_H */

View File

@ -0,0 +1,288 @@
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "basefs_allocator.h"
#include "block_range.h"
#include "hashmap.h"
#include "base_fs.h"
struct base_fs_allocator {
struct ext2fs_hashmap *entries;
struct basefs_entry *cur_entry;
/* Blocks which are definitely owned by a single inode in BaseFS. */
ext2fs_block_bitmap exclusive_block_map;
/* Blocks which are available to the first inode that requests it. */
ext2fs_block_bitmap dedup_block_map;
};
static errcode_t basefs_block_allocator(ext2_filsys, blk64_t, blk64_t *,
struct blk_alloc_ctx *ctx);
/*
* Free any reserved, but unconsumed block ranges in the allocator. This both
* frees the block_range_list data structure and unreserves exclusive blocks
* from the block map.
*/
static void fs_free_blocks_range(ext2_filsys fs,
struct base_fs_allocator *allocator,
struct block_range_list *list)
{
ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map;
blk64_t block;
while (list->head) {
block = consume_next_block(list);
if (ext2fs_test_block_bitmap2(exclusive_map, block)) {
ext2fs_unmark_block_bitmap2(fs->block_map, block);
ext2fs_unmark_block_bitmap2(exclusive_map, block);
}
}
}
static void basefs_allocator_free(ext2_filsys fs,
struct base_fs_allocator *allocator)
{
struct basefs_entry *e;
struct ext2fs_hashmap_entry *it = NULL;
struct ext2fs_hashmap *entries = allocator->entries;
if (entries) {
while ((e = ext2fs_hashmap_iter_in_order(entries, &it))) {
fs_free_blocks_range(fs, allocator, &e->blocks);
delete_block_ranges(&e->blocks);
}
ext2fs_hashmap_free(entries);
}
ext2fs_free_block_bitmap(allocator->exclusive_block_map);
ext2fs_free_block_bitmap(allocator->dedup_block_map);
free(allocator);
}
/*
* Build a bitmap of which blocks are definitely owned by exactly one file in
* Base FS. Blocks which are not valid or are de-duplicated are skipped. This
* is called during allocator initialization, to ensure that libext2fs does
* not allocate which we want to re-use.
*
* If a block was allocated in the initial filesystem, it can never be re-used,
* so it will appear in neither the exclusive or dedup set. If a block is used
* by multiple files, it will be removed from the owned set and instead added
* to the dedup set.
*
* The dedup set is not removed from fs->block_map. This allows us to re-use
* dedup blocks separately and not have them be allocated outside of file data.
*/
static void fs_reserve_block(ext2_filsys fs,
struct base_fs_allocator *allocator,
blk64_t block)
{
ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map;
ext2fs_block_bitmap dedup_map = allocator->dedup_block_map;
if (block >= ext2fs_blocks_count(fs->super))
return;
if (ext2fs_test_block_bitmap2(fs->block_map, block)) {
if (!ext2fs_test_block_bitmap2(exclusive_map, block))
return;
ext2fs_unmark_block_bitmap2(exclusive_map, block);
ext2fs_mark_block_bitmap2(dedup_map, block);
} else {
ext2fs_mark_block_bitmap2(fs->block_map, block);
ext2fs_mark_block_bitmap2(exclusive_map, block);
}
}
static void fs_reserve_blocks_range(ext2_filsys fs,
struct base_fs_allocator *allocator,
struct block_range_list *list)
{
blk64_t block;
struct block_range *blocks = list->head;
while (blocks) {
for (block = blocks->start; block <= blocks->end; block++)
fs_reserve_block(fs, allocator, block);
blocks = blocks->next;
}
}
/*
* For each file in the base FS map, ensure that its blocks are reserved in
* the actual block map. This prevents libext2fs from allocating them for
* general purpose use, and ensures that if the file needs data blocks, they
* can be re-acquired exclusively for that file.
*
* If a file in the base map is missing, or not a regular file in the new
* filesystem, then it's skipped to ensure that its blocks are reusable.
*/
static errcode_t fs_reserve_blocks(ext2_filsys fs,
struct base_fs_allocator *allocator,
const char *src_dir)
{
int nbytes;
char full_path[PATH_MAX];
const char *sep = "/";
struct stat st;
struct basefs_entry *e;
struct ext2fs_hashmap_entry *it = NULL;
struct ext2fs_hashmap *entries = allocator->entries;
if (strlen(src_dir) && src_dir[strlen(src_dir) - 1] == '/')
sep = "";
while ((e = ext2fs_hashmap_iter_in_order(entries, &it))) {
nbytes = snprintf(full_path, sizeof(full_path), "%s%s%s",
src_dir, sep, e->path);
if (nbytes >= sizeof(full_path))
return ENAMETOOLONG;
if (lstat(full_path, &st) || !S_ISREG(st.st_mode))
continue;
fs_reserve_blocks_range(fs, allocator, &e->blocks);
}
return 0;
}
errcode_t base_fs_alloc_load(ext2_filsys fs, const char *file,
const char *mountpoint, const char *src_dir)
{
errcode_t retval = 0;
struct base_fs_allocator *allocator;
allocator = calloc(1, sizeof(*allocator));
if (!allocator) {
retval = ENOMEM;
goto out;
}
retval = ext2fs_read_bitmaps(fs);
if (retval)
goto err_load;
allocator->cur_entry = NULL;
allocator->entries = basefs_parse(file, mountpoint);
if (!allocator->entries) {
retval = EIO;
goto err_load;
}
retval = ext2fs_allocate_block_bitmap(fs, "exclusive map",
&allocator->exclusive_block_map);
if (retval)
goto err_load;
retval = ext2fs_allocate_block_bitmap(fs, "dedup map",
&allocator->dedup_block_map);
if (retval)
goto err_load;
retval = fs_reserve_blocks(fs, allocator, src_dir);
if (retval)
goto err_load;
/* Override the default allocator */
fs->get_alloc_block2 = basefs_block_allocator;
fs->priv_data = allocator;
goto out;
err_load:
basefs_allocator_free(fs, allocator);
out:
return retval;
}
/* Try and acquire the next usable block from the Base FS map. */
static int get_next_block(ext2_filsys fs, struct base_fs_allocator *allocator,
struct block_range_list* list, blk64_t *ret)
{
blk64_t block;
ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map;
ext2fs_block_bitmap dedup_map = allocator->dedup_block_map;
while (list->head) {
block = consume_next_block(list);
if (block >= ext2fs_blocks_count(fs->super))
continue;
if (ext2fs_test_block_bitmap2(exclusive_map, block)) {
ext2fs_unmark_block_bitmap2(exclusive_map, block);
*ret = block;
return 0;
}
if (ext2fs_test_block_bitmap2(dedup_map, block)) {
ext2fs_unmark_block_bitmap2(dedup_map, block);
*ret = block;
return 0;
}
}
return -1;
}
static errcode_t basefs_block_allocator(ext2_filsys fs, blk64_t goal,
blk64_t *ret, struct blk_alloc_ctx *ctx)
{
errcode_t retval;
struct base_fs_allocator *allocator = fs->priv_data;
struct basefs_entry *e = allocator->cur_entry;
ext2fs_block_bitmap dedup_map = allocator->dedup_block_map;
if (e && ctx && (ctx->flags & BLOCK_ALLOC_DATA)) {
if (!get_next_block(fs, allocator, &e->blocks, ret))
return 0;
}
retval = ext2fs_new_block2(fs, goal, fs->block_map, ret);
if (!retval) {
ext2fs_mark_block_bitmap2(fs->block_map, *ret);
return 0;
}
if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) {
/* Try to steal a block from the dedup pool. */
retval = ext2fs_find_first_set_block_bitmap2(dedup_map,
fs->super->s_first_data_block,
ext2fs_blocks_count(fs->super) - 1, ret);
if (!retval) {
ext2fs_unmark_block_bitmap2(dedup_map, *ret);
return 0;
}
}
return retval;
}
void base_fs_alloc_cleanup(ext2_filsys fs)
{
basefs_allocator_free(fs, fs->priv_data);
fs->priv_data = NULL;
fs->get_alloc_block2 = NULL;
}
errcode_t base_fs_alloc_set_target(ext2_filsys fs, const char *target_path,
const char *name EXT2FS_ATTR((unused)),
ext2_ino_t parent_ino EXT2FS_ATTR((unused)),
ext2_ino_t root EXT2FS_ATTR((unused)), mode_t mode)
{
struct base_fs_allocator *allocator = fs->priv_data;
if (mode != S_IFREG)
return 0;
if (allocator)
allocator->cur_entry = ext2fs_hashmap_lookup(allocator->entries,
target_path,
strlen(target_path));
return 0;
}
errcode_t base_fs_alloc_unset_target(ext2_filsys fs,
const char *target_path EXT2FS_ATTR((unused)),
const char *name EXT2FS_ATTR((unused)),
ext2_ino_t parent_ino EXT2FS_ATTR((unused)),
ext2_ino_t root EXT2FS_ATTR((unused)), mode_t mode)
{
struct base_fs_allocator *allocator = fs->priv_data;
if (!allocator || !allocator->cur_entry || mode != S_IFREG)
return 0;
fs_free_blocks_range(fs, allocator, &allocator->cur_entry->blocks);
delete_block_ranges(&allocator->cur_entry->blocks);
return 0;
}

View File

@ -0,0 +1,16 @@
#ifndef BASE_FS_ALLOCATOR_H
# define BASE_FS_ALLOCATOR_H
# include <time.h>
# include <ext2fs/ext2fs.h>
errcode_t base_fs_alloc_load(ext2_filsys fs, const char *file,
const char *mountpoint, const char *src_dir);
void base_fs_alloc_cleanup(ext2_filsys fs);
errcode_t base_fs_alloc_set_target(ext2_filsys fs, const char *target_path,
const char *name, ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode);
errcode_t base_fs_alloc_unset_target(ext2_filsys fs, const char *target_path,
const char *name, ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode);
#endif /* !BASE_FS_ALLOCATOR_H */

View File

@ -0,0 +1,89 @@
#include "block_list.h"
#include "block_range.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
struct block_list {
FILE *f;
const char *mountpoint;
const char *filename;
struct block_range_list blocks;
};
static void *init(const char *file, const char *mountpoint)
{
struct block_list *params = calloc(1, sizeof(*params));
if (!params)
return NULL;
params->mountpoint = mountpoint;
params->f = fopen(file, "w+");
if (!params->f) {
free(params);
return NULL;
}
return params;
}
static int start_new_file(char *path, ext2_ino_t ino EXT2FS_ATTR((unused)),
struct ext2_inode *inode EXT2FS_ATTR((unused)),
void *data)
{
struct block_list *params = data;
params->filename = LINUX_S_ISREG(inode->i_mode) ? path : NULL;
return 0;
}
static int add_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk64_t blocknr,
int metadata, void *data)
{
struct block_list *params = data;
if (params->filename && !metadata)
add_blocks_to_range(&params->blocks, blocknr, blocknr);
return 0;
}
static int inline_data(void *inline_data EXT2FS_ATTR((unused)),
void *data EXT2FS_ATTR((unused)))
{
return 0;
}
static int end_new_file(void *data)
{
struct block_list *params = data;
if (!params->filename || !params->blocks.head)
return 0;
if (fprintf(params->f, "%s%s ", params->mountpoint,
params->filename) < 0
|| write_block_ranges(params->f, params->blocks.head, " ")
|| fwrite("\n", 1, 1, params->f) != 1)
return -1;
delete_block_ranges(&params->blocks);
return 0;
}
static int cleanup(void *data)
{
struct block_list *params = data;
fclose(params->f);
free(params);
return 0;
}
struct fsmap_format block_list_format = {
.init = init,
.start_new_file = start_new_file,
.add_block = add_block,
.inline_data = inline_data,
.end_new_file = end_new_file,
.cleanup = cleanup,
};

View File

@ -0,0 +1,8 @@
#ifndef BLOCK_LIST_H
# define BLOCK_LIST_H
# include "fsmap.h"
extern struct fsmap_format block_list_format;
#endif /* !BLOCK_LIST_H */

View File

@ -0,0 +1,80 @@
#define _GNU_SOURCE
#include "block_range.h"
#include <stdio.h>
struct block_range *new_block_range(blk64_t start, blk64_t end)
{
struct block_range *range = malloc(sizeof(*range));
range->start = start;
range->end = end;
range->next = NULL;
return range;
}
void add_blocks_to_range(struct block_range_list *list, blk64_t blk_start,
blk64_t blk_end)
{
if (list->head == NULL)
list->head = list->tail = new_block_range(blk_start, blk_end);
else if (list->tail->end + 1 == blk_start)
list->tail->end += (blk_end - blk_start + 1);
else {
struct block_range *range = new_block_range(blk_start, blk_end);
list->tail->next = range;
list->tail = range;
}
}
static void remove_head(struct block_range_list *list)
{
struct block_range *next_range = list->head->next;
free(list->head);
if (next_range == NULL)
list->head = list->tail = NULL;
else
list->head = next_range;
}
void delete_block_ranges(struct block_range_list *list)
{
while (list->head)
remove_head(list);
}
int write_block_ranges(FILE *f, struct block_range *range,
char *sep)
{
int len;
char *buf;
while (range) {
if (range->start == range->end)
len = asprintf(&buf, "%llu%s", range->start, sep);
else
len = asprintf(&buf, "%llu-%llu%s", range->start,
range->end, sep);
if (fwrite(buf, 1, len, f) != (size_t)len) {
free(buf);
return -1;
}
free(buf);
range = range->next;
}
len = strlen(sep);
if (fseek(f, -len, SEEK_CUR) == -len)
return -1;
return 0;
}
blk64_t consume_next_block(struct block_range_list *list)
{
blk64_t ret = list->head->start;
list->head->start += 1;
if (list->head->start > list->head->end)
remove_head(list);
return ret;
}

View File

@ -0,0 +1,29 @@
#ifndef BLOCK_RANGE_H
# define BLOCK_RANGE_H
# include <sys/types.h>
# include <ext2fs/ext2fs.h>
struct block_range {
blk64_t start;
blk64_t end;
struct block_range *next;
};
struct block_range_list {
struct block_range *head;
struct block_range *tail;
};
void add_blocks_to_range(struct block_range_list *list, blk64_t blk_start,
blk64_t blk_end);
void delete_block_ranges(struct block_range_list *list);
int write_block_ranges(FILE *f, struct block_range *range, char *sep);
/*
* Given a non-empty range list, return the next block and remove it from the
* list.
*/
blk64_t consume_next_block(struct block_range_list *list);
#endif /* !BLOCK_RANGE_H */

376
contrib/android/e2fsdroid.c Normal file
View File

@ -0,0 +1,376 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <ext2fs/ext2fs.h>
#include "perms.h"
#include "base_fs.h"
#include "block_list.h"
#include "basefs_allocator.h"
#include "create_inode.h"
#ifndef UID_GID_MAP_MAX_EXTENTS
/*
* The value is defined in linux/user_namspace.h.
* The value is (arbitrarily) 5 in 4.14 and earlier, or 340 in 4.15 and later.
* Here, the bigger value is taken. See also man user_namespace(7).
*/
#define UID_GID_MAP_MAX_EXTENTS 340
#endif
static char *prog_name = "e2fsdroid";
static char *in_file;
static char *block_list;
static char *basefs_out;
static char *basefs_in;
static char *mountpoint = "";
static time_t fixed_time = -1;
static char *fs_config_file;
static struct selinux_opt seopt_file[8];
static int max_nr_opt = (int)sizeof(seopt_file) / sizeof(seopt_file[0]);
static char *product_out;
static char *src_dir;
static int android_configure;
static int android_sparse_file = 1;
static void usage(int ret)
{
fprintf(stderr, "%s [-B block_list] [-D basefs_out] [-T timestamp]\n"
"\t[-C fs_config] [-S file_contexts] [-p product_out]\n"
"\t[-a mountpoint] [-d basefs_in] [-f src_dir] [-e] [-s]\n"
"\t[-u uid-mapping] [-g gid-mapping] image\n",
prog_name);
exit(ret);
}
static char *absolute_path(const char *file)
{
char *ret;
char cwd[PATH_MAX];
if (file[0] != '/') {
if (getcwd(cwd, PATH_MAX) == NULL) {
fprintf(stderr, "Failed to getcwd\n");
exit(EXIT_FAILURE);
}
ret = malloc(strlen(cwd) + 1 + strlen(file) + 1);
if (ret)
sprintf(ret, "%s/%s", cwd, file);
} else
ret = strdup(file);
return ret;
}
static int parse_ugid_map_entry(char* line, struct ugid_map_entry* result)
{
char *token, *token_saveptr;
size_t num_tokens;
unsigned int *parsed[] = {&result->child_id,
&result->parent_id,
&result->length};
for (token = strtok_r(line, " ", &token_saveptr), num_tokens = 0;
token && num_tokens < 3;
token = strtok_r(NULL, " ", &token_saveptr), ++num_tokens) {
char* endptr = NULL;
*parsed[num_tokens] = strtoul(token, &endptr, 10);
if ((*parsed[num_tokens] == ULONG_MAX && errno) || *endptr) {
fprintf(stderr, "Malformed u/gid mapping line\n");
return 0;
}
}
if (num_tokens < 3 || strtok_r(NULL, " ", &token_saveptr) != NULL) {
fprintf(stderr, "Malformed u/gid mapping line\n");
return 0;
}
if (result->child_id + result->length < result->child_id ||
result->parent_id + result->length < result->parent_id) {
fprintf(stderr, "u/gid mapping overflow\n");
return 0;
}
return 1;
}
/*
* Returns 1 if [begin1, begin1+length1) and [begin2, begin2+length2) have
* overlapping range. Otherwise 0.
*/
static int is_overlapping(unsigned int begin1, unsigned int length1,
unsigned int begin2, unsigned int length2)
{
unsigned int end1 = begin1 + length1;
unsigned int end2 = begin2 + length2;
return !(end1 <= begin2 || end2 <= begin1);
}
/*
* Verifies if the given mapping works.
* - Checks if the number of entries is less than or equals to
* UID_GID_MAP_MAX_EXTENTS.
* - Checks if there is no overlapped ranges.
* Returns 1 if valid, otherwise 0.
*/
static int is_valid_ugid_map(const struct ugid_map* mapping)
{
size_t i, j;
if (mapping->size > UID_GID_MAP_MAX_EXTENTS) {
fprintf(stderr, "too many u/gid mapping entries\n");
return 0;
}
for (i = 0; i < mapping->size; ++i) {
const struct ugid_map_entry *entry1 = &mapping->entries[i];
for (j = i + 1; j < mapping->size; ++j) {
const struct ugid_map_entry *entry2 =
&mapping->entries[j];
if (is_overlapping(entry1->child_id, entry1->length,
entry2->child_id, entry2->length)) {
fprintf(stderr,
"Overlapping child u/gid: [%d %d %d],"
" [%d %d %d]\n",
entry1->child_id, entry1->parent_id,
entry1->length, entry2->child_id,
entry2->parent_id, entry2->length);
return 0;
}
if (is_overlapping(entry1->parent_id, entry1->length,
entry2->parent_id, entry2->length)) {
fprintf(stderr,
"Overlapping parent u/gid: [%d %d %d],"
" [%d %d %d]\n",
entry1->child_id, entry1->parent_id,
entry1->length, entry2->child_id,
entry2->parent_id, entry2->length);
return 0;
}
}
}
return 1;
}
/*
* Parses the UID/GID mapping argument. The argument could be a multi-line
* string (separated by '\n', no trailing '\n' is allowed). Each line must
* contain exact three integer tokens; the first token is |child_id|,
* the second is |parent_id|, and the last is |length| of the mapping range.
* See also user_namespace(7) man page.
* On success, the parsed entries are stored in |result|, and it returns 1.
* Otherwise, returns 0.
*/
static int parse_ugid_map(char* arg, struct ugid_map* result)
{
int i;
char *line, *line_saveptr;
size_t current_index;
/* Count the number of lines. */
result->size = 1;
for (i = 0; arg[i]; ++i) {
if (arg[i] == '\n')
++result->size;
}
/* Allocate memory for entries. */
result->entries = malloc(sizeof(struct ugid_map_entry) * result->size);
if (!result->entries) {
result->size = 0;
return 0;
}
/* Parse each line */
for (line = strtok_r(arg, "\n", &line_saveptr), current_index = 0;
line;
line = strtok_r(NULL, "\n", &line_saveptr), ++current_index) {
if (!parse_ugid_map_entry(
line, &result->entries[current_index])) {
return 0;
}
}
return is_valid_ugid_map(result);
}
int main(int argc, char *argv[])
{
int c;
char *p;
int flags = EXT2_FLAG_RW;
errcode_t retval;
io_manager io_mgr;
ext2_filsys fs = NULL;
struct fs_ops_callbacks fs_callbacks = { NULL, NULL };
char *token;
int nr_opt = 0;
ext2_ino_t inodes_count;
ext2_ino_t free_inodes_count;
blk64_t blocks_count;
blk64_t free_blocks_count;
struct ugid_map uid_map = { 0, NULL }, gid_map = { 0, NULL };
add_error_table(&et_ext2_error_table);
while ((c = getopt (argc, argv, "T:C:S:p:a:D:d:B:f:esu:g:")) != EOF) {
switch (c) {
case 'T':
fixed_time = strtoul(optarg, &p, 0);
android_configure = 1;
break;
case 'C':
fs_config_file = absolute_path(optarg);
android_configure = 1;
break;
case 'S':
token = strtok(optarg, ",");
while (token) {
if (nr_opt == max_nr_opt) {
fprintf(stderr, "Expected at most %d selinux opts\n",
max_nr_opt);
exit(EXIT_FAILURE);
}
seopt_file[nr_opt].type = SELABEL_OPT_PATH;
seopt_file[nr_opt].value = absolute_path(token);
nr_opt++;
token = strtok(NULL, ",");
}
android_configure = 1;
break;
case 'p':
product_out = absolute_path(optarg);
android_configure = 1;
break;
case 'a':
mountpoint = strdup(optarg);
break;
case 'D':
basefs_out = absolute_path(optarg);
break;
case 'd':
basefs_in = absolute_path(optarg);
break;
case 'B':
block_list = absolute_path(optarg);
break;
case 'f':
src_dir = absolute_path(optarg);
break;
case 'e':
android_sparse_file = 0;
break;
case 's':
flags |= EXT2_FLAG_SHARE_DUP;
break;
case 'u':
if (!parse_ugid_map(optarg, &uid_map))
exit(EXIT_FAILURE);
android_configure = 1;
break;
case 'g':
if (!parse_ugid_map(optarg, &gid_map))
exit(EXIT_FAILURE);
android_configure = 1;
break;
default:
usage(EXIT_FAILURE);
}
}
if (optind >= argc) {
fprintf(stderr, "Expected filename after options\n");
exit(EXIT_FAILURE);
}
if (android_sparse_file) {
io_mgr = sparse_io_manager;
if (asprintf(&in_file, "(%s)", argv[optind]) == -1) {
fprintf(stderr, "Failed to allocate file name\n");
exit(EXIT_FAILURE);
}
} else {
io_mgr = unix_io_manager;
in_file = strdup(argv[optind]);
}
retval = ext2fs_open(in_file, flags, 0, 0, io_mgr, &fs);
if (retval) {
com_err(prog_name, retval, "while opening file %s\n", in_file);
return retval;
}
if (src_dir) {
ext2fs_read_bitmaps(fs);
if (basefs_in) {
retval = base_fs_alloc_load(fs, basefs_in, mountpoint,
src_dir);
if (retval) {
com_err(prog_name, retval, "%s",
"while reading base_fs file");
exit(1);
}
fs_callbacks.create_new_inode =
base_fs_alloc_set_target;
fs_callbacks.end_create_new_inode =
base_fs_alloc_unset_target;
}
retval = populate_fs2(fs, EXT2_ROOT_INO, src_dir,
EXT2_ROOT_INO, &fs_callbacks);
if (retval) {
com_err(prog_name, retval, "%s",
"while populating file system");
exit(1);
}
if (basefs_in)
base_fs_alloc_cleanup(fs);
}
if (android_configure) {
retval = android_configure_fs(
fs, src_dir, product_out, mountpoint, seopt_file,
nr_opt, fs_config_file, fixed_time, &uid_map, &gid_map);
if (retval) {
com_err(prog_name, retval, "%s",
"while configuring the file system");
exit(1);
}
}
if (block_list) {
retval = fsmap_iter_filsys(fs, &block_list_format, block_list,
mountpoint);
if (retval) {
com_err(prog_name, retval, "%s",
"while creating the block_list");
exit(1);
}
}
if (basefs_out) {
retval = fsmap_iter_filsys(fs, &base_fs_format,
basefs_out, mountpoint);
if (retval) {
com_err(prog_name, retval, "%s",
"while creating the basefs file");
exit(1);
}
}
inodes_count = fs->super->s_inodes_count;
free_inodes_count = fs->super->s_free_inodes_count;
blocks_count = ext2fs_blocks_count(fs->super);
free_blocks_count = ext2fs_free_blocks_count(fs->super);
retval = ext2fs_close_free(&fs);
if (retval) {
com_err(prog_name, retval, "%s",
"while writing superblocks");
exit(1);
}
printf("Created filesystem with %u/%u inodes and %llu/%llu blocks\n",
inodes_count - free_inodes_count, inodes_count,
blocks_count - free_blocks_count, blocks_count);
remove_error_table(&et_ext2_error_table);
return 0;
}

224
contrib/android/ext2simg.c Normal file
View File

@ -0,0 +1,224 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <libgen.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ext2fs/ext2fs.h>
#include <et/com_err.h>
#include <sparse/sparse.h>
struct {
int crc;
int sparse;
int gzip;
char *in_file;
char *out_file;
bool overwrite_input;
} params = {
.crc = 0,
.sparse = 1,
.gzip = 0,
};
#define ext2fs_fatal(Retval, Format, ...) \
do { \
com_err("error", Retval, Format, __VA_ARGS__); \
exit(EXIT_FAILURE); \
} while(0)
#define sparse_fatal(Format) \
do { \
fprintf(stderr, "sparse: "Format); \
exit(EXIT_FAILURE); \
} while(0)
static void usage(char *path)
{
char *progname = basename(path);
fprintf(stderr, "%s [ options ] <image or block device> <output image>\n"
" -c include CRC block\n"
" -z gzip output\n"
" -S don't use sparse output format\n", progname);
}
static struct buf_item {
struct buf_item *next;
void *buf[0];
} *buf_list;
static void add_chunk(ext2_filsys fs, struct sparse_file *s, blk_t chunk_start, blk_t chunk_end)
{
int retval;
unsigned int nb_blk = chunk_end - chunk_start;
size_t len = nb_blk * fs->blocksize;
int64_t offset = (int64_t)chunk_start * (int64_t)fs->blocksize;
if (params.overwrite_input == false) {
if (sparse_file_add_file(s, params.in_file, offset, len, chunk_start) < 0)
sparse_fatal("adding data to the sparse file");
} else {
/*
* The input file will be overwritten, make a copy of
* the blocks
*/
struct buf_item *bi = calloc(1, sizeof(struct buf_item) + len);
if (buf_list == NULL)
buf_list = bi;
else {
bi->next = buf_list;
buf_list = bi;
}
retval = io_channel_read_blk64(fs->io, chunk_start, nb_blk, bi->buf);
if (retval < 0)
ext2fs_fatal(retval, "reading block %u - %u", chunk_start, chunk_end);
if (sparse_file_add_data(s, bi->buf, len, chunk_start) < 0)
sparse_fatal("adding data to the sparse file");
}
}
static void free_chunks(void)
{
struct buf_item *bi;
while (buf_list) {
bi = buf_list->next;
free(buf_list);
buf_list = bi;
}
}
static struct sparse_file *ext_to_sparse(const char *in_file)
{
errcode_t retval;
ext2_filsys fs;
struct sparse_file *s;
int64_t chunk_start = -1;
blk_t first_blk, last_blk, nb_blk, cur_blk;
retval = ext2fs_open(in_file, 0, 0, 0, unix_io_manager, &fs);
if (retval)
ext2fs_fatal(retval, "while reading %s", in_file);
retval = ext2fs_read_block_bitmap(fs);
if (retval)
ext2fs_fatal(retval, "while reading block bitmap of %s", in_file);
first_blk = ext2fs_get_block_bitmap_start2(fs->block_map);
last_blk = ext2fs_get_block_bitmap_end2(fs->block_map);
nb_blk = last_blk - first_blk + 1;
s = sparse_file_new(fs->blocksize, (uint64_t)fs->blocksize * (uint64_t)nb_blk);
if (!s)
sparse_fatal("creating sparse file");
/*
* The sparse format encodes the size of a chunk (and its header) in a
* 32-bit unsigned integer (UINT32_MAX)
* When writing the chunk, the library uses a single call to write().
* Linux's implementation of the 'write' syscall does not allow transfers
* larger than INT32_MAX (32-bit _and_ 64-bit systems).
* Make sure we do not create chunks larger than this limit.
*/
int64_t max_blk_per_chunk = (INT32_MAX - 12) / fs->blocksize;
/* Iter on the blocks to merge contiguous chunk */
for (cur_blk = first_blk; cur_blk <= last_blk; ++cur_blk) {
if (ext2fs_test_block_bitmap2(fs->block_map, cur_blk)) {
if (chunk_start == -1) {
chunk_start = cur_blk;
} else if (cur_blk - chunk_start + 1 == max_blk_per_chunk) {
add_chunk(fs, s, chunk_start, cur_blk);
chunk_start = -1;
}
} else if (chunk_start != -1) {
add_chunk(fs, s, chunk_start, cur_blk);
chunk_start = -1;
}
}
if (chunk_start != -1)
add_chunk(fs, s, chunk_start, cur_blk - 1);
ext2fs_free(fs);
return s;
}
static bool same_file(const char *in, const char *out)
{
struct stat st1, st2;
if (access(out, F_OK) == -1)
return false;
if (lstat(in, &st1) == -1)
ext2fs_fatal(errno, "stat %s\n", in);
if (lstat(out, &st2) == -1)
ext2fs_fatal(errno, "stat %s\n", out);
return st1.st_ino == st2.st_ino;
}
int main(int argc, char *argv[])
{
int opt;
int out_fd;
struct sparse_file *s;
while ((opt = getopt(argc, argv, "czS")) != -1) {
switch(opt) {
case 'c':
params.crc = 1;
break;
case 'z':
params.gzip = 1;
break;
case 'S':
params.sparse = 0;
break;
default:
usage(argv[0]);
exit(EXIT_FAILURE);
}
}
if (optind + 1 >= argc) {
usage(argv[0]);
exit(EXIT_FAILURE);
}
params.in_file = strdup(argv[optind++]);
params.out_file = strdup(argv[optind]);
params.overwrite_input = same_file(params.in_file, params.out_file);
s = ext_to_sparse(params.in_file);
out_fd = open(params.out_file, O_WRONLY | O_CREAT | O_TRUNC, 0664);
if (out_fd == -1)
ext2fs_fatal(errno, "opening %s\n", params.out_file);
if (sparse_file_write(s, out_fd, params.gzip, params.sparse, params.crc) < 0)
sparse_fatal("writing sparse file");
sparse_file_destroy(s);
free(params.in_file);
free(params.out_file);
free_chunks();
close(out_fd);
return 0;
}

119
contrib/android/fsmap.c Normal file
View File

@ -0,0 +1,119 @@
#include "fsmap.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "support/nls-enable.h"
struct walk_ext_priv_data {
char *path;
ext2_filsys fs;
struct fsmap_format *format;
};
static int walk_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk64_t *blocknr,
e2_blkcnt_t blockcnt,
blk64_t ref64_blk EXT2FS_ATTR((unused)),
int ref_offset EXT2FS_ATTR((unused)),
void *priv)
{
struct walk_ext_priv_data *pdata = priv;
struct fsmap_format *format = pdata->format;
return format->add_block(fs, *blocknr, blockcnt < 0, format->private);
}
static errcode_t ino_iter_blocks(ext2_filsys fs, ext2_ino_t ino,
struct walk_ext_priv_data *pdata)
{
errcode_t retval;
struct ext2_inode inode;
struct fsmap_format *format = pdata->format;
retval = ext2fs_read_inode(fs, ino, &inode);
if (retval)
return retval;
if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
return format->inline_data(&(inode.i_block[0]),
format->private);
retval = ext2fs_block_iterate3(fs, ino, 0, NULL, walk_block, pdata);
if (retval)
com_err(__func__, retval, _("listing blocks of ino \"%u\""),
ino);
return retval;
}
static int is_dir(ext2_filsys fs, ext2_ino_t ino)
{
struct ext2_inode inode;
if (ext2fs_read_inode(fs, ino, &inode))
return 0;
return S_ISDIR(inode.i_mode);
}
static int walk_ext_dir(ext2_ino_t dir EXT2FS_ATTR((unused)),
int flags EXT2FS_ATTR((unused)),
struct ext2_dir_entry *de,
int offset EXT2FS_ATTR((unused)),
int blocksize EXT2FS_ATTR((unused)),
char *buf EXT2FS_ATTR((unused)), void *priv_data)
{
errcode_t retval;
struct ext2_inode inode;
char *filename, *cur_path, *name = de->name;
int name_len = de->name_len & 0xff;
struct walk_ext_priv_data *pdata = priv_data;
struct fsmap_format *format = pdata->format;
if (!strncmp(name, ".", name_len)
|| !strncmp(name, "..", name_len)
|| !strncmp(name, "lost+found", 10))
return 0;
if (asprintf(&filename, "%s/%.*s", pdata->path, name_len, name) < 0)
return -ENOMEM;
retval = ext2fs_read_inode(pdata->fs, de->inode, &inode);
if (retval) {
com_err(__func__, retval, _("reading ino \"%u\""), de->inode);
goto end;
}
format->start_new_file(filename, de->inode, &inode, format->private);
retval = ino_iter_blocks(pdata->fs, de->inode, pdata);
if (retval)
return retval;
format->end_new_file(format->private);
retval = 0;
if (is_dir(pdata->fs, de->inode)) {
cur_path = pdata->path;
pdata->path = filename;
retval = ext2fs_dir_iterate2(pdata->fs, de->inode, 0, NULL,
walk_ext_dir, pdata);
pdata->path = cur_path;
}
end:
free(filename);
return retval;
}
errcode_t fsmap_iter_filsys(ext2_filsys fs, struct fsmap_format *format,
const char *file, const char *mountpoint)
{
struct walk_ext_priv_data pdata;
errcode_t retval;
format->private = format->init(file, mountpoint);
pdata.fs = fs;
pdata.path = "";
pdata.format = format;
retval = ext2fs_dir_iterate2(fs, EXT2_ROOT_INO, 0, NULL, walk_ext_dir, &pdata);
format->cleanup(format->private);
return retval;
}

29
contrib/android/fsmap.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef FSMAP_H
# define FSMAP_H
# ifndef _GNU_SOURCE
# define _GNU_SOURCE // asprintf
# endif
# include <stdio.h>
# include <stdint.h>
# include <stdbool.h>
# include <sys/types.h>
# include <ext2fs/ext2fs.h>
struct fsmap_format {
void* (* init)(const char *file, const char *mountpoint);
int (* start_new_file)(char *path, ext2_ino_t ino,
struct ext2_inode *inode, void *data);
int (* add_block)(ext2_filsys fs, blk64_t blocknr, int metadata,
void *data);
int (* inline_data)(void *inline_data, void *data);
int (* end_new_file)(void *data);
int (* cleanup)(void *data);
void *private;
};
errcode_t fsmap_iter_filsys(ext2_filsys fs, struct fsmap_format *format,
const char *file, const char *mountpoint);
#endif /* !FSMAP_H */

375
contrib/android/perms.c Normal file
View File

@ -0,0 +1,375 @@
#ifndef _GNU_SOURCE
# define _GNU_SOURCE //asprintf
#endif
#include "perms.h"
#include "support/nls-enable.h"
#include <time.h>
#include <sys/stat.h>
#ifndef XATTR_SELINUX_SUFFIX
# define XATTR_SELINUX_SUFFIX "selinux"
#endif
#ifndef XATTR_CAPS_SUFFIX
# define XATTR_CAPS_SUFFIX "capability"
#endif
struct inode_params {
ext2_filsys fs;
char *path;
char *filename;
char *src_dir;
char *target_out;
char *mountpoint;
fs_config_f fs_config_func;
struct selabel_handle *sehnd;
time_t fixed_time;
const struct ugid_map* uid_map;
const struct ugid_map* gid_map;
errcode_t error;
};
static errcode_t ino_add_xattr(ext2_filsys fs, ext2_ino_t ino, const char *name,
const void *value, int value_len)
{
errcode_t retval, close_retval;
struct ext2_xattr_handle *xhandle;
retval = ext2fs_xattrs_open(fs, ino, &xhandle);
if (retval) {
com_err(__func__, retval, _("while opening inode %u"), ino);
return retval;
}
retval = ext2fs_xattrs_read(xhandle);
if (retval) {
com_err(__func__, retval,
_("while reading xattrs of inode %u"), ino);
goto xattrs_close;
}
retval = ext2fs_xattr_set(xhandle, name, value, value_len);
if (retval) {
com_err(__func__, retval,
_("while setting xattrs of inode %u"), ino);
goto xattrs_close;
}
xattrs_close:
close_retval = ext2fs_xattrs_close(&xhandle);
if (close_retval) {
com_err(__func__, close_retval,
_("while closing xattrs of inode %u"), ino);
return retval ? retval : close_retval;
}
return retval;
}
static errcode_t set_selinux_xattr(ext2_filsys fs, ext2_ino_t ino,
struct inode_params *params)
{
errcode_t retval;
char *secontext = NULL;
struct ext2_inode inode;
if (params->sehnd == NULL)
return 0;
retval = ext2fs_read_inode(fs, ino, &inode);
if (retval) {
com_err(__func__, retval,
_("while reading inode %u"), ino);
return retval;
}
retval = selabel_lookup(params->sehnd, &secontext, params->filename,
inode.i_mode);
if (retval < 0) {
int saved_errno = errno;
com_err(__func__, errno,
_("searching for label \"%s\""), params->filename);
return saved_errno;
}
retval = ino_add_xattr(fs, ino, "security." XATTR_SELINUX_SUFFIX,
secontext, strlen(secontext) + 1);
freecon(secontext);
return retval;
}
/*
* Returns mapped UID/GID if there is a corresponding entry in |mapping|.
* Otherwise |id| as is.
*/
static unsigned int resolve_ugid(const struct ugid_map* mapping,
unsigned int id)
{
size_t i;
for (i = 0; i < mapping->size; ++i) {
const struct ugid_map_entry* entry = &mapping->entries[i];
if (entry->parent_id <= id &&
id < entry->parent_id + entry->length) {
return id + entry->child_id - entry->parent_id;
}
}
/* No entry is found. */
return id;
}
static errcode_t set_perms_and_caps(ext2_filsys fs, ext2_ino_t ino,
struct inode_params *params)
{
errcode_t retval;
uint64_t capabilities = 0;
struct ext2_inode inode;
struct vfs_cap_data cap_data;
unsigned int uid = 0, gid = 0, imode = 0;
retval = ext2fs_read_inode(fs, ino, &inode);
if (retval) {
com_err(__func__, retval, _("while reading inode %u"), ino);
return retval;
}
/* Permissions */
if (params->fs_config_func != NULL) {
const char *filename = params->filename;
if (strcmp(filename, params->mountpoint) == 0) {
/* The root of the filesystem needs to be an empty string. */
filename = "";
}
params->fs_config_func(filename, S_ISDIR(inode.i_mode),
params->target_out, &uid, &gid, &imode,
&capabilities);
uid = resolve_ugid(params->uid_map, uid);
gid = resolve_ugid(params->gid_map, gid);
inode.i_uid = (__u16) uid;
inode.i_gid = (__u16) gid;
ext2fs_set_i_uid_high(inode, (__u16) (uid >> 16));
ext2fs_set_i_gid_high(inode, (__u16) (gid >> 16));
inode.i_mode = (inode.i_mode & S_IFMT) | (imode & 0xffff);
retval = ext2fs_write_inode(fs, ino, &inode);
if (retval) {
com_err(__func__, retval,
_("while writing inode %u"), ino);
return retval;
}
}
/* Capabilities */
if (!capabilities)
return 0;
memset(&cap_data, 0, sizeof(cap_data));
cap_data.magic_etc = VFS_CAP_REVISION_2 | VFS_CAP_FLAGS_EFFECTIVE;
cap_data.data[0].permitted = (uint32_t) (capabilities & 0xffffffff);
cap_data.data[1].permitted = (uint32_t) (capabilities >> 32);
return ino_add_xattr(fs, ino, "security." XATTR_CAPS_SUFFIX,
&cap_data, sizeof(cap_data));
}
static errcode_t set_timestamp(ext2_filsys fs, ext2_ino_t ino,
struct inode_params *params)
{
errcode_t retval;
struct ext2_inode inode;
struct stat stat;
char *src_filename = NULL;
retval = ext2fs_read_inode(fs, ino, &inode);
if (retval) {
com_err(__func__, retval,
_("while reading inode %u"), ino);
return retval;
}
if (params->fixed_time == -1 && params->src_dir) {
/* replace mountpoint from filename with src_dir */
if (asprintf(&src_filename, "%s/%s", params->src_dir,
params->filename + strlen(params->mountpoint)) < 0) {
return -ENOMEM;
}
retval = lstat(src_filename, &stat);
if (retval < 0) {
com_err(__func__, errno,
_("while lstat file %s"), src_filename);
goto end;
}
inode.i_atime = inode.i_ctime = inode.i_mtime = stat.st_mtime;
} else {
inode.i_atime = inode.i_ctime = inode.i_mtime = params->fixed_time;
}
retval = ext2fs_write_inode(fs, ino, &inode);
if (retval) {
com_err(__func__, retval,
_("while writing inode %u"), ino);
goto end;
}
end:
free(src_filename);
return retval;
}
static int is_dir(ext2_filsys fs, ext2_ino_t ino)
{
struct ext2_inode inode;
if (ext2fs_read_inode(fs, ino, &inode))
return 0;
return S_ISDIR(inode.i_mode);
}
static errcode_t androidify_inode(ext2_filsys fs, ext2_ino_t ino,
struct inode_params *params)
{
errcode_t retval;
retval = set_timestamp(fs, ino, params);
if (retval)
return retval;
retval = set_selinux_xattr(fs, ino, params);
if (retval)
return retval;
return set_perms_and_caps(fs, ino, params);
}
static int walk_dir(ext2_ino_t dir EXT2FS_ATTR((unused)),
int flags EXT2FS_ATTR((unused)),
struct ext2_dir_entry *de,
int offset EXT2FS_ATTR((unused)),
int blocksize EXT2FS_ATTR((unused)),
char *buf EXT2FS_ATTR((unused)), void *priv_data)
{
__u16 name_len;
errcode_t retval;
struct inode_params *params = (struct inode_params *)priv_data;
name_len = de->name_len & 0xff;
if (!strncmp(de->name, ".", name_len)
|| (!strncmp(de->name, "..", name_len)))
return 0;
if (asprintf(&params->filename, "%s/%.*s", params->path, name_len,
de->name) < 0) {
params->error = ENOMEM;
return -ENOMEM;
}
if (!strncmp(de->name, "lost+found", 10)) {
retval = set_selinux_xattr(params->fs, de->inode, params);
if (retval)
goto end;
} else {
retval = androidify_inode(params->fs, de->inode, params);
if (retval)
goto end;
if (is_dir(params->fs, de->inode)) {
char *cur_path = params->path;
char *cur_filename = params->filename;
params->path = params->filename;
retval = ext2fs_dir_iterate2(params->fs, de->inode, 0, NULL,
walk_dir, params);
if (retval)
goto end;
params->path = cur_path;
params->filename = cur_filename;
}
}
end:
free(params->filename);
params->error |= retval;
return retval;
}
errcode_t __android_configure_fs(ext2_filsys fs, char *src_dir,
char *target_out,
char *mountpoint,
fs_config_f fs_config_func,
struct selabel_handle *sehnd,
time_t fixed_time,
const struct ugid_map* uid_map,
const struct ugid_map* gid_map)
{
errcode_t retval;
struct inode_params params = {
.fs = fs,
.src_dir = src_dir,
.target_out = target_out,
.fs_config_func = fs_config_func,
.sehnd = sehnd,
.fixed_time = fixed_time,
.path = mountpoint,
.filename = mountpoint,
.mountpoint = mountpoint,
.uid_map = uid_map,
.gid_map = gid_map,
.error = 0
};
/* walk_dir will add the "/". Don't add it twice. */
if (strlen(mountpoint) == 1 && mountpoint[0] == '/')
params.path = "";
retval = androidify_inode(fs, EXT2_ROOT_INO, &params);
if (retval)
return retval;
retval = ext2fs_dir_iterate2(fs, EXT2_ROOT_INO, 0, NULL, walk_dir,
&params);
if (retval)
return retval;
return params.error;
}
errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out,
char *mountpoint,
struct selinux_opt *seopts EXT2FS_ATTR((unused)),
unsigned int nopt EXT2FS_ATTR((unused)),
char *fs_config_file, time_t fixed_time,
const struct ugid_map* uid_map,
const struct ugid_map* gid_map)
{
errcode_t retval;
fs_config_f fs_config_func = NULL;
struct selabel_handle *sehnd = NULL;
/* Retrieve file contexts */
#if !defined(__ANDROID__)
if (nopt > 0) {
sehnd = selabel_open(SELABEL_CTX_FILE, seopts, nopt);
if (!sehnd) {
int saved_errno = errno;
com_err(__func__, errno,
_("while opening file contexts \"%s\""),
seopts[0].value);
return saved_errno;
}
}
#else
sehnd = selinux_android_file_context_handle();
if (!sehnd) {
com_err(__func__, EINVAL,
_("while opening android file_contexts"));
return EINVAL;
}
#endif
/* Load the FS config */
if (fs_config_file) {
retval = load_canned_fs_config(fs_config_file);
if (retval < 0) {
com_err(__func__, retval,
_("while loading fs_config \"%s\""),
fs_config_file);
return retval;
}
fs_config_func = canned_fs_config;
} else if (mountpoint)
fs_config_func = fs_config;
return __android_configure_fs(fs, src_dir, target_out, mountpoint,
fs_config_func, sehnd, fixed_time,
uid_map, gid_map);
}

65
contrib/android/perms.h Normal file
View File

@ -0,0 +1,65 @@
#ifndef ANDROID_PERMS_H
# define ANDROID_PERMS_H
# include "config.h"
# include <ext2fs/ext2fs.h>
typedef void (*fs_config_f)(const char *path, int dir,
const char *target_out_path,
unsigned *uid, unsigned *gid,
unsigned *mode, uint64_t *capabilities);
/*
* Represents a range of UID/GID mapping.
* This maps the id in [|parent_id|, |parent_id| + |length|) into
* [|child_id|, |child_id| + |length|)
*/
struct ugid_map_entry {
unsigned int child_id;
unsigned int parent_id;
unsigned int length;
};
struct ugid_map {
/* The number of elements in |entries|. */
size_t size;
/* An array of entries. If |size| is 0, this is a null pointer. */
struct ugid_map_entry* entries;
};
# ifdef _WIN32
struct selabel_handle;
static inline errcode_t android_configure_fs(ext2_filsys fs,
char *src_dir,
char *target_out,
char *mountpoint,
void *seopts,
unsigned int nopt,
char *fs_config_file,
time_t fixed_time,
const struct ugid_map* uid_map,
const struct ugdi_map* gid_map)
{
return 0;
}
# else
# include <selinux/selinux.h>
# include <selinux/label.h>
# if defined(__ANDROID__)
# include <selinux/android.h>
# endif
# include <private/android_filesystem_config.h>
# include <private/canned_fs_config.h>
errcode_t android_configure_fs(ext2_filsys fs, char *src_dir,
char *target_out,
char *mountpoint,
struct selinux_opt *seopts,
unsigned int nopt,
char *fs_config_file, time_t fixed_time,
const struct ugid_map* uid_map,
const struct ugid_map* gid_map);
# endif
#endif /* !ANDROID_PERMS_H */

45
contrib/build-rpm Normal file
View File

@ -0,0 +1,45 @@
#!/bin/sh
# enable xtrace output if requested
if [ -n ${ENABLE_XTRACE:-''} ]; then
set -x
fi
# Build an e2fsprogs RPM from cvs
pwd=`pwd`
currdir=`basename $pwd`
pkgname=`grep Name: e2fsprogs.spec | awk '{print $2;}'`
pkgvers=`grep Version: e2fsprogs.spec | awk '{print $2;}'`
builddir=${pkgname}-${pkgvers}
# ensure that $TMP is set to something
TMP=${TMP:-'/tmp'}
cd ..
tmpdir=`mktemp -d ${RPM_TMPDIR:-$TMP}/rpmtmp.XXXXXX`
# We need to build a tarball for the SRPM using $builddir as the
# directory name (since that's what RPM will expect it to unpack
# into). That may require a symlink.
# Make a recursive-symlink copy of the source dir
cp -sR `pwd`/$currdir $tmpdir/$builddir || exit 1
# Remove any build files from the temporary tarball directory
[ -f $tmpdir/$builddir/Makefile ] && make -C $tmpdir/$builddir distclean
EXCLUDE="--exclude .hg* --exclude .pc*"
(cd $tmpdir && tar czfh ${builddir}.tar.gz $EXCLUDE $builddir)
[ "`rpmbuild --version 2> /dev/null`" ] && RPM=rpmbuild || RPM=rpm
$RPM --define "_sourcedir $tmpdir" \
--define "_topdir ${RPM_TOPDIR:-$(rpm -E %_topdir)}" \
--define "_tmpdir ${RPM_TMPDIR:-$TMP}" \
--define "extra_config_flags ${EXTRA_CONFIG_FLAGS:-''}" \
-ba $currdir/e2fsprogs.spec
rpm_exit=$?
rm -rf $tmpdir
exit $rpm_exit

118
contrib/dconf Normal file
View File

@ -0,0 +1,118 @@
#!/bin/sh
#$Id$
# Create Adobe-PostScript file that graphically displays the output of
# dumpe2fs(8). Use "dumpe2fs | dconf" to create a PostScript file on stdout.
# Developed and tested for Linux 1.0.
# Copyright (c) 1994
# Ulrich Windl
# ALte Regensburger Strasse 11a
# D-93149 Nittenau, Germany
# <Ulrich.Windl@rz.uni-regensburg.de>
SELF=`basename $0`
AWKFILE=/tmp/${SELF}.awk
TEMPFILE=/tmp/${SELF}.tmp
echo '
BEGIN {
print "B"
}
/^Inode count:/ {
ic=$3; next
}
/^Block count:/ {
bc=$3; next
}
/^First block:/ {
fb=$3; next
}
/^Block size:/ {
bs=$3; next
}
/^Blocks per group:/ {
bpg=$4
printf("BC %d\n", bpg)
printf("GC %d\n", (bc + bpg - 1) / bpg)
next
}
/^Inodes per group:/ {
ipg=$4; next
}
/^Last write time:/ {
lwtime=$0; gsub("Last write time:[ ]+", "", lwtime)
printf("T %s\n", lwtime)
next
}
/^Group [0-9]+:/ {
group=$2; gsub(":", "", group)
block=""
group_start=group*bpg+fb
group_end=group_start+bpg
printf("G %d : %d - %d\n", group, group_start, group_end)
next
}
/^[ ]+Free blocks: / {
for ( i=3; i < NF; ++i ) {
block=$i; gsub(",", "", block)
if ( index(block, "-") == 0 ) block=block "-" block
pos=index(block, "-")
printf("FB %d-%d\n",
substr(block, 0, pos) - group_start,
substr(block, pos + 1) - group_start)
}
if ( block == "" ) printf("Group %d is full\n", group)
print "----"
next
}
END {
printf("E %s\n", lwtime)
}' >$AWKFILE
awk -f $AWKFILE $* >$TEMPFILE
echo '
BEGIN {
printf("%%!PS-Adobe\n")
printf("%%%%BoundingBox: 0 0 1 1\n")
printf("/rect {/y2 exch def /x2 exch def /y1 exch def /x1 exch def\n")
printf(" newpath x1 y1 moveto x2 y1 lineto x2 y2 lineto\n")
printf(" x1 y2 lineto closepath} def\n")
printf("/fb {rect gsave 1.0 setgray fill grestore} def\n")
printf("/dg {rect gsave gsave 0.0 setgray fill grestore\n")
printf(" 0.5 setgray stroke grestore} def\n")
printf("/textxy {moveto show} bind def\n")
printf("0.0001 setlinewidth\n")
}
$1 == "GC" && NF == 2 {
number_of_groups=$2
printf("/Times-Roman findfont %g scalefont setfont\n",
1.0 / number_of_groups)
next
}
$1 == "BC" && NF == 2 {
blocks_per_group=$2; next
}
$1 == "T" && NF > 1 {
printf("(%s) %g %g textxy\n",
substr($0, 2), 0, 1.02)
next
}
$1 == "G" && NF == 6 && $3 == ":" && $5 == "-" {
group_index=$2
gs=$4
ge=$6
height=1.0 / number_of_groups
vstart=group_index * height
printf("%% group %d of %d:\n0 %g 1 %g dg\n",
group_index, number_of_groups, vstart, vstart + height)
printf("(Group %s) 1.02 %g textxy\n", group_index, vstart)
next
}
$1 == "FB" && NF == 2 {
pos = index($2, "-")
printf("%% hole %s\n%g %g %g %g fb\n",
$2, substr($2, 0, pos) / blocks_per_group, vstart,
(substr($2, pos + 1) + 1) / blocks_per_group, vstart + height)
next
}
END {
printf("%%%%EOF\n")
}
' >$AWKFILE
awk -f $AWKFILE $TEMPFILE

66
contrib/dir2fs Executable file
View File

@ -0,0 +1,66 @@
#!/bin/sh
dir="$1"
dev="$2"
if [ "$1" = "--help" ] || [ ! -d "${dir}" ]; then
echo "Usage: $0 dir [mke2fs args] dev"
exit 1
fi
shift
# Goal: Put all the files at the beginning (which mke2fs does) and minimize
# the number of free inodes given the minimum number of blocks required.
# Hence all this math to get the inode ratio just right.
bytes="$(du -ks "${dir}" | awk '{print $1}')"
bytes="$((bytes * 1024))"
inodes="$(find "${dir}" -print0 | xargs -0 stat -c '%i' | sort -g | uniq | wc -l)"
block_sz=4096
inode_sz=256
sb_overhead=4096
blocks_per_group="$((block_sz * 8))"
bytes_per_group="$((blocks_per_group * block_sz))"
inode_bytes="$((inodes * inode_sz))"
# Estimate overhead with the minimum number of groups...
nr_groups="$(( (bytes + inode_bytes + bytes_per_group - 1) / bytes_per_group))"
inode_bytes_per_group="$((inode_bytes / nr_groups))"
inode_blocks_per_group="$(( (inode_bytes_per_group + (block_sz - 1)) / block_sz ))"
per_grp_overhead="$(( ((3 + inode_blocks_per_group) * block_sz) + 64 ))"
overhead="$(( sb_overhead + (per_grp_overhead * nr_groups) ))"
used_bytes="$((bytes + overhead))"
# Then do it again with the real number of groups.
nr_groups="$(( (used_bytes + (bytes_per_group - 1)) / bytes_per_group))"
tot_blocks="$((nr_groups * blocks_per_group))"
tot_bytes="$((tot_blocks * block_sz))"
ratio="$((bytes / inodes))"
mkfs_blocks="$((tot_blocks * 4 / 3))"
mke2fs -i "${ratio}" -T ext4 -d "${dir}" -O ^resize_inode,sparse_super2,metadata_csum,64bit,^has_journal -E packed_meta_blocks=1,num_backup_sb=0 -b "${block_sz}" -I "${inodesz}" -F "${dev}" "${mkfs_blocks}" || exit
e2fsck -fyD "${dev}"
blocks="$(dumpe2fs -h "${dev}" 2>&1 | grep 'Block count:' | awk '{print $3}')"
while resize2fs -f -M "${dev}"; do
new_blocks="$(dumpe2fs -h "${dev}" 2>&1 | grep 'Block count:' | awk '{print $3}')"
if [ "${new_blocks}" -eq "${blocks}" ]; then
break;
fi
blocks="${new_blocks}"
done
if [ ! -b "${dev}" ]; then
truncate -s "$((blocks * block_sz))" "${dev}" || (e2image -ar "${dev}" "${dev}.min"; mv "${dev}.min" "${dev}")
fi
e2fsck -fy "${dev}"
dir_blocks="$((bytes / block_sz))"
overhead="$((blocks - dir_blocks))"
echo "Minimized image overhead: $((100 * overhead / dir_blocks))%"
exit 0

47
contrib/e2croncheck Executable file
View File

@ -0,0 +1,47 @@
#!/bin/sh
#
# e2croncheck -- run e2fsck automatically out of /etc/cron.weekly
#
# This script is intended to be run by the system administrator
# periodically from the command line, or to be run once a week
# or so by the cron daemon to check a mounted filesystem (normally
# the root filesystem, but it could be used to check other filesystems
# that are always mounted when the system is booted).
#
# Make sure you customize "VG" so it is your LVM volume group name,
# "VOLUME" so it is the name of the filesystem's logical volume,
# and "EMAIL" to be your e-mail address
#
# Written by Theodore Ts'o, Copyright 2007, 2008, 2009.
#
# This file may be redistributed under the terms of the
# GNU Public License, version 2.
#
VG=ssd
VOLUME=root
SNAPSIZE=100m
EMAIL=sysadmin@example.com
TMPFILE=`mktemp ${TMPDIR:-/tmp}/e2fsck.log.XXXXXXXXXX`
OPTS="-Fttv -C0"
#OPTS="-Fttv -E fragcheck"
set -e
START="$(date +'%Y%m%d%H%M%S')"
lvcreate -s -L ${SNAPSIZE} -n "${VOLUME}-snap" "${VG}/${VOLUME}"
if nice logsave -as $TMPFILE e2fsck -p $OPTS "/dev/${VG}/${VOLUME}-snap" && \
nice logsave -as $TMPFILE e2fsck -fy $OPTS "/dev/${VG}/${VOLUME}-snap" ; then
echo 'Background scrubbing succeeded!'
tune2fs -C 0 -T "${START}" "/dev/${VG}/${VOLUME}"
else
echo 'Background scrubbing failed! Reboot to fsck soon!'
tune2fs -C 16000 -T "19000101" "/dev/${VG}/${VOLUME}"
if test -n "$RPT-EMAIL"; then
mail -s "E2fsck of /dev/${VG}/${VOLUME} failed!" $EMAIL < $TMPFILE
fi
fi
lvremove -f "${VG}/${VOLUME}-snap"
rm $TMPFILE

190
contrib/fallocate.c Normal file
View File

@ -0,0 +1,190 @@
/*
* fallocate - utility to use the fallocate system call
*
* Copyright (C) 2008 Red Hat, Inc. All rights reserved.
* Written by Eric Sandeen <sandeen@redhat.com>
*
* cvtnum routine taken from xfsprogs,
* Copyright (c) 2003-2005 Silicon Graphics, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
// #include <linux/falloc.h>
#define FALLOC_FL_KEEP_SIZE 0x01
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
#define FALLOC_FL_COLLAPSE_RANGE 0x08
#define FALLOC_FL_ZERO_RANGE 0x10
void usage(void)
{
printf("Usage: fallocate [-npt] [-o offset] -l length filename\n");
exit(EXIT_FAILURE);
}
#define EXABYTES(x) ((long long)(x) << 60)
#define PETABYTES(x) ((long long)(x) << 50)
#define TERABYTES(x) ((long long)(x) << 40)
#define GIGABYTES(x) ((long long)(x) << 30)
#define MEGABYTES(x) ((long long)(x) << 20)
#define KILOBYTES(x) ((long long)(x) << 10)
long long
cvtnum(char *s)
{
long long i;
char *sp;
int c;
i = strtoll(s, &sp, 0);
if (i == 0 && sp == s)
return -1LL;
if (*sp == '\0')
return i;
if (sp[1] != '\0')
return -1LL;
c = tolower(*sp);
switch (c) {
case 'k':
return KILOBYTES(i);
case 'm':
return MEGABYTES(i);
case 'g':
return GIGABYTES(i);
case 't':
return TERABYTES(i);
case 'p':
return PETABYTES(i);
case 'e':
return EXABYTES(i);
}
return -1LL;
}
int main(int argc, char **argv)
{
int fd;
char *fname;
int opt;
loff_t length = -2LL;
loff_t offset = 0;
int falloc_mode = 0;
int error;
int tflag = 0;
while ((opt = getopt(argc, argv, "npl:o:tzc")) != -1) {
switch(opt) {
case 'n':
/* do not change filesize */
falloc_mode = FALLOC_FL_KEEP_SIZE;
break;
case 'p':
/* punch mode */
falloc_mode = (FALLOC_FL_PUNCH_HOLE |
FALLOC_FL_KEEP_SIZE);
break;
case 'c':
/* collapse range mode */
falloc_mode = (FALLOC_FL_COLLAPSE_RANGE |
FALLOC_FL_KEEP_SIZE);
break;
case 'z':
/* zero range mode */
falloc_mode = (FALLOC_FL_ZERO_RANGE |
FALLOC_FL_KEEP_SIZE);
break;
case 'l':
length = cvtnum(optarg);
break;
case 'o':
offset = cvtnum(optarg);
break;
case 't':
tflag++;
break;
default:
usage();
}
}
if (length == -2LL) {
printf("Error: no length argument specified\n");
usage();
}
if (length <= 0) {
printf("Error: invalid length value specified\n");
usage();
}
if (offset < 0) {
printf("Error: invalid offset value specified\n");
usage();
}
if (tflag && (falloc_mode & FALLOC_FL_KEEP_SIZE)) {
printf("-n and -t options incompatible\n");
usage();
}
if (tflag && offset) {
printf("-n and -o options incompatible\n");
usage();
}
if (optind == argc) {
printf("Error: no filename specified\n");
usage();
}
fname = argv[optind++];
/* Should we create the file if it doesn't already exist? */
fd = open(fname, O_WRONLY|O_LARGEFILE);
if (fd < 0) {
perror("Error opening file");
exit(EXIT_FAILURE);
}
if (tflag)
error = ftruncate(fd, length);
else
error = syscall(SYS_fallocate, fd, falloc_mode, offset, length);
if (error < 0) {
perror("fallocate failed");
exit(EXIT_FAILURE);
}
close(fd);
return 0;
}

2701
contrib/fsstress.c Normal file

File diff suppressed because it is too large Load Diff

19
contrib/jbd2-resync.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 kernel-file e2fsprogs-file"
exit 0
fi
# Transform a few things to fit the compatibility things defined in jfs_user.h.
# Use the ext2fs_ endian conversion functions because they truncate oversized
# inputs (e.g. passing a u32 to cpu_to_be16()) like the kernel versions and
# unlike the libc6 versions.
exec sed -e 's/JBD_/JFS_/g' \
-e 's/JBD2_/JFS_/g' \
-e 's/jbd2_journal_/journal_/g' \
-e 's/__be/__u/g' \
-e 's/struct kmem_cache/lkmem_cache_t/g' \
-e 's/cpu_to_be/ext2fs_cpu_to_be/g' \
-e 's/be\([0-9][0-9]\)_to_cpu/ext2fs_be\1_to_cpu/g' \
< "$1" > "$2"

91
contrib/make-sparse.c Normal file
View File

@ -0,0 +1,91 @@
/*
* make-sparse.c --- make a sparse file from stdin
*
* Copyright 2004 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
int full_read(int fd, char *buf, size_t count)
{
int got, total = 0;
int pass = 0;
while (count > 0) {
got = read(fd, buf, count);
if (got == -1) {
if ((errno == EINTR) || (errno == EAGAIN))
continue;
return total ? total : -1;
}
if (got == 0) {
if (pass++ >= 3)
return total;
continue;
}
pass = 0;
buf += got;
total += got;
count -= got;
}
return total;
}
int main(int argc, char **argv)
{
int fd, got, i;
int zflag = 0;
char buf[1024];
if (argc != 2) {
fprintf(stderr, "Usage: make-sparse out-file\n");
exit(1);
}
fd = open(argv[1], O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0777);
if (fd < 0) {
perror(argv[1]);
exit(1);
}
while (1) {
got = full_read(0, buf, sizeof(buf));
if (got == 0)
break;
if (got == sizeof(buf)) {
for (i=0; i < sizeof(buf); i++)
if (buf[i])
break;
if (i == sizeof(buf)) {
lseek(fd, sizeof(buf), SEEK_CUR);
zflag = 1;
continue;
}
}
zflag = 0;
write(fd, buf, got);
}
if (zflag) {
lseek(fd, -1, SEEK_CUR);
buf[0] = 0;
write(fd, buf, 1);
}
return 0;
}

105
contrib/populate-extfs.sh Executable file
View File

@ -0,0 +1,105 @@
#!/bin/sh
#
# This script uses debugfs command to populate the ext2/3/4 filesystem
# from a given directory.
#
do_usage () {
cat << _EOF
Usage: populate-extfs.sh <source> <device>
Create an ext2/ext3/ext4 filesystem from a directory or file
source: The source directory or file
device: The target device
_EOF
exit 1
}
[ $# -ne 2 ] && do_usage
SRCDIR=${1%%/}
DEVICE=$2
# Find where is the debugfs command if not found in the env.
if [ -z "$DEBUGFS" ]; then
CONTRIB_DIR=$(dirname $(readlink -f $0))
DEBUGFS="$CONTRIB_DIR/../debugfs/debugfs"
fi
{
CWD="/"
find $SRCDIR | while read FILE; do
TGT="${FILE##*/}"
DIR="${FILE#$SRCDIR}"
DIR="${DIR%$TGT}"
# Skip the root dir
[ ! -z "$DIR" ] || continue
[ ! -z "$TGT" ] || continue
if [ "$DIR" != "$CWD" ]; then
echo "cd $DIR"
CWD="$DIR"
fi
# Only stat once since stat is a time consuming command
STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" $FILE)
eval $STAT
case $TYPE in
"directory")
echo "mkdir $TGT"
;;
"regular file" | "regular empty file")
echo "write $FILE $TGT"
;;
"symbolic link")
LINK_TGT=$(readlink $FILE)
echo "symlink $TGT $LINK_TGT"
;;
"block special file")
echo "mknod $TGT b $DEVNO"
;;
"character special file")
echo "mknod $TGT c $DEVNO"
;;
"fifo")
echo "mknod $TGT p"
;;
*)
echo "Unknown/unhandled file type '$TYPE' file: $FILE" 1>&2
;;
esac
# Set the file mode
echo "sif $TGT mode 0x$MODE"
# Set uid and gid
echo "sif $TGT uid $U"
echo "sif $TGT gid $G"
done
# Handle the hard links.
# Save the hard links to a file, use the inode number as the filename, for example:
# If a and b's inode number is 6775928, save a and b to /tmp/tmp.VrCwHh5gdt/6775928.
INODE_DIR=`mktemp -d` || exit 1
for i in `find $SRCDIR -type f -links +1 -printf 'INODE=%i###FN=%p\n'`; do
eval `echo $i | sed 's$###$ $'`
echo ${FN#$SRCDIR} >>$INODE_DIR/$INODE
done
# Use the debugfs' ln and "sif links_count" to handle them.
for i in `ls $INODE_DIR`; do
# The link source
SRC=`head -1 $INODE_DIR/$i`
# Remove the files and link them again except the first one
for TGT in `sed -n -e '1!p' $INODE_DIR/$i`; do
echo "rm $TGT"
echo "ln $SRC $TGT"
done
LN_CNT=`cat $INODE_DIR/$i | wc -l`
# Set the links count
echo "sif $SRC links_count $LN_CNT"
done
rm -fr $INODE_DIR
} | $DEBUGFS -w -f - $DEVICE

11
contrib/python-uuid/setup.py Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/python
from distutils.core import setup, Extension
uuid = Extension('e2fsprogs_uuid',
sources = ['uuid.c'],
libraries = ['uuid'])
setup (name = 'e2fsprogs_uuid',
version = '1.0',
description = 'This is python uuid interface',
ext_modules = [uuid])

18
contrib/python-uuid/test.py Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python
import e2fsprogs_uuid
import time
print "Generating uuid...",
try:
time = time.time()
u = e2fsprogs_uuid.generate()
except:
u = "FAIL"
print u, "...", time
print "Calling generate with param...",
try:
e2fsprogs_uuid.generate("param")
print "FAIL."
except:
print "OK"

View File

@ -0,0 +1,23 @@
#include <Python.h>
#include <time.h>
#include <uuid/uuid.h>
static PyObject * _uuid_generate(PyObject *self, PyObject *args)
{
uuid_t u;
char uuid[37];
if (!PyArg_ParseTuple(args, "")) return NULL;
uuid_generate(u);
uuid_unparse(u, uuid);
return Py_BuildValue("s", uuid);
}
static PyMethodDef _uuid_methods[] = {
{"generate", _uuid_generate, METH_VARARGS, "Generate UUID"},
{NULL, NULL, 0, NULL}
};
void inite2fsprogs_uuid(void)
{
(void) Py_InitModule("e2fsprogs_uuid", _uuid_methods);
}

458
contrib/spd_readdir.c Normal file
View File

@ -0,0 +1,458 @@
/*
* readdir accelerator
*
* (C) Copyright 2003, 2004, 2008 by Theodore Ts'o.
*
* 2008-06-08 Modified by Ross Boylan <RossBoylan stanfordalumni org>
* Added support for readdir_r and readdir64_r calls. Note
* this has not been tested on anything other than GNU/Linux i386,
* and that the regular readdir wrapper will take slightly more
* space than Ted's original since it now includes a lock.
*
* Compile using the command:
*
* gcc -o spd_readdir.so -shared -fpic spd_readdir.c -ldl
*
* Use it by setting the LD_PRELOAD environment variable:
*
* export LD_PRELOAD=/usr/local/sbin/spd_readdir.so
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*
*/
#define ALLOC_STEPSIZE 100
#define MAX_DIRSIZE 0
#define DEBUG
/* Util we autoconfiscate spd_readdir... */
#define HAVE___SECURE_GETENV 1
#define HAVE_PRCTL 1
#define HAVE_SYS_PRCTL_H 1
#ifdef DEBUG
#define DEBUG_DIR(x) {if (do_debug) { x; }}
#else
#define DEBUG_DIR(x)
#endif
#define _GNU_SOURCE
#define __USE_LARGEFILE64
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <dlfcn.h>
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#else
#define PR_GET_DUMPABLE 3
#endif
#include <pthread.h>
struct dirent_s {
unsigned long long d_ino;
long long d_off;
unsigned short int d_reclen;
unsigned char d_type;
char *d_name;
};
struct dir_s {
DIR *dir;
pthread_mutex_t lock; /* Mutex lock for this structure. */
int num;
int max;
struct dirent_s *dp;
int pos;
int direct;
struct dirent ret_dir;
struct dirent64 ret_dir64;
};
static int (*real_closedir)(DIR *dir) = 0;
static DIR *(*real_opendir)(const char *name) = 0;
static DIR *(*real_fdopendir)(int fd) = 0;
static void *(*real_rewinddir)(DIR *dirp) = 0;
static struct dirent *(*real_readdir)(DIR *dir) = 0;
static int (*real_readdir_r)(DIR *dir, struct dirent *entry,
struct dirent **result) = 0;
static struct dirent64 *(*real_readdir64)(DIR *dir) = 0;
static int (*real_readdir64_r)(DIR *dir, struct dirent64 *entry,
struct dirent64 **result) = 0;
static off_t (*real_telldir)(DIR *dir) = 0;
static void (*real_seekdir)(DIR *dir, off_t offset) = 0;
static int (*real_dirfd)(DIR *dir) = 0;
static unsigned long max_dirsize = MAX_DIRSIZE;
static int num_open = 0;
#ifdef DEBUG
static int do_debug = 0;
#endif
static char *safe_getenv(const char *arg)
{
if ((getuid() != geteuid()) || (getgid() != getegid()))
return NULL;
#if HAVE_PRCTL
if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
return NULL;
#else
#if (defined(linux) && defined(SYS_prctl))
if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
return NULL;
#endif
#endif
#if HAVE___SECURE_GETENV
return __secure_getenv(arg);
#else
return getenv(arg);
#endif
}
static void setup_ptr()
{
char *cp;
real_opendir = dlsym(RTLD_NEXT, "opendir");
real_fdopendir = dlsym(RTLD_NEXT, "fdopendir");
real_closedir = dlsym(RTLD_NEXT, "closedir");
real_rewinddir = dlsym(RTLD_NEXT, "rewinddir");
real_readdir = dlsym(RTLD_NEXT, "readdir");
real_readdir_r = dlsym(RTLD_NEXT, "readdir_r");
real_readdir64 = dlsym(RTLD_NEXT, "readdir64");
real_readdir64_r = dlsym(RTLD_NEXT, "readdir64_r");
real_telldir = dlsym(RTLD_NEXT, "telldir");
real_seekdir = dlsym(RTLD_NEXT, "seekdir");
real_dirfd = dlsym(RTLD_NEXT, "dirfd");
if ((cp = safe_getenv("SPD_READDIR_MAX_SIZE")) != NULL) {
max_dirsize = atol(cp);
}
#ifdef DEBUG
if (safe_getenv("SPD_READDIR_DEBUG")) {
printf("initialized!\n");
do_debug++;
}
#endif
}
static void free_cached_dir(struct dir_s *dirstruct)
{
int i;
pthread_mutex_destroy(&(dirstruct->lock));
if (!dirstruct->dp)
return;
for (i=0; i < dirstruct->num; i++) {
free(dirstruct->dp[i].d_name);
}
free(dirstruct->dp);
dirstruct->dp = 0;
dirstruct->max = dirstruct->num = 0;
}
static int ino_cmp(const void *a, const void *b)
{
const struct dirent_s *ds_a = (const struct dirent_s *) a;
const struct dirent_s *ds_b = (const struct dirent_s *) b;
ino_t i_a, i_b;
i_a = ds_a->d_ino;
i_b = ds_b->d_ino;
if (ds_a->d_name[0] == '.') {
if (ds_a->d_name[1] == 0)
i_a = 0;
else if ((ds_a->d_name[1] == '.') && (ds_a->d_name[2] == 0))
i_a = 1;
}
if (ds_b->d_name[0] == '.') {
if (ds_b->d_name[1] == 0)
i_b = 0;
else if ((ds_b->d_name[1] == '.') && (ds_b->d_name[2] == 0))
i_b = 1;
}
return (i_a - i_b);
}
static struct dir_s *alloc_dirstruct(DIR *dir)
{
struct dir_s *dirstruct;
static pthread_mutexattr_t mutexattr;
mutexattr.__align = PTHREAD_MUTEX_RECURSIVE;
dirstruct = malloc(sizeof(struct dir_s));
if (dirstruct)
memset(dirstruct, 0, sizeof(struct dir_s));
dirstruct->dir = dir;
pthread_mutex_init(&(dirstruct->lock), &mutexattr);
return dirstruct;
}
static void cache_dirstruct(struct dir_s *dirstruct)
{
struct dirent_s *ds, *dnew;
struct dirent64 *d;
while ((d = (*real_readdir64)(dirstruct->dir)) != NULL) {
if (dirstruct->num >= dirstruct->max) {
dirstruct->max += ALLOC_STEPSIZE;
DEBUG_DIR(printf("Reallocating to size %d\n",
dirstruct->max));
dnew = realloc(dirstruct->dp,
dirstruct->max * sizeof(struct dir_s));
if (!dnew)
goto nomem;
dirstruct->dp = dnew;
}
ds = &dirstruct->dp[dirstruct->num++];
ds->d_ino = d->d_ino;
ds->d_off = d->d_off;
ds->d_reclen = d->d_reclen;
ds->d_type = d->d_type;
if ((ds->d_name = malloc(strlen(d->d_name)+1)) == NULL) {
dirstruct->num--;
goto nomem;
}
strcpy(ds->d_name, d->d_name);
DEBUG_DIR(printf("readdir: %lu %s\n",
(unsigned long) d->d_ino, d->d_name));
}
qsort(dirstruct->dp, dirstruct->num, sizeof(struct dirent_s), ino_cmp);
return;
nomem:
DEBUG_DIR(printf("No memory, backing off to direct readdir\n"));
free_cached_dir(dirstruct);
dirstruct->direct = 1;
}
DIR *opendir(const char *name)
{
DIR *dir;
struct dir_s *dirstruct;
struct stat st;
if (!real_opendir)
setup_ptr();
DEBUG_DIR(printf("Opendir(%s) (%d open)\n", name, num_open++));
dir = (*real_opendir)(name);
if (!dir)
return NULL;
dirstruct = alloc_dirstruct(dir);
if (!dirstruct) {
(*real_closedir)(dir);
errno = -ENOMEM;
return NULL;
}
if (max_dirsize && (stat(name, &st) == 0) &&
(st.st_size > max_dirsize)) {
DEBUG_DIR(printf("Directory size %ld, using direct readdir\n",
st.st_size));
dirstruct->direct = 1;
return (DIR *) dirstruct;
}
cache_dirstruct(dirstruct);
return ((DIR *) dirstruct);
}
DIR *fdopendir(int fd)
{
DIR *dir;
struct dir_s *dirstruct;
struct stat st;
if (!real_fdopendir)
setup_ptr();
DEBUG_DIR(printf("fdopendir(%d) (%d open)\n", fd, num_open++));
dir = (*real_fdopendir)(fd);
if (!dir)
return NULL;
dirstruct = alloc_dirstruct(dir);
if (!dirstruct) {
(*real_closedir)(dir);
errno = -ENOMEM;
return NULL;
}
if (max_dirsize && (fstat(fd, &st) == 0) &&
(st.st_size > max_dirsize)) {
DEBUG_DIR(printf("Directory size %ld, using direct readdir\n",
st.st_size));
dirstruct->dir = dir;
dirstruct->direct = 1;
return (DIR *) dirstruct;
}
cache_dirstruct(dirstruct);
return ((DIR *) dirstruct);
}
int closedir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
DEBUG_DIR(printf("Closedir (%d open)\n", --num_open));
if (dirstruct->dir)
(*real_closedir)(dirstruct->dir);
free_cached_dir(dirstruct);
free(dirstruct);
return 0;
}
struct dirent *readdir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
struct dirent_s *ds;
if (dirstruct->direct)
return (*real_readdir)(dirstruct->dir);
if (dirstruct->pos >= dirstruct->num)
return NULL;
ds = &dirstruct->dp[dirstruct->pos++];
dirstruct->ret_dir.d_ino = ds->d_ino;
dirstruct->ret_dir.d_off = ds->d_off;
dirstruct->ret_dir.d_reclen = ds->d_reclen;
dirstruct->ret_dir.d_type = ds->d_type;
strncpy(dirstruct->ret_dir.d_name, ds->d_name,
sizeof(dirstruct->ret_dir.d_name));
return (&dirstruct->ret_dir);
}
int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
struct dirent_s *ds;
if (dirstruct->direct)
return (*real_readdir_r)(dirstruct->dir, entry, result);
pthread_mutex_lock(&(dirstruct->lock));
if (dirstruct->pos >= dirstruct->num) {
*result = NULL;
} else {
ds = &dirstruct->dp[dirstruct->pos++];
entry->d_ino = ds->d_ino;
entry->d_off = ds->d_off;
entry->d_reclen = ds->d_reclen;
entry->d_type = ds->d_type;
strncpy(entry->d_name, ds->d_name, sizeof(entry->d_name));
*result = entry;
}
pthread_mutex_unlock(&(dirstruct->lock));
return 0;
}
struct dirent64 *readdir64(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
struct dirent_s *ds;
if (dirstruct->direct)
return (*real_readdir64)(dirstruct->dir);
if (dirstruct->pos >= dirstruct->num)
return NULL;
ds = &dirstruct->dp[dirstruct->pos++];
dirstruct->ret_dir64.d_ino = ds->d_ino;
dirstruct->ret_dir64.d_off = ds->d_off;
dirstruct->ret_dir64.d_reclen = ds->d_reclen;
dirstruct->ret_dir64.d_type = ds->d_type;
strncpy(dirstruct->ret_dir64.d_name, ds->d_name,
sizeof(dirstruct->ret_dir64.d_name));
return (&dirstruct->ret_dir64);
}
int readdir64_r (DIR *__restrict dir,
struct dirent64 *__restrict entry,
struct dirent64 **__restrict result)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
struct dirent_s *ds;
if (dirstruct->direct)
return (*real_readdir64_r)(dir, entry, result);
pthread_mutex_lock(&(dirstruct->lock));
if (dirstruct->pos >= dirstruct->num) {
*result = NULL;
} else {
ds = &dirstruct->dp[dirstruct->pos++];
entry->d_ino = ds->d_ino;
entry->d_off = ds->d_off;
entry->d_reclen = ds->d_reclen;
entry->d_type = ds->d_type;
strncpy(entry->d_name, ds->d_name,
sizeof(entry->d_name));
*result = entry;
}
pthread_mutex_unlock(&(dirstruct->lock));
return 0;
}
off_t telldir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
if (dirstruct->direct)
return (*real_telldir)(dirstruct->dir);
return ((off_t) dirstruct->pos);
}
void seekdir(DIR *dir, off_t offset)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
if (dirstruct->direct) {
(*real_seekdir)(dirstruct->dir, offset);
return;
}
dirstruct->pos = offset;
}
void rewinddir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
(*real_rewinddir)(dirstruct->dir);
if (dirstruct->direct)
return;
pthread_mutex_lock(&(dirstruct->lock));
dirstruct->pos = 0;
free_cached_dir(dirstruct);
cache_dirstruct(dirstruct);
pthread_mutex_unlock(&(dirstruct->lock));
}
int dirfd(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
int fd = (*real_dirfd)(dirstruct->dir);
DEBUG_DIR(printf("dirfd %d, %p\n", fd, real_dirfd));
return fd;
}

1
debian/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
!patches

4
debian/attic/comerrg-dev.info vendored Normal file
View File

@ -0,0 +1,4 @@
DESCR="The Common Error Description library."
SECTION_MATCH="Development"
SECTION_NAME="Development"
FILE=com_err.info

7
debian/attic/comerrg-dev.menu vendored Normal file
View File

@ -0,0 +1,7 @@
?package(comerrg-dev):needs="dwww" section="Apps/Programming"\
title="The com_err library" \
longtitle="The Common Error Description library"\
description="libcomerr 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 identified with mechanisms commonly in use." \
command="/usr/doc/comerrg-dev/html-info/com_err_toc.html"

4
debian/attic/e2fslibsg-dev.info vendored Normal file
View File

@ -0,0 +1,4 @@
DESCR="Library of routines to manipulate an ext2 filesystem."
SECTION_MATCH="Development"
SECTION_NAME="Development"
FILE=libext2fs.info

4
debian/attic/e2fslibsg-dev.menu vendored Normal file
View File

@ -0,0 +1,4 @@
?package(e2fslibsg-dev):needs="dwww" section="Apps/Programming"\
title="The ext2fs library." \
longtitle="A library to handle low-level structures in an ext2 filesystem"\
command="/usr/doc/e2fslibsg-dev/html-info/libext2fs_toc.html"

2
debian/attic/libs/comerr2g.files vendored Normal file
View File

@ -0,0 +1,2 @@
lib/libcom_err.so.?.*
lib/libcom_err.so.?

114
debian/attic/libs/control vendored Normal file
View File

@ -0,0 +1,114 @@
Source: e2fsprogs
Section: base
Priority: required
Maintainer: Yann Dirson <dirson@debian.org>
Standards-Version: 2.4.0.0
Package: e2fsprogs
Essential: yes
Depends: ${shlibs:Depends}
Conflicts: e2fsprogsg, dump (<< 0.4b4-4), quota (<< 1.55-8.1)
Architecture: any
Description: The EXT2 file system utilities.
EXT2 stands for "Extended Filesystem", version 2. It's the main
filesystem type used for hard disks on Debian and other Linux systems.
.
This package contains programs for creating, checking, and maintaining EXT2
filesystems, and the generic `fsck' wrapper.
.
This release may break older versions of dump and quota.
Package: comerr2g
Depends: ${shlibs:Depends}
Conflicts: e2fsprogs (<< 1.10-6), comerr2
Architecture: any
Description: The Common Error Description library - shared libraries.
libcomerr 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 identified with mechanisms commonly in use.
.
It is mainly used by the EXT2-filesystem tools.
Package: ss2g
Depends: ${shlibs:Depends}
Conflicts: e2fsprogs (<< 1.10-6), ss2
Architecture: any
Description: "Sub-System" library for simple command-line interface parsing - shared libs
This package contains the shared libs to support command-line
interface parsers generated with the ssg-dev package.
.
It was originally inspired by the Multics SubSystem library.
Package: e2fslibsg
Depends: ${shlibs:Depends}
Provides: ext2fs2g, e2p2g, uuid1g
Conflicts: e2fsprogs (<= 1.10-7)
Architecture: any
Description: The EXT2 file system shared libs.
EXT2 stands for "Extended Filesystem", version 2. It's the filesystem type
used for hard disks on Debian and other Linux systems.
.
This package contains shared libraries needed by the utility programs.
Package: comerrg-dev
Section: devel
Priority: extra
Depends: ${libcdev:Depends}, comerr2g
Suggests: doc-base
Conflicts: e2fsprogs (<< 1.10-6), comerr-dev
Architecture: any
Description: The Common Error Description library - headers and static libraries.
libcomerr 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 identified with mechanisms commonly in use.
Package: ssg-dev
Section: devel
Priority: extra
Depends: ${libcdev:Depends}, ss2g
Conflicts: e2fsprogs (<< 1.10-6), ss-dev
Architecture: any
Description: "Sub-System" library for simple command-line interface parsing - devel. files
This package includes a tool that parses a command table to generate
a simple command-line interface parser, the include files needed to
compile and use it, and the static libs.
.
It was originally inspired by the Multics SubSystem library.
Package: e2fslibsg-dev
Section: devel
Priority: extra
Depends: ${libcdev:Depends}, e2fslibsg, comerrg-dev
Suggests: doc-base
Provides: ext2fsg-dev, e2pg-dev, uuidg-dev
Conflicts: e2fsprogs (<< 1.10-6), e2fslibs-dev
Architecture: any
Description: The headers and static libraries for ext2fs-aware tools-development.
EXT2FS stands for "Extended Filesystem", version 2. It's the filesystem
type used for hard disks on Debian and other Linux systems.
.
This package contains the headers and shared libraries needed to compile
ext2fs-aware programs. Only programmers that really manipulate
features specific to the ext2 filesystem will need this. Most
programmers will use the generic filesystem-independent interface
from libc.
.
It also contains dev files for 2 other libs (e2p and uuid) used by
the e2fsprogs, but which are not yet packaged all by themselves
because they lack documentation. They may also lack some support
files, by I can't really know until someone uses them...
.
libe2p is for user-level e2fsprogs commands. It's used by dumpe2fs,
chattr, and lsattr. Functions in libe2p typically have two
characteristics (a) don't require that block device containing the
filesystem be opened directly (functions in libext2fs do), and (b)
libe2p typically contains printf statements or parse user input, and so
have more internationalization issues.
.
libuuid generates and parses 128-bit universally unique id's (UUID's),
using a standard which is blessed by both Microsoft and DCE, and is
being proposed as an internet standard. See the internet-draft:
.
draft-leach-uuids-guids-01.txt
.
for more information.

3
debian/attic/libs/e2fslibsg.files vendored Normal file
View File

@ -0,0 +1,3 @@
lib/*.so.?.*
lib/*.so.?
usr/doc/e2fslibsg/*

182
debian/attic/libs/rules vendored Normal file
View File

@ -0,0 +1,182 @@
#! /usr/bin/make -f
# -*- makefile -*-
#
# Invoke each target with `./debian/rules <target>'. All targets should be
# invoked with the package root as the current directory.
#
# The `binary' target must be run as root, as it needs to install files with
# specific ownerships.
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
package = e2fsprogs
ARCH = $(shell dpkg --print-architecture)
# find the version for the main package, from changelog file
MAIN_VERSION = $(shell head -1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
# find versions for libraries going into their own packages, from their Makefile.in's
COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
COMERR_MAJOR = $(word 1,$(subst ., ,$(COMERR_VERSION)))
SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
SS_MAJOR = $(word 1,$(subst ., ,$(SS_VERSION)))
topdir = $(shell pwd)
debdir = $(topdir)/debian
maindir = $(debdir)/tmp
builddir = $(topdir)/builddir
docdir = $(maindir)/usr/doc/$(package)
SUBPACKAGES_DIRS = tmp e2fslibsg e2fslibsg-dev comerr$(COMERR_MAJOR)g comerrg-dev \
ss$(SS_MAJOR)g ssg-dev
installdoc = install -m 644
installbin = install -m 755
ifeq ($(ARCH),alpha)
CCOPTS = -g -O2 -fsigned-char -DHAVE_NETINET_IN_H
LIBC-DEV = libc6.1-dev
else
CCOPTS = -g -O2 -fsigned-char
LIBC-DEV = libc6-dev
endif
build: configured
dh_testdir
make -C $(builddir)
make -C $(builddir)/misc findsuper
cd doc && texi2html -split_chapter libext2fs.texinfo
cd lib/et && texi2html -split_chapter -expandinfo com_err.texinfo
touch build
configured:
dh_testdir
mkdir -p $(builddir)
cd $(builddir) && CFLAGS="$(CFLAGS)" \
../configure --enable-elf-shlibs --enable-dynamic-e2fsck \
--with-ccopts="$(CCOPTS)"
touch configured
clean:
dh_testdir
rm -f build configured install
-make -C $(builddir) -i distclean
rm -rf $(builddir)
rm -f doc/libext2fs_*.html lib/et/com_err_*.html
dh_clean
binary-indep: build
# no arch-independant debs.
binary-arch: build
dh_testversion 0.56 # == 0.53 + fixes
dh_testdir -a
dh_testroot -a
dh_clean -a -k
dh_installdirs -a
make -C $(builddir) install DESTDIR=$(maindir)
install -m 755 $(builddir)/misc/findsuper $(maindir)/sbin
# static libs and .h files
make -C $(builddir) install-libs DESTDIR=$(maindir)
install -m 644 $(builddir)/lib/ss/ss_err.h $(maindir)/usr/include/ss/
# fix and install compile_et script
sed s%$(topdir)/lib/et%/usr/share/comerr% \
<$(builddir)/lib/et/compile_et \
>$(debdir)/comerrg-dev/usr/bin/compile_et
chmod 755 $(debdir)/comerrg-dev/usr/bin/compile_et
# add support files for compile_et
install -m 644 lib/et/et_c.awk lib/et/et_h.awk \
$(debdir)/comerrg-dev/usr/share/comerr/
# fix and install mk_cmds script
sed s%$(topdir)/lib/ss%/usr/share/ss% \
<$(builddir)/lib/ss/mk_cmds \
>$(debdir)/ssg-dev/usr/bin/mk_cmds
chmod 755 $(debdir)/ssg-dev/usr/bin/mk_cmds
# add support files for mk_cmds
install -m 644 lib/ss/ct_c.awk lib/ss/ct_c.sed \
$(debdir)/ssg-dev/usr/share/ss/
# docs
mkdir -p $(debdir)/e2fslibsg-dev/usr/doc/e2fslibsg
ln -sf e2fslibsg $(debdir)/e2fslibsg-dev/usr/doc/e2fslibsg-dev
mkdir -p $(maindir)/usr/doc/e2fslibsg
ln -sf e2fslibsg $(maindir)/usr/doc/e2fsprogs
mkdir -p $(debdir)/comerrg-dev/usr/doc/comerr$(COMERR_MAJOR)g
ln -sf comerr$(COMERR_MAJOR)g $(debdir)/comerrg-dev/usr/doc/comerrg-dev
mkdir -p $(debdir)/ssg-dev/usr/doc/ss$(SS_MAJOR)g
ln -sf ss$(SS_MAJOR)g $(debdir)/ssg-dev/usr/doc/ssg-dev
dh_installdocs -a
# HTML docs
install -d $(debdir)/e2fslibsg-dev/usr/doc/e2fslibsg-dev/html-info/
install -p $(topdir)/doc/libext2fs_*.html \
$(debdir)/e2fslibsg-dev/usr/doc/e2fslibsg-dev/html-info/
install -d $(debdir)/comerrg-dev/usr/doc/comerrg-dev/html-info/
install -p $(topdir)/lib/et/com_err_*.html \
$(debdir)/comerrg-dev/usr/doc/comerrg-dev/html-info/
# texinfo docs
install -p $(topdir)/doc/libext2fs.texinfo \
$(debdir)/e2fslibsg-dev/usr/doc/e2fslibsg/libext2fs.texi
install -p $(topdir)/lib/et/com_err.texinfo \
$(debdir)/comerrg-dev/usr/doc/comerr2g/com_err.texi
# doc-base support
install -d $(debdir)/e2fslibsg-dev/usr/share/doc-base/
install -p -m 644 $(debdir)/libext2fs.docbase \
$(debdir)/e2fslibsg-dev/usr/share/doc-base/libext2fs
install -d $(debdir)/comerrg-dev/usr/share/doc-base/
install -p -m 644 $(debdir)/com_err.docbase \
$(debdir)/comerrg-dev/usr/share/doc-base/com_err
# examples
dh_installexamples -a
# dh_installmanpages still makes a mess as of 0.54 (see below dh_movefiles)
install -p $(topdir)/lib/et/compile_et.1 $(maindir)/usr/man/man1/
install -d $(maindir)/usr/man/man3/
install -p $(topdir)/lib/et/com_err.3 $(maindir)/usr/man/man3/
ln -s e2fsck.8 $(maindir)/usr/man/man8/fsck.ext2.8
ln -s mke2fs.8 $(maindir)/usr/man/man8/mkfs.ext2.8
dh_movefiles -a
# cleanup empty dirs
cd $(maindir) && rmdir usr/man/cat? bin lib usr/include/* usr/include \
usr/info usr/lib usr/man/man3 usr/doc/e2fslibsg
# dh_installmenu -a
# broken + useless in 0.52
# dh_installmanpages -a
dh_undocumented -a
dh_installchangelogs -pe2fslibsg -pcomerr$(COMERR_MAJOR)g -pss$(SS_MAJOR)g ChangeLog
dh_strip -a
dh_compress -a
dh_fixperms -a
echo "libcdev:Depends=$(LIBC-DEV)" > debian/comerrg-dev.substvars
echo "libcdev:Depends=$(LIBC-DEV)" > debian/ssg-dev.substvars
echo "libcdev:Depends=$(LIBC-DEV)" > debian/e2fslibsg-dev.substvars
dh_installdeb -a
LD_LIBRARY_PATH=$(builddir)/lib:/lib:/usr/lib \
dh_shlibdeps -a
dh_gencontrol -u '-isp' -pe2fsprogs -pe2fslibsg -pe2fslibsg-dev
dh_gencontrol -u '-isp' -pcomerr$(COMERR_MAJOR)g -pcomerrg-dev \
-u '-v$(COMERR_VERSION)-$(MAIN_VERSION)'
dh_gencontrol -u '-isp' -pss$(SS_MAJOR)g -pssg-dev \
-u '-v$(SS_VERSION)-$(MAIN_VERSION)'
dh_makeshlibs -a
# dh_du -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: binary binary-arch binary-indep clean checkroot

2
debian/attic/libs/ss2g.files vendored Normal file
View File

@ -0,0 +1,2 @@
lib/libss.so.?.*
lib/libss.so.?

4550
debian/changelog vendored Normal file

File diff suppressed because it is too large Load Diff

12
debian/comerr-dev.doc-base vendored Normal file
View File

@ -0,0 +1,12 @@
Document: comerr-manual
Title: The com_err library
Author: Ken Raeburn and Bill Sommerfeld
Abstract: A library, and associated utilities,
which allow a more uniform way for libraries
to return errors to their callers, and for programs
to describe errors and exceptional conditions to their users.
Section: Programming
Format: HTML
Index: /usr/share/doc/comerr-dev/html-info/com_err.html
Files: /usr/share/doc/comerr-dev/html-info/*.html

2
debian/comerr-dev.examples vendored Normal file
View File

@ -0,0 +1,2 @@
lib/ss/ss_err.et
debian/BUILD-STD/lib/ext2fs/ext2_err.et

9
debian/comerr-dev.install vendored Normal file
View File

@ -0,0 +1,9 @@
usr/lib/*/libcom_err.a
usr/lib/*/libcom_err.so
usr/include/et/*
usr/include/com_err.h
usr/share/man/man1/compile_et*
usr/share/man/man3/com_err.3*
usr/bin/compile_et
usr/share/et/*
usr/lib/*/pkgconfig/com_err.pc

30
debian/comerr-dev.postinst vendored Normal file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# Abort on error.
set -e
symlink_match()
{
local SYMLINK="$1"
local SYMLINK_TARGET="$2"
[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}
SYMLINK=/usr/share/doc/comerr-dev
SYMLINK_TARGET=libcomerr2
SYMLINK_TARGET2=libcom-err2
if [ "$1" = "configure" ] && [ -h "${SYMLINK}.dpkg-backup" ]
then
if symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET" ||
symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET2"
then
rm -f "${SYMLINK}.dpkg-backup"
fi
fi
#DEBHELPER#
exit 0

36
debian/comerr-dev.postrm vendored Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
# Abort on error.
set -e
symlink_match()
{
local SYMLINK="$1"
local SYMLINK_TARGET="$2"
[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}
SYMLINK=/usr/share/doc/comerr-dev
SYMLINK_TARGET=libcomerr2
SYMLINK_TARGET2=libcom-err2
if [ "$1" = "purge" ] && [ -h "${SYMLINK}.dpkg-backup" ]
then
rm -f "${SYMLINK}.dpkg-backup"
fi
if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] &&
[ -n "$2" ] && [ ! -e "$SYMLINK" ] && [ -h "${SYMLINK}.dpkg-backup" ]
then
if symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET" ||
symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET2"
then
echo "Restoring backup of $SYMLINK ..."
mv "${SYMLINK}.dpkg-backup" "$SYMLINK"
fi
fi
#DEBHELPER#
exit 0

31
debian/comerr-dev.preinst vendored Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# Abort on error.
set -e
symlink_match()
{
local SYMLINK="$1"
local SYMLINK_TARGET="$2"
[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}
SYMLINK=/usr/share/doc/comerr-dev
SYMLINK_TARGET=libcomerr2
SYMLINK_TARGET2=libcom-err2
if [ "$1" = "install" -o "$1" = "upgrade" ] &&
[ -n "$2" ] && [ -h "$SYMLINK" ]
then
if symlink_match "$SYMLINK" "$SYMLINK_TARGET" ||
symlink_match "$SYMLINK" "$SYMLINK_TARGET2"
then
mv -f "$SYMLINK" "${SYMLINK}.dpkg-backup"
fi
fi
#DEBHELPER#
exit 0

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
12

216
debian/control vendored Normal file
View File

@ -0,0 +1,216 @@
Source: e2fsprogs
Section: admin
Priority: required
Maintainer: Theodore Y. Ts'o <tytso@mit.edu>
Build-Depends: gettext, texinfo, pkg-config, libfuse-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, libattr1-dev, debhelper (>= 12.0), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], cron [linux-any]
Standards-Version: 4.4.1
Homepage: http://e2fsprogs.sourceforge.net
Vcs-Browser: https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Vcs-Git: https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git -b debian/master
Package: fuse2fs
Build-Profiles: <!pkg.e2fsprogs.no-fuse2fs>
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}
Architecture: linux-any kfreebsd-any
Description: ext2 / ext3 / ext4 file system driver for FUSE
fuse2fs is a FUSE file system client that supports reading and
writing from devices or image files containing ext2, ext3, and ext4
file systems.
Package: logsave
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}
Replaces: e2fsprogs (<< 1.45.3-1)
Breaks: e2fsprogs (<< 1.45.3-1)
Architecture: any
Multi-Arch: foreign
Description: save the output of a command in a log file
The logsave program will execute cmd_prog with the specified
argument(s), and save a copy of its output to logfile. If the
containing directory for logfile does not exist, logsave will
accumulate the output in memory until it can be written out. A copy
of the output will also be written to standard output.
Package: e2fsck-static
Priority: optional
Depends: ${misc:Depends}
Recommends: sash | bash-static | zsh-static | busybox-static
Architecture: any
Description: statically-linked version of the ext2/ext3/ext4 filesystem checker
This may be of some help to you if your filesystem gets corrupted enough
to break the shared libraries used by the dynamically linked checker.
.
This binary takes much more space than its dynamic counterpart located
in e2fsprogs, though.
.
You may want to install a statically-linked shell as well, to be able
to run this program if something like your C library gets corrupted.
Package: e2fsprogs-l10n
Section: localization
Priority: optional
Depends: e2fsprogs (>= ${binary:Version}), e2fsprogs (<< ${binary:Version}+c~), ${misc:Depends}
Replaces: e2fsprogs (<< 1.43.5-1)
Architecture: all
Multi-Arch: foreign
Description: ext2/ext3/ext4 file system utilities - translations
The ext2, ext3 and ext4 file systems are successors of the original ext
("extended") file system. They are the main file system types used for
hard disks on Debian and other Linux systems.
.
This package provides translations for messages for programs found in
the 'e2fsprogs' package.
Package: libcomerr2
Depends: libcom-err2, ${misc:Depends}
Architecture: any
Multi-Arch: same
Priority: optional
Section: oldlibs
Description: transitional package to libcom-err2
This is a transitional package to libcom-err2. It can safely be removed.
Package: libcom-err2
Section: libs
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}
Replaces: libcomerr2 (<< 1.43.9-1~)
Breaks: libcomerr2 (<< 1.43.9-1~)
Provides: libcomerr2 (= ${binary:Version})
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Description: common error description library
libcomerr 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 identified with mechanisms commonly in use.
Package: comerr-dev
Section: libdevel
Priority: optional
Depends: libc6-dev | libc-dev, libcom-err2 (= ${mainBinary}), ${misc:Depends}
Suggests: doc-base
Replaces: e2fslibs-dev (<< 1.33-2), libkrb5-dev (<< 1.3)
Architecture: any
Multi-Arch: same
Description: common error description library - headers and static libraries
libcom_err 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 identified with mechanisms commonly in use.
.
This package contains the development environment for the com_err library.
Package: libss2
Section: libs
Priority: optional
Depends: libcom-err2, ${shlibs:Depends}, ${misc:Depends}
Replaces: e2fsprogs (<< 1.34-1)
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Description: command-line interface parsing library
libss provides a simple command-line interface parser which will
accept input from the user, parse the command into an argv argument
vector, and then dispatch it to a handler function.
.
It was originally inspired by the Multics SubSystem library.
Package: ss-dev
Section: libdevel
Priority: optional
Depends: libc6-dev | libc-dev, libss2 (= ${mainBinary}), comerr-dev, ${misc:Depends}
Architecture: any
Multi-Arch: same
Description: command-line interface parsing library - headers and static libraries
This package includes a tool that parses a command table to generate
a simple command-line interface parser, the include files needed to
compile and use it, and the static libs.
.
It was originally inspired by the Multics SubSystem library.
.
This package contains the development environment for the ss library.
Package: e2fsprogs-udeb
Package-Type: udeb
Section: debian-installer
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}
Architecture: any
Description: stripped-down versions of e2fsprogs, for debian-installer
This package is an e2fsprogs package built for a reduced size, so that
it can help to save space in debian-installer.
.
Don't attempt to install this package, it has no support for a couple of
features you surely want. Anyway it should refuse to install.
Package: e2fslibs
Depends: libext2fs2, ${misc:Depends}
Architecture: any
Multi-Arch: same
Priority: optional
Section: oldlibs
Description: transitional package to libext2fs2
This is a transitional package to libext2fs2. It can safely be removed.
Package: e2fslibs-dev
Depends: libext2fs-dev, ${misc:Depends}
Architecture: all
Priority: optional
Section: oldlibs
Description: transitional package to libext2fs-dev
This is a transitional package to libext2fs-dev. It can safely be removed.
Package: libext2fs2
Section: libs
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}
Replaces: e2fslibs (<< 1.43.9-1~)
Breaks: e2fslibs (<< 1.43.9-1~)
Provides: e2fslibs (= ${binary:Version})
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Description: ext2/ext3/ext4 file system libraries
The ext2, ext3 and ext4 file systems are successors of the original ext
("extended") file system. They are the main file system types used for
hard disks on Debian and other Linux systems.
.
This package provides the ext2fs and e2p libraries, for userspace software
that directly accesses extended file systems. Programs that use libext2fs
include e2fsck, mke2fs, and tune2fs. Programs that use libe2p include
dumpe2fs, chattr, and lsattr.
Package: libext2fs-dev
Section: libdevel
Priority: optional
Depends: libc6-dev | libc-dev, comerr-dev, libext2fs2 (= ${binary:Version}), ${misc:Depends}
Replaces: e2fslibs-dev (<< 1.43.9-1~)
Breaks: e2fslibs-dev (<< 1.43.9-1~)
Provides: e2fslibs-dev (= ${binary:Version})
Suggests: doc-base
Architecture: any
Description: ext2/ext3/ext4 file system libraries - headers and static libraries
The ext2, ext3 and ext4 file systems are successors of the original ext
("extended") file system. They are the main file system types used for
hard disks on Debian and other Linux systems.
.
This package contains the development environment for the ext2fs and e2p
libraries.
Package: e2fsprogs
XB-Important: yes
Pre-Depends: ${shlibs:Depends}, ${misc:Depends}, libblkid1, libuuid1
Depends: logsave
Multi-Arch: foreign
Suggests: gpart, parted, fuse2fs, e2fsck-static
Recommends: e2fsprogs-l10n
Architecture: any
Description: ext2/ext3/ext4 file system utilities
The ext2, ext3 and ext4 file systems are successors of the original ext
("extended") file system. They are the main file system types used for
hard disks on Debian and other Linux systems.
.
This package contains programs for creating, checking, and maintaining
ext2/3/4-based file systems. It also includes the "badblocks" program,
which can be used to scan for bad blocks on a disk or other storage device.

73
debian/copyright vendored Normal file
View File

@ -0,0 +1,73 @@
This is the Debian GNU/Linux prepackaged version of the EXT2 file
system utilities (e2fsck, mke2fs, etc.). The EXT2 utilities were
written by Theodore Ts'o <tytso@mit.edu> and Remy Card <card@masi.ibp.fr>.
Sources were obtained from http://sourceforge.net/projects/e2fsprogs
Packaging is Copyright (c) 2003-2007 Theodore Ts'o <tytso@mit.edu>
Copyright (c) 1997-2003 Yann Dirson <dirson@debian.org>
Copyright (c) 2001 Alcove <http://www.alcove.com/>
Copyright (c) 1997 Klee Dienes
Copyright (c) 1995-1996 Michael Nonweiler <mrn20@cam.ac.uk>
Upstream Author: Theodore Ts'o <tytso@mit.edu>
Copyright notice:
This package, the EXT2 filesystem utilities, are made available under
the GNU General Public License version 2, with the exception of the
lib/ext2fs and lib/e2p libraries, which are made available under the
GNU Library General Public License Version 2, the lib/uuid library
which is made available under a BSD-style license and the lib/et and
lib/ss libraries which are made available under an MIT-style license.
Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Theodore Ts'o
On Debian GNU systems, the complete text of the GNU General Public
License can be found in `/usr/share/common-licenses/GPL-2'. The
complete text of the GNU Library General Public License can be found
in '/usr/share/common-licenses/LGPL-2'.
The license used for lib/et and lib/ss libraries is:
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 is hereby granted, provided 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.
The license used for lib/uuid is:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, and the entire permission notice in its entirety,
including the disclaimer of warranties.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

26
debian/e2fsck-static.copyright vendored Normal file
View File

@ -0,0 +1,26 @@
This is the Debian GNU/Linux prepackaged version of the static EXT2
file system consistency checker (e2fsck.static). The EXT2 utilities
were written by Theodore Ts'o <tytso@mit.edu> and Remy Card
<card@masi.ibp.fr>.
Sources were obtained from http://sourceforge.net/projects/e2fsprogs
Packaging is Copyright (c) 2003-2006 Theodore Ts'o <tytso@mit.edu>
Copyright (c) 1997-2003 Yann Dirson <dirson@debian.org>
Copyright (c) 2001 Alcove <http://www.alcove.com/>
Copyright (c) 1997 Klee Dienes
Copyright (c) 1995-1996 Michael Nonweiler <mrn20@cam.ac.uk>
Upstream Author: Theodore Ts'o <tytso@mit.edu>
Copyright notice:
This package, the EXT2 filesystem utilities, is protected by the GNU
General Public License.
Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Theodore Ts'o
On Debian GNU systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.

2
debian/e2fsck-static.install vendored Normal file
View File

@ -0,0 +1,2 @@
/sbin/e2fsck.static
/usr/share/man/man8/e2fsck.static*

19
debian/e2fsck-static.preinst vendored Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# Abort on error.
set -e
PKG=e2fsck-static
DOCLNK=/usr/share/doc/$PKG
if test "$1" = upgrade \
-a -L $DOCLNK
then
rm $DOCLNK
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

26
debian/e2fslibs-dev.postinst vendored Normal file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# Abort on error.
set -e
symlink_match()
{
local SYMLINK="$1"
local SYMLINK_TARGET="$2"
[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}
SYMLINK=/usr/share/doc/e2fslibs-dev
SYMLINK_TARGET=e2fslibs
if [ "$1" = "configure" ] && [ -h "${SYMLINK}.dpkg-backup" ] &&
symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET"
then
rm -f "${SYMLINK}.dpkg-backup"
fi
#DEBHELPER#
exit 0

32
debian/e2fslibs-dev.postrm vendored Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# Abort on error.
set -e
symlink_match()
{
local SYMLINK="$1"
local SYMLINK_TARGET="$2"
[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}
SYMLINK=/usr/share/doc/e2fslibs-dev
SYMLINK_TARGET=e2fslibs
if [ "$1" = "purge" ] && [ -h "${SYMLINK}.dpkg-backup" ]
then
rm -f "${SYMLINK}.dpkg-backup"
fi
if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] &&
[ -n "$2" ] && [ ! -e "$SYMLINK" ] && [ -h "${SYMLINK}.dpkg-backup" ] &&
symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET"
then
echo "Restoring backup of $SYMLINK ..."
mv "${SYMLINK}.dpkg-backup" "$SYMLINK"
fi
#DEBHELPER#
exit 0

27
debian/e2fslibs-dev.preinst vendored Normal file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Abort on error.
set -e
symlink_match()
{
local SYMLINK="$1"
local SYMLINK_TARGET="$2"
[ "$(readlink "$SYMLINK")" = "$SYMLINK_TARGET" ] || \
[ "$(readlink -f "$SYMLINK")" = "$SYMLINK_TARGET" ]
}
SYMLINK=/usr/share/doc/e2fslibs-dev
SYMLINK_TARGET=e2fslibs
if [ "$1" = "install" -o "$1" = "upgrade" ] &&
[ -n "$2" ] && [ -h "$SYMLINK" ] &&
symlink_match "$SYMLINK" "$SYMLINK_TARGET"
then
mv -f "$SYMLINK" "${SYMLINK}.dpkg-backup"
fi
#DEBHELPER#
exit 0

26
debian/e2fsprogs-l10n.copyright vendored Normal file
View File

@ -0,0 +1,26 @@
This is the Debian GNU/Linux prepackaged version of the translation
files of the EXT2 file system utilities. The EXT2 utilities were
written by Theodore Ts'o <tytso@mit.edu> and Remy Card
<card@masi.ibp.fr>.
Sources were obtained from http://sourceforge.net/projects/e2fsprogs
Packaging is Copyright (c) 2003-2006 Theodore Ts'o <tytso@mit.edu>
Copyright (c) 1997-2003 Yann Dirson <dirson@debian.org>
Copyright (c) 2001 Alcove <http://www.alcove.com/>
Copyright (c) 1997 Klee Dienes
Copyright (c) 1995-1996 Michael Nonweiler <mrn20@cam.ac.uk>
Upstream Author: Theodore Ts'o <tytso@mit.edu>
Copyright notice:
This package, the EXT2 filesystem utilities, is protected by the GNU
General Public License.
Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Theodore Ts'o
On Debian GNU systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.

1
debian/e2fsprogs-l10n.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/locale

11
debian/e2fsprogs-udeb.install vendored Normal file
View File

@ -0,0 +1,11 @@
etc/mke2fs.conf
lib/*/lib*.so.*
sbin/badblocks
sbin/e2fsck
sbin/mke2fs
sbin/resize2fs
sbin/tune2fs
sbin/e2label
sbin/e2mmpstatus
sbin/fsck.ext?
sbin/mkfs.ext?

View File

@ -0,0 +1,2 @@
e2fsprogs-udeb udeb: package-name-doesnt-match-sonames libcom-err2 libe2p2 libext2fs2 libss2

6
debian/e2fsprogs-udeb.shlibs.local vendored Normal file
View File

@ -0,0 +1,6 @@
libblkid 1 libblkid1-udeb
# force the dependency to libblkid1-udeb, even if it don't include the lib
libcom_err 2 libblkid1-udeb
libuuid 1 libuuid1-udeb
libext2fs 2 libblkid1-udeb
libe2p 2 libblkid1-udeb

1
debian/e2fsprogs.docs vendored Normal file
View File

@ -0,0 +1 @@
README

53
debian/e2fsprogs.install vendored Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/dh-exec
sbin/badblocks
sbin/debugfs
sbin/dumpe2fs
sbin/e2fsck
sbin/e2image
sbin/e2label
sbin/e2mmpstatus
[linux-any] sbin/e2scrub
[linux-any] sbin/e2scrub_all
sbin/e2undo
sbin/fsck.ext?
sbin/mke2fs
sbin/mkfs.ext?
sbin/resize2fs
sbin/tune2fs
usr/bin/chattr
usr/bin/lsattr
[linux-any] usr/lib/*/e2fsprogs/e2scrub_all_cron
[linux-any] usr/lib/*/e2fsprogs/e2scrub_fail
usr/sbin/e2freefrag
[linux-any] usr/sbin/e4crypt
[linux-any] usr/sbin/e4defrag
usr/sbin/filefrag
usr/sbin/mklost+found
usr/share/man/man1/chattr.1
usr/share/man/man1/lsattr.1
usr/share/man/man5/e2fsck.conf.5
usr/share/man/man5/ext?.5
usr/share/man/man5/mke2fs.conf.5
usr/share/man/man8/badblocks.8
usr/share/man/man8/debugfs.8
usr/share/man/man8/dumpe2fs.8
usr/share/man/man8/e2freefrag.8
usr/share/man/man8/e2fsck.8
usr/share/man/man8/e2image.8
usr/share/man/man8/e2label.8
usr/share/man/man8/e2mmpstatus.8
[linux-any] usr/share/man/man8/e2scrub.8
[linux-any] usr/share/man/man8/e2scrub_all.8
usr/share/man/man8/e2undo.8
[linux-any] usr/share/man/man8/e4crypt.8
[linux-any] usr/share/man/man8/e4defrag.8
usr/share/man/man8/filefrag.8
usr/share/man/man8/fsck.ext?.8
usr/share/man/man8/mke2fs.8
usr/share/man/man8/mkfs.ext?.8
usr/share/man/man8/mklost+found.8
usr/share/man/man8/resize2fs.8
usr/share/man/man8/tune2fs.8
etc
[linux-any] lib/udev/rules.d
[linux-any] lib/systemd/system

1
debian/e2fsprogs.lintian-overrides vendored Normal file
View File

@ -0,0 +1 @@
e2fsprogs: package-supports-alternative-init-but-no-init.d-script

13
debian/e2fsprogs.postinst vendored Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Abort on error.
set -e
if [ -x /usr/sbin/update-initramfs -a \
-e /etc/initramfs-tools/initramfs.conf ]; then
update-initramfs -u
fi
#DEBHELPER#
exit 0

32
debian/e2fsprogs.postinst.dh9 vendored Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# Abort on error.
set -e
if [ -x /usr/sbin/update-initramfs -a \
-e /etc/initramfs-tools/initramfs.conf ]; then
update-initramfs -u
fi
#DEBHELPER#
# debhelper doesn't know what timers are...
update_svc() {
deb-systemd-helper unmask "$1" >/dev/null || true
if deb-systemd-helper --quiet was-enabled "$1"; then
deb-systemd-helper enable "$1" >/dev/null || true
else
deb-systemd-helper update-state "$1" >/dev/null || true
fi
}
update_svc e2scrub_all.timer
update_svc e2scrub_reap.service
# Start our new services
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start e2scrub_all.timer >/dev/null || true
fi
exit 0

35
debian/e2fsprogs.postrm.dh9 vendored Normal file
View File

@ -0,0 +1,35 @@
#!/bin/sh
update_svc() {
deb-systemd-helper mask "$1" >/dev/null || true
if deb-systemd-helper --quiet was-enabled "$1"; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper disable "$1" >/dev/null || true
fi
}
if [ "$1" != "upgrade" ]; then
# Abort on error.
set -e
if [ -x /usr/sbin/update-initramfs -a \
-e /etc/initramfs-tools/initramfs.conf ]; then
update-initramfs -u
fi
#DEBHELPER#
# debhelper doesn't know what timers are...
update_svc e2scrub_all.timer
update_svc e2scrub_reap.service
# Start our new services
if [ -d /run/systemd/system ]; then
deb-systemd-invoke stop e2scrub_all.timer >/dev/null || true
fi
fi
exit 0

19
debian/e2fsprogs.preinst vendored Normal file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# Abort on error.
set -e
PKG=e2fsprogs
DOCLNK=/usr/share/doc/$PKG
if test "$1" = upgrade \
-a -L $DOCLNK
then
rm $DOCLNK
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

2
debian/e2fsprogs.shlibs.local vendored Normal file
View File

@ -0,0 +1,2 @@
libext2fs 2 libext2fs2 (= ${binary:Version})
libe2p 2 libext2fs2 (= ${binary:Version})

2
debian/fuse2fs.install vendored Normal file
View File

@ -0,0 +1,2 @@
/usr/bin/fuse2fs
/usr/share/man/man1/fuse2fs.1

4
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
pristine-tar = True
upstream-tag='v%(version)s'
debian-branch=debian/master

4
debian/libblkid-dev.install vendored Normal file
View File

@ -0,0 +1,4 @@
usr/lib/*/libblkid*.so.*
usr/include/blkid
usr/share/man/man3/libblkid.3
usr/lib/*/pkgconfig/blkid.pc

19
debian/libblkid.copyright vendored Normal file
View File

@ -0,0 +1,19 @@
This package was added to the e2fsprogs debian source package by
Theodore Ts'o <tytso@mit.edu> on Sat Mar 15 15:33:37 EST 2003
It is part of the main e2fsprogs distribution, which can be found at:
http://sourceforge.net/projects/e2fsprogs
Upstream Author: Theodore Ts'o <tytso@mit.edu>
Copyright:
Copyright (C) 1999, 2001 by Andries Brouwer
Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
You are free to distribute this software under the terms of the GNU
Lesser (Library) General Public License.
On Debian systems, the complete text of the GNU Lesser (Library)
General Public License can be found in /usr/share/common-licenses/LGPL-2.

1
debian/libblkid1.install vendored Normal file
View File

@ -0,0 +1 @@
lib/*/libblkid*.so.*

Some files were not shown because too many files have changed in this diff Show More