[lxc-devel] [lxc/lxc] 3c16d0: Split bdev into modules: btrfs

GitHub noreply at github.com
Mon Dec 28 22:37:20 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 3c16d0cb4d4d618dd83feefd1ab2854c9550d2cb
      https://github.com/lxc/lxc/commit/3c16d0cb4d4d618dd83feefd1ab2854c9550d2cb
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-12-28 (Mon, 28 Dec 2015)

  Changed paths:
    M src/lxc/Makefile.am
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/bdev.h
    R src/lxc/bdev/lxc-btrfs.h
    A src/lxc/bdev/lxcbtrfs.c
    A src/lxc/bdev/lxcbtrfs.h
    A src/lxc/bdev/lxcoverlay.c
    A src/lxc/bdev/lxcoverlay.h
    R src/lxc/bdev/overlay.c
    R src/lxc/bdev/overlay.h
    M src/lxc/conf.c
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  Split bdev into modules: btrfs

Create a module for btrfs: lxcbtrfs.{c,h}.

The functions:

	- get_btrfs_subvol_path()
	- btrfs_list_get_path_rootid()
	- is_btrfs_fs()
	- btrfs_detect()
	- btrfs_mount()
	- btrfs_umount()
	- btrfs_subvolume_create()
	- btrfs_same_fs()
	- btrfs_snapshot()
	- btrfs_snapshot_wrapper()
	- btrfs_clonepaths()
	- btrfs_do_destroy_subvol()
	- get_btrfs_tree_idx()
	- my_btrfs_tree *create_my_btrfs_tree()
	- update_tree_node()
	- add_btrfs_tree_node()
	- free_btrfs_tree()
	- do_remove_btrfs_children()
	- btrfs_recursive_destroy()
	- btrfs_try_remove_subvol()
	- btrfs_destroy()
	- btrfs_create()

and the structs:

	- struct mytree_node
	- struct my_btrfs_tree

move from bdev.{c,h} to lxcbtrfs.{c,h}.

Rename the header file

	- lxc-btrfs.h --> lxcbtrfs.h

Adapt Makefile.am to include lxcbtrfs.{c,h} and remove lxc-btrfs.h.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 988be9c1378e4a1af305f5cdd163ad9cd48b41ab
      https://github.com/lxc/lxc/commit/988be9c1378e4a1af305f5cdd163ad9cd48b41ab
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-12-28 (Mon, 28 Dec 2015)

  Changed paths:
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/bdev.h
    M src/lxc/bdev/lxcbtrfs.c
    M src/lxc/bdev/lxcbtrfs.h

  Log Message:
  -----------
  lxcbtrfs.{c,h} rework declarations and definitions

Declare

	- btrfs_same_fs();
	- btrfs_snapshot();

extern instead of static in lxcbtrfs.h. They are defined in lxcbtrfs.c.

Forward declare/put

	- struct bdev; /* defined in bdev.h */
	- struct bdev_specs; /* defined in lxccontainer.h */
	- struct lxc_conf; /* defined conf.h */

as incomplete types in lxcbtrfs.h so that functions declared and defined in
lxcbtrfs.{c,h} have access to it.

Declare

	- dir_new_path();

in lxcbtrfs.c. It is defined in lxccontainer.c.

Move definition of struct

	- struct rsync_data_char;

from bdev.c to bdev.h because the functions in lxcbtrfs.{c,h} need to access it.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: e9df7e1a94a693f74293b3f6cfe37268a830162b
      https://github.com/lxc/lxc/commit/e9df7e1a94a693f74293b3f6cfe37268a830162b
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-12-28 (Mon, 28 Dec 2015)

  Changed paths:
    M src/lxc/Makefile.am
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/bdev.h
    M src/lxc/bdev/lxcbtrfs.c
    A src/lxc/bdev/lxcrsync.c
    A src/lxc/bdev/lxcrsync.h

  Log Message:
  -----------
  Split bdev into modules: lxcrsync

The functions:
   - do_rsync();
  - rsync_delta();
  - rsync_delta_wrapper();
  - rsync_rootfs();
  - rsync_rootfs_wrapper();

and the structs
   - struct rsync_data;
  - struct rsync_data_char;

move from bdev.{c,h} to lxcrsync.{c.h}. All functions previously declared as
static become public.

lxcrsync.{c,h} should allow for a reasonable amount of abstraction regarding
our rsync functions. Some of the functions could easily be abstracted.

Adapt Makefile.am to include lxcrsync.{c,h}.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: 3188197d2443b37193945f1043f39e7f3b96bd78
      https://github.com/lxc/lxc/commit/3188197d2443b37193945f1043f39e7f3b96bd78
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-12-28 (Mon, 28 Dec 2015)

  Changed paths:
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/lxcoverlay.c
    M src/lxc/bdev/lxcrsync.c

  Log Message:
  -----------
  Simplify overlay.{c,h}

The struct

	struct ovl_rsync_data {
		struct bdev *orig;
		struct bdev *new;
	};

is simply a duplicate of

	struct rsync_data {
		struct bdev *orig;
		struct bdev *new;
	};

So let's replace any references to ovl_rsync_data with rsync_data.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


  Commit: c40c5fdf54de66cb71bebe56d5d680deacb9f61d
      https://github.com/lxc/lxc/commit/c40c5fdf54de66cb71bebe56d5d680deacb9f61d
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2015-12-28 (Mon, 28 Dec 2015)

  Changed paths:
    M src/lxc/bdev/lxcbtrfs.h

  Log Message:
  -----------
  Add <linux/types.h> header to lxcbtrfs.h

Using

	#include <sys/types.h>

is not sufficient to guarantee that __le64 and other types are defined.

Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>


Compare: https://github.com/lxc/lxc/compare/364d54c9f09a...c40c5fdf54de


More information about the lxc-devel mailing list