Damien Le Moal [Fri, 24 Feb 2017 06:45:31 +0000 (15:45 +0900)]
blkzone: Add --count option
The length option is used to specify the number of zones to
operate on. To be more consistent with other tools, have this
option use a number of sectors and introduce the --count option
to allow users to specify a number of zones.
The --count and --length options cannot be used together on
the command line.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Damien Le Moal [Fri, 24 Feb 2017 03:47:29 +0000 (12:47 +0900)]
blkzone: Improve zone information print
Add "0x" to the zone start, length and write pointer print
to make it always clear that the values are Hexadecimal.
Also update the zone condition string and associated comments
to match more closely the wording in the standard document.
The man page is also updated to match the new wording.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Damien Le Moal [Fri, 24 Feb 2017 03:36:08 +0000 (12:36 +0900)]
blkzone: Report all zones if length is not specified
Report all zones of the block device when length is not specified
on the command line. To do this, introduce an inner loop in
blkzone_report to repeatedly issue report zone ioctl to the
device.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
according to MASTERNAME. Note that we have to use $build_<mastername>,
the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
$build_ is evaluated and modified by our UL_...() functions.
* add enable-schedutils.conf to have build-system regression test for
this use-case
Addresses: https://github.com/karelzak/util-linux/issues/415 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Sat, 11 Feb 2017 14:10:51 +0000 (14:10 +0000)]
man: improve blkreport(8) and blkreset(8) manual pages
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.
Sami Kerola [Sat, 11 Feb 2017 14:10:50 +0000 (14:10 +0000)]
blkreport, blkreset: small code clean ups
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.
blkreport: slice up option descriptions, fix typo, fix docstring
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.
Shaun Tancheff [Mon, 23 Jan 2017 13:32:42 +0000 (20:32 +0700)]
blkzonecmd, blkreport: Add new commands for ZAC/ZBC drives
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>
Karel Zak [Thu, 9 Feb 2017 10:35:50 +0000 (11:35 +0100)]
Merge branch 'hwclock-jwp-reviewed' of 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
...
Carlos Santos [Wed, 8 Feb 2017 15:27:36 +0000 (13:27 -0200)]
build-sys: improve detection of the "isnan" function in uClibc
Since commit beceb14b450ded6560ed743634a5e80604a8edf3, MATH_LIBS is set
to "-lm" when the isnan function is detected. In uClibc, however, isnan
is a macro that calls __isnan, __isnanf, or __isnanl, depending on the
size of the argument (double, float or long double).
Sami Kerola [Tue, 10 Jan 2017 21:16:20 +0000 (21:16 +0000)]
hwclock: remove --compare option
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>
Sami Kerola [Wed, 27 Jul 2016 18:47:38 +0000 (19:47 +0100)]
hwclock: make --date=argument less prone to injection
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.
Sami Kerola [Sun, 24 Jul 2016 21:33:01 +0000 (22:33 +0100)]
hwclock: improve coding style
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.
Sami Kerola [Sun, 17 Jul 2016 16:10:48 +0000 (17:10 +0100)]
hwclock: add debugging to open_rtc()
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>
Sami Kerola [Sun, 17 Jul 2016 11:12:52 +0000 (12:12 +0100)]
hwclock: simplify save_adjtime() execution flow
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>
Sami Kerola [Sun, 17 Jul 2016 10:30:40 +0000 (11:30 +0100)]
hwclock: remove dead code and other minor fixes
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.
Sami Kerola [Sat, 16 Jul 2016 15:45:07 +0000 (16:45 +0100)]
hwclock: move command-line options to control structure
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>