Commit Graph

11192 Commits

Author SHA1 Message Date
Karel Zak 1765814521 libsmartcols: allow to add column to already used table
Now it's impossible to add new column if the table already contains
lines with data. This patch forces library to realloc cell array in
the lines to accept a new column.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-03 10:37:37 +01:00
Karel Zak c14224b374 libsmartcols: support columns separators greater than one output cell
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-02 16:56:39 +01:00
Karel Zak 208b2ef0b6 sfdisk: note about small partition in man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-02 13:51:40 +01:00
Karel Zak 86800f5d75 sfdisk: add note about alignment to man page
Addresses: https://github.com/karelzak/util-linux/issues/417
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-02 13:44:26 +01:00
Karel Zak 3e094e5fe2 column: make more obvious what is default behavior
The man page contains mistakes. The default is to fill columns before
lines:

$ printf 'aaaaaaaaaaaaaaaaaaaaaa\nBBBBBBBBBBBBBBBBBBBBB\nXXXXXXX\nYYYYYYYYYYY\nZZZZZ' > data

$ column --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa	XXXXXXX			ZZZZZ
BBBBBBBBBBBBBBBBBBBBB	YYYYYYYYYYY

$ column  --fillrows --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa	BBBBBBBBBBBBBBBBBBBBB	XXXXXXX
YYYYYYYYYYY		ZZZZZ

The patch also rename functions in the code to make it more obvious
for code readers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-01 12:25:16 +01:00
Karel Zak 7bb9ee99da libmount: cosmetic change to mnt_table_find_srcpath()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-28 14:47:02 +01:00
Petr Vorel 443be11396 libmount: return tab entry for default node
This is useful for lsblk.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
2017-02-28 14:41:42 +01:00
Sami Kerola e9f62f3881 setterm: fix bitfield warning [smatch]
term-utils/setterm.c:179:27: warning: dubious bitfield without explicit
`signed' or `unsigned'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-28 14:38:22 +01:00
Karel Zak 168950e3ce libfdisk: (dos) add ID related debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-27 13:44:08 +01:00
Karel Zak ea4ea332a8 libfdisk: add version to debug output
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-27 13:16:18 +01:00
Matthias Gerstner 1db2468106
agetty: fix a memory leak when parsing \S in issue files 2017-02-27 12:31:28 +01:00
Karel Zak 86b6d7f434 unshare: add note about sysfs and procfs
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1390057
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-27 12:09:35 +01:00
Karel Zak 7ab6461fae docs: add note about branches to README
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-24 14:19:04 +01:00
Karel Zak 830043212f blkzone: add count option to bash-completion
and fix typo in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-24 12:05:13 +01:00
Karel Zak c16970f794 blkzone: use optutils.h to check mutually exclusive options
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-24 11:59:53 +01:00
Damien Le Moal f1b8b84d34 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>
2017-02-24 11:53:45 +01:00
Damien Le Moal a7f742069e 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>
2017-02-24 11:53:45 +01:00
Damien Le Moal 6e1958d8dd 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>
2017-02-24 11:53:45 +01:00
Damien Le Moal 72a7310233 blkzone: Reset all zones when length is not specified
If length is 0, operate on all zones starting from offset.
This also fix the maximum length calculation from offset.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2017-02-24 11:53:45 +01:00
Karel Zak 22fae330d9 blkreport, blkreset: remove in favour of blkzone
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 17:03:26 +01:00
Karel Zak 6324d0f494 blkzone: add bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 17:01:29 +01:00
Karel Zak 1ad8ef9187 blkzone: add new command (merge blkreport and blkreset)
This new command is based on the original implementation of blkreport
and blkreset command.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 16:43:51 +01:00
Karel Zak fc72f51e1f build-sys: simplify UL_ENABLE_ALIAS() semantic
Let's follow only $enable_ variables. In this case the MASTERNAME
(e.g. [schedutils] for --enable-schedutils) has to be without
UL_BUILD_INIT.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-21 11:00:19 +01:00
Karel Zak 6f2eb03433 build-sys: fix --disable-all-programs --enable-schedutils
* 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>
2017-02-20 14:17:37 +01:00
Karel Zak 34f3469d18 tests: another improvement to the sfdisk wipe test
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-20 13:22:55 +01:00
Karel Zak bf3e7a40ab libblkid: remove unnecessary 'static' keyword
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-20 13:08:30 +01:00
Sami Kerola 79b915e8df findmnt: fix couple memory leaks [cppcheck]
In both cases FILE *f was leaked.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 13:00:58 +01:00
Sami Kerola c5e3ebcedc libblkid: declare across file variables in blkidP.h [smatch scan]
Else these variables will cause following warning:

libblkid/src/superblocks/superblocks.c:165:29: warning: symbol
'superblocks_drv' was not declared.  Should it be static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 13:00:58 +01:00
Sami Kerola a2c8c533ce lib/idcache: add void to function declaration [smatch scan]
lib/idcache.c:29:29: warning: non-ANSI function declaration of function
'new_idcache'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 13:00:58 +01:00
Sami Kerola 2ba641e5f3 misc: add static keyword to where needed [smatch scan]
text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Sami Kerola 8791804065 misc: do not use plain 0 as NULL [smatch scan]
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer

Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.

Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Sami Kerola e948f4b616 cfdisk: avoid use of VLA in combination with sizeof() [smatch scan]
disk-utils/cfdisk.c:1066:29: error: cannot size expression

One should use sizeof() only when variable size can be known at time of
compilation.  That is not the case with variable length arrays.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:12 +01:00
Karel Zak 1f519a90c1 tests: make sfdisk wipe partition optional
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-17 16:24:35 +01:00
Karel Zak 1c1d30c750 libfdisk: add sample-fdisk-mkpart binary
For example:
	# sample-fdisk-mkpart --device /dev/sdc 1M 2M 3M - 5M

	# fdisk -l /dev/sdc
	...
	Device     Boot Start    End Sectors Size Id Type
	/dev/sdc1        2048   4095    2048   1M 83 Linux
	/dev/sdc2        4096   8191    4096   2M 83 Linux
	/dev/sdc3        8192  14335    6144   3M 83 Linux
	/dev/sdc4       14336 204799  190464  93M  5 Extended
	/dev/sdc5       16384  26623   10240   5M 83 Linux

Addresses: https://github.com/karelzak/util-linux/issues/204
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-17 16:15:03 +01:00
Karel Zak 8d03f4af49 libfdisk: (dos) make it possible to create primary/logical by template
Let's check partition partno if specified to create logical or primary
partition.

Addresses: https://github.com/karelzak/util-linux/issues/204
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-17 16:11:37 +01:00
Karel Zak 21f1206aac libfdisk: (gpt) make sure it's GPT in public API
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-17 14:47:00 +01:00
Karel Zak e1cfb30466 libfdisk: verify partno from template
* verify partno from template when create a new partition
* remove unnecessary l->ext_offset check

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-17 13:17:48 +01:00
Karel Zak 9dc5644717 tests: (sfdisk) tell kernel about new partition
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-17 10:28:53 +01:00
Karel Zak 99d944bb2d tests: add udevadm settle to sfdisk wipe
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 15:30:45 +01:00
Karel Zak 8ad7f6b96a build-sys: add missing file
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 15:27:07 +01:00
Karel Zak 74fe554a41 tests: add --show-diff
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 14:14:54 +01:00
Karel Zak 1854d6dfc6 build-sys: add non-widechar.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 13:47:44 +01:00
Karel Zak 1b6d02fe8c cfdisk: use buffer editor for ui_get_string()
Addresses: https://github.com/karelzak/util-linux/issues/403
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 13:47:44 +01:00
Karel Zak 299ef2c457 lib/mbsedit: add simple buffer editor
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 13:47:44 +01:00
Karel Zak ab3d893784 tests: use swap in sfdisk wipe test
and add "udevadm settle".

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 11:01:35 +01:00
Karel Zak d86dc71427 rename: add --no-act to bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-15 13:45:02 +01:00
Alexander F Rødseth 990bf1f048 rename: add --no-act option
[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>
2017-02-15 13:41:46 +01:00
Karel Zak f0c60dff1a tests: add sfdisk --wipe and --wipe-partition tests
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>
2017-02-15 12:48:06 +01:00
Karel Zak e9e88bb8e9 libblkid: (gpt) fix force flag
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-15 11:30:58 +01:00
Karel Zak 5635d19550 fdisk: improve --wipe functionality
* 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>
2017-02-14 15:13:35 +01:00