Patchwork [04/24] petitboot: Add udev trigger

login
register
mail settings
Submitter Geoff Levand
Date April 13, 2009, 1:11 a.m.
Message ID <20090413011136.787134536@am.sony.com>
Download mbox | patch
Permalink /patch/25873/
State Accepted
Headers show

Comments

Geoff Levand - April 13, 2009, 1:11 a.m.
Add a new routine udev_trigger() that requests a replay of
system udev events.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 discover/pb-discover.c |    2 ++
 discover/udev.c        |   10 ++++++++++
 discover/udev.h        |    1 +
 3 files changed, 13 insertions(+)

Patch

--- a/discover/pb-discover.c
+++ b/discover/pb-discover.c
@@ -52,6 +52,8 @@  int main(void)
 	if (!udev)
 		return EXIT_FAILURE;
 
+	udev_trigger(udev);
+
 	for (running = 1; running;) {
 		if (waiter_poll())
 			break;
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -208,6 +208,16 @@  out_err:
 	return NULL;
 }
 
+int udev_trigger(struct udev __attribute__((unused)) *udev)
+{
+	int rc = system("/sbin/udevadm trigger --subsystem-match=block");
+
+	if (rc)
+		pb_log("udev trigger failed: %d (%d)\n", rc, WEXITSTATUS(rc));
+
+	return WEXITSTATUS(rc);
+}
+
 void udev_destroy(struct udev *udev)
 {
 	talloc_free(udev);
--- a/discover/udev.h
+++ b/discover/udev.h
@@ -21,6 +21,7 @@  struct udev;
 struct device_handler;
 
 struct udev *udev_init(struct device_handler *handler);
+int udev_trigger(struct udev *udev);
 
 void udev_destroy(struct udev *udev);