summaryrefslogtreecommitdiffstats
path: root/sys-utils/losetup.c
Commit message (Collapse)AuthorAgeFilesLines
...
* losetup: remove warning for unsupported -e and -EKarel Zak2014-01-061-6/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup, mount: remove --pass-fd at allKarel Zak2014-01-061-5/+1Star
| | | | | | | | The option is unsupported since v2.23, let's cleanup man pages and code to remove it at all. Reported-by: "Dale R. Worley" <worley@alum.mit.edu> Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup, agetty: remove unnecessary if's before free()Sami Kerola2013-12-021-4/+2Star
| | | | | Reference: http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: cut the remaining little block of help text into slices tooBenno Schulenberg2013-10-091-6/+7
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* losetup: don't require 512-byte aligned offsetsKarel Zak2013-10-011-5/+1Star
| | | | | | | | | | | | | | | | Kernel aligns the device size, but the offset where the device starts is not required to be aligned. # losetup --offset 32 -f file.img is just fine, the final size of the look device will be (in sectors) (backing_file_size - offset) >> 9 so we have to do the same in userspace when we check for successful set capacity ioctl. Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix various typosYuri Chornoivan2013-09-281-1/+1
|
* losetup: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use loop-control to explicitly ask for deviceKarel Zak2013-08-061-0/+2
| | | | | | | | | | | | | | | | Now we use LOOP_CTL_GET_FREE ioctl to ask for free device, for example losetup -f foo.img Unfortunately, losetup(8) allows to ask for specified device losetup /dev/loop100 foo.img and in this case we assume that the device already exists in the system. This is incorrect, we should be able to use loop-control LOOP_CTL_ADD ioctl to ask for the specified device. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: fix loop device name usageKarel Zak2013-08-051-4/+9
| | | | | | | | The code is not paranoid enough, loopcxt_set_device() only set the device name to loopdev struct, but it does not check if the device really exists. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: make -j <path> more robustKarel Zak2013-08-051-10/+28
| | | | | | | | It's usually unnecessary as we compare devno and ino, but let's use absolute paths for situations when it's necessary to compare paths as strings. Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: set errno for misaligned offsetsKarel Zak2013-07-191-6/+14
| | | | | References: https://bugs.archlinux.org/task/36189 Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: improve clarity of some error messagesBenno Schulenberg2013-06-071-3/+3
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: harmonize some loop-device error messagesBenno Schulenberg2013-06-071-6/+6
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* losetup: add --raw and --noheadingsKarel Zak2013-05-131-10/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use warn_size() for regular files onlyKarel Zak2013-05-131-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: sync capacity after setting itJeff Mahoney2013-04-091-15/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I recently tried to mount an hfsplus file system from an image file with a partition table by using the loop offset and sizelimit options to specify the location of the file system. hfsplus stores some metadata at a set offset from the end of the partition, so it's sensitive to the device size reported by the kernel. It worked with this: But failed with this: /dev/loop0: [0089]:2 (<imagefile>), offset 32768, sizelimit 102400000 /dev/loop1: [0089]:2 (<imagefile>), offset 32768, sizelimit 102400000 /proc/partitions shows the correct number of blocks to match the sizelimit. But if I set a breakpoint in mount before the mount syscall, I could see: 102400000 102432768 The kernel loop driver will set the gendisk capacity of the device at LOOP_SET_STATUS64 but won't sync it to the block device until one of two conditions are met: All open file descriptors referring to the device are closed (and it will sync when re-opened) or if the LOOP_SET_CAPACITY ioctl is called to sync it. Since mount opens the device and passes it directly to the mount syscall after LOOP_SET_STATUS64 without closing and reopening it, the sizelimit argument is effectively ignroed. The capacity needs to be synced immediately for it to work as expected. This patch adds the LOOP_SET_CAPACITY call to loopctx_setup_device since the device isn't yet released to the user, so it's safe to sync the capacity immediately. [kzak@redhat.com: - port to the current git HEAD, - use uint64_t] Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: allow -j option argument to be relative pathSami Kerola2013-04-051-3/+10
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: make usage() translator friendlySami Kerola2013-01-251-8/+8
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: fix declarations [smatch scan]Sami Kerola2013-01-091-2/+5
| | | | | | | sys-utils/losetup.c:309:2: error: 'for' loop initial declarations are only allowed in C99 mode sys-utils/losetup.c:374:2: error: 'for' loop initial declarations are only allowed in C99 mode Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: allow to use -O without --listKarel Zak2012-11-121-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rename SIZE->SIZELIMITKarel Zak2012-11-121-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: add --list and --output optionOndrej Oprala2012-11-121-9/+253
| | | | | | | | | | | | | | | | The --list --all is the default output: # losetup NAME SIZE OFFSET AUTOCLEAR RO BACK-FILE /dev/loop0 0 0 0 0 /home/fs-images/swap.img /dev/loop1 0 100 0 0 /home/fs-images/disk.img [kzak@redhat.com: - default to --all if no device specified, - cleanup column names (add BACK- prefix) - add MAJ:MIN to of the loopdev device] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: improve debug messagesKarel Zak2012-10-171-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: losetup: remove obsolete encryption supportLudwig Nussel2012-09-111-23/+7Star
| | | | | | | | | | | | | | | kernel cryptoloop is deprecated since ages and support for cryptoloop in util-linux is incomplete/broken. - no password hashing - last 8 bit of key are always set to zero - no binary keys possible (stops reading key at \n and \0) In the past some Distros added the above features with patches. So remove cryptoloop support from util-linux completely to make sure people won't try using it. Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: add missing comma and colon in some help textsBenno Schulenberg2012-09-041-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* losetup: use err_exclusive_options()Karel Zak2012-07-261-19/+9Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/loopdev: use warn_unused_result forimportant functionsKarel Zak2012-06-211-6/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: use exclusive_option()Sami Kerola2012-06-171-6/+20
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: warn about backing file sizeKarel Zak2012-06-121-2/+25
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=730266 Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: more verbose failed setup error mesageKarel Zak2012-05-281-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* losetup: use strtosize_or_err()Karel Zak2012-03-301-6/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: Fix setting of sizelimit on new loop devicesDaniel Drake2012-03-131-1/+1
| | | | | | | | "losetup --offset 10 --sizelimit 20 foo.img" was producing a loop device with offset 20 and no sizelimit. Looks like a typo, fix it. Signed-off-by: Daniel Drake <dsd@laptop.org>
* losetup: fix compiler warnings [-Wpointer-sign -Wformat]Karel Zak2012-01-171-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: move xgetpass() to lib/xgetpass.cKarel Zak2012-01-111-39/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: add --partscan optionKarel Zak2012-01-091-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: cleanup headers, cmdline checksKarel Zak2011-12-221-11/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: cleanup usage()Karel Zak2011-12-221-31/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: check to control debug outputKarel Zak2011-12-221-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: print info about one deviceKarel Zak2011-12-221-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite loop setupKarel Zak2011-12-221-833/+94Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite -fKarel Zak2011-12-221-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite -d and -DKarel Zak2011-12-221-79/+50Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite -cKarel Zak2011-12-221-38/+29Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite -jKarel Zak2011-12-221-61/+36Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite -aKarel Zak2011-12-221-18/+117
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: move to sys-utils directoryKarel Zak2011-12-201-0/+1131
Now losetup(8) is independent on mount/ stuff at all. Signed-off-by: Karel Zak <kzak@redhat.com>