diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2012-04-26 13:36:02 -0300 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-04-29 19:15:08 +0200 |
commit | b27ee00bf5e377a4b59b454c68c8617ea9666bc8 (patch) | |
tree | c4305be00b117607bdc0561d2a97dadc204107bb /src/udev/udevd.c | |
parent | c4326aa4af424ada8ab9e6fe77035db1cf222ffa (diff) |
udev: use container_of() macro
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 59e2cfac6b..0d85960e63 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -99,13 +99,9 @@ struct event { int ifindex; }; -static struct event *node_to_event(struct udev_list_node *node) +static inline struct event *node_to_event(struct udev_list_node *node) { - char *event; - - event = (char *)node; - event -= offsetof(struct event, node); - return (struct event *)event; + return container_of(node, struct event, node); } static void event_queue_cleanup(struct udev *udev, enum event_state type); @@ -134,13 +130,9 @@ struct worker_message { int exitcode; }; -static struct worker *node_to_worker(struct udev_list_node *node) +static inline struct worker *node_to_worker(struct udev_list_node *node) { - char *worker; - - worker = (char *)node; - worker -= offsetof(struct worker, node); - return (struct worker *)worker; + return container_of(node, struct worker, node); } static void event_queue_delete(struct event *event, bool export) |