Commit Graph

3779 Commits

Author SHA1 Message Date
Serge Hallyn
c43cbc040b fork off a task to delete ovs ports when done
The new task waits until the container is STOPPED, then asks
openvswitch to delete the port.

This requires two new arguements to be sent to lxc-user-nic.
Since lxc-user-nic ships with lxc, this shouldn't be a problem.

Finally when calling lxc-user-nic, use execlp insteac of execvp
to preserve lxcpath's const-ness.  Technically we are
guaranteed that execvp won't change the args, but it's worth
it to silence the warnings (and not hide real errors).

With this patch, container nics are cleaned up from openvswitch
bridges on shutdown.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 15:20:14 +01:00
Stéphane Graber
23c9c64d50
Fix Android build failure
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 14:53:26 +01:00
Christian Brauner
fa659172a1 lxc-ls: tweak algorithm for ls_has_all_grps()
- With the -g/--groups argument the user can give a comma-separated list of
  groups MUST a container must have in order to be displayed. We receive
  this list as a single string. ls_has_all_grps() is called to check if a
  container has all the groups of MUST in its current list of groups HAS. I.e.
  we determine whether MUST ⊆ HAS and only then do we record the container.
  The original implementation was dumb in that it split the string MUST
  everytime it needed to check whether MUST ⊆ HAS for a given container. That's
  pointless work. Instead we split the string MUST only once in main() and pass
  it to ls_get() which passes it along to ls_has_all_grps().
- Before doing any costly checking make sure that #MUST <= #HAS. If not bail
  immediately.
- The linear search algorithm ls_has_all_grps() currently uses stays for now.
  Binary search et al. do not seem to make sense since sorting the array HAS
  for each container is probably too costly. Especially, since it seems
  unlikely that a users specifies 50+ or so groups on the command line a
  container must have to be displayed. If however there are a lot of use-cases
  where users have a lot of containers each with 50-100 groups and regularly use
  lxc-ls with -g/--groups to only show containers that have 50 specified groups
  among their 50-100 groups we can revisit this issue and implement e.g. binary
  search or a ternary search tree.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:33:17 +01:00
Christian Brauner
4763f6cade Restore old behaviour [filter] behaviour
In the Python implementation users could pass a regex without a parameter flag
as additional argument on the command line. The C implementation gained the
flag -r/--regex for this. To not irritate users we restore the old behaviour
and additionally rename -r/--regex to --filter to allow eplicitly passing the
regex.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:33:17 +01:00
Christian Brauner
07385df53e lxc-ls: check for ENOMEM and tweaking
- If lxc_container_new() fails we check for ENOMEM and if so goto out. If
  ENOMEM is not set we will simply continue. The same goes for the call to
  regcomp() but instead of checking for ENOMEM we need to check for REG_ESPACE.

- Tweaking: Since lxc-ls might have to gather a lot of containers and I don't
  know if compilers will always optimize this let's move *some* variable
  declarations outside of the loop when it does not hinder readability

- Set ls_nesting to 0 initially. Otherwise users will always see nested
  containers printed.

- ls_get() gains an argument char **lockpath which is a string pointing us to
  the lock we put under /run/lxc/lock/.../... so that we can remove the lock
  when we no longer need it. To avoid pointless memory allocation in each new
  recursion level we share lockpath amongst all non-fork()ing recursive call to
  ls_get().  As it is not guaranteed that realloc() does not do any memory
  moving when newlen == len_lockpath, we give ls_get() an additional argument
  size_t len_lockpath). Every time we have a non-fork()ing recursive call to
  ls_get() we check if newlen > len_lockpath and only then do we
  realloc(*lockpath, newlen * 2) a reasonable chunk of memory (as the path will
  keep growing) and set len_lockpath = newlen * 2 to pass to the next
  non-fork()ing recursive call to ls_get().
  To avoid keeping a variable char *lockpath in main() which serves no purpose
  whatsoever and might be abused later we use a compound literal
  &(char *){NULL} which gives us an anonymous pointer which we can use for
  memory allocation in ls_get() for lockpath. We can conveniently free() it in
  ls_get() when the nesting level parameter lvl == 0 after exiting the loop.
  The advantage is that the variable is only accessible within ls_get() and not
  in main() while at the same time giving us an easy way to share lockpath
  amongst all non-fork()ing recursive calls to ls_get().

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:33:17 +01:00
Stéphane Graber
a8459b91f6 Revert "lxc-ls: check for ENOMEM and tweaking"
This reverts commit 7f3c1cf27f.
2016-01-28 12:33:00 +01:00
Stéphane Graber
adbc2d3389 Revert "lxc-ls: Restore old [filter] behaviour"
This reverts commit e4434e0fc9.
2016-01-28 12:32:56 +01:00
Christian Brauner
e4434e0fc9 lxc-ls: Restore old [filter] behaviour
In the Python implementation users could pass a regex without a parameter flag
as additional argument on the command line. The C implementation gained the
flag -r/--regex for this. To not irritate users we restore the old behaviour
and additionally rename -r/--regex to --filter to allow eplicitly passing the
regex.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:22:21 +01:00
Christian Brauner
7f3c1cf27f lxc-ls: check for ENOMEM and tweaking
- If lxc_container_new() fails we check for ENOMEM and if so goto out. If
  ENOMEM is not set we will simply continue. The same goes for the call to
  regcomp() but instead of checking for ENOMEM we need to check for REG_ESPACE.

- Tweaking: Since lxc-ls might have to gather a lot of containers and I don't
  know if compilers will always optimize this, let's move *some* variable
  declarations outside of the loop when it does not hinder readability.

- Set ls_nesting to 0 initially. Otherwise users will always see nested
  containers printed.

- ls_get() gains an argument char **lockpath which is a string pointing us to
  the lock we put under /run/lxc/lock/.../... so that we can remove the lock
  when we no longer need it. To avoid pointless memory allocation in each new
  recursion level, we share lockpath amongst all non-fork()ing recursive calls
  to ls_get().  As it is not guaranteed that realloc() does not do any memory
  moving when newlen == len_lockpath, we give ls_get() an additional argument
  size_t len_lockpath). Every time we have a non-fork()ing recursive call to
  ls_get() we check if newlen > len_lockpath and only then do we
  realloc(*lockpath, newlen * 2) a reasonable chunk of memory (as the path will
  keep growing) and set len_lockpath = newlen * 2 to pass to the next
  non-fork()ing recursive call to ls_get().
  To avoid keeping a variable char *lockpath in main() which serves no purpose
  whatsoever and might be abused later we use a compound literal
  &(char *){NULL} which gives us an anonymous pointer. This pointer we can use
  for memory allocation in ls_get() for lockpath. We can conveniently free() it
  in ls_get() when the nesting level parameter lvl == 0 after exiting the loop.
  The advantage is that the variable is only accessible within ls_get() and not
  in main() while at the same time giving us an easy way to share lockpath
  amongst all non-fork()ing recursive calls to ls_get().

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:21:00 +01:00
Christian Brauner
280d23796c update overlayfs and aufs in lxc.container.conf
Explain that multiple /lower layers can be used.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:02:23 +01:00
Christian Brauner
410d0f6e5c aufs: support multiple lower layers
Do it in a safe way by using strstr() to check for the substring ":/" should
':' be part of a pathname.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:02:23 +01:00
Christian Brauner
9208af160e lxc.rootfs: support multiple lower layers
Do it in a safe way by using strstr() to check for the substring ":/" should
':' be part of a pathname. This should be a safer implementation than the one
originally suggested in #547.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:01:18 +01:00
Bogdan Purcareata
f267d6668e mount_proc_if_needed: only safe mount when rootfs is defined
The safe_mount function was introduced in order to address CVE-2015-1335,
one of the vulnerabilities being a mount with a symlink for the
destination path. In scenarios such as lxc-execute with no rootfs, the
destination path is the host /proc, which is previously mounted by the
host, and is unmounted and mounted again in a new set of namespaces,
therefore eliminating the need to check for it being a symlink.

Mount the rootfs normally if the rootfs is NULL, keep the safe mount
only for scenarios where a different rootfs is defined.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:01:18 +01:00
Christian Brauner
37cf83ea15 Adapt manpage for lxc-ls to new C implementation
- explain new numeric argument to --nesting
- include common options as lxc-ls now uses the standard lxc parser
- add history section and update authors

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 12:01:18 +01:00
Wolfgang Bumiller
289cdc7375 cleanup: lxc_container::want_* comment descriptions
They change a value and return true on success rather than
fetching the value as the comments previously suggested.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Christian Brauner
8f43e53503 lxc-ls: set ls_nesting to 0 initially
Otherwise users will always get nested containers listed.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Thomas Tanaka
21e019c29a Fix btrfs bus error on sparc on snapshot delete
The following patch fixes memory alignment and endianness
issue while doing a snapshot deletion with btrfs as a
backing store on platform such as sparc.

The implementation is taken from btrfs-progs.

Changes since v1:
- include <byteswap.h> for bswap definition
- include defined function name as a comment above BTRFS_SETGET_STACK_FUNCS

Signed-off-by: Thomas Tanaka <thomas.tanaka@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Christian Brauner
9a09badcf5 check for btrfs fs in should_default_to_snapshot
Check if we're really on a btrfs filesystem before we call btrfs_same_fs().
Otherwise we will report misleading errors although everything went fine.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Christian Brauner
7cfe3dd71f add lxc-copy to see_also.sgml.in
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Christian Brauner
f433697442 lxc-ls: try to protect stack in recursive function
As ls_get() is non-tail recursive we face the inherent danger of blowing up the
stack at some level of nesting. To have at least some security we define
MAX_NESTLVL to be 5. That should be sufficient for most users. The argument lvl
to ls_get() can be used to keep track of the level of nesting we are at. If lvl
is greater than the allowed default level return (without error) and unwind the
stack.

--nesting gains an optional numeric argument. This allows the user to specify
the maximum level of nesting she/he wants to see. Fair warning: If your nesting
level is really deep and/or you have a lot of containers your might run into
trouble.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Tycho Andersen
7f9171e528 cgmanager: don't make tasks + cgroup.procs +x
No reason for these to be +x, and it looks weird.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Bogdan Purcareata
81e3c9cf8b lxc_setup_fs: Create /dev/shm folder if it doesn't exist
When running application containers with lxc-execute, /dev is
populated only with device entries. Since /dev is a tmpfs mount in
the container environment, the /dev/shm folder not being present is not
a sufficient reason for the /dev/shm mount to fail.

Create the /dev/shm directory if not present.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Bogdan Purcareata
01074e5b34 open_without_symlink: Account when prefix is empty string
In the current implementation, the open_without_symlink function
will default to opening the root mount only if the passed rootfs
prefix is null. It doesn't account for the case where this prefix
is passed as an empty string.

Properly handle this second case as well.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2016-01-28 11:58:57 +01:00
Marko Hauptvogel
020104c3ad Document network clear option
Should be mentioned separately because it will reset a big group of options.

Signed-off-by: Marko Hauptvogel <marko.hauptvogel@googlemail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 11:58:21 +01:00
Christian Brauner
8d62583ac5 fix lockpath removal in Python lxc-ls
The lock path for lxc is not

	RUNTIME_PATH/lock/lxc

but rather

	RUNTIME_PATH/lxc/lock

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 11:58:18 +01:00
Marko Hauptvogel
ff68914914 Document clear behaviour of list options
More general for all list options.

Seems to currently affect:
lxc.network (clear all NICs)
lxc.network.* (clear current NIC)
lxc.cap.drop
lxc.cap.keep
lxc.cgroup
lxc.mount.entry
lxc.mount.auto
lxc.hook
lxc.id_map
lxc.group
lxc.environment

Signed-off-by: Marko Hauptvogel <marko.hauptvogel@googlemail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 11:58:16 +01:00
KATOH Yasufumi
9c3f2966dd doc: Add valueless lxc.cap.drop behaviour to Japanese man page
Update for commit 7eff30f

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 11:58:14 +01:00
Sungbae Yoo
1cddc3a414 doc: Add LXC_SRC_NAME to Korean lxc.container.conf(5)
Update for commit 0794541

Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-28 11:58:10 +01:00
Stéphane Graber
9dacccdc16
Fix android build
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2016-01-20 14:12:16 -05:00
Stéphane Graber
bb2d53c594 Merge pull request #771 from bostjan/refactor/gitignore-templates-wildcard
Refactor templates section of .gitignore - no need to specify individual templates anymore
2016-01-20 10:03:36 -05:00
Stéphane Graber
bf195aa542 Merge pull request #770 from bostjan/bugfix/gitignore-templates-sparclinux
.gitignore: add missing templates/sparclinux to ignore list
2016-01-20 10:03:13 -05:00
Stéphane Graber
9243207444 Merge pull request #769 from nehaljwani/patch-1
Fix Comment inside Fedora Template
2016-01-20 10:02:48 -05:00
Bostjan Skufca
9337a1a3a5 Refactor .gitignore section for templates/* - no need to specifiy individual templates anymore
Signed-off-by: Bostjan Skufca <bostjan@a2o.si>
2016-01-20 14:20:56 +00:00
Bostjan Skufca
c188108a72 .gitignore: add templates/sparclinux to ignore list
Signed-off-by: Bostjan Skufca <bostjan@a2o.si>
2016-01-20 14:16:15 +00:00
Nehal J Wani
3bca4f5bb1 Fix Comment inside Fedora Template
We no longer use mirrors.kernel.org.
Commit f71e8f4 switched it to archives.fedoraproject.org

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
2016-01-20 00:32:37 +05:30
Serge Hallyn
685062d6ff avoid printing null string in error message
Show the ifindex in case it's useful

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-14 15:08:49 -08:00
Serge Hallyn
157f21051e Merge pull request #757 from tsdmgz/opensuse-template
Add openSUSE Leap release in opensuse template
2016-01-13 23:42:07 -08:00
Serge Hallyn
bdaa0884c4 cgmanager: drop possibly expected failures to a WARN
Otherwise every lxc-info by a user who doesn't own all his cgroups
will result in a set of error messages which are really innocuous.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-13 15:17:50 -08:00
Serge Hallyn
3e376eee6a cgmanager: drop the cgm_supports_multiple_controllers bool
What we want is to make sure we dont' use controller 'all' if cgmanager
doesn't support, if all our cgroups aren't the same, or if we cannot
controll all our cgroups.  We were mixing some of these conditions.  Use
cgm_all_controllers_same for all.  (Might want to rename it, but we want
to stick with just one).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-13 10:05:18 -08:00
Serge Hallyn
a571193241 Merge pull request #748 from brauner/2015-01-01/lxc_ls
Reimplement lxc-ls in C
2016-01-13 09:33:10 -08:00
Serge Hallyn
5f4aafaccb cgmanager - fix (again) previous commit
Bad late-night commit.  We were doing a while loop for a reason.  Just
initialize i to 0 before the while loop.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-13 09:28:15 -08:00
Christian Brauner
15fd209a88 reimplement lxc-ls in C
This is a reimplementation of lxc-ls in C. It supports all features previously
supported by lxc-ls.

- All flags and parameters have the same name as before except when the user
  specifies a regex to filter container names by. In the previous Python
  implementation the regex was passed without paramter flag. The new
  C-implementation has the parameter flag -r/--regex for this.

- Since we fork in lxc_attach() we need some form of IPC. Opening shared memory
  in the parent (mmap()) seems to be impractical since we don't know the size
  of the mapping beforehand. The other option is to open shared memory in the
  child and then to attach the parent to it but then we would need to resort to
  shm_open() or shmget(). Instead we go for a socketpair() here and wait for
  the child.
- Note that we call lxc_attach() and pass ls_get() as exec function to it (To
  be even more specific: We do not pass ls_get() directly but rather a wrapper
  function for ls_get() which receives a few arguments to enable the
  communication between child and parent.). This implementation has the
  advantage that we do not depend on any lxc executables being present in the
  container. The gist in code:

	ls_get()
	{
		/* Gather all relevant information */

		/* get nested containers */
		if (args->ls_nested && running) {
			/* set up some more stuff */

			/*
			 * execute ls_get() in namespace of the container to
 			 * get nested containers
			 */
  			c->attach(c, ls_get_wrapper, &wrapargs, &aopt, &out)

			/* do some cleaning up */
		}
	}

- When the user requests listing of nested containers without fancy-format
  enabled we want him to easily recognize which container is nested in which.
  So in this case we do not simply record the name but rather the name
  prepended with all the parents of the container:

	grand-grand-parent/grand-parent/parent/child

- Pretty-printing nested containers: Any call to list_*_containers() will
  return a sorted array of container names.  Furthermore, the recursive
  implementation of lxc_ls() will automatically put the containers in the
  correct order regarding their nesting. That is if we have the following
  nesting:

	A
	A --> S
	A --> T --> O
	A --> T --> O --> L
	A --> T --> O --> M
	A --> U
	A --> U --> P
	A --> U --> Q
	B

  The array ls_get() will set up looks like this:
	A S T O L M U P Q B

  Hence, we only need to keep an additional variable nestlvl to indicate the
  nesting level a container is at and use that to compute (a) the maximum field
  width we need to print out the container names and (b) to correctly indent
  each container according to its nesting level when printing it.

- add comments to make the ls_get() function more accessible

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
2016-01-13 17:06:23 +01:00
Serge Hallyn
449710f84a cgmanager: fix abuse of 'i'
we were initializing i to 0, then doing a while i <, but then a
separate commit (by myself) used i as a generic variable in between
those two.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-01-12 17:21:59 -08:00
Serge Hallyn
3b117b8500 Merge pull request #742 from brauner/2015-12-12/split_bdev_into_modules
Split bdev into modules
2016-01-12 00:07:33 -08:00
Christian Brauner
cdb4e53a7d 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@mailbox.org>
2016-01-12 08:50:45 +01:00
Christian Brauner
bf76c012b3 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@mailbox.org>
2016-01-12 08:50:45 +01:00
Christian Brauner
3ceb282072 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@mailbox.org>
2016-01-12 08:50:45 +01:00
Christian Brauner
304b4cf3ae 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@mailbox.org>
2016-01-12 08:50:45 +01:00
Christian Brauner
9d983015ff 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@mailbox.org>
2016-01-12 08:50:45 +01:00
Christian Brauner
00f0a1f896 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@mailbox.org>
2016-01-12 08:50:45 +01:00