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