]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/storage/overlay.h
d4c780ff42797e7bc57aaf83ffd5fc10be014d71
[mirror_lxc.git] / src / lxc / storage / overlay.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #ifndef __LXC_OVERLAY_H
4 #define __LXC_OVERLAY_H
5
6 #include <grp.h>
7 #include <stdio.h>
8 #include <stdbool.h>
9 #include <stdint.h>
10 #include <unistd.h>
11 #include <sys/types.h>
12
13 #include "compiler.h"
14 #include "storage.h"
15
16 struct lxc_storage;
17
18 struct bdev_specs;
19
20 struct lxc_conf;
21
22 struct lxc_rootfs;
23
24 __hidden extern int ovl_clonepaths(struct lxc_storage *orig, struct lxc_storage *new,
25 const char *oldname, const char *cname, const char *oldpath,
26 const char *lxcpath, int snap, uint64_t newsize,
27 struct lxc_conf *conf);
28 __hidden extern int ovl_create(struct lxc_storage *bdev, const char *dest, const char *n,
29 struct bdev_specs *specs, const struct lxc_conf *conf);
30 __hidden extern int ovl_destroy(struct lxc_storage *orig);
31 __hidden extern bool ovl_detect(const char *path);
32 __hidden extern int ovl_mount(struct lxc_storage *bdev);
33 __hidden extern int ovl_umount(struct lxc_storage *bdev);
34
35 /* To be called from lxcapi_clone() in lxccontainer.c: When we clone a container
36 * with overlay lxc.mount.entry entries we need to update absolute paths for
37 * upper- and workdir. This update is done in two locations:
38 * lxc_conf->unexpanded_config and lxc_conf->mount_list. Both updates are done
39 * independent of each other since lxc_conf->mountlist may container more mount
40 * entries (e.g. from other included files) than lxc_conf->unexpanded_config .
41 */
42 __hidden extern int ovl_update_abs_paths(struct lxc_conf *lxc_conf, const char *lxc_path,
43 const char *lxc_name, const char *newpath,
44 const char *newname);
45
46 /* To be called from functions in lxccontainer.c: Get lower directory for
47 * overlay rootfs.
48 */
49 __hidden extern const char *ovl_get_lower(const char *rootfs_path);
50
51 /* Get rootfs path for overlay backed containers. Allocated memory must be freed
52 * by caller.
53 */
54 __hidden extern char *ovl_get_rootfs(const char *rootfs_path, size_t *rootfslen);
55
56 /* Create upper- and workdirs for overlay mounts.
57 */
58 __hidden extern int ovl_mkdir(const struct mntent *mntent, const struct lxc_rootfs *rootfs,
59 const char *lxc_name, const char *lxc_path);
60
61 #endif /* __LXC_OVERLAY_H */