summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: use swap in sfdisk wipe testKarel Zak2017-02-162-5/+6
| | | | | | and add "udevadm settle". Signed-off-by: Karel Zak <kzak@redhat.com>
* rename: add --no-act to bash-completionKarel Zak2017-02-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rename: add --no-act optionAlexander F Rødseth2017-02-152-16/+27
| | | | | | | [kzak@redhat.com: - rename --dry-run to --no-act] Signed-off-by: Alexander F Rødseth <xyproto@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add sfdisk --wipe and --wipe-partition testsKarel Zak2017-02-156-0/+303
| | | | | | Addresses: https://github.com/karelzak/util-linux/issues/410 Addresses: https://github.com/karelzak/util-linux/issues/411 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (gpt) fix force flagKarel Zak2017-02-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: improve --wipe functionalityKarel Zak2017-02-144-44/+47
| | | | | | | | | * always (except --wipe=never) wipe old partition tables * improve warn messages * improve man page Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: improve --wipe functionalityKarel Zak2017-02-142-22/+40
| | | | | | | | | * always (except --wipe=never) wipe old partition tables * improve warn messages * improve man page Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix BLKID_PARTS_FORCE_GPT usageKarel Zak2017-02-141-2/+6
| | | | | | Now wipefs always inform about MBR as about PMBR. That's bug. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) debug what we read from first sectorKarel Zak2017-02-141-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: classify collision typeKarel Zak2017-02-146-4/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: check for collisions when create new labelKarel Zak2017-02-144-50/+57
| | | | | | | | We need to be sure that when create a new disklabel than the old label will be removed. Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/randutils: glibc 2.25 has getrandom(2) declarationSami Kerola2017-02-131-1/+1
| | | | | | | Use correct header file to include the function. Reference: http://git.kernel.org/cgit/docs/man-pages/man-pages.git/commit/?id=2cbb6fb4e926e56dc3985b19ac02389321a0af5d Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* bash-completion: add blkreset and blkreport completionSami Kerola2017-02-131-0/+34
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* man: improve blkreport(8) and blkreset(8) manual pagesSami Kerola2017-02-132-6/+32
| | | | | | | | Tell in manual page what ZAC and ZBC acronyms mean. Include explanation to blkreport output, so that users do not need to search source code to understand what the tool informed. And fix couple dot double space issues. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blkreport, blkreset: small code clean upsSami Kerola2017-02-132-35/+25Star
| | | | | | | | | | Set variables read-only where possible. Fix few code style issues, mostly with spacing. Avoid initializing variables if they are never read before next update. Remove "ERR: %d -> %s" message that repeated system error three times, twice in that message and once at end of main that is the only of these three left in place. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: Fix word repetitionsYuri Chornoivan2017-02-1325-26/+26
|
* findmnt: use line separator for --poll outputKarel Zak2017-02-101-0/+2
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/409 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix fdisk_set_wipe_area() callsKarel Zak2017-02-102-9/+7Star
| | | | | | | The function expects size in sectors rather than in bytes. Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: --quiet fixesKarel Zak2017-02-102-4/+7
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/412 Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: don't use zero PID in messagesKarel Zak2017-02-101-7/+14
| | | | | | | | The pid 0 is technically correct, but very confusing for end users. Use getpid() in the messages. Addresses: https://github.com/karelzak/util-linux/issues/413 Signed-off-by: Karel Zak <kzak@redhat.com>
* blkreset: remove "LBA" from usage()Karel Zak2017-02-101-2/+3
| | | | | | | * "LBA" sounds confusing Reported-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* blkreport: remove "LBA" from usage() and unnecessary alignment checkKarel Zak2017-02-101-6/+1Star
| | | | | | | | | * "LBA" sounds confusing * alignment check is unnecessary for report ioctl Reported-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* blkreport: slice up option descriptions, fix typo, fix docstringBenno Schulenberg2017-02-102-18/+14Star
| | | | | | | | | | Each option plus its description should be a separate translatable string. And, if all is well, blkreport should not discard anything -- that is: fix the cut-and-paste error from blkdiscard. Additionally, tweak some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* blkzonecmd, blkreport: Add new commands for ZAC/ZBC drivesShaun Tancheff2017-02-097-0/+588
| | | | | | | | | | | | | | | This patch adds: - blkreset to issue Reset (Write Pointer) zone commands - blkreport to retrieve drive zone information [kzak@redhat.com: - cleanup man page and usage() - remove command line options aliases, - use strtosize_or_err() - remove unnecessary -ludev - use blkdev.h stuff] Signed-off-by: Shaun Tancheff <shaun@tancheff.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: remove if-if-conditionKarel Zak2017-02-091-3/+2Star
|
* Merge branch 'hwclock-jwp-reviewed' of ↵Karel Zak2017-02-0913-772/+639Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://github.com/kerolasa/lelux-utiliteetit * 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit: (25 commits) hwclock: remove --compare option hwclock: remove trailing dot from messages that include system error message hwclock: make --date=argument less prone to injection hwclock: fix rtc atexit registration hwclock: clarify cmos inb and outb preprocessor directives hwclock: try RTCGET and RTCSET only when normal rtc fails hwclock: stream line synchronize_to_clock_tick_rtc() hwclock: improve coding style hwclock: remove division by zero [asan] hwclock: add debugging to open_rtc() hwclock: remove magic constants from interpret_date_string() hwclock: use symbolic magic values passed in between functions hwclock: initialize struct adjtime members hwclock: alloate date_resp parsing buffer in interpret_date_string() hwclock: simplify save_adjtime() execution flow hwclock: remove dead code and other minor fixes hwclock: move error messages to determine_clock_access_method() hwclock: clarify set_cmos_epoch() code hwclock: move command-line options to control structure hwclock: remove unnecessary type casts ...
| * hwclock: remove --compare optionSami Kerola2017-02-055-80/+8Star
| | | | | | | | | | | | | | | | | | | | | | Compare functionality was printing nonsense values. There is no knowledge of anyone using this broken functionality. Instead of deprecating the code for months, and removing it after few release, it is removed immediately. Needless to say this is unusual removal. Reference: http://marc.info/?l=util-linux-ng&m=148396210506652&w=2 Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove trailing dot from messages that include system error messageSami Kerola2017-02-052-2/+2
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: make --date=argument less prone to injectionSami Kerola2017-02-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | This change should not improve security much. One hopes hwclock --set is restricted for root only. Where hwclock is allowed to run via sudo, or has setuid setup, there is a pretty easy privilege escalation via subshell. $ sudo ./hwclock --set --date='2000-10-20$(touch /tmp/hwclock.inject)' Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: fix rtc atexit registrationSami Kerola2017-02-051-1/+1
| | | | | | | | | | | | | | | | Commit 27f9db17bd57b85947445c03e2cd9dda36ca377f missed a minus sign from comparison. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: clarify cmos inb and outb preprocessor directivesSami Kerola2017-02-051-17/+15Star
| | | | | | | | | | | | | | The cmos only works when architecture is i386, x86_64, or alpha. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: try RTCGET and RTCSET only when normal rtc failsSami Kerola2017-02-051-21/+23
| | | | | | | | | | | | | | | | | | The RTCGET and RTCSET are in use for sparcs with sbus, so try them as fallback rather than always. Reference: https://github.com/torvalds/linux/blob/master/fs/compat_ioctl.c#L967-L974 Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: stream line synchronize_to_clock_tick_rtc()Sami Kerola2017-02-051-22/+19Star
| | | | | | | | | | | | | | Flip if clauses to hit common case first. This should be easier and quicker to read and run. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: improve coding styleSami Kerola2017-02-053-18/+23
| | | | | | | | | | | | | | | | | | Make string constants to be symbolical declarations. Use longer variable name for rtc and cmos function pointer values. Exclude code that is architecture specific with preprocessor directives. And remove message duplication. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove division by zero [asan]Sami Kerola2017-02-051-3/+4
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: add debugging to open_rtc()Sami Kerola2017-02-051-18/+16Star
| | | | | | | | | | | | | | | | | | | | Earlier when open_rtc() returned -1 the char *rtc_dev_name end up having NULL that made it unsuitable to be used in error message. Now one can debug what paths the open_rtc() tries to use when one has to debug why 'cannot open rtc device' happen. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove magic constants from interpret_date_string()Sami Kerola2017-02-051-38/+27Star
| | | | | | | | | | | | | | | | The constants function returned were not used. In same go clean up execution flow a little bit. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: use symbolic magic values passed in between functionsSami Kerola2017-02-054-13/+19
| | | | | | | | | | | | | | | | | | | | The manipulate_clock() is seeing return value from busywait_for_rtc_clock_tick(). And the get_permissions_cmos() can see i386_iopl() return value. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: initialize struct adjtime membersSami Kerola2017-02-051-26/+5Star
| | | | | | | | | | | | | | | | Avoid any chance of using uninitialized values. It looks like the earlier code did take care of that, but it was less obvious about the fact. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: alloate date_resp parsing buffer in interpret_date_string()Sami Kerola2017-02-051-5/+12
| | | | | | | | | | | | | | This makes overflowing the variable in question impossible. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: simplify save_adjtime() execution flowSami Kerola2017-02-051-48/+34Star
| | | | | | | | | | | | | | | | | | Return early to avoid excessive nesting. In same go remove any chance of overflow by using appropriate allocation. And update variable names to be easier to understand. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove dead code and other minor fixesSami Kerola2017-02-053-20/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use #ifdef rather than #if to avoid undefined preprocessor identifier warning. Remove dead code. The #if 0 ensured the code has not been used for long time, which is good because the linux/mc146818rtc.h is not been part of user-api for long time. Value of the adjtime_p->last_calib_time is checked if it has value of zero, so testing none-zero bit later is necessarily true, and therefore does not need to be checked. And at the and remove unnecessary boolean variable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: move error messages to determine_clock_access_method()Sami Kerola2017-02-052-17/+14Star
| | | | | | | | | | | | | | This makes main() a little bit shorter. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: clarify set_cmos_epoch() codeSami Kerola2017-02-051-16/+12Star
| | | | | | | | | | | | | | | | Variable set_epoc is unnecessary, and removal of it makes it obvious what is happening in this function. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: move command-line options to control structureSami Kerola2017-02-054-400/+402
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The control structure is read-only everywhere else but in main(). Almost all changes are about how variables are referred, with one exception. Calls to read_adjtime() from manipulate_clock() and compare_clock() are moved to main(). This way it is possible to keep variable that tells if hwclock is using UTC-0 be part of control structure. Changes within #ifdef __alpha__ segments were tested by flipping the preprocessor directivive otherway around and getting good compilaton all the way to the point where linking on none-alpha system failed. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove unnecessary type castsSami Kerola2017-02-051-26/+26
| | | | | | | | | | | | | | | | Most of the casts did nothing, with exception of couple printouts where format specifier is updated to match with the variable type. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: do not hardcode date command magic string twiceSami Kerola2017-02-051-2/+2
| | | | | | | | | | | | | | Variable 'magic' already contains string 'seconds-into-epoch'. Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove hwclock_exit() indirectionSami Kerola2017-02-052-13/+4Star
| | | | | | | | | | Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * hwclock: remove FLOOR macro in favour of floor(3)Sami Kerola2017-02-052-4/+2Star
| | | | | | | | | | Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * lib: add timegm() portability function to lib/timeutils.cSami Kerola2017-02-034-0/+25
| | | | | | | | | | | | | | | | | | Local timegm() is a replacement function in cases it is missing from libc implementation. Hopefully the replacement is never, or very rarely, used. CC: Ruediger Meier <ruediger.meier@ga-group.nl> Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>