]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
6 years agohwclock: add --delay <seconds>
Karel Zak [Wed, 18 Jul 2018 11:59:15 +0000 (13:59 +0200)] 
hwclock: add --delay <seconds>

* add command line option --delay <seconds>

* read RTC type from /sys/class/rtc/rtc<N>/name

* default to 0.5 (500ms) for rtc_cmos or when RTC type is impossible
  determine; otherwise delay is 0.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: add -Wno-cast-function-type for python
Karel Zak [Wed, 18 Jul 2018 08:23:51 +0000 (10:23 +0200)] 
build-sys: add -Wno-cast-function-type for python

 libmount/python/pylibmount.c:158:19: warning: cast between incompatible function types
   from ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’}
     to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’}
   [-Wcast-function-type]

This is generic problem in all Python C code and gcc v8. The another
possible (and probably more correct) way is to add unused argument to
all API functions. Unfortunately, this solution is pretty invasive. The
question is if gcc is not too paranoid in this case.

For more details see https://bugs.python.org/issue33012. It seems
Python guys also prefer CFLAGS modification for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: fix compiler warning [-Wmaybe-uninitialized]
Karel Zak [Wed, 18 Jul 2018 08:00:18 +0000 (10:00 +0200)] 
libfdisk: fix compiler warning [-Wmaybe-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolslogins: remove redundant condition
Karel Zak [Wed, 18 Jul 2018 07:46:40 +0000 (09:46 +0200)] 
lslogins: remove redundant condition

[util-linux-2.32.1/login-utils/lslogins.c:601]: (style) Redundant condition: If '!EXPR', the comparison 'EXPR != '$'' is always true.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/strutils: remove redundant condition
Karel Zak [Wed, 18 Jul 2018 07:46:40 +0000 (09:46 +0200)] 
lib/strutils: remove redundant condition

[util-linux-2.32.1/lib/strutils.c:122]: (style) Redundant condition: If 'EXPR == '0'', the comparison 'EXPR' is always true.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agomkfs.cramfs: remove redundant condition
Karel Zak [Wed, 18 Jul 2018 07:46:40 +0000 (09:46 +0200)] 
mkfs.cramfs: remove redundant condition

util-linux-2.32.1/disk-utils/mkfs.cramfs.c:362]: (style) Redundant condition: If 'EXPR >= 16777216', the comparison 'EXPR' is always true.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/pager: fix compiler warning [-Wrestrict]
Karel Zak [Wed, 18 Jul 2018 07:41:46 +0000 (09:41 +0200)] 
lib/pager: fix compiler warning [-Wrestrict]

lib/pager.c: In function ‘pager_preexec’:
lib/pager.c:148:12: warning: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: add fdisk to TODO
Karel Zak [Tue, 17 Jul 2018 10:10:37 +0000 (12:10 +0200)] 
docs: add fdisk to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: add hwclock to TODO
Karel Zak [Tue, 17 Jul 2018 09:58:09 +0000 (11:58 +0200)] 
docs: add hwclock to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibblkid: Check for a secondary LUKS2 header.
Milan Broz [Wed, 11 Jul 2018 10:34:39 +0000 (12:34 +0200)] 
libblkid: Check for a secondary LUKS2 header.

This patch adds search for a secondary LUKS2 header,
if the primary one is corrupted.

This patch is primarily needed for wipefs that should wipe
both signatures (otherwise LUKS2 header recovery can use
secondary header and revert wipefs action).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
6 years ago* break up large strings for PySys_WriteStdout()
Frank Schaefer [Wed, 11 Jul 2018 01:21:02 +0000 (20:21 -0500)] 
* break up large strings for PySys_WriteStdout()

6 years agotests: add mountinfo with empty source
Karel Zak [Tue, 10 Jul 2018 12:04:09 +0000 (14:04 +0200)] 
tests: add mountinfo with empty source

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: (mountinfo) parse empty strings in source
Alban Crequy [Fri, 22 Jun 2018 11:54:25 +0000 (13:54 +0200)] 
libmount: (mountinfo) parse empty strings in source

The source of a mount in /proc/self/mountinfo can unfortunately be an
empty string. Before this patch, 'mount' and 'mountpoint' fail as
following:

  $ sudo mount -t tmpfs "" /tmp/bb
  $ mount
  mount: /proc/self/mountinfo: parse error at line 64 -- ignored
  $ mountpoint /tmp/bb
  /tmp/bb is not a mountpoint

This patch fixes the parsing. It is unfortunately more complex because
sscanf() does not handle fields with empty strings easily.

Other projects have their own parser for mountinfo and have similar
issues. I know of runc and runtime-tools (I'll send a patch for those
two) but there are probably others.

Signed-off-by: Alban Crequy <alban@kinvolk.io>
6 years agolsblk: add PATH column
Karel Zak [Tue, 10 Jul 2018 08:33:18 +0000 (10:33 +0200)] 
lsblk: add PATH column

$ lsblk -o+PATH
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT    PATH
sda           8:0    0 223.6G  0 disk               /dev/sda
├─sda1        8:1    0   200M  0 part /boot/efi     /dev/sda1
├─sda2        8:2    0   200M  0 part /boot         /dev/sda2
├─sda3        8:3    0 130.3G  0 part               /dev/sda3
├─sda4        8:4    0    50G  0 part /             /dev/sda4
├─sda5        8:5    0  35.1G  0 part               /dev/sda5
└─sda6        8:6    0   7.8G  0 part               /dev/sda6

Requested-by: Marcel Partap <mpartap@gmx.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'master' of https://github.com/hjmallon/util-linux
Karel Zak [Tue, 10 Jul 2018 07:38:07 +0000 (09:38 +0200)] 
Merge branch 'master' of https://github.com/hjmallon/util-linux

* 'master' of https://github.com/hjmallon/util-linux:
  libblkid: Add more APFS checking to avoid false positives

6 years agologger: Define SD_JOURNAL_SUPPRESS_LOCATION.
YmrDtnJu [Sat, 7 Jul 2018 18:11:46 +0000 (20:11 +0200)] 
logger: Define SD_JOURNAL_SUPPRESS_LOCATION.

The normal journald functions add the location in the C source code files to
the log messages. This is nice for a big C based project, but logger is used in
scripts so it would be more useful to let users specify the location in the
script by adding the CODE_FUNC, CODE_FILE and CODE_FILE fields to the log
message.

It is already possible to do this, but it will result in two versions of these
fields: one for the location in logger.c and one for the location in the
script.

6 years agolibblkid: Add more APFS checking to avoid false positives
Harry Mallon [Fri, 6 Jul 2018 17:39:26 +0000 (18:39 +0100)] 
libblkid: Add more APFS checking to avoid false positives

6 years agolibfdisk: reduce number of asprintf() calls, check return value
Karel Zak [Wed, 4 Jul 2018 13:16:35 +0000 (15:16 +0200)] 
libfdisk: reduce number of asprintf() calls, check return value

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: Fix multipath partition seperators for user-friendly names
KyleMahlkuch [Mon, 25 Jun 2018 19:52:01 +0000 (14:52 -0500)] 
libfdisk: Fix multipath partition seperators for user-friendly names

The current code assumes "-part" is the only partition sepereator
but this is not true for some distros.

For example in Ubuntu 18.04 fdisk does not print the correct names for
mpatha:

~# ls -l /dev/mapper/mpatha*
lrwxrwxrwx 1 root root 7 Feb  1 04:39 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx 1 root root 7 Feb  1 04:38 /dev/mapper/mpatha1 -> ../dm-4
lrwxrwxrwx 1 root root 7 Feb  1 04:38 /dev/mapper/mpatha2 -> ../dm-5
lrwxrwxrwx 1 root root 7 Feb  1 04:38 /dev/mapper/mpatha3 -> ../dm-6

~# fdisk -l /dev/mapper/mpatha
Device                   Boot     Start        End   Sectors  Size Id Type
/dev/mapper/mpatha-part1           2048  419432447 419430400  200G 83 Linux
/dev/mapper/mpatha-part2      419432448  838862847 419430400  200G 83 Linux
/dev/mapper/mpatha-part3      838862848 1258291199 419428352  200G 83 Linux

Instead of assuming a partition seperator of "-part" this patch uses
access to check the file system for a partition seperator of "p" or
the absense of a partition seperator. If neither of these work the patch
defaults to "-part" like we had before this patch.

6 years agolibfdisk: use \x<hex> to read/write partition name
Karel Zak [Wed, 4 Jul 2018 12:06:38 +0000 (14:06 +0200)] 
libfdisk: use \x<hex> to read/write partition name

Addresses: https://github.com/karelzak/util-linux/issues/656
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofallocate: remove unwanted debug message
Karel Zak [Wed, 4 Jul 2018 11:34:56 +0000 (13:34 +0200)] 
fallocate: remove unwanted debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'master' of https://github.com/hjmallon/util-linux
Karel Zak [Wed, 4 Jul 2018 11:25:07 +0000 (13:25 +0200)] 
Merge branch 'master' of https://github.com/hjmallon/util-linux

* 'master' of https://github.com/hjmallon/util-linux:
  libblkid: Add very basic APFS recognition

6 years agoMerge branch 'quick-fix-20180625' of https://github.com/sjitech/util-linux
Karel Zak [Wed, 4 Jul 2018 09:00:58 +0000 (11:00 +0200)] 
Merge branch 'quick-fix-20180625' of https://github.com/sjitech/util-linux

* 'quick-fix-20180625' of https://github.com/sjitech/util-linux:
  exec_shell: prevent ".: applet not found" error when SHELL env is not set.

6 years agoMerge branch 'fixes' of https://github.com/rudimeier/util-linux
Karel Zak [Tue, 3 Jul 2018 11:55:32 +0000 (13:55 +0200)] 
Merge branch 'fixes' of https://github.com/rudimeier/util-linux

* 'fixes' of https://github.com/rudimeier/util-linux:
  wipefs: add missing ifdef
  lib/path: remove unused expression
  ipcs,chmem: fix access() usage

6 years agofallocate: add man page note about --collapse-range granularity
Karel Zak [Tue, 3 Jul 2018 11:51:51 +0000 (13:51 +0200)] 
fallocate: add man page note about --collapse-range granularity

Reported-by: Radka Skvarilova <rskvaril@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibblkid: Add very basic APFS recognition
Harry Mallon [Mon, 25 Jun 2018 15:19:18 +0000 (16:19 +0100)] 
libblkid: Add very basic APFS recognition

6 years agowipefs: add missing ifdef
Ruediger Meier [Mon, 25 Jun 2018 13:08:55 +0000 (15:08 +0200)] 
wipefs: add missing ifdef

Seen on OSX:
misc-utils/wipefs.c:822:5: warning: implicit declaration of function 'rereadpt' is invalid in C99 [-Wimplicit-function-declaration]
                                rereadpt(fd, devname);

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agolib/path: remove unused expression
Ruediger Meier [Mon, 25 Jun 2018 12:23:42 +0000 (14:23 +0200)] 
lib/path: remove unused expression

 error: expression result unused [-Werror,-Wunused-value]
                        prefix = optarg, "failed to parse range start";
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agoipcs,chmem: fix access() usage
Ruediger Meier [Mon, 25 Jun 2018 12:01:21 +0000 (14:01 +0200)] 
ipcs,chmem: fix access() usage

Some mistakes happened lately when switching from path_exist()
to ul_path_access(). See f09a98de and 8ca31279.

This caused ipcs test failures when running i386 binaries on x86_64
hosts, because the syscall fallback was always used. That's why I
reviewed all similar changes and found another one in chmem.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agoexec_shell: prevent ".: applet not found" error when SHELL env is not set.
osexp2000 [Mon, 25 Jun 2018 01:34:31 +0000 (10:34 +0900)] 
exec_shell: prevent ".: applet not found" error when SHELL env is not set.

When SHELL env is not set, it cause xstrdup(NULL) be executed, and result in weird error message ".: applet not found" instead of /bin/sh being used.

6 years agodocs: update TODO
Karel Zak [Fri, 22 Jun 2018 10:47:25 +0000 (12:47 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoinclude/path: make sure PATH_MAX is defined
Karel Zak [Thu, 21 Jun 2018 12:24:01 +0000 (14:24 +0200)] 
include/path: make sure PATH_MAX is defined

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'more' of https://github.com/kerolasa/util-linux
Karel Zak [Thu, 21 Jun 2018 12:01:54 +0000 (14:01 +0200)] 
Merge branch 'more' of https://github.com/kerolasa/util-linux

* 'more' of https://github.com/kerolasa/util-linux:
  more: remove function like preprocessor defines
  more: remove global variables, add struct more_control
  more: move couple functions

6 years agochoom: use new ul_path_* API
Karel Zak [Thu, 21 Jun 2018 11:46:20 +0000 (13:46 +0200)] 
choom: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: allow dir-path formatting
Karel Zak [Thu, 21 Jun 2018 11:49:03 +0000 (13:49 +0200)] 
lib/path: allow dir-path formatting

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: add simple LVM lsblk dump
Karel Zak [Wed, 20 Jun 2018 14:43:19 +0000 (16:43 +0200)] 
tests: add simple LVM lsblk dump

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: fix ul_path_read_string() usage
Karel Zak [Wed, 20 Jun 2018 14:41:51 +0000 (16:41 +0200)] 
lsblk: fix ul_path_read_string() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: add simple ATA and NVME lsblk dump
Karel Zak [Wed, 20 Jun 2018 14:32:56 +0000 (16:32 +0200)] 
tests: add simple ATA and NVME lsblk dump

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: add lsblk test script
Karel Zak [Wed, 20 Jun 2018 10:59:40 +0000 (12:59 +0200)] 
tests: add lsblk test script

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: fix COL_SCHED
Karel Zak [Wed, 20 Jun 2018 10:58:19 +0000 (12:58 +0200)] 
lsblk: fix COL_SCHED

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: add simple & stupid script to generate lsblk /sys and /proc dump
Karel Zak [Tue, 19 Jun 2018 15:00:14 +0000 (17:00 +0200)] 
tests: add simple & stupid script to generate lsblk /sys and /proc dump

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: document --sysroot
Karel Zak [Tue, 19 Jun 2018 14:30:29 +0000 (16:30 +0200)] 
lsblk: document --sysroot

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: fix sysfs_devno_to_devname() usage
Karel Zak [Tue, 19 Jun 2018 14:10:17 +0000 (16:10 +0200)] 
lsblk: fix sysfs_devno_to_devname() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: follow --sysroot when read mountpoints
Karel Zak [Tue, 19 Jun 2018 10:22:59 +0000 (12:22 +0200)] 
lsblk: follow --sysroot when read mountpoints

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: use prefix for DM name
Karel Zak [Tue, 19 Jun 2018 10:02:52 +0000 (12:02 +0200)] 
lsblk: use prefix for DM name

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: add --sysroot
Karel Zak [Mon, 18 Jun 2018 11:01:27 +0000 (13:01 +0200)] 
lsblk: add --sysroot

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: add note about lsblk to TODO
Karel Zak [Fri, 15 Jun 2018 10:07:10 +0000 (12:07 +0200)] 
docs: add note about lsblk to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: use new ul_path_* API
Karel Zak [Fri, 15 Jun 2018 09:59:29 +0000 (11:59 +0200)] 
lsblk: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: cleanup function names
Karel Zak [Fri, 15 Jun 2018 09:57:48 +0000 (11:57 +0200)] 
lib/sysfs: cleanup function names

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoblockdev: use new ul_path_* API
Karel Zak [Wed, 30 May 2018 09:24:40 +0000 (11:24 +0200)] 
blockdev: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopartx: use new ul_path_* API
Karel Zak [Wed, 30 May 2018 08:47:09 +0000 (10:47 +0200)] 
partx: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoresizepart: use new ul_path_* API
Karel Zak [Wed, 30 May 2018 08:41:46 +0000 (10:41 +0200)] 
resizepart: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoblkzone: use new ul_path_* API
Karel Zak [Tue, 29 May 2018 10:59:03 +0000 (12:59 +0200)] 
blkzone: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: use new ul_path_* API
Karel Zak [Tue, 29 May 2018 10:53:52 +0000 (12:53 +0200)] 
fstrim: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: improve debug message on redirect
Karel Zak [Tue, 29 May 2018 10:41:48 +0000 (12:41 +0200)] 
lib/path: improve debug message on redirect

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: add --dry-run
Karel Zak [Tue, 29 May 2018 10:39:32 +0000 (12:39 +0200)] 
fstrim: add --dry-run

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: use new ul_path_* API, improve sysfs context usage
Karel Zak [Tue, 29 May 2018 10:10:31 +0000 (12:10 +0200)] 
fstrim: use new ul_path_* API, improve sysfs context usage

* improve has_discard() function to initialize sysfs context only once
* use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: fix sysfs_blkdev_get_wholedisk()
Karel Zak [Tue, 29 May 2018 10:09:56 +0000 (12:09 +0200)] 
lib/sysfs: fix sysfs_blkdev_get_wholedisk()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: simplify debug message
Karel Zak [Fri, 25 May 2018 11:20:22 +0000 (13:20 +0200)] 
lib/path: simplify debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: use new ul_path_* API
Karel Zak [Fri, 25 May 2018 10:51:55 +0000 (12:51 +0200)] 
lscpu: use new ul_path_* API

* use ul_path_* API for /sys/devices/system/cpu paths
* use ul_path_* API for /proc
* rename is_compatible() to is_devtree_compatible() as it works
  with the devices tree only

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: add ul_prefix_fopen(), improve cpuset funcs
Karel Zak [Fri, 25 May 2018 10:47:06 +0000 (12:47 +0200)] 
lib/path: add ul_prefix_fopen(), improve cpuset funcs

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: don't use extra '/'
Karel Zak [Thu, 24 May 2018 12:06:11 +0000 (14:06 +0200)] 
lib/path: don't use extra '/'

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoipcs: use new ul_path_* API
Karel Zak [Thu, 24 May 2018 11:50:52 +0000 (13:50 +0200)] 
ipcs: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: add more debug messages
Karel Zak [Fri, 18 May 2018 10:33:03 +0000 (12:33 +0200)] 
lib/path: add more debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agochcpu: use new ul_path_* API
Karel Zak [Fri, 18 May 2018 10:32:52 +0000 (12:32 +0200)] 
chcpu: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoctrlaltdel: use new ul_path_* API
Karel Zak [Thu, 17 May 2018 14:26:07 +0000 (16:26 +0200)] 
ctrlaltdel: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: make ul_path_read_ usable with NULL handler
Karel Zak [Thu, 17 May 2018 14:25:47 +0000 (16:25 +0200)] 
lib/path: make ul_path_read_ usable with NULL handler

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agorfkill: don't use lib/path
Karel Zak [Thu, 17 May 2018 14:05:39 +0000 (16:05 +0200)] 
rfkill: don't use lib/path

It seems like crazy overkill for this trivial purpose.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agochmem: use new ul_path_* API
Karel Zak [Thu, 17 May 2018 12:45:23 +0000 (14:45 +0200)] 
chmem: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsmem: use new ul_path_* API
Karel Zak [Thu, 17 May 2018 12:45:23 +0000 (14:45 +0200)] 
lsmem: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: add ul_path_read_buffer()
Karel Zak [Thu, 17 May 2018 13:42:37 +0000 (15:42 +0200)] 
lib/path: add ul_path_read_buffer()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: add ul_path_get_abspath()
Karel Zak [Thu, 17 May 2018 11:58:30 +0000 (13:58 +0200)] 
lib/path: add ul_path_get_abspath()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agozramctl: use new ul_path_* API
Karel Zak [Wed, 16 May 2018 12:08:11 +0000 (14:08 +0200)] 
zramctl: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: fix ul_path_read_string() usage
Karel Zak [Wed, 16 May 2018 12:06:02 +0000 (14:06 +0200)] 
lib/sysfs: fix ul_path_read_string() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: use new ul_path_* API
Karel Zak [Wed, 16 May 2018 11:22:38 +0000 (13:22 +0200)] 
libfdisk: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibblkid: use new ul_path_* API
Karel Zak [Wed, 16 May 2018 11:20:39 +0000 (13:20 +0200)] 
libblkid: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: add sysfs_blkdev_get_parent()
Karel Zak [Wed, 16 May 2018 11:20:01 +0000 (13:20 +0200)] 
lib/sysfs: add sysfs_blkdev_get_parent()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: make possible to call sysfs_blkdev_deinit_path() in loop
Karel Zak [Wed, 16 May 2018 10:52:47 +0000 (12:52 +0200)] 
lib/sysfs: make possible to call sysfs_blkdev_deinit_path() in loop

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: fix read string to be backwardly compatible
Karel Zak [Tue, 15 May 2018 12:11:38 +0000 (14:11 +0200)] 
lib/path: fix read string to be backwardly compatible

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path lib/sysfs: add debug
Karel Zak [Tue, 15 May 2018 11:43:29 +0000 (13:43 +0200)] 
lib/path lib/sysfs: add debug

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/loopdev: remove obsolete macro
Karel Zak [Tue, 15 May 2018 11:21:41 +0000 (13:21 +0200)] 
lib/loopdev: remove obsolete macro

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/loopdev: use new ul_path_* API
Karel Zak [Tue, 15 May 2018 11:08:47 +0000 (13:08 +0200)] 
lib/loopdev: use new ul_path_* API

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: add ul_new_sysfs_path() shortcut
Karel Zak [Tue, 15 May 2018 11:08:18 +0000 (13:08 +0200)] 
lib/sysfs: add ul_new_sysfs_path() shortcut

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/sysfs: new implementation
Karel Zak [Fri, 11 May 2018 12:28:03 +0000 (14:28 +0200)] 
lib/sysfs: new implementation

* reuse ul_path_* API

* allow to use prefix for sysfs paths, so we can use snapshots from
  sysfs for regression tests

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: new implementation
Karel Zak [Wed, 9 May 2018 13:54:12 +0000 (15:54 +0200)] 
lib/path: new implementation

The goal is to avoid duplicate code in path.c and sysfs.c and make it
possible to define prefix for paths for all sysfs and procfs based
utils. Now we have /proc snapshots (for tests) for lscpu only. It
would be nice to have the same (for sysfs) for lsblk and another tools.

* very simple API to read numbers, strings and symlinks

* based on openat()

     pc = ul_new_path("/sys/block/sda");
     ul_path_read_u64(pc, &size, "size");
     ul_path_read_u64(pc, &lsz, "queue/logical_block_size");

* printf-like API to generate paths, for example:

     ul_path_readf_u64(pc, &num, "sda%d/size", partno)

* allow to define prefix to redirect hardcoded paths to another
  location, for example:

     pc = ul_new_path("/sys/block/sda");
     ul_path_set_prefix(pc, "/my/regression/dump");
     ul_path_read_u64(pc, &num, "size");

  to read /my/regression/dump/sys/block/sda/size

* allow to extend the API by "dialects", for example for sysfs:

     pc = ul_new_path(NULL);
     sysfs_blkdev_init_path(pc, devno, NULL);

  and use ul_path_* functions to read from @pc initialized by
  sysfs_blkdev_init_path()

* add test_path binary

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: add partition table UUID and type fields.
Milan Broz [Tue, 19 Jun 2018 10:33:20 +0000 (12:33 +0200)] 
lsblk: add partition table UUID and type fields.

This patch adds PTUUID and PTTYPE fields to lsblk, that are corresponding
fields to ID_PART_TABLE_UUID and ID_PART_TABLE_TYPE in udev database.

[kzak@redhat.com: - small change in PTUUID description]

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agomore: remove function like preprocessor defines
Sami Kerola [Sat, 26 May 2018 08:37:47 +0000 (09:37 +0100)] 
more: remove function like preprocessor defines

Inlining code using preprocessor function like macros is bad for
readability, and prone to errors.  Besides this is a pager, who cares if
code is few milliseconds slower.

Requestee-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agomore: remove global variables, add struct more_control
Sami Kerola [Wed, 23 May 2018 21:58:34 +0000 (22:58 +0100)] 
more: remove global variables, add struct more_control

This is rather big change, but that is the only way to do this sort job.  To
keep this change relatively understandable only moves global variables to a
state structure.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agomore: move couple functions
Sami Kerola [Wed, 23 May 2018 20:54:42 +0000 (21:54 +0100)] 
more: move couple functions

Earlier commit moved lots of functions to work without declarations, but to
be able to get rid of global variables few more moves is needed.

Reference: a8f98304e6d2f4627ca31f6c661934c92b1095f7
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agopartx: exit with error code when partition read failed
Andreas Henriksson [Sun, 17 Jun 2018 12:49:15 +0000 (14:49 +0200)] 
partx: exit with error code when partition read failed

Make sure partx exits with a non-0 return code when
it runs into either code-path where getting the partition
table failed (or wasn't even attempted because of previous
error condition).

Change was tested using:
touch /tmp/foobar
partx -s - /tmp/foobar

Previously that was only printing an error/warning message
and then exiting with 0, but after this change it exits
with 1.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Reported-by: Juan Céspedes <cespedes@debian.org>
Addresses: https://bugs.debian.org/898426

6 years agosetarch: add another PER_LINUX32 aliases for ppcle
Karel Zak [Thu, 14 Jun 2018 11:02:49 +0000 (13:02 +0200)] 
setarch: add another PER_LINUX32 aliases for ppcle

The big-endian version maps generic "ppc" and "ppc32" aliases to
PER_LINUX32.  It seems that we can do the same for little-endian.

Note that SYS_personality does not care about LE/BE, it's 32 or 64 bit.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update TODO
Karel Zak [Mon, 11 Jun 2018 14:28:59 +0000 (16:28 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agomount: add -N to man page helpers section
Karel Zak [Mon, 11 Jun 2018 14:27:51 +0000 (16:27 +0200)] 
mount: add -N to man page helpers section

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoumount: fix behaviour of -A and -R with --namespace
Vaclav Dolezal [Tue, 24 Apr 2018 16:05:04 +0000 (18:05 +0200)] 
umount: fix behaviour of -A and -R with --namespace

Load /proc/self/mountinfo from correct namespace.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoumount: allow PID as --namespace argument
Vaclav Dolezal [Fri, 20 Apr 2018 15:57:39 +0000 (17:57 +0200)] 
umount: allow PID as --namespace argument

[kzak@redhat.com: - update code]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
6 years agomount: allow PID as --namespace argument
Vaclav Dolezal [Fri, 20 Apr 2018 15:57:39 +0000 (17:57 +0200)] 
mount: allow PID as --namespace argument

[[kzak@redhat.com: - update code]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
6 years agomount: document --namespace in man/help
Vaclav Dolezal [Tue, 17 Apr 2018 13:52:54 +0000 (15:52 +0200)] 
mount: document --namespace in man/help

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
6 years agolibmount: switch namespace when appropriate
Vaclav Dolezal [Wed, 11 Apr 2018 13:52:52 +0000 (15:52 +0200)] 
libmount: switch namespace when appropriate

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
6 years agolibmount: support for namespaces for helpers
Vaclav Dolezal [Tue, 6 Mar 2018 11:30:27 +0000 (12:30 +0100)] 
libmount: support for namespaces for helpers

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
6 years agolibmount: make errno usable after mnt_context_set_target_ns()
Karel Zak [Mon, 11 Jun 2018 14:06:17 +0000 (16:06 +0200)] 
libmount: make errno usable after mnt_context_set_target_ns()

Signed-off-by: Karel Zak <kzak@redhat.com>