Commit Graph

11968 Commits

Author SHA1 Message Date
Karel Zak 0158e68fbd lib/match: make match_fstype() case insensitive
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 14:15:23 +02:00
Karel Zak 3d47ab0549 build-sys: add --disable-rfkill
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 11:40:51 +02:00
Karel Zak 3c5022c645 rfkill: cleanup returns
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 11:16:07 +02:00
Karel Zak 24f9dde539 build-sys: remove unused rfkill.py
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 10:37:36 +02:00
Karel Zak f4949fcc3b rfkill: add Sami to authors
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 10:36:51 +02:00
Karel Zak fcc3efb40e rfkill: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 10:31:21 +02:00
Karel Zak f1f874bf48 Merge branch 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit into rfkill
* 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit: (57 commits)
  rfkill: add systemd-rfkill(8) see also segment
  rfkill: check id number refers to a device that exists
  rfkill: use back and forward compatible test
  rfkill: add bash-completion file
  rfkill: inform in syslog when rfkill is invoked
  rfkill: use human readable timestamps in event output
  rfkill: use libsmartcols output
  rfkill: do not ignore read error
  rfkill: clarify 'all devices' handling
  rfkill: update manual page
  rfkill: make programming style to match util-linux project
  rfkill: make command to build in util-linux project
  rfkill: move files to appropriate locations
  add python module
  use uapi rfkill.h
  version 0.5
  fix compiler warning
  Add NFC support
  version 0.4
  Add rfkill type "fm" to the man page.
  ...
2017-08-31 09:56:18 +02:00
Sami Kerola 11dc93b78a
rfkill: add systemd-rfkill(8) see also segment
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:49 +01:00
Sami Kerola f806a238f7
rfkill: check id number refers to a device that exists
Earlier all commands happily accepted without detecting failure when
none-existing id number was used.  For example:

$ rfkill block 2017; echo $?
0

The same input after this change looks following.

$ rfkill block 2017; echo $?
rfkill: invalid identifier: 2017
1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:49 +01:00
Sami Kerola 1bee8ec6f8
rfkill: use back and forward compatible test
The rfkill_event struct might grow in future, so ensure the read sizes are
at least the minimum, and allow it to be more.

Reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h#L90-L102
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:49 +01:00
Sami Kerola 9bf5e08fd3
rfkill: add bash-completion file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:49 +01:00
Sami Kerola fd3d4ec710
rfkill: inform in syslog when rfkill is invoked
This should help when trying to explain what or who is flicking wireles on
or off.  Notice that the change is not perfect - if rfkill command is
setting a state that is already set the syslog entry is sent eventhough
there was no effective change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:49 +01:00
Sami Kerola 7d0b3acbb4
rfkill: use human readable timestamps in event output
The event command appears to be something what primarily a developers will
to use when debugging.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola b3849c66d3
rfkill: use libsmartcols output
This also makes the rfkill to output status when executed without arguments.
That is believed ot be more useful than usage() output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola 6955a1d66c
rfkill: do not ignore read error
Read error should be impossible, but when one does happen user certainly
wants to know about that rather than see even more strange issue caused
random data in name variable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola b03378e793
rfkill: clarify 'all devices' handling
Stop using RFKILL_IS_INVALID a marker when rfkill is iterating over all
devices.  Addition of RFKIL_IS_ALL should make this a lot easier to digest,
especially if reading code in hurry.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola a60cbb52e3
rfkill: update manual page
Make the manual page style to match with util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola 367f40806e
rfkill: make programming style to match util-linux project
Use the usual facilities, add translation strings, move global variables at
the beginning of the file, make usage() look as expected, add standard
command-line option parsing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola c0d78c90be
rfkill: make command to build in util-linux project
After this commit the command merely builds, but does not confirm style used
in util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola e69263c03b
rfkill: move files to appropriate locations
Also remove unnecessary items.  Notice that the licence text from COPYING is
moved to top of the command in comment section.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola d17fb726b5
rfkill: merge rfkill.8 project to util-linux
Projet merge discussion in maillists:
http://www.spinics.net/lists/util-linux-ng/msg14289.html
http://marc.info/?l=linux-wireless&m=149880885914076&w=2

Old-Remote: http://git.sipsolutions.net/rfkill.git/
Old-Remote: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/rfkill.git
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:29:31 +01:00
Karel Zak 9001a06ebe docs: remove TODO item for fdisk
We use libsmartcols so basic escape for terminal should be already
done by the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-30 12:01:21 +02:00
Karel Zak 49a3d609ed build-sys: define dependence between chsh and getusershell 2017-08-30 11:30:41 +02:00
Sami Kerola a1f5bb9d1f chsh: remove local /etc/shells parsing in favour of getusershell(3)
Less code, less bugs.  And if there are bugs at least share them with all
other programs that use getusershell(3) from libc.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 11:21:59 +02:00
Sami Kerola 75c5f4a516 bash-completion: simplify pid listing
Changing directory in subshell does not effect parent process, so this is
better and possibly quicker way to list pids.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 11:21:57 +02:00
Sami Kerola 473ec35974 hwclock: remove bool type definition
Use plain int instead of type defining it to a boolean, and use numbers to
signify true or false as we do everywhere else in this source tree.  And in
hwclock-cmos.c file booleans weren't even needed, to the related code is
removed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 11:21:56 +02:00
Vaclav Dolezal 6c183c283b fdisk: use strutils to trim whitespace from input
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-29 15:26:39 +02:00
Vaclav Dolezal 1d775aa260 fdisk: fix copy from readline and whitespace stripping
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>
2017-08-28 14:06:15 +02:00
Vaclav Dolezal 3063670425 fdisk: minor fixes to make readline work
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-28 14:03:30 +02:00
J William Piggott e406be01b4 hwclock: for debugging print startup system time
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:49:11 -04:00
J William Piggott e5cb8d4dfe hwclock: refactor set_system_clock()
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:48:47 -04:00
J William Piggott c8f64f94f3 hwclock: update set_system_clock comments
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:30:39 -04:00
J William Piggott b44dd522b4 hwclock: update set_system_clock debugging
Update debug messages for a combined --systz and --hctosys in
the set_system_clock function.

New debug messages:

hwclock --test -D --systz --localtime
Calling settimeofday(NULL, 240) to warp System time.
Test mode: clock was not changed

hwclock --test -D --systz --utc
Calling settimeofday(NULL, 0) to lock the warp function.
Calling settimeofday(NULL, 240) to set the kernel timezone.
Test mode: clock was not changed

hwclock --test -D --hctosys --utc
Calling settimeofday(1502239269.733639, 240)
Test mode: clock was not changed

hwclock --test -D --hctosys --localtime
Calling settimeofday(NULL, 240) to set persistent_clock_is_local.
Calling settimeofday(1502253708.200200, 240)
Test mode: clock was not changed

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:30:39 -04:00
J William Piggott 3a7669aa8a hwclock: remove set_system_clock_timezone()
Remove set_system_clock_timezone() because the previous patch
moved its functionality into set_system_clock().

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:30:39 -04:00
J William Piggott 404fdd2ca4 hwclock: move systz into hctosys
The set_system_clock_timezone() function is nearly identical to
set_system_clock(). Three additional statements are required
to include systz in hctosys.

This patch is intentionally incomplete to make reviewing the
actual required changes easier. Other patches in this set will:

 * remove set_system_clock_timezone()
 * fix messages and debugging
 * fix comments
 * and finally refactor set_system_clock()

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:30:39 -04:00
Karel Zak ebfab541cf fdisk: add missing include
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 19:59:20 +02:00
Karel Zak c1154128db fdisk: fix readline interaction with signals
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>
2017-08-24 15:48:46 +02:00
Vaclav Dolezal 6c8c429d49 fdisk: handle SIGINT in dialogs as cancel
[kzak@redhat.com: - use sig_atomic_t]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 13:08:22 +02:00
Vaclav Dolezal 55cf371609 fdisk: add wrap_fgets() for getting user input
make function wrapping rl_fgets() and fputs()&fgets() to remove
code duplication in get_user_reply().

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-24 11:27:18 +02:00
Vaclav Dolezal 504c594777 libfdisk: fix fdisk_reset_partition() leaking *_chs strings.
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-24 11:23:44 +02:00
Vaclav Dolezal 5cebb2ab33 libfdisk: fix two potential memory errors.
Fixes one leak and one unchecked allocation error.

[kzak@redhat.com: - don't call fdisk_ask_menu_get_result()
                    after failed fdisk_do_ask()]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 11:21:59 +02:00
Karel Zak b428eb14a8 libfdisk: improve alignment debug mesagges
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 15:12:36 +02:00
Karel Zak 27c284b848 libfdisk: add --grain to mkpart sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:59:42 +02:00
Karel Zak adf09b5c38 libfdisk: add fdisk_save_user_grain()
Let's provide API for applications that don't want to use the default
1MiB grain. The new function allow to use "as minimal as possible" if
grain is set by fdisk_save_user_grain() to 512.

If the phy sector size (or minimal I/O size) is greater than specified
grain size than smallest possible setting is used.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:55:51 +02:00
Karel Zak 980cc4a182 libfdisk: (dos) use size-=1 when alignment not used later
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:54:27 +02:00
Karel Zak 1573e95514 libfdisk: improve "add partition" debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:53:18 +02:00
Karel Zak 694a407de9 libfdisk: (gpt) fix size-1 error
If partition does not require alignment, then don't call LBA align
function and don't use size-=1 (fdisk_align_lba_in_range() returns
unmodified size and we call size=-1 more than once for the same size).

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:48:14 +02:00
Karel Zak 3f30dedd56 docs: add CAP_SYS_ADMIN to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 11:22:26 +02:00
Karel Zak c64376b051 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Define magic constants
2017-08-21 11:33:17 +02:00
Karel Zak 1da83869cf isosize: usage() and coding style cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-21 11:16:51 +02:00