]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/storage/storage.h
rename functions which clash with libsystemd's
[mirror_lxc.git] / src / lxc / storage / storage.h
index aa819df65f9dd5a137a2581e3f37b4267b75070e..a3873fa80e2b06a6b3557177997c6b427444676f 100644 (file)
@@ -1,41 +1,24 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <daniel.lezcano at free.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+/* SPDX-License-Identifier: LGPL-2.1+ */
 
 #ifndef __LXC_STORAGE_H
 #define __LXC_STORAGE_H
 
 #include "config.h"
+
 #include <stdint.h>
 #include <sys/mount.h>
 
-#include <lxc/lxccontainer.h>
+#include "lxc.h"
 
 #if IS_BIONIC
-#include <../include/lxcmntent.h>
+#include "lxcmntent.h"
 #else
 #include <mntent.h>
 #endif
 
+#include "compiler.h"
+#include "conf.h"
+
 #ifndef MS_DIRSYNC
 #define MS_DIRSYNC 128
 #endif
@@ -61,7 +44,7 @@
 #endif
 
 #define DEFAULT_FS_SIZE 1073741824
-#define DEFAULT_FSTYPE "ext3"
+#define DEFAULT_FSTYPE "ext4"
 
 #define LXC_STORAGE_INTERNAL_OVERLAY_RESTORE  (1 << 6)
 
@@ -76,7 +59,7 @@ struct lxc_storage_ops {
        int (*umount)(struct lxc_storage *bdev);
        int (*destroy)(struct lxc_storage *bdev);
        int (*create)(struct lxc_storage *bdev, const char *dest, const char *n,
-                     struct bdev_specs *specs);
+                     struct bdev_specs *specs, const struct lxc_conf *conf);
        /* given original mount, rename the paths for cloned container */
        int (*clone_paths)(struct lxc_storage *orig, struct lxc_storage *new,
                           const char *oldname, const char *cname,
@@ -107,38 +90,34 @@ struct lxc_storage {
        /* index for the connected nbd device. */
        int nbd_idx;
        int flags;
+       struct lxc_rootfs *rootfs;
 };
 
-extern bool storage_is_dir(struct lxc_conf *conf, const char *path);
-extern bool storage_can_backup(struct lxc_conf *conf);
-
-/* Instantiate a lxc_storage object. The src is used to determine which blockdev
- * type this should be. The dst and data are optional, and will be used in case
- * of mount/umount.
- *
- * The source will be "dir:/var/lib/lxc/c1" or "lvm:/dev/lxc/c1". For other
- * backing stores, this will allow additional options. In particular,
- * "overlayfs:/var/lib/lxc/canonical/rootfs:/var/lib/lxc/c1/delta" will mean use
- * /var/lib/lxc/canonical/rootfs as lower dir, and /var/lib/lxc/c1/delta as the
- * upper, writeable layer.
+/**
+ * storage_lxc_is_dir : Check whether the roots is a directory. This function will
+ *                  trust the config file. If the config file key
+ *                  lxc.rootfs.path is set to <storage type>:<container path>
+ *                  the confile parser will have split this into <storage type>
+ *                  and <container path> and set the <bdev_type> member in the
+ *                  lxc_rootfs struct to <storage type> and the <path> member
+ *                  will be set to a clean <container path> without the <storage
+ *                  type> prefix. This is the new, clean way of handling storage
+ *                  type specifications.  If the <storage type> prefix is not
+ *                  detected liblxc will try to detect the storage type.
  */
-extern struct lxc_storage *storage_init(struct lxc_conf *conf, const char *src,
-                                       const char *dst, const char *data);
-
-extern struct lxc_storage *storage_copy(struct lxc_container *c0,
-                                       const char *cname, const char *lxcpath,
-                                       const char *bdevtype, int flags,
-                                       const char *bdevdata, uint64_t newsize,
-                                       bool *needs_rdep);
-extern struct lxc_storage *storage_create(const char *dest, const char *type,
-                                         const char *cname,
-                                         struct bdev_specs *specs);
-extern void storage_put(struct lxc_storage *bdev);
-extern bool storage_destroy(struct lxc_conf *conf);
-
-/* callback function to be used with userns_exec_1() */
-extern int storage_destroy_wrapper(void *data);
-extern bool rootfs_is_blockdev(struct lxc_conf *conf);
-extern char *lxc_storage_get_path(char *src, const char *prefix);
+__hidden extern bool storage_lxc_is_dir(struct lxc_conf *conf);
+__hidden extern bool storage_can_backup(struct lxc_conf *conf);
+__hidden extern struct lxc_storage *storage_init(struct lxc_conf *conf);
+__hidden extern struct lxc_storage *storage_copy(struct lxc_container *c, const char *cname,
+                                                const char *lxcpath, const char *bdevtype,
+                                                int flags, const char *bdevdata, uint64_t newsize,
+                                                bool *needs_rdep);
+__hidden extern struct lxc_storage *storage_create(const char *dest, const char *type,
+                                                  const char *cname, struct bdev_specs *specs,
+                                                  const struct lxc_conf *conf);
+__hidden extern void storage_put(struct lxc_storage *bdev);
+__hidden extern bool storage_destroy(struct lxc_conf *conf);
+__hidden extern bool rootfs_is_blockdev(struct lxc_conf *conf);
+__hidden extern const char *lxc_storage_get_path(char *src, const char *prefix);
 
 #endif /* #define __LXC_STORAGE_H */