Commit Graph

4139 Commits

Author SHA1 Message Date
Karel Zak 1a7a421ed7 libmount: add support for encrypted loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 16:16:00 +01:00
Karel Zak 6af8d3d722 losetup: add note about non-root users to losetup.8
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 15:45:36 +01:00
Karel Zak 6c503d5916 losetup: move xgetpass() to lib/xgetpass.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 15:17:06 +01:00
Karel Zak 143635c91f build-sys: move swapon from mount/ to sys-utils/
... to make it independent on mount stuff.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 12:14:29 +01:00
Karel Zak 9514a61246 swapon: merge swap_constants.h into swapon.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 11:43:42 +01:00
Karel Zak 0b359bcdfd docs: add info about virt-what to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-10 16:48:37 +01:00
Karel Zak 3142564b24 mount: add hint that context= has to be quoted
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=747038
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-10 15:43:56 +01:00
Karel Zak c6238085a1 mount: update info about check= mount option
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=770172
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-10 14:01:17 +01:00
Karel Zak 916bf85e62 losetup: add --partscan option
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-09 23:28:50 +01:00
Karel Zak d356c5d238 loopdev: improve debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-09 23:28:50 +01:00
Karel Zak 59d749c331 loopdev: support LO_FLAGS_PARTSCAN flag (kernel 3.2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-09 23:28:43 +01:00
Davidlohr Bueso 4e4a25c0dd sfdisk: use is_blkdev
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-01-05 17:23:21 +01:00
Wanlong Gao f61a097bec blockdev: make functions static
make the functions in blockdev to statics.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2012-01-05 17:09:27 +01:00
Davidlohr Bueso 756d79cd63 lscpu: fix compiler warnings
The string format is not being passed triggering:

    lscpu.c: In function ‘read_hypervisor’:
    lscpu.c:545:4: warning: format not a string literal and no format arguments
    lscpu.c: In function ‘get_cell_header’:
    lscpu.c:904:2: warning: format not a string literal and no format arguments
    lscpu.c:904:2: warning: format not a string literal and no format arguments

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-01-05 17:09:27 +01:00
Davidlohr Bueso 8150beac7c blkdev: add is_blkdev function
We should have the most basic of checks in this library to see whether or not a block device is being used.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-01-05 17:09:27 +01:00
Karel Zak 67aa2fc795 fdisk: remove PACKED macro
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-05 17:01:19 +01:00
Karel Zak 9df2ac603e sfdisk: remove PACKED macro
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-05 16:58:56 +01:00
Davidlohr Bueso 66d28be811 sfdisk: remove do_warn
Replace it with warnx() instead.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-01-05 16:45:44 +01:00
Davidlohr Bueso 109dbc4f84 sfdisk: remove fatal
Since fatal() exists with a standard 1 code, it can easily be replaced by errx(3).
The xalloc lib is also introduced in this patch.

[kzak@redhat,com: - fix coding style]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-04 14:34:37 +01:00
Karel Zak 5be926fac1 column: don't check result from xmalloc()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-04 14:29:26 +01:00
Karel Zak d05a3e9713 build-sys: add checkxalloc to toplevel Makefile
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-04 14:25:21 +01:00
Dave Reisner cce4d25aed column: use xalloc libs
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-04 13:53:40 +01:00
Dave Reisner 8290a24952 lscpu: use xalloc libs
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-04 13:53:38 +01:00
Dave Reisner e1e7be22ee tools: add new code checking script
Finds usage of strdup, malloc, calloc, and realloc when xalloc.h is
included.

http://marc.info/?l=util-linux-ng&m=132438338929925&w=2

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-04 13:53:08 +01:00
s.p@orbitalfox.com b631e4d801 libmount: fixed a small typo 2012-01-04 11:37:49 +01:00
Francesco Cosoleto 0c48d37192 fdisk: fix incorrect position of is_ide_cdrom_or_tape() call
Reported-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2012-01-04 11:35:26 +01:00
Dave Reisner b928ab01e0 libmount: fix typo in function name
Build broken in c70d9d7.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-02 16:56:12 +01:00
Karel Zak c70d9d768b libmount: consolidate MNT_FS_* code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 15:00:27 +01:00
Dave Reisner 46c59b5119 mount: don't canonicalize the source of a pseudofs
In line with previous patches, the source of a pseudofs is strictly
semantic; do not attempt to resolve it to a filesystem path.

As a side effect of this, nspec needs to be initialized to NULL since
it may not be assigned null by spec_to_devname when the FS is deemed
a pseudofs.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-02 14:28:30 +01:00
Dave Reisner ee83edede1 libmount: avoid resolving pseudofs source on update
Similar to the previous commit, when mounting a pseudofs, trust the
source of the fs, as it cannot be matched to backing device on the
filesystem.

Similar situation, but slightly different bug:

  # mkdir /foo /root/foo
  # echo 'foo  /foo  tmpfs  defaults  0  0' >> /etc/fstab
  # cd /root
  # mount -a
  # mount | grep /foo
  /root/foo on /foo type tmpfs (rw,relatime)

This fixes the pure libmount based mount utility, but the legacy mount
tool will still fail to handle this properly.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 14:27:09 +01:00
Karel Zak 16b8db49fe libmount; fix possible mem-leak
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 14:16:15 +01:00
Dave Reisner 14f66ad69a libmount: always trust the source of a pseudofs
Since nodev FSs have no backing block device, it's unreasonable to try
and resolve the source back to a path on the filesystem. Always trust
the source of the FS given in /etc/fstab to avoid remounting the device
when a directory of the same name exists in the current working
directory.

Example reproduction:

  # mkdir /foo
  # echo 'foo  /foo  tmpfs  defaults  0  0' >> /etc/fstab
  # mount -a
  # cd /root; mkdir foo
  # mount -a
  # mount | grep /foo
  foo on /foo type tmpfs (rw,relatime)
  /root/foo on /foo type tmpfs (rw,relatime)

[kzak@redhat.com: - use fs->flags to detect pseudo FS]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 13:59:35 +01:00
Davidlohr Bueso 3b622ddd72 fdisk: use CDROM_GET_CAPABILITY ioctl
And replace the current archaic logic of is_ide_cdrom_or_tape().

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-01-02 13:43:06 +01:00
Karel Zak a4c0cc75ff mount: append inverting options for mount.<type>
fstab:
	server://foo   /mnt/foo    nfs    user,exec

The mount(8) does not append the option "exec" to /sbin/mount.<type>
helper's command line. This is no problem when executed by non-root
user as it reads the options from fstab only.

.. but when executed by root (UID=0) then the mount.<type> helper
follows the command where the "exec" option is missing. This is bug.

original version (strace output):

 execve("/sbin/mount.nfs", ["/sbin/mount.nfs",
        "sr.net.home:/mnt/store", "/mnt/store", "-o",
        "rw,nosuid,nodev,noauto,user"], [/* 21 vars */]) = 0

fixed version:

 execve("/sbin/mount.nfs", ["/sbin/mount.nfs",
        "sr.net.home:/mnt/store", "/mnt/store", "-o",
        "rw,nosuid,nodev,noauto,user,exec"], [/* 21 vars */]) = 0
                                    ^^^^^

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-02 11:08:17 +01:00
Karel Zak 3ed8b5363d lib,tt: don't trim last line char
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 13:21:16 +01:00
Karel Zak 934df30dd0 losetup: cleanup headers, cmdline checks
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:20:07 +01:00
Karel Zak 23b85230e7 losetup: cleanup man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak aadb930377 losetup: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak 6da69b83a6 losetup: check to control debug output
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak 09ec0c0a97 losetup: print info about one device
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak c7e0925def losetup: rewrite loop setup
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak bcdbdc72cb losetup: rewrite -f
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak c654c4f0a3 losetup: rewrite -d and -D
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak 6e90a44c1e losetup: rewrite -c
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak bc0ac075a9 losetup: rewrite -j
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak 39fde1373d losetup: rewrite -a
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak 6c224de18b lib,loopdev: add missing functions
- improve loop_info usage (don't call ioctl more than once)
 - add functions to get devno and inode of the backing file
 - add function for compare any file with backing file by devno + inode
   or by filename

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-22 12:19:38 +01:00
Karel Zak 7eac65fcf6 libblkid; fix memory leak in blkid_probe_get_wholedisk_probe()
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-21 17:32:01 +01:00
Davidlohr Bueso 212db7f2af prlimit: use xalloc libs
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-12-20 13:09:32 +01:00
Karel Zak bd6d0d039c losetup: move to sys-utils directory
Now losetup(8) is independent on mount/ stuff at all.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 13:07:54 +01:00