Commit Graph

8 Commits

Author SHA1 Message Date
Benno Schulenberg b779c1aecb mount, umount, swapon, fsck, lsblk, findmnt: harmonize six error messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-16 10:39:38 +01:00
Ruediger Meier fea1cbf748 misc: never cast void* from malloc(3) and friends
Such cast could hide serious compiler warnings in case we are
missing includes (e.g. <stdlib.h> or "xalloc.h").

See
http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:29:27 +01:00
Karel Zak 1cd9d0d746 mount, umount, swapon, fsck, lsblk, findmnt: ignore malformed lines
The libmount provides way how to deal with parsing errors in fstab --
on error callback function is executed and according to the return
libmount manipulate with the malformed line, possible are three
states:

  1/ fatal error; all file ignored              (callback rc < 0)
  2/ recoverable error; malformed line ignored  (callback rc > 0)
  3/ ignore the error                           (callback rc == 0)

The 2/ is the default if no callback specified.

Unfortunately our utils uses 3/. The correct way is to use 2/.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-15 12:01:48 +02:00
Karel Zak 18b3e5495b swapon: split swapon-common.c
swapon    - requires libmount and libblkid
 swapoff   - requires libmount
 swaplabel - requires libblkid

This patch add lib/swapprober.c with blkid stuff for swap. It allows
to use and link libblkid only when necessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-22 13:16:25 +02:00
Sami Kerola 5db57cfc46 swapon: share get_swap_prober() with swaplabel to print uuid and label
The swapon(8) listing was almost complete, apart from label and uuid.
This change moves the code from swaplabel(8) to shared scope to be used
for printouts in other swap commands, such as swapon.

Adding this feature to lsblk(8) was a consideration, but lsblk is not
interested of swapfiles, so the swapon seems like a better option to add
this information.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-22 12:17:20 +02:00
Karel Zak 50fccba1ab misc: use libmnt_table reference counter
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21 16:07:51 +02:00
Karel Zak e7b63bea04 swapoff: use libmount to parse fstab
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:22:11 +02:00
Karel Zak 0b0c231f64 swapon: move generic code to swapon-common.c
This will allow to use separate binary for swapon and swapoff.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 11:21:12 +02:00