X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fpart.h;h=419c85970886041bf5b5b31947c69cec627ce2a0;hb=49c8ef0e45a91ec894ef15e7d043dafe8f1c5efd;hp=fac36364bd4b544a64e77be884154cfc8dfd9d5c;hpb=14ea1b3635b4af8d9e283e3671f7ee872d50b859;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/part.h b/include/part.h index fac3636..419c859 100644 --- a/include/part.h +++ b/include/part.h @@ -9,6 +9,7 @@ #include #include #include +#include #include struct block_drvr { @@ -226,12 +227,16 @@ int part_get_info_by_name(struct blk_desc *dev_desc, * @param[in] dev_part_str Input partition description, like "0#misc" or "0:1" * @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 a negative on error + * @param[in] allow_whole_dev true to allow the user to select partition 0 + * (which means the whole device), false to require a valid + * partition number >= 1 + * @return the partition number on success, or negative errno on error */ int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, struct blk_desc **dev_desc, - struct disk_partition *part_info); + struct disk_partition *part_info, + int allow_whole_dev); /** * part_set_generic_name() - create generic partition like hda1 or sdb2 @@ -270,6 +275,16 @@ static inline int blk_get_device_part_str(const char *ifname, struct disk_partition *info, int allow_whole_dev) { *dev_desc = NULL; return -1; } +static inline int +part_get_info_by_dev_and_name_or_num(const char *dev_iface, + const char *dev_part_str, + struct blk_desc **dev_desc, + struct disk_partition *part_info, + int allow_whole_dev) +{ + *dev_desc = NULL; + return -ENOSYS; +} #endif /* @@ -481,5 +496,33 @@ int layout_mbr_partitions(struct disk_partition *p, int count, #endif +#ifdef CONFIG_PARTITIONS +/** + * part_driver_get_count() - get partition driver count + * + * @return - number of partition drivers + */ +static inline int part_driver_get_count(void) +{ + return ll_entry_count(struct part_driver, part_driver); +} + +/** + * part_driver_get_first() - get first partition driver + * + * @return - pointer to first partition driver on success, otherwise NULL + */ +static inline struct part_driver *part_driver_get_first(void) +{ + return ll_entry_start(struct part_driver, part_driver); +} + +#else +static inline int part_driver_get_count(void) +{ return 0; } + +static inline struct part_driver *part_driver_get_first(void) +{ return NULL; } +#endif /* CONFIG_PARTITIONS */ #endif /* _PART_H */