#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>
#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;
struct lxc_console_log;
+struct lxc_mount {
+ int version;
+};
+
/*!
* An 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.
/*!
* \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).
*
int (*migrate)(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, unsigned int size);
/*!
- * \brief Set a key/value configuration option on a running container.
+ * \brief Query the console log of a container.
*
* \param c Container.
- * \param key Name of option to set.
- * \param value Value of \p name to set.
+ * \param opts A lxc_console_log struct filled with relevant options.
*
- * \return \c true on success, else \c false.
+ * \return \c 0 on success, nonzero on failure.
*/
- bool (*set_running_config_item)(struct lxc_container *c, const char *key, const char *value);
+ int (*console_log)(struct lxc_container *c, struct lxc_console_log *log);
/*!
- * \brief Query the console log of a container.
+ * \brief Request the container reboot by sending it \c SIGINT.
*
* \param c Container.
- * \param opts A lxc_console_log struct filled with relevant options.
+ * \param timeout Seconds to wait before returning false.
+ * (-1 to wait forever, 0 to avoid waiting).
*
- * \return \c 0 on success, nonzero on failure.
+ * \return \c true if the container was rebooted successfully, else \c false.
*/
- int (*console_log)(struct lxc_container *c, struct lxc_console_log *log);
+ 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);
};
/*!
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.
*/
* 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 {
* "data" is invalid.
*/
char *data;
-
- /* If a console log file was specified this flag indicates whether the
- * contents of the ringbuffer should be written to the logfile when a
- * request is sent to the ringbuffer.
- */
- bool write_logfile;
};
/*!
*/
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