]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/bdev.h
3 /* blockdev operations for:
4 * dir, raw, btrfs, overlayfs, aufs, lvm, loop, zfs, btrfs
5 * someday: qemu-nbd, qcow2, qed
9 #include "lxccontainer.h"
14 * specifications for how to create a new backing store
25 unsigned long fssize
; // fs size in bytes
31 /* detect whether path is of this bdev type */
32 int (*detect
)(const char *path
);
33 // mount requires src and dest to be set.
34 int (*mount
)(struct bdev
*bdev
);
35 int (*umount
)(struct bdev
*bdev
);
36 int (*destroy
)(struct bdev
*bdev
);
37 int (*create
)(struct bdev
*bdev
, const char *dest
, const char *n
,
38 struct bdev_specs
*specs
);
39 /* given original mount, rename the paths for cloned container */
40 int (*clone_paths
)(struct bdev
*orig
, struct bdev
*new, const char *oldname
,
41 const char *cname
, const char *oldpath
, const char *lxcpath
,
42 int snap
, unsigned long newsize
);
46 * When lxc-start (conf.c) is mounting a rootfs, then src will be the
47 * 'lxc.rootfs' value, dest will be mount dir (i.e. $libdir/lxc) When clone
48 * or create is doing so, then dest will be $lxcpath/$lxcname/rootfs, since
49 * we may need to rsync from one to the other.
50 * data is so far unused.
60 char *overlayfs_getlower(char *p
);
63 * Instantiate a bdev object. The src is used to determine which blockdev
64 * type this should be. The dst and data are optional, and will be used
65 * in case of mount/umount.
67 * Optionally, src can be 'dir:/var/lib/lxc/c1' or 'lvm:/dev/lxc/c1'. For
68 * other backing stores, this will allow additional options. In particular,
69 * "overlayfs:/var/lib/lxc/canonical/rootfs:/var/lib/lxc/c1/delta" will mean
70 * use /var/lib/lxc/canonical/rootfs as lower dir, and /var/lib/lxc/c1/delta
71 * as the upper, writeable layer.
73 struct bdev
*bdev_init(const char *src
, const char *dst
, const char *data
);
75 struct bdev
*bdev_copy(const char *src
, const char *oldname
, const char *cname
,
76 const char *oldpath
, const char *lxcpath
, const char *bdevtype
,
77 int snap
, const char *bdevdata
, unsigned long newsize
);
78 struct bdev
*bdev_create(const char *dest
, const char *type
,
79 const char *cname
, struct bdev_specs
*specs
);
80 void bdev_put(struct bdev
*bdev
);
82 /* define constants if the kernel/glibc headers don't define them */
84 #define MS_DIRSYNC 128
96 #define MS_SLAVE (1<<19)
100 #define MS_RELATIME (1 << 21)
103 #ifndef MS_STRICTATIME
104 #define MS_STRICTATIME (1 << 24)