]> err.no Git - util-linux/log
util-linux
14 years agocol: use err.h and EXIT_* macros
Karel Zak [Mon, 1 Nov 2010 13:51:08 +0000 (14:51 +0100)]
col: use err.h and EXIT_* macros

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocol: use xalloc for memory allocation
Davidlohr Bueso [Fri, 22 Oct 2010 15:24:37 +0000 (12:24 -0300)]
col: use xalloc for memory allocation

Differentiate between malloc and realloc (not done so far) and get rid of local warn()

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agotailf: use xalloc for memory allocation
Davidlohr Bueso [Fri, 22 Oct 2010 15:23:31 +0000 (12:23 -0300)]
tailf: use xalloc for memory allocation

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agomore: use xalloc for memory allocation
Davidlohr Bueso [Fri, 22 Oct 2010 15:22:56 +0000 (12:22 -0300)]
more: use xalloc for memory allocation

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agopg: use xalloc for memory allocation
Davidlohr Bueso [Fri, 22 Oct 2010 15:22:09 +0000 (12:22 -0300)]
pg: use xalloc for memory allocation

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agomount: use utimensat(AT_FDCWD) rather than open()+futimens()
Karel Zak [Fri, 29 Oct 2010 18:04:00 +0000 (20:04 +0200)]
mount: use utimensat(AT_FDCWD) rather than open()+futimens()

Thanks to Kay Sievers.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: add note about agetty to TODO
Karel Zak [Fri, 29 Oct 2010 15:51:35 +0000 (17:51 +0200)]
docs: add note about agetty to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoremove free() from atexit() callbacks
Karel Zak [Fri, 29 Oct 2010 11:29:28 +0000 (13:29 +0200)]
remove free() from atexit() callbacks

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agochrt: Add noreturn attribute to show_usage() function
Marek Polacek [Thu, 28 Oct 2010 23:04:30 +0000 (01:04 +0200)]
chrt: Add noreturn attribute to show_usage() function

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
14 years agouse _exit() instead of exit() in sighandlers
Marek Polacek [Thu, 28 Oct 2010 22:55:07 +0000 (00:55 +0200)]
use _exit() instead of exit() in sighandlers

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
14 years agoagetty: fix -s option (baud rate setup)
Karel Zak [Fri, 22 Oct 2010 19:24:50 +0000 (21:24 +0200)]
agetty: fix -s option (baud rate setup)

The problem is pretty visible in strace output:

broken version:
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
  [...]
  ioctl(0, SNDCTL_TMR_START or TCSETS, {B0 -opost -isig -icanon -echo ...}) = 0
                                       ^^^
fixed version:
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
  [...]
  ioctl(0, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0

Reported-by: Jon Masters <jcm@redhat.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=645640
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofsck: add support for whole-disk locking (-l option)
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>
14 years agolibmount: optimize blkid_devno_to_devname()
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoswapon: add support for "nofail" fstab mount option
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoumount: umount -r segfault
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>
14 years agolib: add test program to canonicalize.c
Karel Zak [Fri, 22 Oct 2010 21:38:07 +0000 (23:38 +0200)]
lib: add test program to canonicalize.c

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: remove warning about FS detection from mount.1
Karel Zak [Thu, 21 Oct 2010 15:24:41 +0000 (17:24 +0200)]
mount: remove warning about FS detection from mount.1

The warning is from util-linux 2.7.1 (year 1996)... the filesystems
detection is pretty generic now.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoman: add russian translation of ddate.1
Karel Zak [Thu, 21 Oct 2010 13:00:47 +0000 (15:00 +0200)]
man: add russian translation of ddate.1

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoctrlaltdel: use err() instead of fprintf() and exit()
Marek Polacek [Sun, 17 Oct 2010 09:01:22 +0000 (11:01 +0200)]
ctrlaltdel: use err() instead of fprintf() and exit()

[kzak@redhat.com: - remove unnecessary program name from err(),
                  - use program_invocation_short_name]

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolook: fix conflict between locally defined err() and glibc's version
Davidlohr Bueso [Fri, 15 Oct 2010 17:23:16 +0000 (14:23 -0300)]
look: fix conflict between locally defined err() and glibc's version

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomisc-utils: use new xmalloc() wrapper
Davidlohr Bueso [Fri, 15 Oct 2010 14:59:18 +0000 (11:59 -0300)]
misc-utils: use new xmalloc() wrapper

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agoxalloc: general purpose memory allocation handling wrappers
Davidlohr Bueso [Fri, 15 Oct 2010 17:03:25 +0000 (14:03 -0300)]
xalloc: general purpose memory allocation handling wrappers

[kzak@redhat.com: - use %zu for size_t]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix memory leak
Igor Bazhitov [Sat, 9 Oct 2010 18:54:31 +0000 (22:54 +0400)]
libblkid: fix memory leak

search_type and search_handle fields of blkid_dev_iterate iterator are
not being freed after usage.
Add cleanup code.

Signed-off-by: Igor Bazhitov <igor.bazhitov@gmail.com>
14 years agocolumn: code readability improvements
Sami Kerola [Sat, 9 Oct 2010 17:59:50 +0000 (19:59 +0200)]
column: code readability improvements

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
14 years agocolumn: error messaging & exit codes
Sami Kerola [Sat, 9 Oct 2010 17:59:49 +0000 (19:59 +0200)]
column: error messaging & exit codes

Human understandable error messages along with symbolic exit
codes to comply with coding standard.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
14 years agocolumn: EOF handling bug
Sami Kerola [Sat, 9 Oct 2010 17:59:48 +0000 (19:59 +0200)]
column: EOF handling bug

For the last line of the file lenght of line should be determined
where the EOF is instead of new line. Old output was

$ printf "1 2\n3" | column -t
column: line too long
1 2

which this commit will change to

$ printf "1 2\n3" | column -t
1  2
3

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix MBR detection on iPod and cleanup vfat code
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>
14 years agolibblkid: consolidate magic strings detection code
Karel Zak [Thu, 14 Oct 2010 23:32:13 +0000 (01:32 +0200)]
libblkid: consolidate magic strings detection code

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agopartx: integrate support for mac and sun partitions, based on kpartx.
Davidlohr Bueso [Thu, 7 Oct 2010 14:48:28 +0000 (10:48 -0400)]
partx: integrate support for mac and sun partitions, based on kpartx.

[kzak@redhat.com: - remove unnecessary members from struct slice,
                  - fix gcc warnings]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agopartx: add sun partition table support
Davidlohr Bueso [Thu, 7 Oct 2010 14:48:22 +0000 (10:48 -0400)]
partx: add sun partition table support

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agopartx: add mac partition table support
Davidlohr Bueso [Thu, 7 Oct 2010 14:48:16 +0000 (10:48 -0400)]
partx: add mac partition table support

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agodocs: update TODO
Karel Zak [Thu, 7 Oct 2010 15:57:35 +0000 (17:57 +0200)]
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: don't canonicalize "spec" with --no-canonicalize option
Miklos Szeredi [Thu, 7 Oct 2010 14:05:12 +0000 (16:05 +0200)]
mount: don't canonicalize "spec" with --no-canonicalize option

"Spec" was still canonicalized despite --no-canonicalize.  This
resulted in a hang during login with pam_encfs (Debian Bug#593336).

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
14 years agotests: update namei regression test
Karel Zak [Thu, 7 Oct 2010 08:37:03 +0000 (10:37 +0200)]
tests: update namei regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocal: use EXIT_* and program_invocation_short_name
Karel Zak [Thu, 7 Oct 2010 08:35:32 +0000 (10:35 +0200)]
cal: use EXIT_* and program_invocation_short_name

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: really use 'mode' argument in path_fopen()
Petr Uzel [Wed, 6 Oct 2010 14:03:34 +0000 (16:03 +0200)]
lscpu: really use 'mode' argument in path_fopen()

14 years agoflock: use more useful example in flock.1
Jakob Unterwurzacher [Wed, 6 Oct 2010 11:32:20 +0000 (13:32 +0200)]
flock: use more useful example in flock.1

The example in the man page does not prevent concurrent execution, as it
obtains a shared lock. More useful is taking an exclusive lock, i.e.
remove "-s".
Additionally, IMO most people want the script to exit when the lock
cannot be acquired, so adding "-n".

14 years agofindmnt: fix support for -a option
Milan Broz [Tue, 5 Oct 2010 15:38:43 +0000 (17:38 +0200)]
findmnt: fix support for -a option

Signed-off-by: Milan Broz <mbroz@redhat.com>
14 years agosfdisk: save errno before calling perror
Forest Bond [Tue, 5 Oct 2010 01:01:30 +0000 (21:01 -0400)]
sfdisk: save errno before calling perror

errno is saved into a local variable to avoid it getting trampled
by perror before it is checked to determine the return value.

This issue seems quite rare, but I have seen it when running sfdisk
via gksudo and using the --quiet command-line option.  From what I
can tell, this combination triggers loading of translations in perror,
which (at least on my machine) ends up changing the value of errno.

Signed-off-by: Forest Bond <forest@alittletooquiet.net>
14 years agocolumn: update manual page to match column switches
Sami Kerola [Mon, 4 Oct 2010 18:57:58 +0000 (20:57 +0200)]
column: update manual page to match column switches

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocolumn: getopt_long and new help output
Sami Kerola [Mon, 4 Oct 2010 18:57:57 +0000 (20:57 +0200)]
column: getopt_long and new help output

[kzak@redhat.com: - remove __progname, cleanup usage()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofallocate: fix build failure with old linux headers
Mike Frysinger [Sun, 3 Oct 2010 20:00:09 +0000 (16:00 -0400)]
fallocate: fix build failure with old linux headers

If linux/falloc.h does not exist, the build system still enables the
fallocate util, but ultimately fails when it tries to include the
header and use a define from it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agofsck: inform about nonexistent devices in verbose mode
Karel Zak [Thu, 7 Oct 2010 07:26:37 +0000 (09:26 +0200)]
fsck: inform about nonexistent devices in verbose mode

Reported-by: Serafeim Zanikolas <sez@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add searching in attributes dir to BeFS
Jeroen Oortwijn [Wed, 22 Sep 2010 17:14:21 +0000 (19:14 +0200)]
libblkid: add searching in attributes dir to BeFS

Add searching for the be:volume_id attribute in the attributes directory
of the root directory. UUID is now always set when the root directory
contains the be:volume_id attribute.

Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
14 years agoswapon: warn if file owner is not root
Karel Zak [Thu, 7 Oct 2010 07:03:31 +0000 (09:03 +0200)]
swapon: warn if file owner is not root

Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoumount: use strtosize() for offset=
Karel Zak [Thu, 7 Oct 2010 06:58:00 +0000 (08:58 +0200)]
umount: use strtosize() for offset=

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agonamei: parse all path arguments when an optarg path will fail
Sami Kerola [Thu, 30 Sep 2010 22:33:44 +0000 (00:33 +0200)]
namei: parse all path arguments when an optarg path will fail

Old implementation of namei listed path all the way to non-existing
file or directory, something like:

f: /usr/bin/nxdir/file
 d /
 d usr
 d bin
 ? nxdir - No such file or directory (2)

whiles the current implementation prints:

namei: failed to stat: /usr/bin/nxdir/file: No such file or directory

The new output it's not helpful. I am especially interested see where
the path is broken when a path is symlink to other path with symlink,
and few more like that, and something somewhere is broken.

[kzak@redhat.com: - coding style changes]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotaskset: proper numbers parsing
Karel Zak [Thu, 30 Sep 2010 21:27:42 +0000 (23:27 +0200)]
taskset: proper numbers parsing

Reported-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: eliminate redundant call to open()
Markus Rinne [Wed, 22 Sep 2010 19:11:54 +0000 (22:11 +0300)]
fdisk: eliminate redundant call to open()

Don't use open() in get_boot() if it's called with an argument try_only,
because the file has already been opened by the caller.

Signed-off-by: Markus Rinne <markus.ka.rinne@gmail.com>
14 years agomount: Don't call canonicalize_*(SPEC) for 9p
Sven Eckelmann [Sun, 26 Sep 2010 19:18:15 +0000 (21:18 +0200)]
mount: Don't call canonicalize_*(SPEC) for 9p

When calling "mount -t 9p -o trans=virtio foobar /mnt/bar" and foobar
exists in the current path, the 9p virtio transport driver will be
called with $CWD/foobar and fail with "9p: no channels available".

Similar problems exist with remote file servers
 "mount -t 9p 23.42.08.15 /mnt/bar"
and Plan 9 From User Space applications
 "mount -t 9p -o trans=unix,uname=$USER `namespace`/acme /mnt/bar"

A similar exception like for nfs, cifs and smbfs must be added for 9p.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
14 years agomount: avoid starting a man page line with a single quote
Chris Frost [Mon, 20 Sep 2010 17:27:19 +0000 (10:27 -0700)]
mount: avoid starting a man page line with a single quote

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: fix mount.8, shortname=mixed is now default for vfat
Petr Uzel [Mon, 20 Sep 2010 15:12:42 +0000 (17:12 +0200)]
mount: fix mount.8, shortname=mixed is now default for vfat

Since Linux kernel commit 955234755ce4a2c33cfc558912aa8f2148cc1fc6,
the default mode for vfat filesystem is 'shortname=mixed'.

Reported-by: Harald Koenig <koenig@linux.de>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
14 years agoddate: revert man page typo
Karel Zak [Thu, 30 Sep 2010 20:27:42 +0000 (22:27 +0200)]
ddate: revert man page typo

On Sat, Sep 18, 2010 at 03:10:52AM +0300, Anssi Hannula wrote:
> According to wikipedia [1] 'Holyday' was the correct spelling, I
> guess the first hunk should be reverted.
>
> [1] http://en.wikipedia.org/wiki/Discordian_calendar

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: rewrite is_readonly()
Karel Zak [Mon, 20 Sep 2010 11:10:36 +0000 (13:10 +0200)]
mount: rewrite is_readonly()

This new implementation is more optimistic and always calls access(2).
The fallback solution (modify atime by futimens(2)) should be used
very rarely.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoul: use atexit() to deallocate buffer, print errors by err()
Karel Zak [Fri, 17 Sep 2010 08:35:35 +0000 (10:35 +0200)]
ul: use atexit() to deallocate buffer, print errors by err()

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoul: fix memory leak.
Davidlohr Bueso [Mon, 30 Aug 2010 02:03:32 +0000 (22:03 -0400)]
ul: fix memory leak.

The 'obuf' variable is not being freed after usage and this includes
when SIGINTs occur, hence add some basic signal handling.

[kzak@redhat.com - remove if-before-free ]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: update lscpu.1 to include new additions.
Davidlohr Bueso [Mon, 30 Aug 2010 22:06:19 +0000 (18:06 -0400)]
lscpu: update lscpu.1 to include new additions.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agoddate: fix typo in ddate.1
Davidlohr Bueso [Thu, 2 Sep 2010 12:40:23 +0000 (08:40 -0400)]
ddate: fix typo in ddate.1

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agomount: add note about context= remount to mount.8
Karel Zak [Thu, 16 Sep 2010 22:09:38 +0000 (00:09 +0200)]
mount: add note about context= remount to mount.8

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: don't probe directories
Karel Zak [Wed, 15 Sep 2010 09:51:09 +0000 (11:51 +0200)]
libblkid: don't probe directories

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: better describe UUIDs usage in man pages
Karel Zak [Mon, 13 Sep 2010 09:43:14 +0000 (11:43 +0200)]
mount: better describe UUIDs usage in man pages

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=632373
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: don't ignore zero for SBMAGIC_OFFSET
Karel Zak [Tue, 7 Sep 2010 09:30:50 +0000 (11:30 +0200)]
libblkid: don't ignore zero for SBMAGIC_OFFSET

The side effect of this bug is that wipefs(8) does not report LUKS...

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: add blkid --list-all to TODO
Karel Zak [Tue, 7 Sep 2010 09:03:45 +0000 (11:03 +0200)]
docs: add blkid --list-all to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: don't use size of device based on cylinders
Karel Zak [Mon, 6 Sep 2010 11:30:48 +0000 (13:30 +0200)]
cfdisk: don't use size of device based on cylinders

This patch is enough to make cfdisk usable on non-DOS disks where
partitioning is not based on CHS. cfdisk should not print error
messages for such disks.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=630340
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofindmnt: don't swap source and target if the source is a tag
Karel Zak [Tue, 31 Aug 2010 10:24:00 +0000 (12:24 +0200)]
findmnt: don't swap source and target if the source is a tag

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: clean up fstab.5
Karel Zak [Mon, 30 Aug 2010 09:43:41 +0000 (11:43 +0200)]
mount: clean up fstab.5

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: add note about subtypes to fstab.5
Karel Zak [Mon, 30 Aug 2010 08:48:52 +0000 (10:48 +0200)]
mount: add note about subtypes to fstab.5

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblockdev: fix typo in blockdev.8
Karel Zak [Fri, 27 Aug 2010 22:50:24 +0000 (00:50 +0200)]
blockdev: fix typo in blockdev.8

Reported-by: Marcos Felipe Rasia de Mello <marcosfrm@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: add info about type.subtype to /sbin/mount.<type> API description
Karel Zak [Fri, 27 Aug 2010 18:42:16 +0000 (20:42 +0200)]
mount: add info about type.subtype to /sbin/mount.<type> API description

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: handle filesystems with subtype
Miklos Szeredi [Fri, 27 Aug 2010 14:58:44 +0000 (16:58 +0200)]
mount: handle filesystems with subtype

Linux can handle filesystem types with "MAINTYPE.SUBTYPE" format,
where the main type determines the actual filesystem driver while the
subtype can be interpreted by the filesystem itself.

When searching for mount helpers mount(8) and umount(8) should also
interpret such types, falling back to (u)mount.MAINTYPE if
(u)mount.MAINTYPE.SUBTYPE doesn't exist.

This patch implements this, passing the type with "-t TYPE"
to the mount program in this case.

Reported-by: Josef Bacik <josef@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=625064
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
14 years agomount: sanity check mount flags for MS_PROPAGATION
Karel Zak [Fri, 27 Aug 2010 10:22:27 +0000 (12:22 +0200)]
mount: sanity check mount flags for MS_PROPAGATION

 mount(8) reuses mount flags from fstab/mtab, the problem is that for
 MS_PROPAGATION operations kernel incorrectly evaluates mount flags if
 the flags contains any non-propagation stuff (e.g. MS_RDONLY). For
 example --make-shared on read-only FS:

   # strace -e mount mount --make-shared /mnt/test
   mount("/dev/sda1", "/mnt/test", "none", MS_RDONLY|MS_SHARED, NULL) = 0

 must be:

   # strace -e mount mount --make-shared /mnt/test
   mount("/dev/sda1", "/mnt/test", "none", MS_SHARED, NULL) = 0

Reported-by: Valerie Aurora <vaurora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: Add more pseudo filesystems.
Davidlohr Bueso [Mon, 23 Aug 2010 14:17:36 +0000 (10:17 -0400)]
mount: Add more pseudo filesystems.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
14 years agoblockdev: sync man page with code
Karel Zak [Tue, 24 Aug 2010 10:59:41 +0000 (12:59 +0200)]
blockdev: sync man page with code

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoinclude: cleanup blkdev.h
Karel Zak [Tue, 24 Aug 2010 10:04:24 +0000 (12:04 +0200)]
include: cleanup blkdev.h

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblockdev: add BLKDISCARDZEROES
Karel Zak [Tue, 24 Aug 2010 09:43:21 +0000 (11:43 +0200)]
blockdev: add BLKDISCARDZEROES

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: fix alignment check for non-512-byte logical sectors
Karel Zak [Mon, 23 Aug 2010 11:13:36 +0000 (13:13 +0200)]
fdisk: fix alignment check for non-512-byte logical sectors

 # modprobe scsi_debug dev_size_mb=1024 sector_size=4096

 # fdisk /dev/sdb

  Command (m for help): n
  Command action
    e   extended
    p   primary partition (1-4)
  p
  Partition number (1-4, default 1):
  Using default value 1
  First sector (256-262143, default 256): 257
  Last sector, +sectors or +size{K,M,G} (257-262143, default 262143): +100M

  Command (m for help): p

  Disk /dev/sdb: 1073 MB, 1073741824 bytes
  32 heads, 32 sectors/track, 256 cylinders, total 262144 sectors
  Units = sectors of 1 * 4096 = 4096 bytes
  Sector size (logical/physical): 4096 bytes / 4096 bytes
  I/O size (minimum/optimal): 4096 bytes / 262144 bytes
  Disk identifier: 0x16db2bb0

    Device Boot      Start         End      Blocks   Id  System
  /dev/sdb1            257       25855      102396   83  Linux
  Partition 1 does not start on physical sector boundary.
  ^^^^^^^^

 The warning is nonsense. The logical and physical sector size is the
 same. It means that every LBA is always aligned to physical sector
 boundary.

 Note that this bug does not mean that fdisk produces unaligned
 partitions. The problem is that fdisk forces to use bigger gaps
 between aligned LBAs, for example:

   correctly aligned LBA are: 256, 257, 258, ...  [N+1]
   fdisk assumes:             256, 264, 272, ...  [N+(sector_size/512)]

Reported-by: JOB NELSON <job_nelson@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: don't keep internally device size in 512-byte sectors
Karel Zak [Mon, 23 Aug 2010 10:11:26 +0000 (12:11 +0200)]
fdisk: don't keep internally device size in 512-byte sectors

All fdisk code uses sector_size variable, so there should not be an
exception where we use 512-byte sectors.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: fix syntax error in blkdev.c
Karel Zak [Mon, 23 Aug 2010 09:06:08 +0000 (11:06 +0200)]
lib: fix syntax error in blkdev.c

Reported-by: Tuco <tuco.xyz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: update lscpu tests
Karel Zak [Fri, 20 Aug 2010 19:29:04 +0000 (21:29 +0200)]
tests: update lscpu tests

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: support sysfs without cpu/online file
Karel Zak [Fri, 20 Aug 2010 19:15:51 +0000 (21:15 +0200)]
lscpu: support sysfs without cpu/online file

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: fix blkid MD test (missing tailing whitespaces)
Karel Zak [Fri, 20 Aug 2010 19:02:29 +0000 (21:02 +0200)]
tests: fix blkid MD test (missing tailing whitespaces)

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: make it easier to find mail list address
Alexander Shishkin [Fri, 20 Aug 2010 08:08:48 +0000 (11:08 +0300)]
docs: make it easier to find mail list address

AUTHORS doesn't really have the mail list info, but README does.
Mention it in README.devel.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
14 years agolscpu: add byte order and bogoMIPS information
Davidlohr Bueso [Tue, 17 Aug 2010 14:02:00 +0000 (10:02 -0400)]
lscpu: add byte order and bogoMIPS information

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotailf: fixed timing issue that could cause duplicate data output
Dima Kogan [Sat, 14 Aug 2010 09:15:47 +0000 (02:15 -0700)]
tailf: fixed timing issue that could cause duplicate data output

The issue is that in roll_file() we fstat() to find the file size, then read()
as much data as we can and then use the previously saved file size to mark our
position. The bug occurs if we read past the file size reported by fstat()
because more data has arrived while we were reading it. The attached patch uses
the current file position as the location marker instead, with some extra logic
to handle tailing truncated files.

[kzak@redhat.com: - fix coding style]

Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolosetup: do not distinguish between malloc and realloc
Tobias Klauser [Wed, 11 Aug 2010 21:12:07 +0000 (23:12 +0200)]
losetup: do not distinguish between malloc and realloc

realloc(NULL, size) behaves the same as malloc(size) so there is no need
to distinguish between the two.

[kzak@redhat.com: - better handle realloc() errors]

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibmount: remove unused mnt_strconcat3()
Karel Zak [Fri, 20 Aug 2010 11:03:51 +0000 (13:03 +0200)]
libmount: remove unused mnt_strconcat3()

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agorev: coding style, various fixes
Davidlohr Bueso [Sun, 8 Aug 2010 21:03:56 +0000 (17:03 -0400)]
rev: coding style, various fixes

 * Change indentation to 8 characters and coding style, for better reading the code.

 * Add some memory allocation error handling.

 * Fix memory leaks. In cases when Ctrl-C is used to exit the program,
  'p' cannot be freed, so made it a global var, to share between main()
   and sig_handler(). Signal handing is necessary to fix some leaks, so
   added a very basic, non invasive, mechanism.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoflock: properly report exec() errors
Karel Zak [Fri, 20 Aug 2010 09:45:00 +0000 (11:45 +0200)]
flock: properly report exec() errors

Reported-by: Barry Davis <barry_davis@stormagic.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofsck: improve whole-disk check, detect stacked devices
Karel Zak [Thu, 19 Aug 2010 13:33:45 +0000 (15:33 +0200)]
fsck: improve whole-disk check, detect stacked devices

The current heuristic for conversion from partition to whole-disk
is based on device names. It's pretty poor. This patch replaces this
code with blkid_devno_to_wholedisk(). This solution is based on
/sys FS and it works for arbitrary partitioned devices.

The another problem is the way how fsck determines stacked devices.
The current code checks device name for "md" prefix only. It does not
care about DM, dm-ccypt, and so on. This patch uses
/sys/block/.../slaves/, but it does not fully resolves dependencies
between all devices. The method is simple -- fsck does not check
stacked devices in parallel with any other device.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: add blkid test for partitioned RAID0
Karel Zak [Wed, 18 Aug 2010 07:33:11 +0000 (09:33 +0200)]
tests: add blkid test for partitioned RAID0

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoagetty: add -c to reuse cflags
Karel Zak [Wed, 18 Aug 2010 07:29:59 +0000 (09:29 +0200)]
agetty: add -c to reuse cflags

The agetty command resets terminal cflags setting. The -c option
disables this behavior and serial setting from kernel is used.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoaggety: don't wipe CLOCAL flag
Karel Zak [Mon, 12 Jul 2010 09:57:55 +0000 (11:57 +0200)]
aggety: don't wipe CLOCAL flag

gettey should not clear the flag. It seems that the flag is
automatically enabled for serial consoles tht don't use CD signal.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=598631
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoagetty: add -s to reuse existing baud rate
Karel Zak [Wed, 18 Aug 2010 07:02:03 +0000 (09:02 +0200)]
agetty: add -s to reuse existing baud rate

For example:

/sbin/agetty -s /dev/ttyS0 9600

will reuse the speed the kernel configured on the port. If the setting
from kernel is useless (tty returns BREAK character) then the baud
rate from command line (9600) is used.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623685
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: wrong PT detection on RAID0
Karel Zak [Fri, 13 Aug 2010 07:59:31 +0000 (09:59 +0200)]
libblkid: wrong PT detection on RAID0

Reported-by: Yulia Kopkova <ykopkova@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: add -x and {On,Off}-line CPU(s) mask/list
Karel Zak [Wed, 11 Aug 2010 13:41:48 +0000 (15:41 +0200)]
lscpu: add -x and {On,Off}-line CPU(s) mask/list

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolscpu: support offline CPUs
Karel Zak [Wed, 11 Aug 2010 10:43:25 +0000 (12:43 +0200)]
lscpu: support offline CPUs

 # echo 0 >/sys/devices/system/cpu/cpu3/online
 # echo 0 >/sys/devices/system/cpu/cpu2/online

 # grep processor /proc/cpuinfo
 processor       : 0
 processor       : 1

 # lscpu
 lscpu: error: cannot open
 /sys/devices/system/cpu/cpu2/cache/index0/shared_cpu_map: No such file or directory

This patch also add a new "On-line CPU(s):" line to the lscpu(1)
output.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623012
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: add note about sfdisk to TODO
Karel Zak [Tue, 10 Aug 2010 07:06:29 +0000 (09:06 +0200)]
docs: add note about sfdisk to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: fix n+1 again
Karel Zak [Mon, 9 Aug 2010 11:33:17 +0000 (13:33 +0200)]
cfdisk: fix n+1 again

Reported-by: J B <jb.1234abcd@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: update MBR after ID change
Karel Zak [Mon, 9 Aug 2010 11:03:02 +0000 (13:03 +0200)]
fdisk: update MBR after ID change

Reported-by: Bernard Pidoux <bpidoux@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocfdisk: fix n+1 bug in error message
Karel Zak [Mon, 9 Aug 2010 09:32:46 +0000 (11:32 +0200)]
cfdisk: fix n+1 bug in error message

 # cfdisk -Ps <devname>

correctly uses 1..N range for partition numbers, unfortunately some
error messages use 0..N. This is confusing.

Reported-by: J B <jb.1234abcd@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>