Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=520154ca0d74d27d2818dd0609caf90ecc7c126c
commit 520154ca0d74d27d2818dd0609caf90ecc7c126c Author: James Buren <[email protected]> Date: Mon Aug 13 00:12:27 2012 -0500 cache the partition number and partition type number/string diff --git a/fwsetup.h b/fwsetup.h index 009ca1d..dc2300f 100644 --- a/fwsetup.h +++ b/fwsetup.h @@ -84,10 +84,15 @@ struct partition struct partition *prev; struct partition *next; char *name; + uint64_t num; uint64_t start; uint64_t end; uint64_t sectors; - uint16_t type; + union + { + uint8_t type_n; + char *type_s; + }; }; struct device diff --git a/utility.c b/utility.c index cf0c55a..3556ece 100644 --- a/utility.c +++ b/utility.c @@ -220,9 +220,12 @@ extern struct device *read_device_data(const char *path) int j = 0; blkid_partition partition = 0; struct partition *partitions = 0; + int partnum = 0; const char *partname = 0; blkid_loff_t partstart = 0; blkid_loff_t partsize = 0; + int parttype_n = 0; + const char *parttype_s = 0; memzero(&st,sizeof(struct stat)); @@ -285,12 +288,20 @@ extern struct device *read_device_data(const char *path) { partitions = list_append(partitions,sizeof(struct partition)); + partnum = blkid_partition_get_partno(partition); + partname = blkid_partition_get_name(partition); partstart = blkid_partition_get_start(partition); partsize = blkid_partition_get_size(partition); + parttype_n = blkid_partition_get_type(partition); + + parttype_s = blkid_partition_get_type_string(partition); + + partitions->num = partnum; + partitions->name = (partname != 0) ? strdup(partname) : 0; partitions->start = partstart; @@ -299,7 +310,10 @@ extern struct device *read_device_data(const char *path) partitions->sectors = partsize; - partitions->type = 0; + if(strcmp(label,"dos") == 0) + partitions->type_n = parttype_n; + else if(strcmp(label,"gpt") == 0) + partitions->type_s = strdup(parttype_s); ++i; } _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
