]> git.ozlabs.org Git - petitboot/blob - discover/paths.h
26d4ce41eb2a946c8bc9f13b5e5ba7b60637f4a6
[petitboot] / discover / paths.h
1 #ifndef PATHS_H
2 #define PATHS_H
3
4 /**
5  * Given a string (eg /dev/sda1, sda1 or UUID=B8E53381CA9EA0E3), parse the
6  * device path (eg /dev/sda1). Any device descriptions read from config files
7  * should be parsed into the path first.
8  *
9  * The cur_dev is provided for some remapping situations. If NULL is provided,
10  * no remapping will be done.
11  *
12  * Returns a newly-allocated string.
13  */
14 char *parse_device_path(const char *dev_str, const char *current_device);
15
16 /**
17  * Get the mountpoint for a device.
18  */
19 const char *mountpoint_for_device(const char *dev);
20
21 /**
22  * Resolve a path given in a config file, to a path in the local filesystem.
23  * Paths may be of the form:
24  *  device:path (eg /dev/sda:/boot/vmlinux)
25  *
26  * or just a path:
27  *  /boot/vmlinux
28  * - in this case, the current mountpoint is used.
29  *
30  * Returns a newly-allocated string containing a full path to the file in path
31  */
32 char *resolve_path(const char *path, const char *current_device);
33
34
35 /**
36  * Set the base directory for newly-created mountpoints
37  */
38 void set_mount_base(const char *path);
39
40 /**
41  * Utility function for joining two paths. Adds a / between a and b if
42  * required.
43  *
44  * Returns a newly-allocated string.
45  */
46 char *join_paths(const char *a, const char *b);
47
48 /**
49  * encode a disk label (or uuid) for use in a symlink.
50  */
51 char *encode_label(const char *label);
52
53 #endif /* PATHS_H */