]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/lxccontainer.h
spelling: constant
[mirror_lxc.git] / src / lxc / lxccontainer.h
index 3aee440e4ec788d0e22da40144c44eae4758d2a6..8e38928c3aa3a9e55c66345c85973a93115772df 100644 (file)
 
 #ifndef __LXC_CONTAINER_H
 #define __LXC_CONTAINER_H
+
 #include <malloc.h>
 #include <semaphore.h>
 #include <stdbool.h>
-#include <stdlib.h>
 #include <stdint.h>
+#include <stdlib.h>
 
 #include <lxc/attach_options.h>
 
@@ -42,6 +43,7 @@ extern "C" {
 #define LXC_CLONE_MAXFLAGS        (1 << 5) /*!< Number of \c LXC_CLONE_* flags */
 #define LXC_CREATE_QUIET          (1 << 0) /*!< Redirect \c stdin to \c /dev/zero and \c stdout and \c stderr to \c /dev/null */
 #define LXC_CREATE_MAXFLAGS       (1 << 1) /*!< Number of \c LXC_CREATE* flags */
+#define LXC_MOUNT_API_V1                  1
 
 struct bdev_specs;
 
@@ -51,6 +53,12 @@ struct lxc_lock;
 
 struct migrate_opts;
 
+struct lxc_console_log;
+
+struct lxc_mount {
+       int version;
+};
+
 /*!
  * An LXC container.
  *
@@ -291,7 +299,7 @@ struct lxc_container {
        bool (*destroy)(struct lxc_container *c);
 
        /*!
-        * \brief Save configuaration to a file.
+        * \brief Save configuration to a file.
         *
         * \param c Container.
         * \param alt_file Full path to file to save configuration in.
@@ -816,13 +824,48 @@ struct lxc_container {
        /*!
         * \brief An API call to perform various migration operations
         *
-        * \param cmd One of the MIGRATE_ contstants.
+        * \param cmd One of the MIGRATE_ constants.
         * \param opts A migrate_opts struct filled with relevant options.
         * \param size The size of the migrate_opts struct, i.e. sizeof(struct migrate_opts).
         *
         * \return \c 0 on success, nonzero on failure.
         */
        int (*migrate)(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, unsigned int size);
+
+       /*!
+        * \brief Query the console log of a container.
+        *
+        * \param c Container.
+        * \param opts A lxc_console_log struct filled with relevant options.
+        *
+        * \return \c 0 on success, nonzero on failure.
+        */
+       int (*console_log)(struct lxc_container *c, struct lxc_console_log *log);
+
+       /*!
+        * \brief Request the container reboot by sending it \c SIGINT.
+        *
+        * \param c Container.
+        * \param timeout Seconds to wait before returning false.
+        *  (-1 to wait forever, 0 to avoid waiting).
+        *
+        * \return \c true if the container was rebooted successfully, else \c false.
+        */
+       bool (*reboot2)(struct lxc_container *c, int timeout);
+
+       /*!
+        * \brief Mount the host's path `source` onto the container's path `target`.
+        */
+       int (*mount)(struct lxc_container *c, const char *source,
+                    const char *target, const char *filesystemtype,
+                    unsigned long mountflags, const void *data,
+                    struct lxc_mount *mnt);
+
+       /*!
+        * \brief Unmount the container's path `target`.
+        */
+       int (*umount)(struct lxc_container *c, const char *target,
+                     unsigned long mountflags, struct lxc_mount *mnt);
 };
 
 /*!
@@ -870,8 +913,15 @@ enum {
        MIGRATE_PRE_DUMP,
        MIGRATE_DUMP,
        MIGRATE_RESTORE,
+       MIGRATE_FEATURE_CHECK,
 };
 
+/*!
+ * \brief Available feature checks.
+ */
+#define FEATURE_MEM_TRACK    (1ULL << 0)
+#define FEATURE_LAZY_PAGES   (1ULL << 1)
+
 /*!
  * \brief Options for the migrate API call.
  */
@@ -908,6 +958,35 @@ struct migrate_opts {
         * which at this time is 1MB.
         */
        uint64_t ghost_limit;
+
+       /* Some features cannot be checked by comparing the CRIU version.
+        * Features like dirty page tracking or userfaultfd depend on
+        * the architecture/kernel/criu combination. This is a bitmask
+        * in which the desired feature checks can be encoded.
+        */
+       uint64_t features_to_check;
+};
+
+struct lxc_console_log {
+       /* Clear the console log. */
+       bool clear;
+
+       /* Retrieve the console log. */
+       bool read;
+
+       /* This specifies the maximum size to read from the ringbuffer. Setting
+        * it to 0 means that the a read can be as big as the whole ringbuffer.
+        * On return callers can check how many bytes were actually read.
+        * If "read" and "clear" are set to false and a non-zero value is
+        * specified then up to "read_max" bytes of data will be discarded from
+        * the ringbuffer.
+        */
+       uint64_t *read_max;
+
+       /* Data that was read from the ringbuffer. If "read_max" is 0 on return
+        * "data" is invalid.
+        */
+       char *data;
 };
 
 /*!
@@ -1045,6 +1124,13 @@ void lxc_log_close(void);
  */
 bool lxc_config_item_is_supported(const char *key);
 
+/*!
+ * \brief Check if an API extension is supported by this LXC instance.
+ *
+ * \param extension API extension to check for.
+ */
+bool lxc_has_api_extension(const char *extension);
+
 #ifdef  __cplusplus
 }
 #endif