Commit Graph

3925 Commits (7943ccf5f2fa76f1dc164ddd1ffd5044a1dca31a)

Author SHA1 Message Date
Theodore Ts'o 9d4507c5b6 Pass the gettext() function to libcom_err
For those e2fsprogs programs which use libcom_err and are
internationalized, pass the gettext() function to libcom_err during
program initialization.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05 01:00:30 -04:00
Theodore Ts'o 4259052093 libcom_err: add set_com_err_gettext()
This function allows programs to pass in a pointer to the gettext
function so that error table strings will can be internationalized.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05 00:58:40 -04:00
Theodore Ts'o 789cb34d1a po: add prof_err.c, ext2_err.c and uuidd.c to POTFILES.in
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05 00:46:29 -04:00
Theodore Ts'o da5a6b4317 compile_et: generate *_err.c files that have strings marked for xgettext
This allows error code strings to be internationalized.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05 00:39:40 -04:00
Theodore Ts'o c93c1bc24b libquota: remove NLS support
In general libraries should never (a) call exit() or (b) print output
directly to the stdout (they might be used by GUI programs.  From (b)
follows (c), should never call internationalization functions
directly.

Also, since po/POTFILES.in wasn't edited, these strings weren't
getting included in e2fsprogs.pot for translation, so the _()
indirection didn't actually buy us anything.

We eventually need to nuke all of the log_fatal() and log_err() from
libquota, so best thing to do for now is remove NLS support
completely; no point whipsawing the translators with strings to
translate that will be disappearing soon anyway!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 19:18:15 -04:00
Theodore Ts'o d6120a2a5e libquota: use ext2_loff_t instead of loff_t
The type loff_t is not portable.  Use ext2_loff_t which handles this
for us.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 19:18:15 -04:00
Theodore Ts'o 36e4e21f51 libquota: remove get_qf_name()
The get_qf_name() function used PATH_MAX, which is non-portable.
Worse, it blindly assumed that PATH_MAX was the size of the buffer
passed to it --- which in the one and only place where it was used in
libquota, was a buffer declared to a fixed size 256 bytes.

Fix this by simply getting rid of the function altogether.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 18:51:43 -04:00
Theodore Ts'o edbfd75d8f libquota: clean up some gcc -Wall warnings
Remove unused variables, places where 'return' was used with no value
in a non-void function, missing function declarations, etc.  Don't
assume that all systems have quotactl(), and use <sys/quota.h> if it
exists to define the quotactl interfaces.

One of the unused variables also got rid of a non-portable use of
PATH_MAX.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 11:37:46 -04:00
Theodore Ts'o dba14293d9 libquota: remove get_qf_path()
This function isn't used anywhere, so remove it.  It also uses
PATH_MAX which is not portable.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 11:20:35 -04:00
Theodore Ts'o 1c5ffb6820 e2fsck: make the signal catcher more portable, take 2
One table got missed when adding #ifdef's so that e2fsck/sigcatcher.c
would compile on non-Linux systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 10:36:47 -04:00
Theodore Ts'o f6b16547f4 Update debian/changelog for an interim release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04 00:28:28 -04:00
Theodore Ts'o 00ea586fb2 libext2fs: fix bad cast which causes problems for file systems > 512EB
If the number of block groups exceeds 2**32, a bad cast would lead to
a bogus "Not enough space to build proposed filesystem while setting
up superblock" failure.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 23:47:19 -04:00
Theodore Ts'o 466137fb7e Add "big" and "huge" types to mke2fs.conf
mke2fs attempts to use the "big" and "huge" types, and now that mke2fs
will complain if there are file system types which are undefined,
let's add definitions for them.

Thanks to Richard Jones for reporting this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 23:46:17 -04:00
Theodore Ts'o aff534958b po: rebuild the .gmo files if they are missing or out of date
This makes life easier to support patch updates for Debian when we are
getting lots of updates of .po files, since the .gmo files are binary
files that we don't really need to worry about.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 23:18:10 -04:00
Eric Sandeen bfbeec0c89 e2fsprogs: Fix thinko in ext2fs_initialize bigalloc case
Surely we should be setting s_clusters_per_group, not
s_blocks_per_group, to EXT2_MAX_CLUSTERS_PER_GROUP here.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 23:11:28 -04:00
Theodore Ts'o 8232f2ddae libext2fs: move #include "ext2fs.h" from crc32c_defs.h to crc32c.c
The byte swap functions which are defined in ext2fs.h are only needed
by crc32.c, and not by gen_crc32ctable.c.  The gen_crc32ctable program
needs to be compiled on the host OS, where ext2fs.h may not be
present.  So move the use of the header function to crc32c.c, to avoid
compilation problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 22:49:45 -04:00
Theodore Ts'o 200569608f resize2fs: fix on-line resizing
On-line resizing has been broken in the 1.42 series for two reasons:
(a) the call to the new EXT4_IOC_RESIZE_FS ioctl checked for ENOTTY to
indicate that the ioctl does not exist, when in fact EINVAL is what is
returned if the ioctl doesn't exist.  (b) resize2fs was passing in a
pointer to a 64-bit value, when the ioctl expected a 32-bit value.
This was OK on little-endian systems, but it wouldn't work at all on
big-endian systems.

Fix both problems.

Addresses-Debian-Bug: #451388

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 20:55:34 -04:00
Theodore Ts'o 756690a29e libext2fs, libquota: fix some makefile dependency issues
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 14:57:51 -04:00
Eric Sandeen e43bb12f40 e2fsprogs: include headers for open() in ext2fs.h
ext2fs.h now calls open() so it should include the headers needed
for this system call as well.

Addresses-Red-Hat-Bugzilla: #742147

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03 13:16:52 -04:00
Samuel Thibault 82fc189b63 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-10-02 22:50:38 -04:00
Philipp Thomas 18eaec2919 po: update de.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-10-02 22:50:38 -04:00
Theodore Ts'o c2ac6c5fbd Update for e2fsprogs 1.42-WIP-1001 release 2011-10-01 00:10:24 -04:00
Theodore Ts'o 636019ecdb debian: avoid installing source.lintian-overrides
This avoids lintian errors if we try to rebuild the package since
source.lintian-overrides ends up getting installed in
debian/source/usr/src/lintian/overrides/source, which then gets
dropped in the diff file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-01 00:08:12 -04:00
Theodore Ts'o f39a46a82d Update e2fsprogs.pot file for translators 2011-09-30 23:13:10 -04:00
Theodore Ts'o 86db36abfb e2fsck: avoid unnecessary reboots in some cases when checking the root fs
If e2fsck modifies certain superblock fields which the kernel doesn't
look at, mark the superblock as dirty without marking the file system
as changed.  This will avoid e2fsck signalling the init scripts that a
reboot is necessary.  This is safe, because the kernel doesn't
actually look at these superblock fields.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 23:12:37 -04:00
Theodore Ts'o 9c58eaf7d3 filefrag: fix an off by one error in when printing the next expected block
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 21:28:39 -04:00
Theodore Ts'o a00be17e47 filefrag: Display the number of contiguous, not physical, extents
From a bug report filed by Ibragimov Rinat:

   When filefrag uses FIEMAP ioctl its logic differs for ordinary and
   verbose (-v) modes. ext4 returns extent on every 32768 block so on
   large files it is possible that `filefrag large-file' tells about 4
   extents while `filefrag -v large-file' finds only one.

   Also when I tried to use generic_block_fiemap function to add
   FIEMAP for reiserfs, every block was reported as a new extent
   resulting in thousands "extents" for continuous files.

   I think filefrag should merge adjacent extents even when -v is not
   specified.

Addresses-Debian-Bug: #631498

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 21:28:39 -04:00
Theodore Ts'o 27b422f57b mke2fs.conf.5: clarify the man page regarding boolean relations
Explain more clearly how boolean relations in the mke2fs.conf file are
parsed, and which config parameters are in fact boolean relations.

Addresses-Debian-Bug: #634883

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 21:28:39 -04:00
Darrick J. Wong 9026b3db3a libext2fs: Always swab the MMP block on big-endian systems machines
The MMP code in libext2fs tries to gate MMP block swab'ing with this
test:

if (fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC))

However, EXT2FS_ENABLE_SWAPFS never seems to be defined anywhere (all
possible existed, the field fs->super->s_magic is always in host
byteorder, so the test always fails.  So, we can change the #ifdef to
WORDS_BIGENDIAN (which is conditionally defined on BE platforms) and
get rid of the broken if test.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 21:28:30 -04:00
Darrick J. Wong 1660034c0a e2fsck: zero ctx->fs after freeing fs when restarting due to MMP
If MMP is enabled and e2fsck determines that it needs to restart
itself on account of various MMP conditions, it will close the current
fs and jump back to the start of fs checking.  However, closing fs
also frees it, which means that we need to set ctx->fs to NULL to
prevent subsequent open code from accessing the old deleted pointer.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 21:28:21 -04:00
Darrick J. Wong a7a63675af libext2fs: Fix various bugs from the metadata checksum integration
Fix several minor errors in structure definitions, the byteswap code,
and Makefiles that result from merging the crc32c and initial parts of
the metadata checksumming patchset.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 21:28:12 -04:00
Theodore Ts'o 8c0de61a24 e2fsck: simplify binary search in ea_refcount.c
Remove the interpolation search in ea_refcount.  The added complexity
isn't worth the speed up.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 16:38:26 -04:00
Theodore Ts'o b1c828e875 debian: add hurd-specific mke2fs.conf file
Addresses-Debian-Bug: #629355

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 23:22:01 -04:00
Theodore Ts'o 14b283ae56 mke2fs: set s_max_mnt_count to -1 by default
If the enable_periodic_fsck option is false in /etc/mke2fs.conf (which
is also the default), s_max_mnt_count needs to be set to -1, instead
of 0.  Kernels newer than 3.0 will interpret 0 to disable periodic
checks, but older kernels will print a warning message on each mount,
which will annoy users.

Addresses-Debian-Bug: #632637

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 23:20:56 -04:00
Theodore Ts'o 0dbb256124 e2fsck: make the signal catcher more portable
All of the signals which the signal catcher tries to interpret aren't
necessarily defined on all systems.  So add #ifdef's to protect
various signals to avoid compilation failures on non-x86 platforms.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 22:09:14 -04:00
Theodore Ts'o a378bd5a5a libext2fs: use ext2fs byte swap functions for portability
The functions htole32(), le32toh(), be32toh(), htobe32() aren't
defined in all environments.  Use the ext2fs byte swap functions for
portability.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 20:27:03 -04:00
Theodore Ts'o 38a420bfce libquota: use ext2fs byte swapping functions for portability
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 20:08:37 -04:00
Theodore Ts'o 96a8afa7c1 e2fsck: check for invalid bad block inode
In some cases the bad block inode gets corrupted.  If it looks insane,
offer to clear it before trying to interpret it does more harm than
good.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 18:34:33 -04:00
Theodore Ts'o 20d7949583 debian: don't bomb out if DEB_BUILD_OPTIONS contains nostrip
The debugging packages will contain no debugging symbols (since they
are in the unstripped executables and libraries) but at least the
build won't crash.

Addresses-Debian-Bug: #627535

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25 15:40:24 -04:00
Theodore Ts'o 8a0ef9edfa Update for e2fsprogs 1.42-WIP-0925 release 2011-09-25 02:10:54 -04:00
Theodore Ts'o a828398373 Add spd_readdir.c to the contrib directory
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25 02:10:54 -04:00
Theodore Ts'o af63aacef4 debian: update e2fslibs.symbols to include newly added symbols
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25 01:55:28 -04:00
Theodore Ts'o 3c643f8b18 debian/copyright: update the debian copyright file
Fix up the debian/copyright file so it contains the full information
of the licenses used by all of the libraries.  Also use a single
copyright file for e2fsprogs and e2fslibs, to make sure they are kept
in sync.

Addresses-Debian-Bug: #614662

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25 01:55:28 -04:00
Eric Sandeen d352f838e8 debugfs: initialize inode to 0 in list_dir_proc() if no inode nr
If (!ino), the inode will be uninitialized when we print it
in the PARSE_OPT case.

So do the same as the LONG_OPT case, and memset it to 0 if
(!ino).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-25 01:55:28 -04:00
Andreas Dilger d9c60e04b3 e2fsck: regression tests for INCOMPAT_MMP feature
Add tests for the MMP feature - creating a filesystem with mke2fs
and MMP enabled, enable/disable MMP with tune2fs, disabling the
e2fsck MMP flag with tune2fs after a failed e2fsck, and e2fsck
checking and fixing a corrupt MMP block.

The MMP tests need to be run from a real disk, not tmpfs, because
tmpfs doesn't support O_DIRECT reads, which MMP uses to ensure
that reads from the MMP block are not filled from the page cache.
Using a local disk does not slow down the tests noticably, since
they wait to detect if the MMP block is being modified.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25 01:55:28 -04:00
Andreas Dilger 0f5eba7501 ext2fs: add multi-mount protection (INCOMPAT_MMP)
Multi-mount protection is feature that allows mke2fs, e2fsck, and
others to detect if the filesystem is mounted on a remote node (on
SAN disks) and avoid corrupting the filesystem.  For e2fsprogs this
means that it checks the MMP block to see if the filesystem is in use,
and marks the filesystem busy while e2fsck is running on the system.

This is useful on SAN disks that are shared between high-availability
servers, or accessible by multiple nodes that aren't in HA pairs.  MMP
isn't intended to serve as a primary HA exclusion mechanism, but as a
failsafe to protect against user, software, or hardware errors.

There is no requirement that e2fsck updates the MMP block at regular
intervals, but e2fsck does this occasionally to provide useful
information to the sysadmin in case of a detected conflict.

For the kernel (since Linux 3.0) MMP adds a "heartbeat" mechanism to
periodically write to disk (every few seconds by default) to notify
other nodes that the filesystem is still in use and unsafe to modify.

Originally-by: Kalpak Shah <kalpak@clusterfs.com>

Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-25 01:55:23 -04:00
Andreas Dilger 6747ac86b9 tune2fs: miscellaneous whitespace fixups
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24 14:34:56 -04:00
Andreas Dilger d90d6a7146 tune2fs: kill external journal if device not found
Continue to remove the external journal device even if the device
cannot be found.

Add a test to verify that the journal device/UUID are actually removed
from the superblock.  It isn't possible to use a real journal device
for testing without loopback devices and such (it must be a block device)
and this would invite complexity and failures in the regression test.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24 14:34:47 -04:00
Andreas Dilger 6b56f3d92d misc: quiet minor compiler errors
Several compiler errors are quieted:
- zero-length gnu_printf format string
- unused variable
- uninitalized variable (though it isn't actually used for anything)
- fixed a bug in ext2fs_stat() if stat64() does not exist

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-24 13:00:24 -04:00
Richard W.M. Jones 9d9a53e651 libext2fs: add flag to ext2fs_flush() and ext2fs_close() to avoid fsync
This adds new APIs: ext2fs_flush2 and ext2fs_close2 which take an
extra 'int flags' parameter.

This allows us to pass in an EXT2_FLAG_FLUSH_NO_SYNC flag which avoids
fsync'ing the filesystem when closing it.  For the case we have in
mind where we are just constructing a throwaway ext2 filesystem in a
file in order to boot a VM, this saves over 5 seconds during the boot
process and avoids many unnecessary disk writes.

Existing code using ext2fs_flush and ext2fs_close remains unaffected
by this change.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-24 12:53:16 -04:00