1 #ifndef _DEVICE_HANDLER_H
2 #define _DEVICE_HANDLER_H
9 struct discover_device;
10 struct discover_server;
18 struct discover_device {
19 struct device *device;
28 const char *device_path;
29 struct ramdisk_device *ramdisk;
36 struct list boot_options;
40 struct discover_boot_option {
41 struct parser *source;
42 struct discover_device *device;
43 struct boot_option *option;
44 struct list_item list;
46 struct resource *boot_image;
47 struct resource *initrd;
49 struct resource *icon;
53 struct discover_context {
54 struct parser *parser;
56 struct discover_device *device;
57 struct list boot_options;
58 struct pb_url *conf_url;
59 struct network *network;
63 struct ramdisk_device {
71 struct device_handler *device_handler_init(struct discover_server *server,
72 struct waitset *waitset, int dry_run);
74 void device_handler_destroy(struct device_handler *devices);
76 int device_handler_get_device_count(const struct device_handler *handler);
77 const struct discover_device *device_handler_get_device(
78 const struct device_handler *handler, unsigned int index);
80 struct discover_device *discover_device_create(struct device_handler *handler,
82 void device_handler_add_device(struct device_handler *handler,
83 struct discover_device *device);
84 void device_handler_add_ramdisk(struct device_handler *handler,
86 struct ramdisk_device *device_handler_get_ramdisk(
87 struct device_handler *handler);
88 void device_handler_release_ramdisk(struct discover_device *device);
89 int device_handler_discover(struct device_handler *handler,
90 struct discover_device *dev);
91 int device_handler_dhcp(struct device_handler *handler,
92 struct discover_device *dev, struct event *event);
93 int device_handler_conf(struct device_handler *handler,
94 struct discover_device *dev, struct pb_url *url);
95 void device_handler_remove(struct device_handler *handler,
96 struct discover_device *device);
98 struct discover_context *device_handler_discover_context_create(
99 struct device_handler *handler,
100 struct discover_device *device);
101 void device_handler_discover_context_commit(struct device_handler *handler,
102 struct discover_context *ctx);
104 struct discover_boot_option *discover_boot_option_create(
105 struct discover_context *ctx,
106 struct discover_device *dev);
107 void discover_context_add_boot_option(struct discover_context *ctx,
108 struct discover_boot_option *opt);
110 int device_handler_user_event(struct device_handler *handler,
111 struct event *event);
113 struct discover_device *device_lookup_by_name(struct device_handler *handler,
115 struct discover_device *device_lookup_by_uuid(struct device_handler *handler,
117 struct discover_device *device_lookup_by_label(struct device_handler *handler,
119 struct discover_device *device_lookup_by_id(struct device_handler *handler,
121 struct discover_device *device_lookup_by_serial(
122 struct device_handler *device_handler,
125 void discover_device_set_param(struct discover_device *device,
126 const char *name, const char *value);
127 const char *discover_device_get_param(struct discover_device *device,
130 void device_handler_boot(struct device_handler *handler,
131 struct boot_command *cmd);
132 void device_handler_cancel_default(struct device_handler *handler);
133 void device_handler_update_config(struct device_handler *handler,
134 struct config *config);
135 void device_handler_process_url(struct device_handler *handler,
137 void device_handler_reinit(struct device_handler *handler);
139 int device_request_write(struct discover_device *dev, bool *release);
140 void device_release_write(struct discover_device *dev, bool release);
142 #endif /* _DEVICE_HANDLER_H */