Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=280cc1fe654c5f74906e50ae2b43f5a33303770c
commit 280cc1fe654c5f74906e50ae2b43f5a33303770c Author: James Buren <[email protected]> Date: Wed Sep 26 17:16:42 2012 -0500 add some more disk_open code diff --git a/src/block.c b/src/block.c index 8884480..660ddce 100644 --- a/src/block.c +++ b/src/block.c @@ -28,7 +28,7 @@ enum disktype struct partition { struct disk *disk; - char number; + int number; long long start; long long size; long long end; @@ -46,7 +46,8 @@ struct disk enum disktype type; unsigned int dosuuid; char gptuuid[37]; - struct partition table[129]; + struct partition table[128]; + int size; }; static inline bool isdisk(const struct stat *st) @@ -185,7 +186,7 @@ extern void device_close(struct device *device) free(device); } -extern struct disk *disk_open(const struct device *device) +extern struct disk *disk_open(struct device *device) { int fd = -1; blkid_probe probe = 0; @@ -196,6 +197,7 @@ extern struct disk *disk_open(const struct device *device) int i = 0; int j = 0; blkid_partition partition = 0; + struct disk *result = 0; if(device == 0) { @@ -233,6 +235,8 @@ extern struct disk *disk_open(const struct device *device) goto bail; } + disk.device = device; + if(strcmp(label,"dos") == 0) disk.type = DISKTYPE_DOS; else if(strcmp(label,"gpt") == 0) @@ -286,8 +290,15 @@ extern struct disk *disk_open(const struct device *device) continue; } } + + disk.size = j; } + result = memdup(&disk,sizeof(struct disk)); + + for( i = 0 ; i < j ; ++i ) + result->table[i].disk = result; + bail: if(fd != -1) _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
