summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/devfs-core.c3
-rw-r--r--include/driver.h5
2 files changed, 7 insertions, 1 deletions
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index a16866eab9..a2bea93ed6 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -244,6 +244,8 @@ struct cdev *devfs_add_partition(const char *devname, loff_t offset, loff_t size
new = xzalloc(sizeof (*new));
new->name = strdup(name);
+ if (!strncmp(devname, name, strlen(devname)))
+ new->partname = xstrdup(name + strlen(devname) + 1);
new->ops = cdev->ops;
new->priv = cdev->priv;
new->size = size;
@@ -291,6 +293,7 @@ int devfs_del_partition(const char *name)
return ret;
free(cdev->name);
+ free(cdev->partname);
free(cdev);
return 0;
diff --git a/include/driver.h b/include/driver.h
index 9f114fff58..353af3a0cb 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -444,7 +444,10 @@ struct cdev {
struct device_d *dev;
struct list_head list;
struct list_head devices_list;
- char *name;
+ char *name; /* filename under /dev/ */
+ char *partname; /* the partition name, usually the above without the
+ * device part, i.e. name = "nand0.barebox" -> partname = "barebox"
+ */
loff_t offset;
loff_t size;
unsigned int flags;