libblkid: fix swap-area version

 * v1: hdr->version = 1, magic string = SWAPSPACE2
 * v0: no versio in header, magic string = SWAP-SPACE

The mistake has been introduced in the old udev volume_id
binary where the version was set according to magic string.

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: allow to use -s (sloppy) for all external helpers

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: update utab after successful extern helper mount

This patch allows to maintain private utab libmount file also for
external mount/umount helpers that are not linked with libmount.

The libmount check if utab has been updated after successful extern
helper execution (status=0). If not then the file is updated.

This patch affects only 'user' fstab mount option. So, for example
with suid mount.cifs you can use:

 //server/foo    /mnt  cifs   username=foo,noauto,user

Signed-off-by: Karel Zak <kzak@redhat.com>
blkdiscard: BLKSSZGET fills in an int, not a uint64

Reported-by: Jason Cipriani <jason.cipriani@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
blockdev: don't use HDIO_GETGEO

blockdev was still using this depreciated ioctl and that was
causing blockdev --report to fail on loop and nbd devices.
Switch to reading the partition start from sysfs instead.
This also allows it to correctly report > 2^32 sector counts.

[kzak@redhat.com: - check sysfs_init() return,
                  - use uint64_t rather than unsigned long long]

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lscpu: support non sequentially numbering of CPUs

lscpu don't work correctly on my system with:

 $ cat /sys/devices/system/cpu/possible
 0-1,4-5,8-9,12-13

[kzak@redhat.com: - coding style,
                  - add commit message
                  - add real_cpu_num() macro,
                  - fix functions where we need idx as well as CPU number]

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: add sparc64 lscpu test

Signed-off-by: Karel Zak <kzak@redhat.com>
cal: use control structure for run time configuration

Runtime configuration is set at the time of command line option parsing,
and other initialization.  Later the configuration is read-only.  This
should make code a little bit more understandable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: rename ascii_wnum() to ascii_weeknum()

Week is not long word, so it does not need to be enshorted and made more
difficult to understand.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: add input variable names to function prototypes

While prototypes such as 'function(int, int, char, int);' are legal they
do not help when trying to understand how the function is expected to be
used.  Adding variable names gives at least a hint when looking the
prototypes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: make day_in_week() use same variable names as other functions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: simplify ascii_weeknum() function

Either the week is or isn't highlighted, there is no need to over
complicate printing of that.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: determine output width at beginning of run and reuse result

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: cal: take account week numbers when determing month lenght

The month header does not need to wrap if month width with week number
allows printing to single line.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: make user request to be part of read-only control struct

Signed-off-by: Sami Kerola <kerolasa@iki.fi>