diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2015-03-28 02:42:02 +0100 |
---|---|---|
committer | Thomas Backlund <tmb@mageia.org> | 2015-03-30 15:05:42 +0259 |
commit | 0adf9412b786342346a9df9fd262765d6b97d38f (patch) | |
tree | cee36654909e2452e8d07678ee333e15ae4e25ec /perl-install/c/stuff.xs.pl | |
parent | 6da0111e315928dd9d42494ea3c0d5c208a1f411 (diff) | |
download | drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar.gz drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar.bz2 drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar.xz drakx-0adf9412b786342346a9df9fd262765d6b97d38f.zip |
try to detect recovery partitions on GPT
Diffstat (limited to 'perl-install/c/stuff.xs.pl')
-rwxr-xr-x | perl-install/c/stuff.xs.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 9a983a493..9d8c11375 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -591,6 +591,31 @@ get_iso_volume_ids(int fd) print ' int +is_recovery_partition(char * device_path, int part_number) + CODE: + PedDevice *dev = ped_device_get(device_path); + RETVAL = 0; + if(dev) { + PedDisk* disk = ped_disk_new(dev); + if(disk) { + PedPartition* part = ped_disk_get_partition(disk, part_number); + if (!part) { + printf("is_recovery_partition: failed to find partition\n"); + } else { + /* FIXME: not sure everything is covered ... */ + RETVAL=ped_partition_get_flag(part, PED_PARTITION_HPSERVICE) // HP-UX service partition + || ped_partition_get_flag(part, PED_PARTITION_MSFT_RESERVED) // Microsoft Reserved Partition -> LDM metadata, ... + || ped_partition_get_flag(part, PED_PARTITION_DIAG) // ==> PARTITION_MSFT_RECOVERY (Windows Recovery Environment) + || ped_partition_get_flag(part, PED_PARTITION_APPLE_TV_RECOVERY) + || ped_partition_get_flag(part, PED_PARTITION_HIDDEN); + } + ped_disk_destroy(disk); + } + } + OUTPUT: + RETVAL + +int get_partition_flag(char * device_path, int part_number, char *type) CODE: PedDevice *dev = ped_device_get(device_path); |