diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-08-14 09:28:10 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-08-14 09:28:10 +0200 |
commit | 65778b63d2f0b6d5b3405010eedc72271bce20e0 (patch) | |
tree | c4c3e859387a3dce7da811edff04a3b79cb9f5fd /commands/partition.c | |
parent | 59f72431f42753e1f61bd19176eb67029e2ef77c (diff) | |
download | barebox-65778b63d2f0b6d5b3405010eedc72271bce20e0.tar.gz barebox-65778b63d2f0b6d5b3405010eedc72271bce20e0.tar.xz |
Partition: Add an own device id for partitions
Add an own device id for partitions. This is necessary to allow
the partition layer to check if the given device is really a partition.
Also, check for readonly flag in erase.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/partition.c')
-rwxr-xr-x | commands/partition.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/commands/partition.c b/commands/partition.c index dfc4e0d1aa..9148725522 100755 --- a/commands/partition.c +++ b/commands/partition.c @@ -41,10 +41,16 @@ static int dev_del_partitions(struct device_d *physdev) { struct device_d *child, *tmp; + struct partition *part; int ret; device_for_each_child_safe(physdev, tmp, child) { - struct partition *part = child->type_data; + if (child->type != DEVICE_TYPE_PARTITION) { + printf("not a partition: %s\n", child->id); + continue; + } + + part = child->type_data; if (part->flags & PARTITION_FIXED) { debug("Skip fixed partition: %s\n", child->id); @@ -191,6 +197,7 @@ static int do_addpart(cmd_tbl_t * cmdtp, int argc, char *argv[]) part->num = num; part->device.map_base = dev->map_base + offset; part->device.type_data = part; + part->device.type = DEVICE_TYPE_PARTITION; if (mtd_part_do_parse_one(part, endp, &endp)) goto free_out; |