diff --git a/fs/devfs-core.c b/fs/devfs-core.c index 3368d3e..be56edd 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -95,6 +95,20 @@ return NULL; } +struct cdev *cdev_by_partuuid(const char *partuuid) +{ + struct cdev *cdev; + + if (!partuuid) + return NULL; + + list_for_each_entry(cdev, &cdev_list, list) { + if (!strcmp(cdev->partuuid, partuuid)) + return cdev; + } + return NULL; +} + /** * device_find_partition - find a partition belonging to a physical device * diff --git a/include/driver.h b/include/driver.h index 3d701f2..8617872 100644 --- a/include/driver.h +++ b/include/driver.h @@ -472,6 +472,7 @@ struct cdev *lcdev_by_name(const char *filename); struct cdev *cdev_readlink(struct cdev *cdev); struct cdev *cdev_by_device_node(struct device_node *node); +struct cdev *cdev_by_partuuid(const char *partuuid); struct cdev *cdev_open(const char *name, unsigned long flags); struct cdev *cdev_create_loop(const char *path, ulong flags); void cdev_remove_loop(struct cdev *cdev);