diff options
author | Rob Herring <rob.herring@calxeda.com> | 2012-09-21 04:08:17 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-09-25 14:44:40 -0700 |
commit | 99d2c205d4a151faf5f9a406316b9dd960f43475 (patch) | |
tree | 8c25f66afa7eae3879f134ff8bc8bdd62fc22203 /include | |
parent | 40e0e5686accd2f7ae7fd81297620d0e132624d9 (diff) | |
download | u-boot-imx-99d2c205d4a151faf5f9a406316b9dd960f43475.zip u-boot-imx-99d2c205d4a151faf5f9a406316b9dd960f43475.tar.gz u-boot-imx-99d2c205d4a151faf5f9a406316b9dd960f43475.tar.bz2 |
disk/part: introduce get_device_and_partition
All block device related commands (scsiboot, fatload, ext2ls, etc.) have
simliar duplicated device and partition parsing and selection code. This
adds a common function to replace various implementations.
The new function has an enhancement over current versions. If no device
or partition is specified on the command line, the bootdevice env variable
will be used (scsiboot does this).
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/part.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/part.h b/include/part.h index 447f69d..a6d06f3 100644 --- a/include/part.h +++ b/include/part.h @@ -98,7 +98,7 @@ typedef struct disk_partition { /* Misc _get_dev functions */ #ifdef CONFIG_PARTITIONS -block_dev_desc_t* get_dev(char* ifname, int dev); +block_dev_desc_t *get_dev(const char *ifname, int dev); block_dev_desc_t* ide_get_dev(int dev); block_dev_desc_t* sata_get_dev(int dev); block_dev_desc_t* scsi_get_dev(int dev); @@ -112,8 +112,12 @@ int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t void print_part (block_dev_desc_t *dev_desc); void init_part (block_dev_desc_t *dev_desc); void dev_print(block_dev_desc_t *dev_desc); +int get_device_and_partition(const char *ifname, const char *dev_str, + block_dev_desc_t **dev_desc, + disk_partition_t *info); #else -static inline block_dev_desc_t* get_dev(char* ifname, int dev) { return NULL; } +static inline block_dev_desc_t *get_dev(const char *ifname, int dev) +{ return NULL; } static inline block_dev_desc_t* ide_get_dev(int dev) { return NULL; } static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; } static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; } @@ -127,6 +131,11 @@ static inline int get_partition_info (block_dev_desc_t * dev_desc, int part, static inline void print_part (block_dev_desc_t *dev_desc) {} static inline void init_part (block_dev_desc_t *dev_desc) {} static inline void dev_print(block_dev_desc_t *dev_desc) {} +static inline int get_device_and_partition(const char *ifname, + const char *dev_str, + block_dev_desc_t **dev_desc, + disk_partition_t *info) +{ *dev_desc = NULL; return -1; } #endif #ifdef CONFIG_MAC_PARTITION |