]> git.ozlabs.org Git - petitboot/blob - devices/parser.h
9c6fb352e84337b14ce647e538e7f23bb07bd6f2
[petitboot] / devices / parser.h
1
2 #ifndef _PARSERS_H
3 #define _PARSERS_H
4
5 #include <stdarg.h>
6 #include "message.h"
7
8 struct parser {
9         char *name;
10         int priority;
11         int (*parse)(const char *device);
12         struct parser *next;
13 };
14
15 enum generic_icon_type {
16         ICON_TYPE_DISK,
17         ICON_TYPE_USB,
18         ICON_TYPE_OPTICAL,
19         ICON_TYPE_NETWORK,
20         ICON_TYPE_UNKNOWN
21 };
22
23 #define streq(a,b) (!strcasecmp((a),(b)))
24
25 /* general functions provided by parsers.c */
26 void iterate_parsers(const char *devpath, const char *mountpoint);
27
28 void free_device(struct device *dev);
29 void free_boot_option(struct boot_option *opt);
30
31 const char *generic_icon_file(enum generic_icon_type type);
32
33 /* functions provided by udev-helper or the test wrapper */
34 void pb_log(const char *fmt, ...);
35
36 int mount_device(const char *dev_path);
37
38 char *resolve_path(const char *path, const char *current_dev);
39 const char *mountpoint_for_device(const char *dev_path);
40
41 enum generic_icon_type guess_device_type(void);
42
43 int add_device(const struct device *dev);
44 int add_boot_option(const struct boot_option *opt);
45
46 #endif /* _PARSERS_H */