discover: Separate temporary and permanent device data
[petitboot] / discover / device-handler.h
1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
3
4 #include <list/list.h>
5
6 struct device_handler;
7 struct discover_device;
8 struct discover_server;
9 struct boot_option;
10 struct boot_command;
11 struct event;
12 struct device;
13
14 struct discover_device {
15         struct device           *device;
16
17         char                    **links;
18         int                     n_links;
19
20         char                    *mount_path;
21         char                    *device_path;
22 };
23
24 struct discover_context {
25         struct event            *event;
26         struct discover_device  *device;
27         struct list             boot_options;
28 };
29
30 struct device_handler *device_handler_init(struct discover_server *server,
31                 int dry_run);
32
33 void device_handler_destroy(struct device_handler *devices);
34
35 int device_handler_get_device_count(const struct device_handler *handler);
36 const struct device *device_handler_get_device(
37         const struct device_handler *handler, unsigned int index);
38
39 struct device *discover_context_device(struct discover_context *ctx);
40 void discover_context_add_boot_option(struct discover_context *ctx,
41                 struct boot_option *opt);
42
43 int device_handler_event(struct device_handler *handler, struct event *event);
44
45 void device_handler_boot(struct device_handler *handler,
46                 struct boot_command *cmd);
47
48 #endif /* _DEVICE_HANDLER_H */