diff --git a/common/partitions.c b/common/partitions.c index 69a2b1fe..574b31f 100644 --- a/common/partitions.c +++ b/common/partitions.c @@ -63,6 +63,8 @@ goto out; } + cdev->flags |= DEVFS_PARTITION_FROM_TABLE; + cdev->dos_partition_type = part->dos_partition_type; strcpy(cdev->partuuid, part->partuuid); diff --git a/drivers/of/partition.c b/drivers/of/partition.c index e66b6cc..25b41cb 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -140,6 +140,8 @@ return -EINVAL; list_for_each_entry(partcdev, &cdev->partitions, partition_entry) { + if (partcdev->flags & DEVFS_PARTITION_FROM_TABLE) + continue; n_parts++; } @@ -191,12 +193,14 @@ list_for_each_entry(partcdev, &cdev->partitions, partition_entry) { int na, ns, len = 0; - char *name = basprintf("partition@%0llx", - partcdev->offset); + char *name; void *p; u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */ loff_t partoffset; + if (partcdev->flags & DEVFS_PARTITION_FROM_TABLE) + continue; + if (partcdev->mtd) partoffset = partcdev->mtd->master_offset; else diff --git a/include/driver.h b/include/driver.h index 2af66fe..52e06f7 100644 --- a/include/driver.h +++ b/include/driver.h @@ -484,6 +484,7 @@ #define DEVFS_PARTITION_FIXED (1U << 0) #define DEVFS_PARTITION_READONLY (1U << 1) #define DEVFS_IS_CHARACTER_DEV (1 << 3) +#define DEVFS_PARTITION_FROM_TABLE (1 << 4) struct cdev *devfs_add_partition(const char *devname, loff_t offset, loff_t size, unsigned int flags, const char *name);