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

GitHub noreply at github.com
Mon Dec 28 22:38:25 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: f2e50c442dd40325ec75ff9be32da72dc28b371a
      https://github.com/lxc/lxc/commit/f2e50c442dd40325ec75ff9be32da72dc28b371a
  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: 93d4475ec29fd8025c2dfdac8037ca841cb40f71
      https://github.com/lxc/lxc/commit/93d4475ec29fd8025c2dfdac8037ca841cb40f71
  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: cd0f1eebe5786e7cc5ce8b8bbb0720f5ac0ccdad
      https://github.com/lxc/lxc/commit/cd0f1eebe5786e7cc5ce8b8bbb0720f5ac0ccdad
  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: e0d0f93be5ed23370c1822d5ae434dae7706e938
      https://github.com/lxc/lxc/commit/e0d0f93be5ed23370c1822d5ae434dae7706e938
  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: fc58bf2c622fc403107e6f8cd5601d0f102a4bb1
      https://github.com/lxc/lxc/commit/fc58bf2c622fc403107e6f8cd5601d0f102a4bb1
  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>


  Commit: cb65e5d71b5f34319f3a7da01f12e9f49ec77b3e
      https://github.com/lxc/lxc/commit/cb65e5d71b5f34319f3a7da01f12e9f49ec77b3e
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2015-12-28 (Mon, 28 Dec 2015)

  Log Message:
  -----------
  Merge pull request #734 from brauner/2015-12-12/split_bdev_into_modules

split bdev into modules: btrfs + rsync


Compare: https://github.com/lxc/lxc/compare/c40c5fdf54de...cb65e5d71b5f


More information about the lxc-devel mailing list