X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=disk%2Fpart.c;h=f6a31025dc8a0a1a1a484105285ae060b8765b2d;hb=406df85345f942d9348443983d81a01e013e920b;hp=8982ef3baed129f13ed8936eecb2380a334c9b0b;hpb=60f38d82c45fef55ac04ee52b234e6dd07e31935;p=oweals%2Fu-boot.git diff --git a/disk/part.c b/disk/part.c index 8982ef3bae..f6a31025dc 100644 --- a/disk/part.c +++ b/disk/part.c @@ -5,10 +5,12 @@ */ #include +#include #include #include #include #include +#include #include #include #include @@ -104,17 +106,18 @@ typedef lbaint_t lba512_t; #endif /* - * Overflowless variant of (block_count * mul_by / 2**div_by) - * when div_by > mul_by + * Overflowless variant of (block_count * mul_by / 2**right_shift) + * when 2**right_shift > mul_by */ -static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by, int div_by) +static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by, + int right_shift) { lba512_t bc_quot, bc_rem; /* x * m / d == x / d * m + (x % d) * m / d */ - bc_quot = block_count >> div_by; - bc_rem = block_count - (bc_quot << div_by); - return bc_quot * mul_by + ((bc_rem * mul_by) >> div_by); + bc_quot = block_count >> right_shift; + bc_rem = block_count - (bc_quot << right_shift); + return bc_quot * mul_by + ((bc_rem * mul_by) >> right_shift); } void dev_print (struct blk_desc *dev_desc) @@ -317,7 +320,7 @@ void part_print(struct blk_desc *dev_desc) #endif /* CONFIG_HAVE_BLOCK_DEVICE */ int part_get_info(struct blk_desc *dev_desc, int part, - disk_partition_t *info) + struct disk_partition *info) { #ifdef CONFIG_HAVE_BLOCK_DEVICE struct part_driver *drv; @@ -350,7 +353,8 @@ int part_get_info(struct blk_desc *dev_desc, int part, return -1; } -int part_get_info_whole_disk(struct blk_desc *dev_desc, disk_partition_t *info) +int part_get_info_whole_disk(struct blk_desc *dev_desc, + struct disk_partition *info) { info->start = 0; info->size = dev_desc->lba; @@ -430,7 +434,7 @@ cleanup: #define PART_AUTO -1 int blk_get_device_part_str(const char *ifname, const char *dev_part_str, struct blk_desc **dev_desc, - disk_partition_t *info, int allow_whole_dev) + struct disk_partition *info, int allow_whole_dev) { int ret = -1; const char *part_str; @@ -440,7 +444,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, char *ep; int p; int part; - disk_partition_t tmpinfo; + struct disk_partition tmpinfo; #ifdef CONFIG_SANDBOX /* @@ -645,7 +649,7 @@ cleanup: } int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name, - disk_partition_t *info, int part_type) + struct disk_partition *info, int part_type) { struct part_driver *part_drv; int ret; @@ -670,7 +674,7 @@ int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name, } int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, - disk_partition_t *info) + struct disk_partition *info) { return part_get_info_by_name_type(dev_desc, name, info, PART_TYPE_ALL); } @@ -692,7 +696,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, static int part_get_info_by_dev_and_name(const char *dev_iface, const char *dev_part_str, struct blk_desc **dev_desc, - disk_partition_t *part_info) + struct disk_partition *part_info) { char *ep; const char *part_str; @@ -724,7 +728,7 @@ static int part_get_info_by_dev_and_name(const char *dev_iface, int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, struct blk_desc **dev_desc, - disk_partition_t *part_info) + struct disk_partition *part_info) { /* Split the part_name if passed as "$dev_num#part_name". */ if (!part_get_info_by_dev_and_name(dev_iface, dev_part_str,