summaryrefslogtreecommitdiffstats
path: root/common/cmd_jffs2.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2006-10-28 15:55:52 +0200
committerStefan Roese <sr@denx.de>2006-10-28 17:11:10 +0200
commit856f054410cef52d868feb330168b2a4c4091328 (patch)
tree75995d4bfa2f99852917e5ca035406dd91f6953f /common/cmd_jffs2.c
parent07a69a18c2ecfda904231fdf23e2523ea7792eb6 (diff)
downloadblackbird-obmc-uboot-856f054410cef52d868feb330168b2a4c4091328.tar.gz
blackbird-obmc-uboot-856f054410cef52d868feb330168b2a4c4091328.zip
[PATCH] NAND: Partition name support added to NAND subsystem
chpart, nboot and NAND subsystem related commands now accept also partition name to specify offset. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common/cmd_jffs2.c')
-rw-r--r--common/cmd_jffs2.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index b5fd41724f..7fd1fa33da 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -1300,7 +1300,7 @@ static void list_partitions(void)
* Given partition identifier in form of <dev_type><dev_num>,<part_num> find
* corresponding device and verify partition number.
*
- * @param id string describing device and partition
+ * @param id string describing device and partition or partition name
* @param dev pointer to the requested device (output)
* @param part_num verified partition number (output)
* @param part pointer to requested partition (output)
@@ -1309,11 +1309,23 @@ static void list_partitions(void)
int find_dev_and_part(const char *id, struct mtd_device **dev,
u8 *part_num, struct part_info **part)
{
+ struct list_head *dentry, *pentry;
u8 type, dnum, pnum;
const char *p;
DEBUGF("--- find_dev_and_part ---\nid = %s\n", id);
+ list_for_each(dentry, &devices) {
+ *part_num = 0;
+ *dev = list_entry(dentry, struct mtd_device, link);
+ list_for_each(pentry, &(*dev)->parts) {
+ *part = list_entry(pentry, struct part_info, link);
+ if (strcmp((*part)->name, id) == 0)
+ return 0;
+ (*part_num)++;
+ }
+ }
+
p = id;
*dev = NULL;
*part = NULL;
OpenPOWER on IntegriCloud