]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/lxccontainer.c
Split bdev into modules: overlay
authorChristian Brauner <christian.brauner@mailbox.org>
Sat, 12 Dec 2015 21:48:33 +0000 (22:48 +0100)
committerChristian Brauner <christian.brauner@mailbox.org>
Tue, 15 Dec 2015 16:03:58 +0000 (17:03 +0100)
commit38683db41204cb221892beeb88d67a1df4a07287
tree760585c7dd481436a76fd7dac7fd07cf0417cb2a
parentfbc617e84be8cafb8dcb6dd8db6cd4a4cc5661d0
Split bdev into modules: overlay

With this commit we start to split bdev.{c,h} into modules located in the
subfolder bdev. We start by creating a module for overlay: overlay.{c,h}.

- The functions:

- overlayfs_detect()
- overlayfs_mount()
- overlayfs_umount()
- overlayfs_clonepaths()
- overlayfs_destroy()
- overlayfs_create()

  move from bdev.{c,h} to overlay.{c,h}. The only thing that remains in bdev.c
  is the static definition of

- static const struct bdev_ops overlayfs_ops

- The functions:

- update_ovl_paths()
- overlay_getlower()

  move from lxccontainer.c to overlay.{c,h}. update_ovl_paths() is used to
  update absolute paths for overlay lxc.mount.entry entries but it seems to fit
  more here than into lxccontainer.c.
  The Function overlay_getlower() is used to extract the lower directory for
  overlay (and aufs) rootfs. It should at some point become a common helper.

- The functions:

- do_rsync()
- dir_new_path()

   remain in bdev.c for now but become extern. We declare them extern in
   overlay.c to be able to call them. As the comment to them correctly notices,
   they should at some point become common helpers and probably move to
   utils.{c,h} or some other more appropriate place.

- The structs:

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

  are forward declared/put as incomplete types in overlay.h so that the
  functions have access to it.

- The header overlay.h is *not* included in bdev.h but only in bdev.c so that
  when bdev.h is included the public functions in overlay.h cannot be accessed,
  i.e. if an implementation wants to call functions from overlay.h they need to
  explicitly include it. (As is e.g. done in the case of lxccontainer.c.)

- The header

- lxc-btrfs.h

  also moves to the bdev subfolder.

- Adapt Makefile.am to the new bdev layout.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
src/lxc/Makefile.am
src/lxc/bdev.c [deleted file]
src/lxc/bdev.h [deleted file]
src/lxc/bdev/bdev.c [new file with mode: 0644]
src/lxc/bdev/bdev.h [new file with mode: 0644]
src/lxc/bdev/lxc-btrfs.h [new file with mode: 0644]
src/lxc/bdev/overlay.c [new file with mode: 0644]
src/lxc/bdev/overlay.h [new file with mode: 0644]
src/lxc/lxc-btrfs.h [deleted file]
src/lxc/lxccontainer.c