[U-Boot] [PATCH 2/7] disk: part: Extend API to get partition info

Simon Glass sjg at chromium.org
Thu Dec 6 01:31:09 UTC 2018


Hi Ruslan,

On Tue, 27 Nov 2018 at 12:57, Ruslan Trofymenko
<ruslan.trofymenko at linaro.org> wrote:
>
> This patch adds part_get_info_by_dev_and_name_or_num() function which
> allows us to get partition info from its number or name. Partition of
> interest is specified by string like "device_num:partition_number" or
> "device_num#partition_name".
>
> The patch was extracted from [1].
>
> [1] https://android-review.googlesource.com/c/platform/external/u-boot/+/729880/2
>
> Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko at linaro.org>
> ---
>  disk/part.c    | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/part.h | 21 ++++++++++++++++++
>  2 files changed, 89 insertions(+)
>
> diff --git a/disk/part.c b/disk/part.c
> index f30f9e9..ad4239d 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -675,6 +675,74 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
>         return part_get_info_by_name_type(dev_desc, name, info, PART_TYPE_ALL);
>  }
>
> +/**
> + * Get partition info from device number and partition name.
> + *
> + * Parse a device number and partition name string in the form of
> + * "device_num#partition_name", for example "0#misc". If the partition
> + * is found, sets dev_desc and part_info accordingly with the information
> + * of the partition with the given partition_name.
> + *
> + * @param[in] dev_iface Device interface
> + * @param[in] dev_part_str Input string argument, like "0#misc"
> + * @param[out] dev_desc Place to store the device description pointer
> + * @param[out] part_info Place to store the partition information
> + * @return 0 on success, or -1 on error

Can you please return an error like -EINVAL? -1 is defined as -EPERM
whcih seems wrong.

Regards,
Simon


More information about the U-Boot mailing list