]> git.ozlabs.org Git - petitboot/blob - devices/parser.h
Resolve device paths in kernel and initrd locations.
[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 *devicepath, const char *mountpoint);
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 char *join_paths(const char *a, const char *b);
32
33 const char *generic_icon_file(enum generic_icon_type type);
34
35 /* functions provided by udev-helper or the test wrapper */
36 void pb_log(const char *fmt, ...);
37
38 int mount_device(const char *dev_path);
39
40 char *resolve_path(const char *path, const char *default_mountpoint);
41 const char *mountpoint_for_device(const char *dev_path);
42
43 enum generic_icon_type guess_device_type(void);
44
45 int add_device(const struct device *dev);
46 int add_boot_option(const struct boot_option *opt);
47
48 #endif /* _PARSERS_H */