include: add /proc/locks path to pathnames

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
lslocks: new command

The new lslocks(8) program is meant to replace the deprecated lslk(8). It is
designed for simplicity and removes unnecessary Unix legacy outputs and
options:

- Don't output inode number, whence and maj:min device numbers.
- Don't provide nonblocking syscall options stat(2) and readlink(2)
- Remove lslk's alternate default kernel name list file path (-k)

The option to use nonblocking calls was previously intended for NFS partitions;
however this should be transparent to utility programs considering that
timeouts can occur generically (fuse - sshfs, NFS, netdevs, etc).

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
lslocks: add lslocks.8 man page

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
lslocks: add --notruncate, minor fixes in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
mountpoint: fix a minor bug with 0:0 devno

zhi@debian-lizhi:~$ mountpoint /sys
/sys is not a mountpoint
zhi@debian-lizhi:~$

The problem is in mountpoint.c, function dir_to_device(), which uses 0 as an
error return value, but for sysfs 0 is its device number:

zhi@debian-lizhi:~$ cat /proc/self/mountinfo
14 19 0:0 / /sys rw,nosuid,nodev,noexec,relatime - sysfs none rw
15 19 0:3 / /proc rw,nosuid,nodev,noexec,relatime - proc none rw

My change is on dir_to_device, seperating device number from return value.

Signed-off-by: Zhi Li <lizhi1215@gmail.com>
tests: add tests for mount --make-* stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: properly reset chain in probe_do_wipe()

The command wipefs is not able to remove all signatures from the
device if the first detected signature is linux raid. The another
superblock signatures are ignored. For example:

  # pvcreate /dev/sdb1
  # mdadm --create md8 --metadata=0.90 --chunk=64 --level=0 \
        --raid-devices=2 /dev/sdb1 /dev/sdb2

  # wipefs -a /dev/sdb1

will delete the linux raid signature only.

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
wipefs: add quiet flag (-q)

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
wipefs: support more device arguments for wipefs

[kzak@redhat.com: - print devname only if more devices specified]

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
wipefs: always print devname

It seems too smart to print devname according to number of devices.

Signed-off-by: Karel Zak <kzak@redhat.com>
mountpoint: account for error from in mnt_fs_get_target

commit 04f087ec didn't take into consideration that mnt_fs_get_target()
could return an error, and would therefore show false positives, such
as:

$ mkdir foo; mountpoint foo
foo is a mountpoint

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
libmount: don't treat "none" differently

This causes more problems than it solves. In the latest edition:

  # mount -t proc none foo
  mount: foo: mount failed: Invalid argument

A check for source and target fails in mnt_context_apply_fstab()
because, even though they were indeed specified on the cmdline,
__mnt_fs_set_source_ptr() altered this and NULL'd out the source.

If you're able to mount this device via other means, other tools start
reporting oddities, such as mount's output:

  (null) on /foo type proc (rw,relatime)

or findmnt:

  TARGET      SOURCE FSTYPE OPTIONS
  /foo               proc   rw,relatime

Simply treat "none" like any other source when passed in.

[kzak@redhat.com: - don't translate NULL to "none" in mnt_fs_set_source()]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
tests: update libmount tests

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: cosmetic changes around "none"

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: add mnt_fs_streq_srcpath()

We have to be careful with "none" or another dummy sources for pseudo
filesystems. These strings should be canonicalized or compared as a
paths.

The function is not exported by library API.

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: wait a moment between mount and umount

It seems that without sleep between mount and umount are the test
unstable, because kernel is not able to provide updated
/proc/self/mountinfo so quickly (really?).

Signed-off-by: Karel Zak <kzak@redhat.com>
blkid: add DEVNAME= to export output format

Reported-by: Balamurugan Arumugam <barumuga@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: add mnt_fs_streq_target() and export all mnt_fs_streq_*

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: search for "none" by findmnt

Signed-off-by: Karel Zak <kzak@redhat.com>
login: fix LOGIN_CHOWN_VCS code

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