]> err.no Git - util-linux/log
util-linux
14 years agoMerge remote branch 'origin/master' into HEAD
LaMont Jones [Fri, 14 May 2010 11:07:14 +0000 (05:07 -0600)]
Merge remote branch 'origin/master' into HEAD

Conflicts:
lib/fsprobe.c
mount/lomount.c

14 years agoblkid: add 'export' output format
Karel Zak [Fri, 14 May 2010 10:02:57 +0000 (12:02 +0200)]
blkid: add 'export' output format

This output format is similar to 'udev' but without udev specific
prefixed (e.g. ID_FS_*). The 'export' format is automatically enabled
for I/O Limits (-i).

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: add -i option to print I/O limits
Karel Zak [Thu, 13 May 2010 20:26:27 +0000 (22:26 +0200)]
blkid: add -i option to print I/O limits

blkid -i /dev/sdb /dev/sda
/dev/sdb: MINIMUM_IO_SIZE="512" OPTIMAL_IO_SIZE="32768" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
/dev/sda: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: update man page/usage()
Karel Zak [Thu, 13 May 2010 18:42:28 +0000 (20:42 +0200)]
blkid: update man page/usage()

The "-s <tag>" options is usable for low-level probing more too. This
feature should be documented.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoaddpart: use atoll() for parsing command line arguments
Thomas Fehr [Tue, 11 May 2010 15:09:46 +0000 (17:09 +0200)]
addpart: use atoll() for parsing command line arguments

Addresses: http://bugzilla.novell.com/show_bug.cgi?id=603328
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoshould build Depend: dpkg or install-info
LaMont Jones [Wed, 12 May 2010 12:38:46 +0000 (06:38 -0600)]
should build Depend: dpkg or install-info

14 years agocfdisk: support non-ascii characters in input
Karel Zak [Fri, 7 May 2010 12:12:26 +0000 (14:12 +0200)]
cfdisk: support non-ascii characters in input

On Sat, Apr 03, 2010 at 12:58:48PM +0000, Jorge wrote:
> When you want to write changes to disk you're asked for a
> confirmation, like this one:
>
>   Are you sure you want to write the partition table to disk? (yes
>   or no)
>
> There is no problem on the English version, but when you launch the
> program in Spanish you get this:
>
>   ¿Está seguro de que desea escribir la tabla de particiones en el
> disco?
>      (sí o no):
>
> You can't type the "í" character. Trying to do so will end in no
> input at all. That is, typing in my keyboard "´" then "i" leads to
> nothing. So you can't write changes to disk, and you must launch the
> program in English for it to operate.

Reported-by: Jorge <yo@jorgesuarezdelis.name>
Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/205327
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: update blkid/md-raid1-* tests
Karel Zak [Thu, 6 May 2010 13:30:18 +0000 (15:30 +0200)]
tests: update blkid/md-raid1-* tests

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix readline usage
Karel Zak [Thu, 6 May 2010 13:29:20 +0000 (15:29 +0200)]
libblkid: fix readline usage

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: add blkid test for TuxOnIce
Karel Zak [Thu, 6 May 2010 11:11:40 +0000 (13:11 +0200)]
tests: add blkid test for TuxOnIce

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: set correct offsets for TuxOnIce signature
Chow Loong Jin [Fri, 30 Apr 2010 23:55:41 +0000 (07:55 +0800)]
libblkid: set correct offsets for TuxOnIce signature

TuxOnIce stores its signature at the beginning of the swap, rather than
at the end of the first page like swsusp does.

[kzak@redhat.com: - use macro for TOI magic string,
                  - check for TOI in swap probing function to avoid
                    collision between swap and TOI]

Signed-off-by: Chow Loong Jin <hyperair@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agounshare: drop potential euid privileges before exec
Karel Zak [Thu, 6 May 2010 07:59:16 +0000 (09:59 +0200)]
unshare: drop potential euid privileges before exec

This patch drops potential euid privileges before executing the target
program. This allows to setuid unshare.

The unshare(1) is still distributed as non-setuid program.

Based on patch from Martin Pohlack <mp26@os.inf.tu-dresden.de>.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoionice: non-cryptic error message when ionice can't execvp
Ævar Arnfjörð Bjarmason [Mon, 3 May 2010 18:24:26 +0000 (18:24 +0000)]
ionice: non-cryptic error message when ionice can't execvp

Previously ionice would reply like this when it couldn't find the
command to execute:

    $ ionice -c 3 does-not-exist
    ionice: execvp failed: No such file or directory

Getting that message from cron because you haven't set the right $PATH
makes it hard to track down the problem. Now it says:

    $ ionice -c 3 does-not-exist
    ionice: executing does-not-exist failed: No such file or directory

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
14 years agotests: add blkid tests for RAID1
Karel Zak [Mon, 3 May 2010 09:20:52 +0000 (11:20 +0200)]
tests: add blkid tests for RAID1

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoscript: optionally compile with libutempter to update utmp
Karel Zak [Thu, 29 Apr 2010 10:25:06 +0000 (12:25 +0200)]
script: optionally compile with libutempter to update utmp

Use --with-utempter to enable utempter support. The libutempter calls
/usr/libexec/utempter/utempter suid helper to update utmp and wtmp
files.

Old version:
$ script
Script started, file is typescript

$ who i am

$ exit
Script done, file is typescript

New version:
$ script
Script started, file is typescript

$ who i am
kzak     pts/6        2010-04-29 12:30

$ exit
Script done, file is typescript

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=477753
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: improve 'move begin of partition' command
Karel Zak [Wed, 28 Apr 2010 12:40:46 +0000 (14:40 +0200)]
fdisk: improve 'move begin of partition' command

The 'b' command ("move beginning of data in a partition")
implementation is too restricted. For example:

     Device Boot      Start         End      Blocks   Id  System
  /dev/sdb1            2048       22527       10240   83  Linux
  ....
  Partition number (1-4): 1
  New beginning of data (2048-22527, default 2048):
                         ^^^^^^^^^^

the range is defined by the current partition size. New version:

  Partition number (1-4): 1
  New beginning of data (1-22527, default 2048):
                         ^^^^^^^

allows to move the begin to arbitrary place if the place is not
allocated by any other partition. This is useful for people who don't
want to use the default partitioning (1MiB offset, 1MiB grain).

The 'b' command is expert command and does not force users to use an
aligned LBA (fdisk(8) still prints warning (in 'p' command) if any
partition is not aligned to the physical sector boundary).

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: improve add partition dialog
Karel Zak [Wed, 28 Apr 2010 08:10:39 +0000 (10:10 +0200)]
fdisk: improve add partition dialog

old version:
Partition number (1-4):

new version:
Partition number (1-4, default 1):

where the default value is the first non-used primary partition.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix LUKS version
Karel Zak [Wed, 28 Apr 2010 07:10:27 +0000 (09:10 +0200)]
libblkid: fix LUKS version

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: explicitly use --chunk and --metadata in MD test
Karel Zak [Tue, 27 Apr 2010 15:12:50 +0000 (17:12 +0200)]
tests: explicitly use --chunk and --metadata in MD test

The newer mdadm version uses a different chunk size and superblock
format, so the final MD device has a different I/O limits (optimal I/O
size is 1MiB for 1.20 metadata).

We have to explicitly use the same format which is expected in our tests.

Reported-by: Yulia Kopkova <ykopkova@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: revert ugly ENOMEDIUM support
Karel Zak [Tue, 27 Apr 2010 13:15:11 +0000 (15:15 +0200)]
mount: revert ugly ENOMEDIUM support

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoscript: preserve child exit status
Karel Zak [Tue, 27 Apr 2010 10:11:31 +0000 (12:11 +0200)]
script: preserve child exit status

The patch also removes unnecessary detection of child process
existence (by kill()). This code was replaces with SIGCHLD
hold/release around fork().

Based on the patch from therealneworld@gmail.com.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agologger: add note about 'kern' to the man page
Karel Zak [Tue, 27 Apr 2010 06:31:03 +0000 (08:31 +0200)]
logger: add note about 'kern' to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agortcwake: add disable action to rtcwake man page
Marek Otahal [Fri, 23 Apr 2010 12:20:54 +0000 (14:20 +0200)]
rtcwake: add disable action to rtcwake man page

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agortcwake : add disable action for rtc alarm
Marek Otahal [Fri, 23 Apr 2010 12:16:59 +0000 (14:16 +0200)]
rtcwake : add disable action for rtc alarm

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: reset superblocks result after error
Karel Zak [Fri, 23 Apr 2010 12:03:44 +0000 (14:03 +0200)]
libblkid: reset superblocks result after error

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: cleanup some docs
Karel Zak [Fri, 23 Apr 2010 11:56:58 +0000 (13:56 +0200)]
libblkid: cleanup some docs

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add blkid_partlist_get_table()
Karel Zak [Fri, 23 Apr 2010 11:35:20 +0000 (13:35 +0200)]
libblkid: add blkid_partlist_get_table()

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: don't gather PART_ENTRY_* values for binary interface
Karel Zak [Fri, 23 Apr 2010 09:20:08 +0000 (11:20 +0200)]
libblkid: don't gather PART_ENTRY_* values for binary interface

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agowipefs: print warning is PT detected
Karel Zak [Thu, 22 Apr 2010 19:53:11 +0000 (21:53 +0200)]
wipefs: print warning is PT detected

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: improve RAIDs and tiny devices probing
Karel Zak [Thu, 22 Apr 2010 19:52:31 +0000 (21:52 +0200)]
blkid: improve RAIDs and tiny devices probing

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix collision between RAID and PT probing
Karel Zak [Thu, 22 Apr 2010 19:30:04 +0000 (21:30 +0200)]
libblkid: fix collision between RAID and PT probing

The RAID signature is usually at end of the block device. We have to
differentiate between:

- RAID signature at the end of disk, and
- RAID signature at the end of the last partition

The position of the signature is same in both cases... It means we have
to the parse partition table and check if the area where is RAID signature
is covered by any partition. If yes, then the RAID signature belongs to the
partition and has to be ignored during whole-disk probing.

The second problem are RAID1 underlaying disks (=raid members).  The
RAID device could be partitioned, in such a case the partition table
is visible from underlaying devices. These partition tables has to be
ignored. The libblkid ignores partition tables on raid members now.

Note that all these changes are implemented for blkid_do_safeprobe()
only. The others functions allow to access all detected superblocks or
partition tables.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=543749
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoliblkid: export magic strings from raids
Karel Zak [Wed, 21 Apr 2010 12:24:52 +0000 (14:24 +0200)]
liblkid: export magic strings from raids

The library provides detected magic strings by SBMAGIC= and offsets of
the magic strings by SBMAGIC_OFFSET= variables. This patch allows to
support this feature for RAIDs and filesystems where the magic string
is not on fixed position.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add partial support for superblock binary API
Karel Zak [Mon, 19 Apr 2010 21:03:30 +0000 (23:03 +0200)]
libblkid: add partial support for superblock binary API

The API is used only internally.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: cleanup fstat() usage
Karel Zak [Mon, 19 Apr 2010 09:01:59 +0000 (11:01 +0200)]
libblkid: cleanup fstat() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: export functions to get whole-disk devno
Karel Zak [Mon, 19 Apr 2010 08:51:37 +0000 (10:51 +0200)]
libblkid: export functions to get whole-disk devno

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: add \n to the "-o udev" output when probe more devices
Karel Zak [Thu, 15 Apr 2010 11:15:35 +0000 (13:15 +0200)]
blkid: add \n to the "-o udev" output when probe more devices

Old output:
# blkid -p -o udev /dev/sda{1,3}
ID_FS_LABEL=/boot
ID_FS_LABEL_ENC=\x2fboot
ID_FS_UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_UUID_ENC=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_VERSION=1.0
ID_FS_TYPE=ext3
ID_FS_USAGE=filesystem
ID_FS_LABEL=BAR
ID_FS_LABEL_ENC=BAR
ID_FS_UUID=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_UUID_ENC=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_VERSION=2
ID_FS_TYPE=swap
ID_FS_USAGE=other

new output:
# blkid -p -o udev /dev/sda{1,3}
ID_FS_LABEL=/boot
ID_FS_LABEL_ENC=\x2fboot
ID_FS_UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_UUID_ENC=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
ID_FS_VERSION=1.0
ID_FS_TYPE=ext3
ID_FS_USAGE=filesystem

ID_FS_LABEL=BAR
ID_FS_LABEL_ENC=BAR
ID_FS_UUID=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_UUID_ENC=1f2aa318-9c34-462e-8d29-260819ffd657
ID_FS_VERSION=2
ID_FS_TYPE=swap
ID_FS_USAGE=other

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix some typos
Milan Broz [Thu, 8 Apr 2010 19:15:25 +0000 (21:15 +0200)]
libblkid: fix some typos

Signed-off-by: Milan Broz <mbroz@redhat.com>
14 years agomount: use auto-loopdev for all known filesystems
Karel Zak [Thu, 8 Apr 2010 14:38:23 +0000 (16:38 +0200)]
mount: use auto-loopdev for all known filesystems

The commit e580266914734898999f652025f9c7141023df66 introduced
"automatically detect and loop-mount regular files". This should be
used only for filesystems that require block devices.

All known filesystems in libblkid depend block devices, so we can
use blkid_known_fstype() as a filter for this feature.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agortcwake: add --dry-run option
Karel Zak [Thu, 8 Apr 2010 07:20:21 +0000 (09:20 +0200)]
rtcwake: add --dry-run option

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agortcwake: does miss the "off" option
Karel Zak [Thu, 8 Apr 2010 06:51:00 +0000 (08:51 +0200)]
rtcwake: does miss the "off" option

Reported-by: Piergiorgio Sartor <piergiorgio.sartor@nexgo.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=580296
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoswaplabel: fix typo in man page
Karel Zak [Wed, 7 Apr 2010 14:37:59 +0000 (16:37 +0200)]
swaplabel: fix typo in man page

Reported-by: Marcos Felipe Rasia de Mello <marcosfrm@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add ultrix PT support
Karel Zak [Wed, 7 Apr 2010 09:31:37 +0000 (11:31 +0200)]
libblkid: add ultrix PT support

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix 'partno' usage
Karel Zak [Wed, 7 Apr 2010 07:39:05 +0000 (09:39 +0200)]
libblkid: fix 'partno' usage

Linux kernel ignores empty partitions, but partition number is always
allocated for the partition. (This rule is used for primary partitions
only.)

For example:

  part 1.  size=12345
  part 2.  size=0
  part 3.  size=24567

the final list of partitions:

  sda1 sda3

'sda2' is not defined and partno=2 is not used for any other
partitions.

The libblkid library has to be compatible with this rule.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: fix blkid_partlist_devno_to_partition() for extended partitions
Karel Zak [Tue, 6 Apr 2010 15:57:49 +0000 (17:57 +0200)]
libblkid: fix blkid_partlist_devno_to_partition() for extended partitions

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoswaplabel: new command
Jason Borden [Fri, 2 Apr 2010 13:52:45 +0000 (15:52 +0200)]
swaplabel: new command

Print or change the label / UUID of a swap area.

[kzak@redhat.com: - code refactoring
                  - add long options
                  - clean up Makefile.am]

Signed-off-by: Jason Borden <jborden@bluehost.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomkswap: zap bootbits on regular files
Karel Zak [Fri, 2 Apr 2010 10:49:07 +0000 (12:49 +0200)]
mkswap: zap bootbits on regular files

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoswapon: move DELETED_SUFFIX to include/pathnames.h
Karel Zak [Fri, 2 Apr 2010 09:43:36 +0000 (11:43 +0200)]
swapon: move DELETED_SUFFIX to include/pathnames.h

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomkswap: move write_all() to include/writeall.h
Karel Zak [Thu, 1 Apr 2010 14:17:17 +0000 (16:17 +0200)]
mkswap: move write_all() to include/writeall.h

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: avoid probing CDs for RAID
M.S.Colclough [Wed, 31 Mar 2010 16:11:00 +0000 (18:11 +0200)]
libblkid: avoid probing CDs for RAID

RAID probing of CD/DVD can yield errors because of well-known problem
in reading the end of the disk with some disk/drive combinations.
Borrow CD detection method from udev and skip the RAID tests for
these devices.

[kzak@redhat.com: - check for linux/cdrom.h in ./configure
                  - add #ifdef around the ioctl call
                  - call the ioctl for block devices only]

Signed-off-by: Mark Colclough <m.s.colclough@bham.ac.uk>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblockdev: reduce usage text width
Francesco Cosoleto [Fri, 26 Mar 2010 00:13:29 +0000 (01:13 +0100)]
blockdev: reduce usage text width

Use spaces in usage text instead of tabs and reduce the distance between
option names and descriptions.

This helps to minimize problems due to limited number of columns and
translated texts which take up more space than English.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
14 years agofdisk: replace bzero with memset
Jon Ringle [Fri, 26 Mar 2010 02:42:52 +0000 (22:42 -0400)]
fdisk: replace bzero with memset

Work on this was done in commit c0f19ccff73aa0ec5e9f3b61b932ea4a8bf4e6ed,
however a couple of bzero call sites were missed

Signed-off-by: Jon Ringle <jon@ringle.org>
14 years agodocs: update tests/README
Karel Zak [Wed, 31 Mar 2010 15:18:23 +0000 (17:18 +0200)]
docs: update tests/README

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: added tests against strtosize
Yann Droneaud [Wed, 31 Mar 2010 14:51:52 +0000 (16:51 +0200)]
tests: added tests against strtosize

- test empty string, white spaces
- test hexadecimal

Signed-off-by: Yann Droneaud <yann@droneaud.fr>
14 years agobuild-sys: improved check for fallocate()
Yann Droneaud [Wed, 31 Mar 2010 14:14:04 +0000 (16:14 +0200)]
build-sys: improved check for fallocate()

With glibc 2.10 on a 32bits system, fallocate64() function is not
exported. This a problem, since _FILE_OFFSET_BITS is set to 64 and
fallocate() is redirected to fallocate64().
Sadly, AC_CHECK_FUNC() doesn't catch such problem, since it's overriding
the function prototype.

See this for references:
http://sources.redhat.com/ml/libc-hacker/2009-05/msg00003.html

Signed-off-by: Yann Droneaud <yann@droneaud.fr>
14 years agotests: use POSIX locale
Yann Droneaud [Wed, 31 Mar 2010 14:48:39 +0000 (16:48 +0200)]
tests: use POSIX locale

Since not everyone have en_US.UTF-8 locale, default to POSIX locale.
This changes default sort order, so some expected results were updated.

Signed-off-by: Yann Droneaud <yann@droneaud.fr>
14 years agopartx: fix infinite loop
Karel Zak [Wed, 31 Mar 2010 14:38:51 +0000 (16:38 +0200)]
partx: fix infinite loop

On Wed, Mar 24, 2010 at 04:39:35PM -0400, Phillip Susi wrote:
> I noticed that running partx -d /dev/sda hangs so I looked into it
> and it seems that it keeps trying to delete partitions forever.

Reported-By: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agopartx: do not add nonexistent partitions
Phillip Susi [Wed, 31 Mar 2010 13:52:08 +0000 (15:52 +0200)]
partx: do not add nonexistent partitions

This simple patch fixes partx -a to not add nonexistent zero length
partitions for unused primary partition slots to to the kernel. This
makes partx conform to the usual kernel behavior.

Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomkswap: fixed strtoll() usage
Yann Droneaud [Tue, 30 Mar 2010 15:17:56 +0000 (17:17 +0200)]
mkswap: fixed strtoll() usage

- catch empty string
- check against LLONG_MAX and LLONG_MIN instead of ULLONG_MAX and 0

Signed-off-by: Yann Droneaud <yann@droneaud.fr>
14 years agomount: support suffixes for offset= and sizelimit=
Karel Zak [Tue, 30 Mar 2010 14:15:44 +0000 (16:15 +0200)]
mount: support suffixes for offset= and sizelimit=

Note that the offset= and sizelimit= values in /etc/mtab are
always in the final format -- it means without suffix).

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: more robust offset= and sizelimit= parsing
Karel Zak [Tue, 30 Mar 2010 13:08:21 +0000 (15:08 +0200)]
mount: more robust offset= and sizelimit= parsing

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolosetup: support suffixes and hex numbers for --offset and --sizelimit
Karel Zak [Tue, 30 Mar 2010 12:40:33 +0000 (14:40 +0200)]
losetup: support suffixes and hex numbers for --offset and --sizelimit

Reported-By: Liu Aleaxander <aleaxander@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofallocate: support suffixes for --offset and --lenght
Karel Zak [Tue, 30 Mar 2010 12:28:13 +0000 (14:28 +0200)]
fallocate: support suffixes for --offset and --lenght

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomkswap: more robust strtoull() usage
Karel Zak [Tue, 30 Mar 2010 12:10:08 +0000 (14:10 +0200)]
mkswap: more robust strtoull() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agowipefs: support suffixes for --offset
Karel Zak [Tue, 30 Mar 2010 12:05:58 +0000 (14:05 +0200)]
wipefs: support suffixes for --offset

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: support suffixes for -O <offset> and -S <size>
Karel Zak [Tue, 30 Mar 2010 11:58:16 +0000 (13:58 +0200)]
blkid: support suffixes for -O <offset> and -S <size>

for example:  blkid -p -O 17816085KiB /dev/sda

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: add strtosize() function
Karel Zak [Tue, 30 Mar 2010 11:47:33 +0000 (13:47 +0200)]
lib: add strtosize() function

This function

  int strtosize(const char *str, uintmax_t *res)

supports {K,M,G,T,E,P}iB and {K,M,G,T,E,P}B suffixes.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agohwclock: add --predict for predicting RTC reading at a given time
Timo Juhani Lindfors [Sat, 13 Mar 2010 10:28:50 +0000 (12:28 +0200)]
hwclock: add --predict for predicting RTC reading at a given time

Implement new option --predict that predicts what the RTC will read
at a time given by the --date option. This is useful for example if
you need to setup an RTC wakeup time to distant future and want to
account for the RTC drift.

Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: cleanup man page
Karel Zak [Tue, 23 Mar 2010 13:24:02 +0000 (14:24 +0100)]
blkid: cleanup man page

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: update TODO file
Karel Zak [Tue, 23 Mar 2010 13:12:35 +0000 (14:12 +0100)]
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: add -n <list> option
Karel Zak [Tue, 23 Mar 2010 13:06:54 +0000 (14:06 +0100)]
blkid: add -n <list> option

This option allows to restrict low-level probing to the defined list
of superbocks (filesystems or RAIDs). For example:

blkid -p -n ext3,ext4,vfat /dev/sda1
or
blkid -p -n novfat /dev/sda1

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoblkid: cleanup -u <list> parsing
Karel Zak [Mon, 22 Mar 2010 14:16:01 +0000 (15:16 +0100)]
blkid: cleanup -u <list> parsing

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: fix -b <sectorsize>
Karel Zak [Fri, 19 Mar 2010 14:56:27 +0000 (15:56 +0100)]
fdisk: fix -b <sectorsize>

The old fdisk (<2.17) does not differentiate between logical and
physical sector size, it uses the <sectorsize> for everything.

Now, we have logical and physical sectors size, but the -b option
changes the logical size only. The second bug is that "fdisk -b <sz>"
does not read topology information (it means that all I/O limits and
physical sector size are 512 (default).

The backwardly compatible bug fix is to override both sizes, logical
and physical if "-b" is used.

In future we can add a special option for physical size only.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: update TODO file
Karel Zak [Fri, 19 Mar 2010 14:18:42 +0000 (15:18 +0100)]
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: add microsecond resolution for cache entries
Karel Zak [Wed, 17 Mar 2010 13:49:14 +0000 (14:49 +0100)]
libblkid: add microsecond resolution for cache entries

The libblkid library uses stat.st_mtine to detect changes on the
device. The last update time of of the device in the cache is stored
as TIME= tag in the /etc/blkid.tab file.

Linux since 2.5.48 supports nanosecond resolution and more precise
time is available in the stat.st_mtim timespec struct.

This patch add microsecond precision to TIME= tag in the cache file,
old format:

TIME="<sec>"

the new format:

TIME="<sec>.<usec>"

This change is backwardly compatible.

Now, the blkid_verify() function checks stat.st_mtime and
stat.st_mtim.tv_nsec/1000.

Test:

 # e2label /dev/sdb1 AAAA

old version:

 # blkid -s LABEL /dev/sdb1; e2label /dev/sdb1 BBBB; blkid -s LABEL /dev/sdb1
 /dev/sdb1: LABEL="AAAA"
 /dev/sdb1: LABEL="AAAA"

new version:

 # blkid -s LABEL /dev/sdb1; e2label /dev/sdb1 BBBB; blkid -s LABEL /dev/sdb1
 /dev/sdb1: LABEL="AAAA"
 /dev/sdb1: LABEL="BBBB"

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: fix blkdev_find_size()
Karel Zak [Tue, 16 Mar 2010 16:31:39 +0000 (17:31 +0100)]
lib: fix blkdev_find_size()

echo l | fdisk/fdisk /dev/zero

FYI that however now spins forever doing:

offset=3074457345618258603)
    at ../lib/blkdev.c:31
    at ../lib/blkdev.c:151
    at ../lib/blkdev.c:161

Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agofdisk: correctly truncate and align translated partition names
Pádraig Brady [Tue, 9 Mar 2010 08:21:35 +0000 (08:21 +0000)]
fdisk: correctly truncate and align translated partition names

* fdisk/Makefile.am: Depend on the mbsalign module.
* fdisk/fdisk.c: Align using mbsalign rather than printf.

[kzak@redhat.com: - use size_t for width to fix gcc warning]

Reported-by: Makoto Kato <m_kato@ga2.so-net.ne.jp>
Signed-off-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: add #ifndef around min() max() macros
Karel Zak [Tue, 16 Mar 2010 14:24:04 +0000 (15:24 +0100)]
lib: add #ifndef around min() max() macros

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agocal: factor out and update multibyte alignment code
Pádraig Brady [Mon, 8 Mar 2010 18:29:01 +0000 (18:29 +0000)]
cal: factor out and update multibyte alignment code

* include/mbsalign.h: New module interface
* lib/mbsalign.c: Updated implementation synced from coreutils
* include/Makefile.am: Add mbsalign.h
* misc-utils/Makefile.am: Make cal dependent on mbsalign module
* misc-utils/cal.c: Call mbsalign()

[kzak@redhat.com: - use min() macro from c.h]

Signed-off-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agodocs: update TODO file
Karel Zak [Tue, 16 Mar 2010 13:52:10 +0000 (14:52 +0100)]
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: avoid compilation failure on rawhide
Jim Meyering [Tue, 16 Mar 2010 12:46:58 +0000 (13:46 +0100)]
lib: avoid compilation failure on rawhide

* lib/blkdev.c: Include <sys/stat.h>, for use of S_ISREG.

14 years agomount: automatically detect and loop-mount regular files
Karel Zak [Mon, 15 Mar 2010 16:10:35 +0000 (17:10 +0100)]
mount: automatically detect and loop-mount regular files

This patch allows to automatically create a loop device from a regular
file if a filesystem type is not specified, for example:

   mount /path/disk.img /mnt

If the filesystem type is specified than "-o loop" is required.

Note that there is not a restriction (on kernel side) that prevents
regular file as a mount(2) source argument. A filesystem that is able
to mount regular files could be implemented.

Based on a patch from Adam Jackson <ajax@redhat.com>.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: more explicitly explain fstab usage in mount.8
Karel Zak [Mon, 15 Mar 2010 13:36:22 +0000 (14:36 +0100)]
mount: more explicitly explain fstab usage in mount.8

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: report ambivalent FS detection, improve brute force detection
Karel Zak [Mon, 15 Mar 2010 12:46:43 +0000 (13:46 +0100)]
mount: report ambivalent FS detection, improve brute force detection

The ambivalent probing result should be properly reported and user
should be informed that the problem is possible to bypass by "-t
<type>" or resolved by wipefs(8).

The mount(8) command uses a brute force stage (calls mount(2) for all
/{proc,etc}/fylesystems) if there is not any other way how to detect
the filesystem type. The brute force stage should not be restricted by
libblkid. It's possible that libblkid is not able to detect slightly
corrupted filesystem, but kernel is able to mount such filesystem.

Note that the brute force stage should not be used if libblkid returns
ambivalent probing result. In this case user's intervention is required
(e.g. mount -t <type>).

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agowipefs: cleanup usage() and man page
Karel Zak [Mon, 15 Mar 2010 12:45:03 +0000 (13:45 +0100)]
wipefs: cleanup usage() and man page

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agotests: fix whitespaces
Karel Zak [Sun, 14 Mar 2010 22:18:17 +0000 (23:18 +0100)]
tests: fix whitespaces

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoionice: fix typo
Pierre Hauweele [Sat, 13 Mar 2010 23:50:36 +0000 (00:50 +0100)]
ionice: fix typo

Signed-off-by: Pierre Hauweele <antegallya@gmail.com>
14 years agolibblkid: fix infinite loop when probe chain bails out early
Colin Watson [Sat, 13 Mar 2010 00:46:35 +0000 (00:46 +0000)]
libblkid: fix infinite loop when probe chain bails out early

The superblocks probe bails out early with no results in some cases.  If
this happens, blkid_do_probe needs to go to the next chain, rather than
entering an infinite loop calling superblocks_probe over and over again.

[kzak@redhat.com: - print debug message always when leaving
                    superblocks_probe()]

Addresses: https://bugs.launchpad.net/bugs/528073
Signed-off-by: Colin Watson <cjwatson@canonical.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: remove "0x" prefix from DRBD UUID
Karel Zak [Thu, 11 Mar 2010 14:52:54 +0000 (15:52 +0100)]
libblkid: remove "0x" prefix from DRBD UUID

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: improve ZFS detection and add LABEL and UUID extraction
Andreas Dilger [Thu, 11 Mar 2010 14:16:46 +0000 (15:16 +0100)]
libblkid: improve ZFS detection and add LABEL and UUID extraction

Improve ZFS uberblock detection to loop over multiple uberblocks,
and detect at least 4 magic values, to avoid random collisions.
It doesn't yet probe the VDEV LABEL at the end of the device, though
it wouldn't be too hard to add it at this point if needed.

Add extraction of the pool name (as LABEL), the VDEV (block device)
guid as UUID_SUB, and pool_guid (volume) as UUID from the nvlist in
the VDEV LABEL.  Do simple sanity checking on the nvlist data values
to avoid overflowing the buffer if they are corrupt in any way.

[kzak@redhat.com: - use %PRIu64 instead %llu]

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: prevent overflow in BeFS
Jeroen Oortwijn [Tue, 9 Mar 2010 22:15:30 +0000 (23:15 +0100)]
libblkid: prevent overflow in BeFS

Prevent overflow by casting values to blkid_loff_t before applying
block shift.

Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
14 years agoumount: add --fake option to umount(8)
Miklos Szeredi [Mon, 8 Mar 2010 18:01:13 +0000 (19:01 +0100)]
umount: add --fake option to umount(8)

Add --fake option to umount(8), which omits calling the actual umount
syscall (and the loop device deletion) but modifies /etc/mtab.  This
is similar to the -f or --fake option to mount(8).

This would allow some simplifications in fuse by allowing it to call
the umount syscall and letting umount(8) just update mtab.

[kzak@redhat.com: - initialize 'res' variable in umount_one() ]

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: properly ignore comments in /etc/filesystems
Mike Frysinger [Sun, 7 Mar 2010 05:16:41 +0000 (00:16 -0500)]
mount: properly ignore comments in /etc/filesystems

The POSIX spec for sscanf() says that whitespace may be matched against 0
bytes which means doing sscanf(" %s") against "#foo" will result in a
match. You can see this behavior by using the verbose options on a garbage
file:

...
mount: you didn't specify a filesystem type for /dev/null
       I will try all types mentioned in /etc/filesystems or /proc/filesystems
Trying #
mount: mount(2) syscall: source: "/dev/null", target: "/", filesystemtype: "#", mountflags: -1058209792, data: (null)
Trying #vfat
mount: mount(2) syscall: source: "/dev/null", target: "/", filesystemtype: "#vfat", mountflags: -1058209792, data: (null)
...

Reported-by: Dave Barton <dave.barton@comodo.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agotests: update fdisk tests
Karel Zak [Thu, 11 Mar 2010 00:06:45 +0000 (01:06 +0100)]
tests: update fdisk tests

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomkswap: don't call blkdev_find_size()
Karel Zak [Thu, 11 Mar 2010 00:04:50 +0000 (01:04 +0100)]
mkswap: don't call blkdev_find_size()

.. it's already called by blkdev_get_size().

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolibblkid: don't use fstat() in blkid_get_dev_size()
Karel Zak [Wed, 10 Mar 2010 23:59:47 +0000 (00:59 +0100)]
libblkid: don't use fstat() in blkid_get_dev_size()

We already use fstat() in blkdev_get_size().

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: use fstat() as fallback in blkdev_get_size()
Karel Zak [Wed, 10 Mar 2010 23:59:04 +0000 (00:59 +0100)]
lib: use fstat() as fallback in blkdev_get_size()

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agomount: use unmangle/mangle() from lib
Karel Zak [Wed, 10 Mar 2010 23:27:35 +0000 (00:27 +0100)]
mount: use unmangle/mangle() from lib

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoswapon: use unmangle() for filenames from /proc/swaps
Karel Zak [Wed, 10 Mar 2010 22:59:33 +0000 (23:59 +0100)]
swapon: use unmangle() for filenames from /proc/swaps

linux kernel encodes all garbage in filenames by mangle() function. We
need to unmagle() to get the real filenames.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agolib: add mangle.c for mtab (fstab or swaps) encoding
Karel Zak [Wed, 10 Mar 2010 22:54:11 +0000 (23:54 +0100)]
lib: add mangle.c for mtab (fstab or swaps) encoding

Signed-off-by: Karel Zak <kzak@redhat.com>
14 years agoswapon: remove " (deleted)" from filenames from /proc/swaps
Karel Zak [Wed, 10 Mar 2010 22:08:26 +0000 (23:08 +0100)]
swapon: remove " (deleted)" from filenames from /proc/swaps

The filenames in /proc/swaps are generated by seq_path() and this
function uses __d_path() from fs/dcache.c. The filename could
generated with " (deleted)" suffix. We need real filenames without
the suffix.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=562403
Signed-off-by: Karel Zak <kzak@redhat.com>