Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=2634b7ad00d2f256c16f927a1e29626c3e7203b8
commit 2634b7ad00d2f256c16f927a1e29626c3e7203b8 Author: James Buren <[email protected]> Date: Wed Aug 15 16:08:19 2012 -0500 add function for converting from device independent block size to device dependent sector count diff --git a/fwsetup.h b/fwsetup.h index ea7a393..79b9414 100644 --- a/fwsetup.h +++ b/fwsetup.h @@ -141,6 +141,7 @@ extern struct device *device_read_data(const char *path); extern bool device_write_data(const struct device *device); extern void device_create_partition_table(struct device *device,const char *label); extern bool device_remove_partition(struct device *device,unsigned long long n); +extern unsigned long long device_size_to_sectors(const struct device *device,unsigned long long size); extern void device_free(struct device *device); extern int main(void); extern struct module begin_module; diff --git a/utility.c b/utility.c index 56274bf..adca360 100644 --- a/utility.c +++ b/utility.c @@ -729,6 +729,13 @@ extern bool device_remove_partition(struct device *device,unsigned long long n) return (part != 0); } +extern unsigned long long device_size_to_sectors(const struct device *device,unsigned long long size) +{ + ASSERT_ARGS(device == 0 || size == 0,0); + + return (size / device->logical_sector_size); +} + extern void device_free(struct device *device) { if(device == 0) _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
