summaryrefslogtreecommitdiffstats
path: root/disk-utils
Commit message (Collapse)AuthorAgeFilesLines
* cfdisk: cleanup die-on-signal codeKarel Zak2017-09-261-16/+47
| | | | | | | Let's keep signal handler simple and don't cleanup terminal from the handler. Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: make resize code more readableKarel Zak2017-09-261-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swaplabel: fix --disable-libuuid compilationKarel Zak2017-09-151-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-051-1/+1
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* fdisk: use strutils to trim whitespace from inputVaclav Dolezal2017-08-291-6/+1Star
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: fix copy from readline and whitespace strippingVaclav Dolezal2017-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | | Bug fixed: --- 678: fdisk: ASK: asking for number ['Partition number', <1,4>, default=1, range: 1-4] 678: fdisk: ASK: asking for user replay [interactive] Partition number (1-4, default 1): 12345 678: fdisk: ASK: user's reply: >>>12345<<< Value out of range. 678: fdisk: ASK: asking for user replay [interactive] Partition number (1-4, default 1): 1 678: fdisk: ASK: user's reply: >>>12345<<< Value out of range. 678: fdisk: ASK: asking for user replay [interactive] Partition number (1-4, default 1): 678: fdisk: ASK: user's reply: >>>22345<<< Value out of range. --- Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: minor fixes to make readline workVaclav Dolezal2017-08-281-3/+4
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: add missing includeKarel Zak2017-08-241-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix readline interaction with signalsKarel Zak2017-08-243-63/+102
| | | | | | | | | | | | | The high-level readline API is crazy to use with signals. Fortunately the library provides low-level rl_callback_* API. In this case we can use poll() to wait for input and control all signals, etc. This patch also a little changes fdisk behavior on CTRL+C and CTRL+D. The signals does not kill fdisk, but forces fdisk to return to the main menu, if already in the main menu then exit. If the disk layout has been modified than ask "Do you really want to exit...". Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: handle SIGINT in dialogs as cancelVaclav Dolezal2017-08-241-2/+27
| | | | | | | [kzak@redhat.com: - use sig_atomic_t] Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add wrap_fgets() for getting user inputVaclav Dolezal2017-08-241-31/+26Star
| | | | | | | make function wrapping rl_fgets() and fputs()&fgets() to remove code duplication in get_user_reply(). Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* isosize: usage() and coding style cleanupKarel Zak2017-08-211-13/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* isosize: iterate over all arguments even when something failsKarel Zak2017-08-212-13/+45
| | | | | | | | | | Earlier the command exit too early if one of the arguments failed. After this change all arguments are examined, and command return value will have information what happen during processing. Based on patch from Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add missing 0x7F key mappingKarel Zak2017-08-151-0/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/499 Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: document --setro more properlyKarel Zak2017-08-141-1/+2
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/498 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add resize functionKarel Zak2017-07-191-7/+49
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: use fdisk_reread_changes()Karel Zak2017-07-141-1/+11
| | | | | | Let's make cfdisk usable for disks where some partitions are mounted. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use fdisk_reread_changes()Karel Zak2017-07-143-1/+15
| | | | | | Let's make fdisk usable for disks where some partitions are mounted. Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: move partx.h to include/Karel Zak2017-07-142-74/+4Star
| | | | | | Let's make the ioctls usable also for libfdisk. Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: use fdisk_device_is_used()Karel Zak2017-07-141-27/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devicesKarel Zak2017-07-121-1/+1
| | | | | | | | | For some reason kernel commit e980f62353c697cbf0c4325e43df6e44399aeb64 add extra warning when the ioctl is used for DM devices. It seems we can avoid this ioctl when the device has dm/uuid. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1469532 Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: reset context after failed scriptKarel Zak2017-07-101-2/+8
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/481 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-2920-34/+34
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* blockdev: correct man page name in --helpRuediger Meier2017-06-291-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* docs: remove some old history from manpagesRuediger Meier2017-06-292-4/+3Star
| | | | | | | | We assume that users will have a kernel >= 2.6.0 and removel references to earlier kernels. There are still a few ones left. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* blockdev: improve --help and man pageRuediger Meier2017-06-272-13/+30
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate all --help option descriptionsRuediger Meier2017-06-275-13/+10Star
| | | | | | | | Now we are always using the same text also for commands which had still hardcoded descriptions or where we can't use the standard print_usage_help_options macro. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-2715-30/+16Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-262-6/+8
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-2613-81/+117
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(ERROR)Ruediger Meier2017-06-262-21/+26
| | | | | | | | | | We are using better/shorter error messages and somtimes also errtryhelp(). Here we fix all cases where the usage function took an int argument for exit_code. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cleanup and fix --unknownopt issuesRuediger Meier2017-06-261-10/+17
| | | | | | | | | | | | | | | | Fixed checkusage.sh warnings: rtcwake: --unknownopt, non-empty stdout rtcwake: --unknownopt, stderr too long: 21 blockdev: --unknownopt, stderr too long: 28 lsipc: --unknownopt, stderr too long: 77 pg: --unknownopt, stderr too long: 23 renice: --unknownopt, stderr too long: 18 sulogin: --unknownopt, stderr too long: 17 write: --unknownopt, stderr too long: 12 Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate usage() "Available columns"Karel Zak2017-06-262-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '170622' of github.com:jwpi/util-linuxKarel Zak2017-06-261-1/+1
|\ | | | | | | | | | | | | | | * '170622' of github.com:jwpi/util-linux: Docs: move option naming to howto-contribute.txt Docs: update howto-usage-function.txt Docs: add a comment for constants to boilerplate.c include/c.h: add USAGE_COMMANDS and USAGE_COLUMNS
| * include/c.h: add USAGE_COMMANDS and USAGE_COLUMNSJ William Piggott2017-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * login-utils/lslogins.c: all uses changed * misc-utils/findmnt.c: likewise * sys-utils/blkzone.c: likewise * disk-utils/sfdisk.c: likewise * sys-utils/lscpu.c: likewise * sys-utils/lsmem.c: likewise * sys-utils/wdctl.c: likewise Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | Merge branch 'fix-exit-codes' of https://github.com/rudimeier/util-linuxKarel Zak2017-06-265-4/+12
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * 'fix-exit-codes' of https://github.com/rudimeier/util-linux: misc: fix optutils.h related exit codes misc: fix xalloc.h related exit codes misc: fix more strutils related exit codes lib: fix strutils.h, remove STRTOXX_EXIT_CODE misc: fix some broken exit codes
| * | misc: fix xalloc.h related exit codesRuediger Meier2017-06-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Found by: grep -L "XALLOC_EXIT_CODE" $(grep -l "xalloc\.h" \ $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * | misc: fix more strutils related exit codesRuediger Meier2017-06-224-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by grep: grep -l "\bEXIT_\|exit *( *[0-9][0-9] *)\|strutils\.h" $(grep -L \ strutils_set_exitcode $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) The Command shows also some false positives (fstrim.c, context_mount.c, ...) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * | lib: fix strutils.h, remove STRTOXX_EXIT_CODERuediger Meier2017-06-221-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed on the mailing list. We fix all places where the non-working define STRTOXX_EXIT_CODE was used. Regarding tunelp, also see 7e3c80a7. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * | misc: fix some broken exit codesRuediger Meier2017-06-223-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tools have special exit codes. They got changed mistakenly. See: findfs 0e1fa6b6 fsck 658c0891 fsck.cramfs 922ec175 mkfs.cramfs 16154b1f tunelp 2ab428f6 FIXME: STRTOXX_EXIT_CODE doesn't work as it should. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | mkfs.cramfs: add --help and --versionRuediger Meier2017-06-252-15/+27
| | | | | | | | | | | | | | Note, we were already using errtryhelp() without providing a --help option. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | fsck: add --help and --versionRuediger Meier2017-06-222-7/+26
|/ | | | | | | | | | Also cleanup usage() function, never write usage to stderr. FIXME: - currently strtou32_or_err() exits with wrong exit code. - option -C does not use a safe strto*_err function Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* isosize: avoid reading more data than what is neededSami Kerola2017-06-141-47/+10Star
| | | | | | | | | | | In same go fix error reporting when input file is not long enough. $ touch empty $ isosize empty isosize: empty: might not be an ISO filesystem isosize: read error on empty: Success Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix ggc-7 fallthrough warningsSami Kerola2017-06-141-1/+1
| | | | | | | | | | | | | | | | | | | (Original patch and commit message edited by Rudi.) gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra. This warning can be silenced by using comment /* fallthrough */ which is also recognized by other tools like coverity. There are also other valid comments (see man gcc-7) but we consolidate this style now. We could have also used __attribute__((fallthrough)) but the comment looks nice and does not need to be ifdef'ed for compatibility. Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652 Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl> Suggested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdformat: clear progress message before printing "done"Jakub Wilk2017-06-021-1/+1
| | | | | | | | | | | | Before: Formatting ... done1 After: Formatting ... done Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
* cfdisk: fix compiler warningKarel Zak2017-05-311-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: disambiguate units of --show-sizeChris Morin2017-05-222-4/+17
| | | | | | | [kzak@redhat.com: - use optutils.h] Signed-off-by: Chris Morin <chris.morin2@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate smartcols error messagesKarel Zak2017-05-182-7/+12
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add hints for scanners [coverity scan]Karel Zak2017-05-171-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>