lxc_log_define(bdev, lxc);
-struct rsync_data_char {
- char *src;
- char *dest;
-};
-
/* the bulk of this needs to become a common helper */
int do_rsync(const char *src, const char *dest)
{
/* the bulk of this needs to become a common helper */
char *dir_new_path(char *src, const char *oldname, const char *name,
- const char *oldpath, const char *lxcpath)
+ const char *oldpath, const char *lxcpath)
{
char *ret, *p, *p2;
int l1, l2, nlen;
bool rootfs_is_blockdev(struct lxc_conf *conf);
+struct rsync_data_char {
+ char *src;
+ char *dest;
+};
+
#endif // __LXC_BDEV_H
*/
#define _GNU_SOURCE
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "bdev.h"
#include "log.h"
#include "lxcbtrfs.h"
+#include "utils.h"
lxc_log_define(btrfs, lxc);
+/* defined in lxccontainer.c: needs to become common helper */
+extern char *dir_new_path(char *src, const char *oldname, const char *name,
+ const char *oldpath, const char *lxcpath);
+
/*
* Return the full path of objid under dirid. Let's say dirid is
* /lxc/c1/rootfs, and objid is /lxc/c1/rootfs/a/b/c. Then we will
return ret;
}
-static int btrfs_same_fs(const char *orig, const char *new)
+int btrfs_same_fs(const char *orig, const char *new)
{
int fd_orig = -1, fd_new = -1, ret = -1;
struct btrfs_ioctl_fs_info_args orig_args, new_args;
return ret;
}
-static int btrfs_snapshot(const char *orig, const char *new)
+int btrfs_snapshot(const char *orig, const char *new)
{
int fd = -1, fddst = -1, ret = -1;
struct btrfs_ioctl_vol_args_v2 args;
#ifndef __LXC_BTRFS_H
#define __LXC_BTRFS_H
+#define _GNU_SOURCE
#include <stdbool.h>
#include <stdint.h>
+#include <sys/prctl.h>
typedef uint8_t u8;
typedef uint16_t u16;
#define BTRFS_LAST_FREE_OBJECTID -256ULL
#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
+/* defined in bdev.h */
+struct bdev;
+
+/* defined in lxccontainer.h */
+struct bdev_specs;
+
+/* defined conf.h */
+struct lxc_conf;
+
struct mytree_node {
u64 objid;
u64 parentid;
int btrfs_list_get_path_rootid(int fd, u64 *treeid);
bool is_btrfs_fs(const char *path);
bool btrfs_try_remove_subvol(const char *path);
+int btrfs_same_fs(const char *orig, const char *new);
+int btrfs_snapshot(const char *orig, const char *new);
#endif // __LXC_BTRFS_H