[PATCH 4/8] devfs-core: add function to find cdev by partuuid
Steffen Trumtrar
s.trumtrar at pengutronix.de
Wed Jul 5 03:56:33 PDT 2017
Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
---
fs/devfs-core.c | 14 ++++++++++++++
include/driver.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 3368d3ed68bd..be56edd18d80 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -95,6 +95,20 @@ struct cdev *cdev_by_device_node(struct device_node *node)
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 3d701f24398a..8617872053d8 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -472,6 +472,7 @@ struct cdev *cdev_by_name(const char *filename);
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);
--
2.11.0
More information about the barebox
mailing list