[lxc-devel] [lxc/lxc] 8907f4: Split bdev into modules: lxczfs

GitHub noreply at github.com
Tue Jan 12 08:07:33 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 8907f44457d8adfb8c144e5a07b3b09186cffb59
      https://github.com/lxc/lxc/commit/8907f44457d8adfb8c144e5a07b3b09186cffb59
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

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

The functions:

	- zfs_clone();
	- zfs_clonepaths();
	- zfs_create();
	- zfs_destroy();
	- zfs_detect();
	- zfs_list_entry();
	- zfs_mount();
	- zfs_umount();

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

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

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 lxczfs.h as the functions
associated with zfs need access to it.

Minor changes:

	- Use exit(EXIT_FAILURE) instead of exit(1).
	- Use brackets around else {} if the if {} did:
		I.e. instead of:

			if {
				// do one;
				// do two;
			} else
				// do three;

		use:

			if {
				// do one;
				// do two;
			} else {
				// do three;
			}
	- Instead of declaring char pointers and arrays on the same line, i.e.:

		char arr[len], *p;

	  do:

		char arr[len];
		char *p;

	  which makes intentions a lot clearer.

	- Since we require c99 anyway, use finer-grained scoping by declaring
	  variables where they are needed instead of simply at the top.

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


  Commit: 2b9cbd533de9a6042002e517775afc5b7e7066ae
      https://github.com/lxc/lxc/commit/2b9cbd533de9a6042002e517775afc5b7e7066ae
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M src/lxc/Makefile.am
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/bdev.h
    A src/lxc/bdev/lxclvm.c
    A src/lxc/bdev/lxclvm.h
    M src/lxc/conf.c

  Log Message:
  -----------
  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 at mailbox.org>


  Commit: 00f0a1f89695f22d17b0a756002586cbf8ccda05
      https://github.com/lxc/lxc/commit/00f0a1f89695f22d17b0a756002586cbf8ccda05
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

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

The functions

	- aufs_clonepaths();
	- aufs_create();
	- aufs_destroy();
	- aufs_detect();
	- aufs_mount();
	- aufs_umount();

move from bdev.c to lxcaufs.{c,h}. All functions which previously were static
become extern.

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

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 lxcaufs.h as the functions
associated with aufs need access to it.

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


  Commit: 9d983015ff85a926ec47fd1ca707aa9e86db8d38
      https://github.com/lxc/lxc/commit/9d983015ff85a926ec47fd1ca707aa9e86db8d38
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

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

The functions

	- dir_clonepaths();
	- dir_create();
	- dir_destroy();
	- dir_detect();
	- dir_mount();
	- dir_umount();

move from bdev.c to lxcdir.{c,h}. All functions which previously were static
become extern.

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

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 lxcdir.h as the functions
associated with dir need access to it.

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


  Commit: 304b4cf3ae6c23d8e2a604b5e78e850d767a9f6e
      https://github.com/lxc/lxc/commit/304b4cf3ae6c23d8e2a604b5e78e850d767a9f6e
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

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

The functions

	- loop_clonepaths();
	- loop_create();
	- loop_destroy();
	- loop_detect();
	- loop_mount();
	- loop_umount();

move from bdev.c to lxcloop.{c,h}. All functions previously declared static
become extern.

The functions

	- do_loop_create();
	- find_free_loopdev_no_control();
	- find_free_loopdev();

move from bdev.c to lxcloop.c. They remain static.

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

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 lxcloop.h as the functions
associated with loop need access to it.

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


  Commit: 3ceb28207202e17191a0cf195a971ccaa6c7e5d1
      https://github.com/lxc/lxc/commit/3ceb28207202e17191a0cf195a971ccaa6c7e5d1
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

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

The functions

	- rbd_clonepaths();
	- rbd_create();
	- rbd_destroy();
	- rbd_detect();
	- rbd_mount();
	- rbd_umount();

move from bdev.c to lxcrbd.{c,h}. All functions previously declared static
become extern.

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

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 lxcrbd.h as the functions
associated with rbd need access to it.

Put:
  - #define __STDC_FORMAT_MACROS

and include:
  - #include <inttypes.h>

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

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


  Commit: bf76c012b3f0e49930d207fe77ba6cc3919728ac
      https://github.com/lxc/lxc/commit/bf76c012b3f0e49930d207fe77ba6cc3919728ac
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

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

The functions

	- clone_attach_nbd();
	- do_attach_nbd();
	- nbd_busy();
	- nbd_detach();
	- nbd_get_partition();
	- wait_for_partition();

move from bdev.c to lxcnbd.c. They remain static

The functions

	- attach_nbd();
	- detach_nbd_idx();
	- nbd_clonepaths();
	- nbd_create();
	- nbd_destroy();
	- nbd_detect();
	- nbd_mount();
	- nbd_umount();
	- requires_nbd();

move from bdev.c to lxcnbd.{c,h}. They all become extern.

The struct

	- struct nbd_attach_data

moves from bdev.c to lxcnbd.c.

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

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 lxcnbd.h as the functions
associated with nbd need access to it.

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


  Commit: cdb4e53a7df61f5f3c4a4b03ae5990cb4c86263e
      https://github.com/lxc/lxc/commit/cdb4e53a7df61f5f3c4a4b03ae5990cb4c86263e
  Author: Christian Brauner <christian.brauner at mailbox.org>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

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

  Log Message:
  -----------
  Cleanup bdev.c after splitting into modules

The function

	- bdev_get();

becomes static. It is called from nowhere else so far and never appeared in any
header.

Minor changes

	- Avoid comparisons between int and size_t types. Use size_t where
	  possible else cast to size_t when it makes sense.
	- insert missing spaces between operators
	- put declarations for all static functions at the top

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


  Commit: 3b117b8500a1e3f77b67c3421d9cc6ae22dc5141
      https://github.com/lxc/lxc/commit/3b117b8500a1e3f77b67c3421d9cc6ae22dc5141
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M src/lxc/Makefile.am
    M src/lxc/bdev/bdev.c
    M src/lxc/bdev/bdev.h
    A src/lxc/bdev/lxcaufs.c
    A src/lxc/bdev/lxcaufs.h
    A src/lxc/bdev/lxcdir.c
    A src/lxc/bdev/lxcdir.h
    A src/lxc/bdev/lxcloop.c
    A src/lxc/bdev/lxcloop.h
    A src/lxc/bdev/lxclvm.c
    A src/lxc/bdev/lxclvm.h
    A src/lxc/bdev/lxcnbd.c
    A src/lxc/bdev/lxcnbd.h
    A src/lxc/bdev/lxcrbd.c
    A src/lxc/bdev/lxcrbd.h
    A src/lxc/bdev/lxczfs.c
    A src/lxc/bdev/lxczfs.h
    M src/lxc/conf.c

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

Split bdev into modules


Compare: https://github.com/lxc/lxc/compare/4dbfaf308445...3b117b8500a1


More information about the lxc-devel mailing list