Karel Zak [Wed, 1 Dec 2010 22:02:17 +0000 (23:02 +0100)]
mount: read /sys for loopdev backing file
On systems without /etc/mtab (or everywhere if kernel >= 2.6.37)
we use loop autoclear flag and then the backing file name is not
stored in /etc/mtab. mount(8) uses sysfs to get the filename (or
LOOP_GET_STATU* ioctls on old kernels).
Karel Zak [Wed, 1 Dec 2010 13:04:35 +0000 (14:04 +0100)]
losetup: use /sys/dev/block/.../loop/backing_file
The basic loopdev attributes are available in sysfs since kernel
2.6.37. This patch uses the backing_file attribute from sysfs for very
long filenames (the LOOP_GET_STATUS ioctl uses only 64 bytes for the
filename).
old version:
# losetup -a
/dev/loop0: [0804]:12865322 (/home/images/filesystems/this_is_really_really_long_directory_*)
new version:
# losetup -a
/dev/loop0: [0804]:12865322 (/home/images/filesystems/this_is_really_really_long_directory_name/ext2.img)
Karel Zak [Wed, 1 Dec 2010 10:20:45 +0000 (11:20 +0100)]
lscpu: use GPLv2+
CAI Qian and I agree that GPLv2+ is better for lscpu.c. This license
is more compatible (than v3) with the rest of the util-linux package.
We need to link the code with functions from lib/ -- mix GPLv3 and
GPLv2 is bad idea.
Note that it was only Cai and I who did significant changes to
lscpu.c, all others changes from others developers was trivial (fix
typos, add _(), ...).
Signed-off-by: CAI Qian <caiqian@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Reported-by: "Dr. David Alan Gilbert" <linux@treblig.org>
Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/682176 Signed-off-by: Karel Zak <kzak@redhat.com>
Lukas Czerner [Wed, 24 Nov 2010 23:05:37 +0000 (00:05 +0100)]
fstrim: add new command
fstrim is used on a mounted filesystem to discard (or "trim") blocks
which are not in use by the filesystem. This is useful for
solid-state drives (SSDs) and thinly-provisioned storage
Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Davidlohr Bueso [Tue, 16 Nov 2010 13:47:35 +0000 (10:47 -0300)]
lib: [strutils] general purpose string handling functions
This patch replaces a few functions used throughout the source:
* Renames getnum (from schedutils) to strtol_or_err
* Moves strtosize (from lib/strtosize.c)
* Moves xstrncpy (from include/xstrncpy.h)
* Adds strnlen, strnchr and strndup if not available (remove it from libmount utils)
A few Makefile.am files were modified to compile accordingly along with trivial renaming
in schedutils source code.
Davidlohr Bueso [Mon, 15 Nov 2010 11:55:16 +0000 (08:55 -0300)]
lib/tt: fix langinfo build break
When HAVE_LANGINFO_H is not defined we break the compilation in tt.c:
CC tt.o
tt.c: In function ‘tt_new_table’:
tt.c:142: warning: implicit declaration of function ‘nl_langinfo’
tt.c:142: error: ‘CODESET’ undeclared (first use in this function)
tt.c:142: error: (Each undeclared identifier is reported only once
tt.c:142: error: for each function it appears in.)
make: *** [tt.o] Error 1
Thorsten Glaser [Sun, 7 Nov 2010 14:00:04 +0000 (14:00 +0000)]
hwclock: [m68k] unbreak FTBFS with recent (>= 2.4.18?) kernels
The old KDGHWCLK ioctl was removed from the Linux kernel quite some
time ago. The kd.c source file of hwclock contains fallback code to
handle this, but the fallback code never could have compiled or was
not fixed along other code changes. The Linux kernel nowadays igno-
res the ioctl entirely so removing it unless provided by the kernel
headers, to keep it working on very old kernels, seems the sensible
thing to do, as the comments say m68k only and deprecated (which is
correct AFAICT).
According to pickaxe on gitweb, it was removed in 2002:
http://git.kernel.org/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git;a=commit;h=a915e414af5fc541ff62ef0bfec847457ae650bc
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578168 Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Jeroen Oortwijn [Sun, 31 Oct 2010 20:32:21 +0000 (21:32 +0100)]
libblkid: add signature to FAT32 fsinfo block
Add 0x41645252 to the list of valid signatures of the FAT32 fsinfo
block. It isn't a valid signature, but there are devices that use this
signature in their FAT32 filesystem.
Hugh Dickins [Mon, 25 Oct 2010 00:32:47 +0000 (17:32 -0700)]
swapon: add "discard" support
In kernel 2.6.36 (and in stable kernel 2.6.35.5) I made a tiny change
to the swapon(const char *path, int swapflags) system call interface:
kernel commit 3399446632739fcd05fd8b272b476a69c6e6d14a
swap: discard while swapping only if SWAP_FLAG_DISCARD
As things stand at present, we could just remove the swap discard
support; but since several filesystems (including ext4 and btrfs and
fat) are offering a "discard" mount option, I thought swap should take
the same course, and offer a "--discard" or "-d" option to swapon(8).
[kzak@redhat.com: - update swapon.8 man page
- use for -d the same logic as for -p]
Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 26 Oct 2010 10:58:32 +0000 (12:58 +0200)]
fsck: add support for whole-disk locking (-l option)
This feature allows to call multiple independent fsck instances rather
than use only one "fsck -A" process.
The lock uses LOCK_EX flock(2). The lock request is ignored if the
whole-disk is non-rotating disk. The verbose mode (-V) provides
information about disk locking.
Note that "fsck -l" does not care if the device is stacked, for
example if you want to call "fsck -l /dev/md0" and "fsck -l /dev/md1"
then the underlying devices will not be locked. The traditional "fsck
-A" does not run in parallel for stacked devices.
Requested-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 25 Oct 2010 21:23:48 +0000 (23:23 +0200)]
libmount: optimize blkid_devno_to_devname()
The brutal force /dev directory scanning should be used as a fallback
solution only. Currently, almost all systems use udev and we can read the
name from /sys/block/<maj>:<min> symlink.
Karel Zak [Mon, 25 Oct 2010 12:03:16 +0000 (14:03 +0200)]
swapon: add support for "nofail" fstab mount option
This option is already supported by mount(8) and fsck(8), there is no
reason to have any exception for swap devices. Note that the --ifexists
command line option applies to all swap devices, the "nofail" setting
is per device.
Karel Zak [Mon, 25 Oct 2010 10:26:28 +0000 (12:26 +0200)]
umount: umount -r segfault
umount(8) segfaults when update incomplete mtab file after remount to
read-only (-r). For example autofs does not store info about
mountpoint to /etc/mtab file.
# mount /dev/sda1 /mnt/test
# sed -i -e 's:/dev/sda1 .*::g' /etc/mtab
# cd /mnt/test
# umount -r /mnt/test
umount: /mnt/test busy - remounted read-only
Segmentation fault
The command "umount -r" should not care about /etc/mtab if the related
mtab entry does not exist.
Reported-by: Paul Crawford <psc@sat.dundee.ac.uk>
Addresses: https://bugs.launchpad.net/bugs/579858 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 14 Oct 2010 23:33:28 +0000 (01:33 +0200)]
libblkid: fix MBR detection on iPod and cleanup vfat code
- move all FAT code to superblocks/vfat.c only
- add a generic function to verify FAT superblock and use it
in FAT prober as well as in MBR parser
- add a more robust FAT cluster_count check
(it seems that iPod contains an "almost valid" FAT superblock before MBR)
Reported-by: Davidlohr Bueso <dave.bueso@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>