]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/storage/lvm.c
Split bdev into modules: lxclvm
authorChristian Brauner <christian.brauner@mailbox.org>
Tue, 29 Dec 2015 15:24:29 +0000 (16:24 +0100)
committerChristian Brauner <christian.brauner@mailbox.org>
Tue, 12 Jan 2016 07:50:45 +0000 (08:50 +0100)
commit2b9cbd533de9a6042002e517775afc5b7e7066ae
tree0cac1debd3e3e3f916e794bf13ecf0c560fd4fb6
parent8907f44457d8adfb8c144e5a07b3b09186cffb59
Split bdev into modules: lxclvm

The functions

- lvm_detect();
- lvm_mount();
- lvm_umount();
- lvm_compare_lv_attr();
- lvm_is_thin_volume();
- lvm_is_thin_pool();
- lvm_snapshot();
- lvm_clonepaths();
- lvm_destroy();
- lvm_create();

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

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

The function:

- mount_unknown_fs();

becomes public.

Rationale: It is already called from different places and will be called by lvm,
and rdb. Also, it is defined twice exactly the same way. Once in conf.c
and once in bdev.c. Let's avoid that.
Defining the same function twice in different places just asks for
trouble.

The functions:

- blk_getsize();
- detect_fs();
- do_mkfs();
- is_blktype();

become public as they will be called for loop, lvm, and or rdb.

Move the definition of:

- DEFAULT_FS_SIZE
- DEFAULT_FSTYPE

from bdev.c to bdev.h to grant other modules access to it.

Remove:
- find_fstype_cb();

from conf.c. It is defined static in bdev.c

Put:

- #define __STDC_FORMAT_MACROS

and include:

- #include <inttypes.h>

in lxclvm.c so that the format specifier PRIu64 is available.

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 into lxclvm.h as the functions
associated with lvm need access to it.

Take the chance to restructure bdev.c:

- put bdev structs which have already been split out into separate
  modules at the top
- put declarations of all static functions at the top (This includes
  all functions associated with modules that have not yet already been
  put into a separate module.)

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