summaryrefslogtreecommitdiffstats
path: root/discover/udev.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-04-02 14:08:26 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-04-02 14:08:26 +0800
commitedcfca78ac49793e295ac97328942321f39e3996 (patch)
tree3f92527eba90f27af3fd9fe533a0c490e7ad73ea /discover/udev.c
parent70fb2ec0af31c1d78c8655ef13f682d597921390 (diff)
downloadtalos-petitboot-edcfca78ac49793e295ac97328942321f39e3996.tar.gz
talos-petitboot-edcfca78ac49793e295ac97328942321f39e3996.zip
discover: move device sources to the device handler
Currently, the pb-discover main() function initialises the device handler and the device sources. We want to eventually be able to re-init the device sources, which will be initiated by the handler. In this case, the handler will need references to the sources. This change moves the creation of the device sources to be internal to the handler. This way, the device handler gets a reference to everything, without having to pass pointers around in main(). We also remove the _destroy functions, as we handle everything through talloc destructors, as all sources are parented to the handler. We also change user_event_init and udev_init to take the handler as the first ('context') argument, to make them consistent with network_init. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/udev.c')
-rw-r--r--discover/udev.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/discover/udev.c b/discover/udev.c
index 16e83d5..320dffd 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -425,12 +425,13 @@ static void udev_log_fn(struct udev __attribute__((unused)) *udev,
vfprintf(pb_log_get_stream(), format, args);
}
-struct pb_udev *udev_init(struct waitset *waitset,
- struct device_handler *handler)
+struct pb_udev *udev_init(struct device_handler *handler,
+ struct waitset *waitset)
{
+ struct pb_udev *udev;
int result;
- struct pb_udev *udev = talloc(NULL, struct pb_udev);
+ udev = talloc(handler, struct pb_udev);
talloc_set_destructor(udev, udev_destructor);
udev->handler = handler;
@@ -468,8 +469,3 @@ fail_new:
talloc_free(udev);
return NULL;
}
-
-void udev_destroy(struct pb_udev *udev)
-{
- talloc_free(udev);
-}
OpenPOWER on IntegriCloud