bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ped_partition_get_path with LUKS


From: Matthias Gehre
Subject: ped_partition_get_path with LUKS
Date: Mon, 3 Sep 2012 10:39:17 +0200

Hello list,

thanks for this very nice piece of software!
While working on gparted, I encountered a bug in ped_partition_get_path
for LUKS mappings on latest git (0406b2ce).

Using the code
#include <parted/parted.h>

int main(int argc, char* argv[]) {

    printf("Opening %s\n",argv[1]);
    PedDevice* device = ped_device_get(argv[1]);
    PedDisk* disk = ped_disk_new(device);
    PedPartition* partition = ped_disk_next_partition( disk, NULL ) ;
    printf("Partition path: %s\n", ped_partition_get_path(partition));
}
like
> ./test /dev/mapper/_dev_dm_1
outputs
Opening /dev/mapper/_dev_dm_1
Partition path: /dev/mapper/_dev_dm_1p1

But actually the partition path should be "/dev/mapper/_dev_dm_1",
because this is the LUKS block
device where the virtual first "partition" is. There is no
/dev/mapper/_dev_dm_1p1 device.

More info:
> sudo parted /dev/mapper/_dev_dm_1
GNU Parted 2.3
Using /dev/mapper/_dev_dm_1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/_dev_dm_1: 193GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0,00B  193GB  193GB  ext4

Best wishes
Matthias Gehre



reply via email to

[Prev in Thread] Current Thread [Next in Thread]