]> git.ozlabs.org Git - petitboot/blob - discover/paths.h
Move log to library
[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(void *alloc_ctx,
15                 const char *dev_str, const char *current_device);
16
17 /**
18  * Get the mountpoint for a device.
19  */
20 const char *mountpoint_for_device(const char *dev);
21
22 /**
23  * Resolve a path given in a config file, to a path in the local filesystem.
24  * Paths may be of the form:
25  *  device:path (eg /dev/sda:/boot/vmlinux)
26  *
27  * or just a path:
28  *  /boot/vmlinux
29  * - in this case, the current mountpoint is used.
30  *
31  * Returns a newly-allocated string containing a full path to the file in path
32  */
33 char *resolve_path(void *alloc_ctx,
34                 const char *path, const char *current_device);
35
36 /**
37  * Utility function for joining two paths. Adds a / between a and b if
38  * required.
39  *
40  * Returns a newly-allocated string.
41  */
42 char *join_paths(void *alloc_ctx, const char *a, const char *b);
43
44 /**
45  * encode a disk label (or uuid) for use in a symlink.
46  */
47 char *encode_label(void *alloc_ctx, const char *label);
48
49 /**
50  * Returns the base path for mount points
51  */
52 const char *mount_base(void);
53
54 #endif /* PATHS_H */