summaryrefslogtreecommitdiffstats
path: root/disk-utils
Commit message (Collapse)AuthorAgeFilesLines
* partx: document -d vs. --nr and fix testHEADmasterKarel Zak2019-08-211-1/+4
| | | | | | | | | | The commit ab025087f91b66ee8e23a16bc49eb0d9bd421d65 has disabled error message, but unfortunately it keeps wrong return code. This has been fixed by commit 53ae7d60cfeacd4e87bfe6fcc015b58b78ef4555. This commit add hit about it to docs and fix regression test too. Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: don't report ENXIO as error on -dKarel Zak2019-08-211-2/+1Star
| | | | | | | | | | | | | | | | | The errno ENXIO should be ignored, unfortunately the current code uses variable 'rc' for ioctl return code as well as for final del_parts() return value. So, failed ioctl (which should be ignored) affects all del_parts() status. # modprobe scsi_debug dev_size_mb=100 # partx -d --nr 1-1024 /dev/sdc; echo $? 1 The device dos not contains any partitions, so 0 return code is expected in this case. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1739179 Signed-off-by: Karel Zak <kzak@redhat.com>
* Remove unused utime.h headerRosen Penev2019-08-081-1/+0Star
| | | | | It is sometimes unavailable and errors on inclusion. For example, when disabled in uClibc-ng.
* libfdisk: (script) support shortcuts in the type= fieldKarel Zak2019-08-081-1/+2
| | | | | | | | | | | | | | | | | | | | The unnamed-field format supports partition type shortcuts: ",1MiB,L' but for named-field format it requires full type: (mbr) "size=1MiB,type=83" (gpt) "size=1MiB,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4" This patch implements type shortcuts also for named-field format: "size=1MiB,type=L" to make it more user-friendly and unified. Addresses: https://github.com/karelzak/util-linux/issues/837 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: free libfdisk itemsKarel Zak2019-06-111-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: simplify codeKarel Zak2019-06-111-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add note about -S and -HKarel Zak2019-05-281-0/+4
| | | | | | | It's seems people still follow old advices for SSD/4K devices. Let's make CHS deprecation more visible at the begin of the man page... Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: use xstrcpy()Karel Zak2019-05-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: remove unnecessary size check [cppcheck]Sami Kerola2019-05-181-2/+0Star
| | | | | | | | | | | | Following warning is false positive. Size of the buffer is defined using BUFSIZ, and so the strncpy() will never overwrite the last byte that is initialized to zero in get_user_reply(). [disk-utils/sfdisk.c:137] -> [disk-utils/sfdisk.c:136]: (warning) Either the condition 'bufsz!=0' is redundant or strncpy() argument nr 3 can have invalid value. The value is -1 but the valid values are '0:'. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: initialize buffers for get_user_reply() [coverity scan]Karel Zak2019-05-143-5/+5
| | | | | | It's probably unnecessary, but better be safe than sorry. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-1620-60/+39Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c: add print_version() macroKarel Zak2019-04-162-16/+4Star
| | | | | | | | | | | Let's consolidate the version printing code. It also seems better to use exit() after --version, because it's handled in different way by ASAN. It's strange, but ASAN reports leaks after return in main(). Note that we do not use free-before-exit. Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck: (man) labels are available for all filesystemsKarel Zak2019-03-281-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: be more explicit about maximal number of pagesKarel Zak2019-03-081-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/pull/766 Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: make –-getbsz less confusing for end-usersKarel Zak2019-02-281-1/+3
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1684078 Signed-off-by: Karel Zak <kzak@redhat.com>
* various: fix 'uninitialized when used' warnings [clang]Sami Kerola2019-02-182-2/+2
| | | | | | | This change fixes "warning: variable 'var' may be uninitialized when used here [-Wconditional-uninitialized]" warnings reported in various files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sfdisk: Avoid out of boundary read with readlineTobias Stoeckmann2019-02-181-1/+3
| | | | | | | | | | | | | | | It is not guaranteed that the returned string of readline() actually contains as many bytes as buf can contain. If bufsz is larger than the allocated memory by readline, an out of boundary read occurs and leads to undefined behaviour. Most likely that will be a crash. This can be reproduced when readline-support is compiled in and when you directly enter "quit" and "n" (to not write changes back to disk) when sfdisk was called with any given device. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* fdisk: use 2 decimal places for size in disk summaryKarel Zak2019-02-122-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | In the disk summary it seems nice, but I'm not sure about lists (SIZE columns). It seems more readable to keep the lists with one decimal place only. New output: # sfdisk --list /dev/sda Old output: Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors New output: Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors The rest is unchanged: ... Device Start End Sectors Size Type /dev/sda1 2048 411647 409600 200M EFI System /dev/sda2 411648 821247 409600 200M Linux filesystem /dev/sda3 821248 274087935 273266688 130.3G Linux filesystem /dev/sda4 274087936 378945535 104857600 50G Linux filesystem /dev/sda5 378945536 468862094 89916559 42.9G Linux filesystem Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452 Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: rewrite section about swapfilesKarel Zak2019-01-221-12/+3Star
| | | | | | | | | | | | * don't duplicate info on two places -- let's keep only small note in mkswap(8) man page, suggest to read swapon(8) man page * add info about kernel versions for XFS and Btrfs swapfiles support * use subsection in the NOTES Addresses: https://github.com/karelzak/util-linux/issues/633 Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: (man) iomap for swapfile is already supported by kernelKarel Zak2019-01-211-1/+1
| | | | | | | ... since commit 67482129cdabf7cede1301d2415ef4f0156d35cd (Linus' tree). Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: (man) cleanup note about holesKarel Zak2019-01-211-8/+9
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/633 Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.cramfs: fix utimes() usageKarel Zak2019-01-151-3/+3
| | | | | | The bug has been introduced by untested commit ad7ac3d598e2d541d9eba70975e68dff7e52c7d9 ;-( Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.cramfs: use utimes() instead of utime() that is obsoleteSami Kerola2019-01-121-4/+4
| | | | | Reference: http://man7.org/linux/man-pages/man3/utime.3p.html#APPLICATION_USAGE Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: make partition types uses more robustKarel Zak2019-01-101-3/+8
| | | | | | | | * report failed partition type parsing * make sure partition types code (from user reply) for MBR is hex Reported-by: Jonny Grant <jg@jguk.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: support CTRL+C on change-partition-type dialogKarel Zak2019-01-101-4/+11
| | | | | Reported-by: Jonny Grant <jg@jguk.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: use dd(1) in example rather than fallocate(1)Karel Zak2018-12-121-1/+3
| | | | | | | | | The man page warns against fallocate on some filesystems and recommends dd(1) as the most portable solution. So, let's use dd(1) also in the example used in the same man page. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1203378 Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: fix page size warning messageNoel Cragg2018-11-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: disable --activate for Hybrid GPT/MBRKarel Zak2018-10-041-0/+3
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/699 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: be more verbose about PMBR on --activateKarel Zak2018-10-042-0/+5
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/699 Signed-off-by: Karel Zak <kzak@redhat.com>
* mkfs.cramfs: properly copy disk nameKarel Zak2018-10-031-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: accept grain script headerKarel Zak2018-09-121-0/+5
| | | | | | | | | | | | The "grain" variable is used to calculate partitions alignment. The default is 1MiB (or minimal I/O size). The libfdisk provides API to overwrite this default, but this feature has been nowhere accessible for end-user. This patch support for "grain: <size>" in libfdisk scripts. Addresses: https://github.com/karelzak/util-linux/issues/688 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: document script GPT headersKarel Zak2018-09-121-0/+9
| | | | | | Add first-lba, last-lba and table-length to the sfdisk man page. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add "Disk model:" to the print outputKarel Zak2018-08-301-0/+3
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/682 Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix man page typosJakub Wilk2018-08-162-2/+2
| | | | Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* man pages: Remove "left" (or change to "l") in the column formats of tablesBjarni Ingi Gislason2018-08-061-1/+1
| | | | | | | | | A developmental version of "groff" issued a warning, for example with "test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z": troff: <logger.1>:299: warning: can't find font 't' Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* fdisk: fix error message on 'd' commandKarel Zak2018-08-011-2/+4
| | | | | | | | | | | Command (m for help): d No partition is defined yet! Could not delete partition 93840461057817 <--- ! Don't print 'Could not delete..' if no partition is defined yet. Addresses: https://github.com/karelzak/util-linux/issues/667 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Accept negative numbers for last sector inputAwal Garg2018-07-312-7/+12
| | | | | | | | [kzak@redhat.com: - add note to the man page - add '-' to the dialog query - cleanup functions names and libfdisk.sym] Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: fix compiler warnings [-Wcast-qual]Karel Zak2018-07-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: fix compiler warnings [-Wcast-qual]Karel Zak2018-07-231-3/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkfs.cramfs: remove redundant conditionKarel Zak2018-07-181-1/+1
| | | | | | | 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>
* blockdev: use new ul_path_* APIKarel Zak2018-06-211-12/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: use new ul_path_* APIKarel Zak2018-06-211-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* resizepart: use new ul_path_* APIKarel Zak2018-06-211-8/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use new ul_path_* APIKarel Zak2018-06-211-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: exit with error code when partition read failedAndreas Henriksson2018-06-181-1/+3
| | | | | | | | | | | | | | | | | | | 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
* nls: remove translation stringsSami Kerola2018-05-281-1/+1
| | | | | | | | | | While looking earlier commit I noticed everything but formatting was removed from a message in namei.c file. That inspired me to look if there are more strings that does not need translation project attention. This change removes at least some of them, if not all. Reference: e19cc7b65b31c57f0fe9cb73c9afad5197796f82 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cfdisk: fix compiler warnings, follow-up 7085f1e4 (#636)Ruediger Meier2018-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Seen on OSX 10.13, xcode 9.3. disk-utils/cfdisk.c:1860:45: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] DBG(UI, ul_debug("get_size (default=%ju)", *res)); ~~~ ^~~~ %llu disk-utils/cfdisk.c:267:60: note: expanded from macro 'DBG' #define DBG(m, x) __UL_DBG(cfdisk, CFDISK_DEBUG_, m, x) ^ ./include/debug.h:67:4: note: expanded from macro '__UL_DBG' x; \ ^ disk-utils/cfdisk.c:1889:25: error: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter of type 'uintmax_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types] rc = parse_size(buf, &user, &pwr); /* parse */ ^~~~~ ./include/strutils.h:15:51: note: passing argument to parameter 'res' here extern int parse_size(const char *str, uintmax_t *res, int *power); ^ 2 errors generated. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* cfdisk: use uint64_t to avoid compiler warningsKarel Zak2018-05-241-11/+11
| | | | | Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* man: Use the correct macro for a font change of one argumentBjarni Ingi Gislason2018-05-233-4/+4
| | | | | | | | Use the correct macro (I, B) for the font change of one argument, not those that are used for alternating two fonts, like "BR", "IR", "RB", or "RI". Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* Merge branch 'output-all' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2018-05-102-1/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'output-all' of https://github.com/kerolasa/lelux-utiliteetit: zramctl: add --output-all option swapon: add --output-all option rfkill: add --output-all option partx: add --output-all option lsns: add --output-all option lsmem: add --output-all option lslogins: add --output-all option lslocks: add --output-all option lscpu: add --output-all option losetup: add --output-all option findmnt: add --output-all option