]> git.ozlabs.org Git - petitboot/blob - discover/paths.h
utils/pb-udhcp: Don't add a new option on renew
[petitboot] / discover / paths.h
1 #ifndef PATHS_H
2 #define PATHS_H
3
4 #include <url/url.h>
5
6 /**
7  * Utility function for joining two paths. Adds a / between a and b if
8  * required.
9  *
10  * Returns a newly-allocated string.
11  */
12 char *join_paths(void *alloc_ctx, const char *a, const char *b);
13
14 /**
15  * Returns the base path for mount points
16  */
17 const char *mount_base(void);
18
19
20 struct load_url_result {
21         enum {
22                 LOAD_OK,    /* load complete. other members should only be
23                                accessed if status == LOAD_OK */
24
25                 LOAD_ERROR, /* only signalled to async loaders
26                              * (sync will see a NULL result) */
27
28                 LOAD_ASYNC, /* async load still in progress */
29         } status;
30         const char      *local;
31         bool            cleanup_local;
32 };
33
34 /* callback type for asynchronous loads. The callback implementation is
35  * responsible for freeing result.
36  */
37 typedef void (*load_url_complete)(struct load_url_result *result, void *data);
38
39 /* Load a (potentially remote) file, and return a guaranteed-local name */
40 struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
41                 load_url_complete complete, void *data);
42
43 struct load_url_result *load_url(void *ctx, struct pb_url *url);
44
45 #endif /* PATHS_H */