[parted-devel] [PATCH 0/3] Rework parted-print, make it more useful with empty disk.

Petr Uzel petr.uzel at suse.cz
Fri Mar 11 12:49:58 UTC 2011


'parted print $dev' does not give any useful information for a device without a
disk label, even the informations which are not dependent on the label
(geometry, size, sector size etc.). This is an attempt to make 'parted print'
more useful with an empty disk.

This series is based on feedback I got for the first 'always print geometry'
patches:

http://www.mail-archive.com/parted-devel@lists.alioth.debian.org/msg03022.html


Before:

modprobe scsi_debug
./parted -s /dev/sdd print
   Error: /dev/sdd: unrecognised disk label

After:

./parted -s /dev/sdd print
  Error: /dev/sdd: unrecognised disk label
  Model: Linux scsi_debug (scsi)
  Disk /dev/sdd: 8389kB
  Sector size (logical/physical): 512B/512B
  Partition Table: unknown

I would like to suppress the 'Error: /dev/sdX: unrecognised disk label" in the
output, but I don't know how to achieve that. I know I could catch the
exceptions (ped_exception_fetch_all()) from ped_disk_new(), but this in turn
disables some other error messages from ped_disk_new(), that should not be
suppressed, e.g. the 'Error: The primary GPT table is corrupt, but the backup
appears OK'. Any idea how to suppress this particular error message only when
called from do_print?

Thanks,

	Petr


Petr Uzel (3):
  parted: factor out disk geometry printing into separate function
  parted: rework 'parted print' so that it works with empty disk
  tests: test 'parted print' with empty disk

 NEWS                       |    4 +
 parted/parted.c            |  161 ++++++++++++++++++++++++--------------------
 tests/Makefile.am          |    1 +
 tests/t0101-print-empty.sh |   47 +++++++++++++
 4 files changed, 141 insertions(+), 72 deletions(-)
 create mode 100755 tests/t0101-print-empty.sh

-- 
1.7.3.4




More information about the parted-devel mailing list