GNOME Bugzilla – Bug 788308
Remove whole_device partition flag
Last modified: 2017-10-10 17:24:46 UTC
Patchset justification verbatim from one of the commit messages. --8<-- When unpartitioned drive read-write support was added this commit added a whole_device flag: Add whole_device flag to the partition object (#743181) https://git.gnome.org/browse/gparted/commit/?id=5098744f9aa958ba18d2a4657ea4345e275c885b Using a whole_device flags now seems not the correct way to model unpartitioned drives. GParted models an uninitialised drive as: .path = _("uninitialized") .type = TYPE_UNALLOCATED .whole_device = true .filesystem = FS_UNALLOCATED and a whole drive file system, using ext4 for example, as: .path = "/dev/sdb" .type = TYPE_PRIMARY .whole_device = true .filesystem = FS_EXT4 No partitioning changed yet the type of the partition in the model changed between TYPE_UNALLOCATED and TYPE_PRIMARY depending on whether the whole drive contains a recognised file system or not. The partition object describing a file system within a LUKS encryption mapping is another case of the model not matching reality. .path = /dev/mapper/crypt_sdb1_crypt .type = TYPE_PRIMARY .whole_device = true .filesystem = FS_EXT4 There is no partition table within the encryption mapping, the file system fills it, but GParted records it as a primary partition. Make TYPE_UNALLOCATED and TYPE_PRIMARY be reserved for representing unallocated space and primary partitions within a partitioned disk drive and introduce new TYPE_UNPARTITIONED for all cases of an unpartitioned whole disk drive. The GParted UI does differentiate between an unallocated whole disk device and anything else by requiring a partition table to be created first, even if that is just the loop partition table. That determination can simply look for the partition object containing file system type FS_UNALLOCATED instead.
Created attachment 360697 [details] [review] Remove whole_device partition flag (v1) Hi Curtis, Here's the patchset for this. This can either go before or after the GParted 0.30.0 release. Thanks, Mike
Hi Mike, I've just starting reviewing this patch set with an eye towards including it before our next GParted release. On minor issue I noticed was an incomplete sentence in the first patch commit message: P1/13 Add and use Partition::set_unpartitioned() method (#788308) This patch ^^^^^^ I will move onto testing the patch set next. Curtis
Hi Curtis, These lines in P1/13 commit message are separated by preceding and following lines and should be understood to be sub-headings: Patchset overview This patch Feel free to edit the message to make them more like headings. E.g. append with colon. However don't underline them with single dashes as double dash separates the commit message from the start of the diff in a GIT patch file. Thanks, Mike
Thanks Mike for the clarification and the heads up about underlining with single dashes. I might make these uppercase with a colon at the end to make the titles stand out. Curtis
Thank you Mike for this patch set. My testing of whole disk device along with partition tables has gone well and I have not discovered any regressions. Patch set v1 from comment #1 has been committed to the git repository. The relevant git commits can be viewed at the following links: Add and use Partition::set_unpartitioned() method (#788308) https://git.gnome.org/browse/gparted/commit/?id=400864a65e1bd270f326617536fac4597a25b033 Remove some unnecessary extended partition checks from GParted_Core (#788308) https://git.gnome.org/browse/gparted/commit/?id=326df46af2a3e0474273d610a14bdeb6fb37aa5f Add FILESYSTEM_MAP[FS_EXTENDED] entry https://git.gnome.org/browse/gparted/commit/?id=59185b133ce006e01c390be53581398a0a7ee7bf Update partition related checks in set_valid_operations() (#788308) https://git.gnome.org/browse/gparted/commit/?id=24123c4298f8b468ac94d2dd83d0c632a1555ab1 Add TYPE_UNPARTITIONED partition type (#788308) https://git.gnome.org/browse/gparted/commit/?id=c10d80a2956c688b397ff561ada673b9e9102bee Switch from whole_device flag to TYPE_UNPARTITIONED (#788308) https://git.gnome.org/browse/gparted/commit/?id=ea269cc9294731a1d6a24610b8404441c14aca8b Display unrecognised whole disk devices as all grey again (#788308) https://git.gnome.org/browse/gparted/commit/?id=d5a20697c86d6b485b003f270599a20ffb25c482 Select unallocated whole disk devices again (#788308) https://git.gnome.org/browse/gparted/commit/?id=fa5ed1fb90d1dd23e9a23b6719a0d567ef8d85f0 Allow Partition > New on unallocated whole disk devices again (#788308) https://git.gnome.org/browse/gparted/commit/?id=b1967e72114a8d9da257ef3d99023c3bf444d2f3 Disallow formatting of unrecognised whole disk devices again (#788308) https://git.gnome.org/browse/gparted/commit/?id=c1807ca504271cf4380abcfb1d55e5da61605935 Restore Information dialog display of whole disk devices (#788308) https://git.gnome.org/browse/gparted/commit/?id=bcd03e5c41c5257fbd9b3faf502c5f40e7fbbffd Calibrate whole disk device partitions again (#788308) https://git.gnome.org/browse/gparted/commit/?id=12dcebcb4787a7046464509e51388e7edc0a1694 Extract common code into new method get_lp_partition() https://git.gnome.org/browse/gparted/commit/?id=33a535390e00cf7de42ba2046e1a7093f426159f Curtis
This enhancement was included in the GParted 0.30.0 release on October 10, 2017.