Alexey Gladkov [Tue, 14 Dec 2010 23:14:18 +0000 (02:14 +0300)]
swapon: Canonicalize swap device
Swapon checks whether a swap device is active by searching for the
device name in /proc/swaps. /proc/swaps always specifies the path
to real device file, even if the path to real device file, even
if symlink was passed to the swapon() system call.
This differs from /proc/mounts semantics where each string contains
exactly the same device name as it was passed to the mount*() system call.
If a swap partition resides on lvm, libblkid returns a name in
form /dev/mapper/*, but now there are symlinks pointing to device
files /dev/dm-*, resulting to /proc/swaps containing /dev/dm-*,
but swapon still looks for /dev/mapper/* and tries to activate
the swap partition again.
[kzak@redhat.com: - remove unnecessary changes from
is_in_proc_swaps()]
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> Tested-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 10 Dec 2010 13:05:27 +0000 (14:05 +0100)]
login: fix "ignoring return value" errors
login.c:542:8: warning: ignoring return value of ‘fchown’, declared
with attribute warn_unused_result
login.c:1013:11: warning: ignoring return value of ‘fchown’, declared
with attribute warn_unused_result
login.c: In function ‘dolastlog’:
login.c:1452:7: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result
login.c: In function ‘motd’:
login.c:1391:7: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result
Karel Zak [Thu, 9 Dec 2010 22:13:58 +0000 (23:13 +0100)]
sfdisk: add option to use maximum partition size
Based on patch from Alex Bligh <alex@alex.org.uk>, Alex wrote:
By default, omitting a size parameter means that the maximum sized partition
is used. However, this option is not available in conjunction with the -N
flag, as under such circumstances the default is the current size of the
partition. This patch allows a size to be specified as "+" in which case
the maximum sized partition is used, irrespective of the setting of the -N
flag.
This allows partitions to be programatically resized to their maximum size,
by (for instance):
echo ",+," | sfdisk -N1 /dev/sda
This is non-trivial to do without the patch, as -N makes the default size
the existing size. As there is (without this patch) no way of reading the
maximum size, the only option is to delete the partition and recreate it.
This is undesirable for a number of reasons (e.g. errors between delete
and recreate).
Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/686124 Signed-off-by: Karel Zak <kzak@redhat.com>
renice: improve messages specifying what ID is referring to
Hello,
On 30/11/2010 13:01, Karel Zak wrote:
> Unfortunately, translators don't like this kind of strings where any
> translatable substring is inserted to the normal sentence. It would be
> better to use something like:
>
> "%d (%s): failed to set priority", who, idtype
>
> "%s: %d: failed to set priority", idtype, who
>
> or so...
or "failed to set priority for %d (%s)"?
From 536eb11f873f2c887e075a37ffb3c971cac258d5 Mon Sep 17 00:00:00 2001
From: Francesco Cosoleto <cosoleto@gmail.com>
Date: Mon, 6 Dec 2010 01:23:10 +0100
Subject: [PATCH] renice: improve messages specifying what ID is referring to
This version makes more clear the printed message specially when the
--user option is used.
Old version:
$ renice 19 10 -u fra -g 1
renice: 10: setpriority: Operation not permitted
renice: 1000: setpriority: Operation not permitted
renice: 1: setpriority: Operation not permitted
$ renice 19 -u fra
1000: old priority 0, new priority 19
New version:
$ renice 19 10 -u fra -g 1
renice: failed to set priority for 10 (process ID): Operation not permitted
renice: failed to set priority for 1000 (user ID): Operation not permitted
renice: failed to set priority for 1 (process group ID): Operation not permitted
$ renice 19 -u fra
1000 (user ID) old priority 0, new priority 19
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
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>