Commit Graph

24 Commits

Author SHA1 Message Date
Karel Zak 884659b32a libblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devices
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>
2017-07-12 14:35:53 +02:00
Karel Zak c3a4cfc579 misc: consolidate usage() "Available columns"
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-26 14:09:53 +02:00
Karel Zak 780ce22cda misc: consolidate smartcols error messages
... just to keep translators happy

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-18 11:39:34 +02:00
Karel Zak 25d1a7e5a6 fdisk: check scols_line_refer_data() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-17 11:32:50 +02:00
Karel Zak ddead341c5 fdisk: inform on 'p' about wiped partitions
The wipe operation is potentially dangerous. Let's inform about it
always by 'p' (list) command to make sure user knowns about it.

	Command (m for help): p
	...
	Device     Boot Start    End Sectors Size Id Type
	/dev/sdc1        2048 204799  202752  99M 83 Linux

	Filesystem/RAID signature on partition 1 will be wiped.

Addresses: https://github.com/karelzak/util-linux/issues/437
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-09 14:30:36 +02:00
Karel Zak 35ca511827 sfdisk: support empty label use-case
By default sfdisk creates partition table when a first partition is
specified, otherwise the device is not modified. This force users to
create at least one partition.

This commit allows to create empty label without partitions if "label:
<name>" header line is specified by script.

The commit also modifies "New situation:" output to list label name
and label identifier.

Addresses: https://github.com/karelzak/util-linux/issues/374
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-30 13:01:33 +01:00
Ruediger Meier 0f2eb577ac fdisk: fix memleak in list_disk_geometry()
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-10-27 11:03:16 +02:00
Ruediger Meier 3fd1f7711e docs: fix typos found by codespell
Using "codespell" from https://github.com/lucasdemarchi/codespell

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-03 15:10:08 +01:00
Boris Egorov 43b4f7ea5f lib/tty: Pass default width to get_terminal_width()
Almost any code calling get_terminal_width() checks returned width for
non-positive values and sets it to some default value (say, 80). So,
let's pass this default value directly to the function.

[kzak@redhat.com: - get_terminal_width() refactoring]

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-06 12:22:07 +01:00
Karel Zak 901f85fe54 sfdisk: don't print extra linebreaks on --quiet
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-30 13:22:35 +02:00
Karel Zak 0efd951c80 fdisk: add 'F' command to list free unpartitioned space
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-28 15:53:42 +02:00
Karel Zak 5989556ad3 libfdisk: add new API to read label specific data
* removes list() label operation from internal API

  The list() has been based on fdisk_info() it was useless for
  anything else than print on stdout...

* add a new get_item() label operation and fdisk_get_disklabel_item() public API

  The new API provides abstract and pretty simple way how to get label
  specific disk label information, for example

     fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ENTRIESLBA, &iterm);

  return LBA of the array with GPT entries.

  Note that this patch does not implement public functions to get
  data from the @item object.

* removes get_id() label operation -- it's subset of the new get_item()

* the new internal API is also used to implement backwardly compatible
  fdisk_list_disklabel() and fdisk_get_disklabel_id()

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-11 14:19:47 +02:00
Karel Zak 40b175084f lib/strutils: fix string_add_to_idarray() int vs. size_t
The function uses "int" as argument, but for array size (and index) is better
to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk)
and "int" in lib/strutils.c then result is unexpected behavior on
ppc64.

	# sfdisk --list -o DEVICE,START,SIZE /dev/sdb
	Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors
	Units: sectors of 1 * 512 = 512 bytes
	Sector size (logical/physical): 512 bytes / 4096 bytes
	I/O size (minimum/optimal): 4096 bytes / 32768 bytes
	Disklabel type: gpt
	Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539
	lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed.

The patch cleanup all code to use size_t everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 11:08:05 +02:00
Karel Zak 622be27845 fdisk, sfdisk: fix -o <list> backend
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-04-22 10:20:31 +02:00
Benno Schulenberg 9ac1fcf6c5 sfdisk: actually translate the table headers by calling gettext()
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 10:57:07 +01:00
Benno Schulenberg 54fefa078e textual: fix spellos and inconsistencies in several program messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:17:55 +01:00
Karel Zak c747564764 fdisk: fix and improve -l warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-07 10:42:49 +01:00
Karel Zak ecf40cda76 libfdisk: make it possible to use zero for size and start
The zero may be valid size and start of the partition. This patch
introduces:

	fdisk_partition_has_start()
	fdisk_partition_has_size()
	fdisk_partition_unset_size()
	fdisk_partition_unset_start()

to make it possible to work with zero. The feature is internally
implemented by magic constant ((type) -1) for undefined sizes and
offsets.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-15 12:17:40 +02:00
Karel Zak 6d812a4859 fdisk: reset cached output fields when change disk label
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:03:32 +02:00
Karel Zak f5aa7b613d fdisk: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak fff8ad5882 fdisk: add --output <list> for print command(s)
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:32 +02:00
Karel Zak d2c47697e1 sfdisk: add --verify
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:31 +02:00
Karel Zak d464e2f0f9 fdisk: refactor /proc/partitions usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:31 +02:00
Karel Zak 152788aacb fdisk: improve --list output
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:30 +02:00