From 8ec5cb448e1d5ad539c2ee5caf25e67f20d63391 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 27 Mar 2015 08:18:11 -0400 Subject: extract mapping string to flag needed for next commit --- perl-install/c/stuff.xs.pl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'perl-install/c') diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 662831bc9..95e0c0411 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -118,6 +118,16 @@ int length_of_space_padded(char *str, int len) { return len; } +PedPartitionFlag string_to_pedpartflag(char*type) { + PedPartitionFlag flag = 0; + if (!strcmp(type, "ESP")) { + flag = PED_PARTITION_ESP; + } else { + printf("set_partition_flag: unknown type"); + } + return flag; +} + MODULE = c::stuff PACKAGE = c::stuff '; @@ -608,12 +618,7 @@ set_partition_flag(char * device_path, int part_number, char *type) if (!part) { printf("set_partition_flag: failed to find partition\n"); } else { - PedPartitionFlag flag = 0; - if (!strcmp(type, "ESP")) { - flag = PED_PARTITION_ESP; - } else { - printf("set_partition_flag: unknown type\n"); - } + PedPartitionFlag flag = string_to_pedpartflag(type); if (flag) RETVAL=ped_partition_set_flag(part, flag, 1); if (RETVAL) -- cgit v1.2.1