9
0
Fork 0

cdev: introduce partition names

currently most partition cdevs have the name <devname>.<partname>
This makes it hard to find a partition by <partname>. This introduces
a partname field in struct cdev so that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-07-10 08:27:41 +02:00
parent abf95154f5
commit bec70b3aaa
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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;