mirror of https://gitee.com/openkylin/libvirt.git
build: consistently indent preprocessor directives
* global: patch created by running: for f in $(git ls-files '*.[ch]') ; do cppi $f > $f.t && mv $f.t $f done
This commit is contained in:
parent
0c39adef95
commit
36d8e7d8d7
|
@ -22,10 +22,10 @@
|
|||
*/
|
||||
|
||||
#ifndef __LIBVIRTD_DISPATCH_H__
|
||||
#define __LIBVIRTD_DISPATCH_H__
|
||||
# define __LIBVIRTD_DISPATCH_H__
|
||||
|
||||
|
||||
#include "libvirtd.h"
|
||||
# include "libvirtd.h"
|
||||
|
||||
|
||||
int
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIRTD_EVENT_H__
|
||||
#define __VIRTD_EVENT_H__
|
||||
# define __VIRTD_EVENT_H__
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
/**
|
||||
* virEventAddHandleImpl: register a callback for monitoring file handle events
|
||||
|
|
|
@ -63,60 +63,60 @@
|
|||
#include "memory.h"
|
||||
#include "stream.h"
|
||||
#ifdef HAVE_AVAHI
|
||||
#include "mdns.h"
|
||||
# include "mdns.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
#include "driver.h"
|
||||
# include "driver.h"
|
||||
#else
|
||||
#ifdef WITH_QEMU
|
||||
#include "qemu/qemu_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_LXC
|
||||
#include "lxc/lxc_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_UML
|
||||
#include "uml/uml_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_ONE
|
||||
#include "opennebula/one_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_NETWORK
|
||||
#include "network/bridge_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_NETCF
|
||||
#include "interface/netcf_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_STORAGE_DIR
|
||||
#include "storage/storage_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_NODE_DEVICES
|
||||
#include "node_device/node_device_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_SECRETS
|
||||
#include "secret/secret_driver.h"
|
||||
#endif
|
||||
# ifdef WITH_QEMU
|
||||
# include "qemu/qemu_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_LXC
|
||||
# include "lxc/lxc_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_UML
|
||||
# include "uml/uml_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_ONE
|
||||
# include "opennebula/one_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_NETWORK
|
||||
# include "network/bridge_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_NETCF
|
||||
# include "interface/netcf_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_STORAGE_DIR
|
||||
# include "storage/storage_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_NODE_DEVICES
|
||||
# include "node_device/node_device_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_SECRETS
|
||||
# include "secret/secret_driver.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __sun
|
||||
#include <ucred.h>
|
||||
#include <priv.h>
|
||||
# include <ucred.h>
|
||||
# include <priv.h>
|
||||
|
||||
#ifndef PRIV_VIRT_MANAGE
|
||||
#define PRIV_VIRT_MANAGE ((const char *)"virt_manage")
|
||||
#endif
|
||||
# ifndef PRIV_VIRT_MANAGE
|
||||
# define PRIV_VIRT_MANAGE ((const char *)"virt_manage")
|
||||
# endif
|
||||
|
||||
#ifndef PRIV_XVM_CONTROL
|
||||
#define PRIV_XVM_CONTROL ((const char *)"xvm_control")
|
||||
#endif
|
||||
# ifndef PRIV_XVM_CONTROL
|
||||
# define PRIV_XVM_CONTROL ((const char *)"xvm_control")
|
||||
# endif
|
||||
|
||||
#define PU_RESETGROUPS 0x0001 /* Remove supplemental groups */
|
||||
#define PU_CLEARLIMITSET 0x0008 /* L=0 */
|
||||
# define PU_RESETGROUPS 0x0001 /* Remove supplemental groups */
|
||||
# define PU_CLEARLIMITSET 0x0008 /* L=0 */
|
||||
|
||||
extern int __init_daemon_priv(int, uid_t, gid_t, ...);
|
||||
|
||||
#define SYSTEM_UID 60
|
||||
# define SYSTEM_UID 60
|
||||
|
||||
static gid_t unix_sock_gid = 60; /* Not used */
|
||||
static int unix_sock_rw_mask = 0666;
|
||||
|
@ -877,33 +877,33 @@ static struct qemud_server *qemudInitialize(void) {
|
|||
virDriverLoadModule("uml");
|
||||
virDriverLoadModule("one");
|
||||
#else
|
||||
#ifdef WITH_NETWORK
|
||||
# ifdef WITH_NETWORK
|
||||
networkRegister();
|
||||
#endif
|
||||
#ifdef WITH_NETCF
|
||||
# endif
|
||||
# ifdef WITH_NETCF
|
||||
interfaceRegister();
|
||||
#endif
|
||||
#ifdef WITH_STORAGE_DIR
|
||||
# endif
|
||||
# ifdef WITH_STORAGE_DIR
|
||||
storageRegister();
|
||||
#endif
|
||||
#if defined(WITH_NODE_DEVICES)
|
||||
# endif
|
||||
# if defined(WITH_NODE_DEVICES)
|
||||
nodedevRegister();
|
||||
#endif
|
||||
#ifdef WITH_SECRETS
|
||||
# endif
|
||||
# ifdef WITH_SECRETS
|
||||
secretRegister();
|
||||
#endif
|
||||
#ifdef WITH_QEMU
|
||||
# endif
|
||||
# ifdef WITH_QEMU
|
||||
qemuRegister();
|
||||
#endif
|
||||
#ifdef WITH_LXC
|
||||
# endif
|
||||
# ifdef WITH_LXC
|
||||
lxcRegister();
|
||||
#endif
|
||||
#ifdef WITH_UML
|
||||
# endif
|
||||
# ifdef WITH_UML
|
||||
umlRegister();
|
||||
#endif
|
||||
#ifdef WITH_ONE
|
||||
# endif
|
||||
# ifdef WITH_ONE
|
||||
oneRegister();
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
virEventRegisterImpl(virEventAddHandleImpl,
|
||||
|
@ -1247,7 +1247,7 @@ remoteCheckAccess (struct qemud_client *client)
|
|||
|
||||
#if HAVE_POLKIT
|
||||
int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid) {
|
||||
#ifdef SO_PEERCRED
|
||||
# ifdef SO_PEERCRED
|
||||
struct ucred cr;
|
||||
unsigned int cr_len = sizeof (cr);
|
||||
|
||||
|
@ -1260,10 +1260,10 @@ int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid) {
|
|||
|
||||
*pid = cr.pid;
|
||||
*uid = cr.uid;
|
||||
#else
|
||||
# else
|
||||
/* XXX Many more OS support UNIX socket credentials we could port to. See dbus ....*/
|
||||
#error "UNIX socket credentials not supported/implemented on this platform yet..."
|
||||
#endif
|
||||
# error "UNIX socket credentials not supported/implemented on this platform yet..."
|
||||
# endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -2858,7 +2858,7 @@ qemudSetupPrivs (void)
|
|||
return 0;
|
||||
}
|
||||
#else
|
||||
#define qemudSetupPrivs() 0
|
||||
# define qemudSetupPrivs() 0
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -23,53 +23,53 @@
|
|||
|
||||
|
||||
#ifndef QEMUD_INTERNAL_H__
|
||||
#define QEMUD_INTERNAL_H__
|
||||
# define QEMUD_INTERNAL_H__
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/x509.h>
|
||||
#include "gnutls_1_0_compat.h"
|
||||
#if HAVE_SASL
|
||||
#include <sasl/sasl.h>
|
||||
#endif
|
||||
# include <gnutls/gnutls.h>
|
||||
# include <gnutls/x509.h>
|
||||
# include "gnutls_1_0_compat.h"
|
||||
# if HAVE_SASL
|
||||
# include <sasl/sasl.h>
|
||||
# endif
|
||||
|
||||
#if HAVE_POLKIT0
|
||||
#include <dbus/dbus.h>
|
||||
#endif
|
||||
# if HAVE_POLKIT0
|
||||
# include <dbus/dbus.h>
|
||||
# endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSLIMITS_H
|
||||
#include <sys/syslimits.h>
|
||||
#endif
|
||||
# ifdef HAVE_SYS_SYSLIMITS_H
|
||||
# include <sys/syslimits.h>
|
||||
# endif
|
||||
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include "remote_protocol.h"
|
||||
#include "logging.h"
|
||||
#include "threads.h"
|
||||
# include <rpc/types.h>
|
||||
# include <rpc/xdr.h>
|
||||
# include "remote_protocol.h"
|
||||
# include "logging.h"
|
||||
# include "threads.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
# ifdef __GNUC__
|
||||
# ifdef HAVE_ANSIDECL_H
|
||||
# include <ansidecl.h>
|
||||
# endif
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
#if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
# ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
#define __GNUC_PREREQ(maj,min) 0
|
||||
#endif
|
||||
#endif
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj,min) 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* Macro to flag conciously unused parameters to functions
|
||||
*/
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
# endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_FMT_PRINTF
|
||||
|
@ -81,35 +81,35 @@
|
|||
* printf format specifiers even on broken Win32 platforms
|
||||
* hence we have to force 'gnu_printf' for new GCC
|
||||
*/
|
||||
#ifndef ATTRIBUTE_FMT_PRINTF
|
||||
#if __GNUC_PREREQ (4, 4)
|
||||
#define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (gnu_printf, fmtpos,argpos)))
|
||||
#else
|
||||
#define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (printf, fmtpos,argpos)))
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_FMT_PRINTF
|
||||
# if __GNUC_PREREQ (4, 4)
|
||||
# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (gnu_printf, fmtpos,argpos)))
|
||||
# else
|
||||
# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (printf, fmtpos,argpos)))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifndef ATTRIBUTE_RETURN_CHECK
|
||||
#if __GNUC_PREREQ (3, 4)
|
||||
#define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define ATTRIBUTE_RETURN_CHECK
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_RETURN_CHECK
|
||||
# if __GNUC_PREREQ (3, 4)
|
||||
# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
|
||||
# else
|
||||
# define ATTRIBUTE_RETURN_CHECK
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#else
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_FMT_PRINTF
|
||||
#define ATTRIBUTE_FMT_PRINTF(...)
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_RETURN_CHECK
|
||||
#define ATTRIBUTE_RETURN_CHECK
|
||||
#endif
|
||||
#endif
|
||||
# else
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED
|
||||
# endif
|
||||
# ifndef ATTRIBUTE_FMT_PRINTF
|
||||
# define ATTRIBUTE_FMT_PRINTF(...)
|
||||
# endif
|
||||
# ifndef ATTRIBUTE_RETURN_CHECK
|
||||
# define ATTRIBUTE_RETURN_CHECK
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#define qemudDebug DEBUG
|
||||
# define qemudDebug DEBUG
|
||||
|
||||
/* Whether we're passing reads & writes through a sasl SSF */
|
||||
enum qemud_sasl_ssf {
|
||||
|
@ -186,7 +186,7 @@ struct qemud_client {
|
|||
gnutls_session_t tlssession;
|
||||
int auth;
|
||||
unsigned int handshake :1; /* If we're in progress for TLS handshake */
|
||||
#if HAVE_SASL
|
||||
# if HAVE_SASL
|
||||
sasl_conn_t *saslconn;
|
||||
int saslSSF;
|
||||
const char *saslDecoded;
|
||||
|
@ -196,7 +196,7 @@ struct qemud_client {
|
|||
unsigned int saslEncodedLength;
|
||||
unsigned int saslEncodedOffset;
|
||||
char *saslUsername;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Count of meages in 'dx' or 'tx' queue
|
||||
* ie RPC calls in progress. Does not count
|
||||
|
@ -229,7 +229,7 @@ struct qemud_client {
|
|||
|
||||
};
|
||||
|
||||
#define QEMUD_CLIENT_MAGIC 0x7788aaee
|
||||
# define QEMUD_CLIENT_MAGIC 0x7788aaee
|
||||
|
||||
|
||||
struct qemud_socket {
|
||||
|
@ -273,15 +273,15 @@ struct qemud_server {
|
|||
pthread_t eventThread;
|
||||
unsigned int hasEventThread :1;
|
||||
unsigned int quitEventThread :1;
|
||||
#ifdef HAVE_AVAHI
|
||||
# ifdef HAVE_AVAHI
|
||||
struct libvirtd_mdns *mdns;
|
||||
#endif
|
||||
#if HAVE_SASL
|
||||
# endif
|
||||
# if HAVE_SASL
|
||||
char **saslUsernameWhitelist;
|
||||
#endif
|
||||
#if HAVE_POLKIT0
|
||||
# endif
|
||||
# if HAVE_POLKIT0
|
||||
DBusConnection *sysbus;
|
||||
#endif
|
||||
# endif
|
||||
};
|
||||
|
||||
void qemudLog(int priority, const char *fmt, ...)
|
||||
|
@ -306,8 +306,8 @@ qemudClientMessageRelease(struct qemud_client *client,
|
|||
struct qemud_client_message *msg);
|
||||
|
||||
|
||||
#if HAVE_POLKIT
|
||||
# if HAVE_POLKIT
|
||||
int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "internal.h"
|
||||
|
||||
#ifndef __VIRTD_MDNS_H__
|
||||
#define __VIRTD_MDNS_H__
|
||||
# define __VIRTD_MDNS_H__
|
||||
|
||||
struct libvirtd_mdns;
|
||||
struct libvirtd_mdns_group;
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
#include "virterror_internal.h"
|
||||
|
||||
#if HAVE_POLKIT0
|
||||
#include <polkit/polkit.h>
|
||||
#include <polkit-dbus/polkit-dbus.h>
|
||||
# include <polkit/polkit.h>
|
||||
# include <polkit-dbus/polkit-dbus.h>
|
||||
#endif
|
||||
|
||||
#include "remote.h"
|
||||
|
@ -3516,7 +3516,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
|
|||
goto authfail;
|
||||
}
|
||||
|
||||
#if HAVE_POLKIT_CONTEXT_IS_CALLER_AUTHORIZED
|
||||
# if HAVE_POLKIT_CONTEXT_IS_CALLER_AUTHORIZED
|
||||
pkresult = polkit_context_is_caller_authorized(pkcontext,
|
||||
pkaction,
|
||||
pkcaller,
|
||||
|
@ -3528,11 +3528,11 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
|
|||
polkit_error_get_error_message(pkerr));
|
||||
goto authfail;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
pkresult = polkit_context_can_caller_do_action(pkcontext,
|
||||
pkaction,
|
||||
pkcaller);
|
||||
#endif
|
||||
# endif
|
||||
polkit_context_unref(pkcontext);
|
||||
polkit_caller_unref(pkcaller);
|
||||
polkit_action_unref(pkaction);
|
||||
|
|
|
@ -22,17 +22,17 @@
|
|||
*/
|
||||
|
||||
#ifndef __LIBVIRTD_REMOTE_H__
|
||||
#define __LIBVIRTD_REMOTE_H__
|
||||
# define __LIBVIRTD_REMOTE_H__
|
||||
|
||||
|
||||
#include "libvirtd.h"
|
||||
# include "libvirtd.h"
|
||||
|
||||
typedef union {
|
||||
#include "remote_dispatch_args.h"
|
||||
# include "remote_dispatch_args.h"
|
||||
} dispatch_args;
|
||||
|
||||
typedef union {
|
||||
#include "remote_dispatch_ret.h"
|
||||
# include "remote_dispatch_ret.h"
|
||||
} dispatch_ret;
|
||||
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
|
||||
#ifndef __LIBVIRTD_STREAM_H__
|
||||
#define __LIBVIRTD_STREAM_H__
|
||||
# define __LIBVIRTD_STREAM_H__
|
||||
|
||||
#include "libvirtd.h"
|
||||
# include "libvirtd.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
#include <signal.h>
|
||||
|
||||
#if HAVE_SYS_POLL_H
|
||||
#include <sys/types.h>
|
||||
#include <sys/poll.h>
|
||||
#include <libvirt/libvirt.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/poll.h>
|
||||
# include <libvirt/libvirt.h>
|
||||
|
||||
#define DEBUG0(fmt) printf("%s:%d :: " fmt "\n", \
|
||||
# define DEBUG0(fmt) printf("%s:%d :: " fmt "\n", \
|
||||
__func__, __LINE__)
|
||||
#define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \
|
||||
# define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \
|
||||
__func__, __LINE__, __VA_ARGS__)
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
# define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
# endif
|
||||
|
||||
/* handle globals */
|
||||
int h_fd = 0;
|
||||
|
@ -28,7 +28,7 @@ virFreeCallback h_ff = NULL;
|
|||
void *h_opaque = NULL;
|
||||
|
||||
/* timeout globals */
|
||||
#define TIMEOUT_MS 1000
|
||||
# define TIMEOUT_MS 1000
|
||||
int t_active = 0;
|
||||
int t_timeout = -1;
|
||||
virEventTimeoutCallback t_cb = NULL;
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_VIRERR_H__
|
||||
#define __VIR_VIRERR_H__
|
||||
# define __VIR_VIRERR_H__
|
||||
|
||||
#include <libvirt/libvirt.h>
|
||||
# include <libvirt/libvirt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* virErrorLevel:
|
||||
|
@ -210,8 +210,8 @@ void virConnSetErrorFunc (virConnectPtr conn,
|
|||
virErrorFunc handler);
|
||||
int virConnCopyLastError (virConnectPtr conn,
|
||||
virErrorPtr to);
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif /* __VIR_VIRERR_H__ */
|
||||
|
|
|
@ -14,30 +14,30 @@
|
|||
|
||||
#ifdef WITH_XEN
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <locale.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include <errno.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/poll.h>
|
||||
# include <sys/socket.h>
|
||||
# include <sys/un.h>
|
||||
# include <locale.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "datatypes.h"
|
||||
#include "proxy_internal.h"
|
||||
#include "util.h"
|
||||
#include "xen_hypervisor.h"
|
||||
#include "xend_internal.h"
|
||||
#include "xs_internal.h"
|
||||
#include "xen_driver.h"
|
||||
# include "internal.h"
|
||||
# include "datatypes.h"
|
||||
# include "proxy_internal.h"
|
||||
# include "util.h"
|
||||
# include "xen_hypervisor.h"
|
||||
# include "xend_internal.h"
|
||||
# include "xs_internal.h"
|
||||
# include "xen_driver.h"
|
||||
|
||||
static int fdServer = -1;
|
||||
static int debug = 0;
|
||||
static int persist = 0;
|
||||
static int done = 0;
|
||||
|
||||
#define MAX_CLIENT 64
|
||||
# define MAX_CLIENT 64
|
||||
|
||||
static int nbClients = 0; /* client 0 is the unix listen socket */
|
||||
static struct pollfd pollInfos[MAX_CLIENT + 1];
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
#include "libvirt/virterror.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef ATTRIBUTE_UNUSED
|
||||
#undef ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif /* ATTRIBUTE_UNUSED */
|
||||
# ifdef ATTRIBUTE_UNUSED
|
||||
# undef ATTRIBUTE_UNUSED
|
||||
# endif
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
# endif /* ATTRIBUTE_UNUSED */
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
|
||||
#define PyvirConnect_Get(v) (((v) == Py_None) ? NULL : \
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CAPABILITIES_H
|
||||
#define __VIR_CAPABILITIES_H
|
||||
# define __VIR_CAPABILITIES_H
|
||||
|
||||
#include "internal.h"
|
||||
#include "util.h"
|
||||
#include "buf.h"
|
||||
#include "cpu_conf.h"
|
||||
# include "internal.h"
|
||||
# include "util.h"
|
||||
# include "buf.h"
|
||||
# include "cpu_conf.h"
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
# include <libxml/xpath.h>
|
||||
|
||||
typedef struct _virCapsGuestFeature virCapsGuestFeature;
|
||||
typedef virCapsGuestFeature *virCapsGuestFeaturePtr;
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CPU_CONF_H__
|
||||
#define __VIR_CPU_CONF_H__
|
||||
# define __VIR_CPU_CONF_H__
|
||||
|
||||
#include "util.h"
|
||||
#include "buf.h"
|
||||
#ifndef PROXY
|
||||
#include "xml.h"
|
||||
#endif
|
||||
# include "util.h"
|
||||
# include "buf.h"
|
||||
# ifndef PROXY
|
||||
# include "xml.h"
|
||||
# endif
|
||||
|
||||
enum virCPUType {
|
||||
VIR_CPU_TYPE_HOST,
|
||||
|
@ -83,12 +83,12 @@ struct _virCPUDef {
|
|||
void
|
||||
virCPUDefFree(virCPUDefPtr def);
|
||||
|
||||
#ifndef PROXY
|
||||
# ifndef PROXY
|
||||
virCPUDefPtr
|
||||
virCPUDefParseXML(const xmlNodePtr node,
|
||||
xmlXPathContextPtr ctxt,
|
||||
enum virCPUType mode);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
enum virCPUFormatFlags {
|
||||
VIR_CPU_FORMAT_EMBEDED = (1 << 0) /* embed into existing <cpu/> element
|
||||
|
|
|
@ -22,20 +22,20 @@
|
|||
*/
|
||||
|
||||
#ifndef __DOMAIN_CONF_H
|
||||
#define __DOMAIN_CONF_H
|
||||
# define __DOMAIN_CONF_H
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
# include <libxml/parser.h>
|
||||
# include <libxml/tree.h>
|
||||
# include <libxml/xpath.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "capabilities.h"
|
||||
#include "storage_encryption_conf.h"
|
||||
#include "cpu_conf.h"
|
||||
#include "util.h"
|
||||
#include "threads.h"
|
||||
#include "hash.h"
|
||||
#include "network.h"
|
||||
# include "internal.h"
|
||||
# include "capabilities.h"
|
||||
# include "storage_encryption_conf.h"
|
||||
# include "cpu_conf.h"
|
||||
# include "util.h"
|
||||
# include "threads.h"
|
||||
# include "hash.h"
|
||||
# include "network.h"
|
||||
|
||||
/* Private component of virDomainXMLFlags */
|
||||
typedef enum {
|
||||
|
@ -566,7 +566,7 @@ struct _virDomainDeviceDef {
|
|||
};
|
||||
|
||||
|
||||
#define VIR_DOMAIN_MAX_BOOT_DEVS 4
|
||||
# define VIR_DOMAIN_MAX_BOOT_DEVS 4
|
||||
|
||||
/* 3 possible boot devices */
|
||||
enum virDomainBootOrder {
|
||||
|
@ -656,7 +656,7 @@ struct _virDomainClockDef {
|
|||
} data;
|
||||
};
|
||||
|
||||
#define VIR_DOMAIN_CPUMASK_LEN 1024
|
||||
# define VIR_DOMAIN_CPUMASK_LEN 1024
|
||||
|
||||
/* Guest VM main configuration */
|
||||
typedef struct _virDomainDef virDomainDef;
|
||||
|
@ -816,7 +816,7 @@ virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
|
|||
void virDomainRemoveInactive(virDomainObjListPtr doms,
|
||||
virDomainObjPtr dom);
|
||||
|
||||
#ifndef PROXY
|
||||
# ifndef PROXY
|
||||
virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
|
||||
const virDomainDefPtr def,
|
||||
const char *xmlStr,
|
||||
|
@ -840,7 +840,7 @@ virDomainObjPtr virDomainObjParseNode(virCapsPtr caps,
|
|||
|
||||
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
|
||||
|
||||
#endif
|
||||
# endif
|
||||
char *virDomainDefFormat(virDomainDefPtr def,
|
||||
int flags);
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
#include "internal.h"
|
||||
|
||||
#ifndef __DOMAIN_EVENT_H__
|
||||
#define __DOMAIN_EVENT_H__
|
||||
# define __DOMAIN_EVENT_H__
|
||||
|
||||
#include "domain_conf.h"
|
||||
# include "domain_conf.h"
|
||||
|
||||
struct _virDomainEventCallback {
|
||||
virConnectPtr conn;
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
*/
|
||||
|
||||
#ifndef __INTERFACE_CONF_H__
|
||||
#define __INTERFACE_CONF_H__
|
||||
# define __INTERFACE_CONF_H__
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
# include <libxml/parser.h>
|
||||
# include <libxml/tree.h>
|
||||
# include <libxml/xpath.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "util.h"
|
||||
#include "threads.h"
|
||||
# include "internal.h"
|
||||
# include "util.h"
|
||||
# include "threads.h"
|
||||
|
||||
/* There is currently 3 types of interfaces */
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __NETWORK_CONF_H__
|
||||
#define __NETWORK_CONF_H__
|
||||
# define __NETWORK_CONF_H__
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
# include <libxml/parser.h>
|
||||
# include <libxml/tree.h>
|
||||
# include <libxml/xpath.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "threads.h"
|
||||
# include "internal.h"
|
||||
# include "threads.h"
|
||||
|
||||
/* 2 possible types of forwarding */
|
||||
enum virNetworkForwardType {
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_NODE_DEVICE_CONF_H__
|
||||
#define __VIR_NODE_DEVICE_CONF_H__
|
||||
# define __VIR_NODE_DEVICE_CONF_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "util.h"
|
||||
#include "threads.h"
|
||||
# include "internal.h"
|
||||
# include "util.h"
|
||||
# include "threads.h"
|
||||
|
||||
#include <libxml/tree.h>
|
||||
# include <libxml/tree.h>
|
||||
|
||||
#define CREATE_DEVICE 1
|
||||
#define EXISTING_DEVICE 0
|
||||
# define CREATE_DEVICE 1
|
||||
# define EXISTING_DEVICE 0
|
||||
|
||||
enum virNodeDevCapType {
|
||||
/* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
|
||||
|
@ -218,7 +218,7 @@ struct _virDeviceMonitorState {
|
|||
void *privateData; /* driver-specific private data */
|
||||
};
|
||||
|
||||
#define virNodeDeviceReportError(code, ...) \
|
||||
# define virNodeDeviceReportError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_SECRET_CONF_H__
|
||||
#define __VIR_SECRET_CONF_H__
|
||||
# define __VIR_SECRET_CONF_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "util.h"
|
||||
# include "internal.h"
|
||||
# include "util.h"
|
||||
|
||||
#define virSecretReportError(code, ...) \
|
||||
# define virSecretReportError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_CONF_H__
|
||||
#define __VIR_STORAGE_CONF_H__
|
||||
# define __VIR_STORAGE_CONF_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "util.h"
|
||||
#include "storage_encryption_conf.h"
|
||||
#include "threads.h"
|
||||
# include "internal.h"
|
||||
# include "util.h"
|
||||
# include "storage_encryption_conf.h"
|
||||
# include "threads.h"
|
||||
|
||||
#include <libxml/tree.h>
|
||||
# include <libxml/tree.h>
|
||||
|
||||
/* Shared structs */
|
||||
|
||||
|
@ -318,7 +318,7 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) {
|
|||
return pool->active;
|
||||
}
|
||||
|
||||
#define virStorageReportError(code, ...) \
|
||||
# define virStorageReportError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_ENCRYPTION_H__
|
||||
#define __VIR_STORAGE_ENCRYPTION_H__
|
||||
# define __VIR_STORAGE_ENCRYPTION_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "buf.h"
|
||||
#include "util.h"
|
||||
# include "internal.h"
|
||||
# include "buf.h"
|
||||
# include "util.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <libxml/tree.h>
|
||||
# include <stdbool.h>
|
||||
# include <libxml/tree.h>
|
||||
|
||||
enum virStorageEncryptionSecretType {
|
||||
VIR_STORAGE_ENCRYPTION_SECRET_TYPE_PASSPHRASE = 0,
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CPU_H__
|
||||
#define __VIR_CPU_H__
|
||||
# define __VIR_CPU_H__
|
||||
|
||||
#include "virterror_internal.h"
|
||||
#include "datatypes.h"
|
||||
#include "conf/cpu_conf.h"
|
||||
#include "cpu_x86_data.h"
|
||||
# include "virterror_internal.h"
|
||||
# include "datatypes.h"
|
||||
# include "conf/cpu_conf.h"
|
||||
# include "cpu_x86_data.h"
|
||||
|
||||
|
||||
#define virCPUReportError(code, ...) \
|
||||
# define virCPUReportError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CPU_GENERIC_H__
|
||||
#define __VIR_CPU_GENERIC_H__
|
||||
# define __VIR_CPU_GENERIC_H__
|
||||
|
||||
#include "cpu.h"
|
||||
# include "cpu.h"
|
||||
|
||||
extern struct cpuArchDriver cpuDriverGeneric;
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CPU_MAP_H__
|
||||
#define __VIR_CPU_MAP_H__
|
||||
# define __VIR_CPU_MAP_H__
|
||||
|
||||
#include "xml.h"
|
||||
# include "xml.h"
|
||||
|
||||
|
||||
typedef int
|
||||
|
|
|
@ -1146,14 +1146,14 @@ error:
|
|||
static inline void
|
||||
cpuidCall(struct cpuX86cpuid *cpuid)
|
||||
{
|
||||
#if __x86_64__
|
||||
# if __x86_64__
|
||||
asm("cpuid"
|
||||
: "=a" (cpuid->eax),
|
||||
"=b" (cpuid->ebx),
|
||||
"=c" (cpuid->ecx),
|
||||
"=d" (cpuid->edx)
|
||||
: "a" (cpuid->function));
|
||||
#else
|
||||
# else
|
||||
/* we need to avoid direct use of ebx for CPUID output as it is used
|
||||
* for global offset table on i386 with -fPIC
|
||||
*/
|
||||
|
@ -1167,7 +1167,7 @@ cpuidCall(struct cpuX86cpuid *cpuid)
|
|||
"=d" (cpuid->edx)
|
||||
: "a" (cpuid->function)
|
||||
: "cc");
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CPU_X86_H__
|
||||
#define __VIR_CPU_X86_H__
|
||||
# define __VIR_CPU_X86_H__
|
||||
|
||||
#include "cpu.h"
|
||||
# include "cpu.h"
|
||||
|
||||
extern struct cpuArchDriver cpuDriverX86;
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_CPU_X86_DATA_H__
|
||||
#define __VIR_CPU_X86_DATA_H__
|
||||
# define __VIR_CPU_X86_DATA_H__
|
||||
|
||||
#include <stdint.h>
|
||||
# include <stdint.h>
|
||||
|
||||
struct cpuX86cpuid {
|
||||
uint32_t function;
|
||||
|
@ -34,8 +34,8 @@ struct cpuX86cpuid {
|
|||
uint32_t edx;
|
||||
};
|
||||
|
||||
#define CPUX86_BASIC 0x0
|
||||
#define CPUX86_EXTENDED 0x80000000
|
||||
# define CPUX86_BASIC 0x0
|
||||
# define CPUX86_EXTENDED 0x80000000
|
||||
|
||||
struct cpuX86Data {
|
||||
int basic_len;
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIRT_DATATYPES_H_
|
||||
#define __VIRT_DATATYPES_H_
|
||||
# define __VIRT_DATATYPES_H_
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
#include "hash.h"
|
||||
#include "driver.h"
|
||||
#include "threads.h"
|
||||
# include "hash.h"
|
||||
# include "driver.h"
|
||||
# include "threads.h"
|
||||
|
||||
/**
|
||||
* VIR_CONNECT_MAGIC:
|
||||
|
@ -34,8 +34,8 @@
|
|||
* magic value used to protect the API when pointers to connection structures
|
||||
* are passed down by the uers.
|
||||
*/
|
||||
#define VIR_CONNECT_MAGIC 0x4F23DEAD
|
||||
#define VIR_IS_CONNECT(obj) ((obj) && (obj)->magic==VIR_CONNECT_MAGIC)
|
||||
# define VIR_CONNECT_MAGIC 0x4F23DEAD
|
||||
# define VIR_IS_CONNECT(obj) ((obj) && (obj)->magic==VIR_CONNECT_MAGIC)
|
||||
|
||||
|
||||
/**
|
||||
|
@ -44,9 +44,9 @@
|
|||
* magic value used to protect the API when pointers to domain structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_DOMAIN_MAGIC 0xDEAD4321
|
||||
#define VIR_IS_DOMAIN(obj) ((obj) && (obj)->magic==VIR_DOMAIN_MAGIC)
|
||||
#define VIR_IS_CONNECTED_DOMAIN(obj) (VIR_IS_DOMAIN(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_DOMAIN_MAGIC 0xDEAD4321
|
||||
# define VIR_IS_DOMAIN(obj) ((obj) && (obj)->magic==VIR_DOMAIN_MAGIC)
|
||||
# define VIR_IS_CONNECTED_DOMAIN(obj) (VIR_IS_DOMAIN(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
/**
|
||||
* VIR_NETWORK_MAGIC:
|
||||
|
@ -54,9 +54,9 @@
|
|||
* magic value used to protect the API when pointers to network structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_NETWORK_MAGIC 0xDEAD1234
|
||||
#define VIR_IS_NETWORK(obj) ((obj) && (obj)->magic==VIR_NETWORK_MAGIC)
|
||||
#define VIR_IS_CONNECTED_NETWORK(obj) (VIR_IS_NETWORK(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_NETWORK_MAGIC 0xDEAD1234
|
||||
# define VIR_IS_NETWORK(obj) ((obj) && (obj)->magic==VIR_NETWORK_MAGIC)
|
||||
# define VIR_IS_CONNECTED_NETWORK(obj) (VIR_IS_NETWORK(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
/**
|
||||
* VIR_INTERFACE_MAGIC:
|
||||
|
@ -64,9 +64,9 @@
|
|||
* magic value used to protect the API when pointers to interface structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_INTERFACE_MAGIC 0xDEAD5309
|
||||
#define VIR_IS_INTERFACE(obj) ((obj) && (obj)->magic==VIR_INTERFACE_MAGIC)
|
||||
#define VIR_IS_CONNECTED_INTERFACE(obj) (VIR_IS_INTERFACE(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_INTERFACE_MAGIC 0xDEAD5309
|
||||
# define VIR_IS_INTERFACE(obj) ((obj) && (obj)->magic==VIR_INTERFACE_MAGIC)
|
||||
# define VIR_IS_CONNECTED_INTERFACE(obj) (VIR_IS_INTERFACE(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
/**
|
||||
* VIR_STORAGE_POOL_MAGIC:
|
||||
|
@ -74,9 +74,9 @@
|
|||
* magic value used to protect the API when pointers to storage pool structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_STORAGE_POOL_MAGIC 0xDEAD5678
|
||||
#define VIR_IS_STORAGE_POOL(obj) ((obj) && (obj)->magic==VIR_STORAGE_POOL_MAGIC)
|
||||
#define VIR_IS_CONNECTED_STORAGE_POOL(obj) (VIR_IS_STORAGE_POOL(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_STORAGE_POOL_MAGIC 0xDEAD5678
|
||||
# define VIR_IS_STORAGE_POOL(obj) ((obj) && (obj)->magic==VIR_STORAGE_POOL_MAGIC)
|
||||
# define VIR_IS_CONNECTED_STORAGE_POOL(obj) (VIR_IS_STORAGE_POOL(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
/**
|
||||
* VIR_STORAGE_VOL_MAGIC:
|
||||
|
@ -84,9 +84,9 @@
|
|||
* magic value used to protect the API when pointers to storage vol structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_STORAGE_VOL_MAGIC 0xDEAD8765
|
||||
#define VIR_IS_STORAGE_VOL(obj) ((obj) && (obj)->magic==VIR_STORAGE_VOL_MAGIC)
|
||||
#define VIR_IS_CONNECTED_STORAGE_VOL(obj) (VIR_IS_STORAGE_VOL(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_STORAGE_VOL_MAGIC 0xDEAD8765
|
||||
# define VIR_IS_STORAGE_VOL(obj) ((obj) && (obj)->magic==VIR_STORAGE_VOL_MAGIC)
|
||||
# define VIR_IS_CONNECTED_STORAGE_VOL(obj) (VIR_IS_STORAGE_VOL(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
/**
|
||||
* VIR_NODE_DEVICE_MAGIC:
|
||||
|
@ -94,9 +94,9 @@
|
|||
* magic value used to protect the API when pointers to storage vol structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_NODE_DEVICE_MAGIC 0xDEAD5679
|
||||
#define VIR_IS_NODE_DEVICE(obj) ((obj) && (obj)->magic==VIR_NODE_DEVICE_MAGIC)
|
||||
#define VIR_IS_CONNECTED_NODE_DEVICE(obj) (VIR_IS_NODE_DEVICE(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_NODE_DEVICE_MAGIC 0xDEAD5679
|
||||
# define VIR_IS_NODE_DEVICE(obj) ((obj) && (obj)->magic==VIR_NODE_DEVICE_MAGIC)
|
||||
# define VIR_IS_CONNECTED_NODE_DEVICE(obj) (VIR_IS_NODE_DEVICE(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
/**
|
||||
* VIR_SECRET_MAGIC:
|
||||
|
@ -104,9 +104,9 @@
|
|||
* magic value used to protect the API when pointers to secret structures are
|
||||
* passed down by the users.
|
||||
*/
|
||||
#define VIR_SECRET_MAGIC 0x5678DEAD
|
||||
#define VIR_IS_SECRET(obj) ((obj) && (obj)->magic==VIR_SECRET_MAGIC)
|
||||
#define VIR_IS_CONNECTED_SECRET(obj) (VIR_IS_SECRET(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_SECRET_MAGIC 0x5678DEAD
|
||||
# define VIR_IS_SECRET(obj) ((obj) && (obj)->magic==VIR_SECRET_MAGIC)
|
||||
# define VIR_IS_CONNECTED_SECRET(obj) (VIR_IS_SECRET(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
|
||||
/**
|
||||
|
@ -115,9 +115,9 @@
|
|||
* magic value used to protect the API when pointers to stream structures
|
||||
* are passed down by the users.
|
||||
*/
|
||||
#define VIR_STREAM_MAGIC 0x1DEAD666
|
||||
#define VIR_IS_STREAM(obj) ((obj) && (obj)->magic==VIR_STREAM_MAGIC)
|
||||
#define VIR_IS_CONNECTED_STREAM(obj) (VIR_IS_STREAM(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
# define VIR_STREAM_MAGIC 0x1DEAD666
|
||||
# define VIR_IS_STREAM(obj) ((obj) && (obj)->magic==VIR_STREAM_MAGIC)
|
||||
# define VIR_IS_CONNECTED_STREAM(obj) (VIR_IS_STREAM(obj) && VIR_IS_CONNECT((obj)->conn))
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
/* XXX re-implment this for other OS, or use libtools helper lib ? */
|
||||
|
||||
#include <dlfcn.h>
|
||||
# include <dlfcn.h>
|
||||
|
||||
void *
|
||||
virDriverLoadModule(const char *name)
|
||||
|
|
24
src/driver.h
24
src/driver.h
|
@ -4,14 +4,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_DRIVER_H__
|
||||
#define __VIR_DRIVER_H__
|
||||
# define __VIR_DRIVER_H__
|
||||
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
# include "config.h"
|
||||
# include <stdbool.h>
|
||||
|
||||
#include <libxml/uri.h>
|
||||
# include <libxml/uri.h>
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
/*
|
||||
* List of registered drivers numbers
|
||||
*/
|
||||
|
@ -55,7 +55,7 @@ typedef enum {
|
|||
* 0 Feature is not supported.
|
||||
* -1 Error.
|
||||
*/
|
||||
#define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature) \
|
||||
# define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature) \
|
||||
((drv)->supports_feature ? (drv)->supports_feature((conn),(feature)) : 0)
|
||||
|
||||
typedef virDrvOpenStatus
|
||||
|
@ -797,7 +797,7 @@ struct _virStorageDriver {
|
|||
virDrvStoragePoolIsPersistent poolIsPersistent;
|
||||
};
|
||||
|
||||
#ifdef WITH_LIBVIRTD
|
||||
# ifdef WITH_LIBVIRTD
|
||||
typedef int (*virDrvStateInitialize) (int privileged);
|
||||
typedef int (*virDrvStateCleanup) (void);
|
||||
typedef int (*virDrvStateReload) (void);
|
||||
|
@ -813,7 +813,7 @@ struct _virStateDriver {
|
|||
virDrvStateReload reload;
|
||||
virDrvStateActive active;
|
||||
};
|
||||
#endif
|
||||
# endif
|
||||
|
||||
|
||||
typedef struct _virDeviceMonitor virDeviceMonitor;
|
||||
|
@ -871,10 +871,10 @@ struct _virDeviceMonitor {
|
|||
};
|
||||
|
||||
/* bits 16 and above of virDomainXMLFlags are for internal use */
|
||||
#define VIR_DOMAIN_XML_FLAGS_MASK 0xffff
|
||||
# define VIR_DOMAIN_XML_FLAGS_MASK 0xffff
|
||||
|
||||
/* Bits 16 and above of virSecretGetValue flags are for internal use */
|
||||
#define VIR_SECRET_GET_VALUE_FLAGS_MASK 0xffff
|
||||
# define VIR_SECRET_GET_VALUE_FLAGS_MASK 0xffff
|
||||
|
||||
enum {
|
||||
/* This getValue call is inside libvirt, override the "private" flag.
|
||||
|
@ -993,9 +993,9 @@ int virRegisterInterfaceDriver(virInterfaceDriverPtr);
|
|||
int virRegisterStorageDriver(virStorageDriverPtr);
|
||||
int virRegisterDeviceMonitor(virDeviceMonitorPtr);
|
||||
int virRegisterSecretDriver(virSecretDriverPtr);
|
||||
#ifdef WITH_LIBVIRTD
|
||||
# ifdef WITH_LIBVIRTD
|
||||
int virRegisterStateDriver(virStateDriverPtr);
|
||||
#endif
|
||||
# endif
|
||||
void *virDriverLoadModule(const char *name);
|
||||
|
||||
#endif /* __VIR_DRIVER_H__ */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_DEVICE_MONITOR_H__
|
||||
#define __ESX_DEVICE_MONITOR_H__
|
||||
# define __ESX_DEVICE_MONITOR_H__
|
||||
|
||||
int esxDeviceRegister(void);
|
||||
|
||||
|
|
|
@ -99,8 +99,8 @@ esxSupportsLongMode(esxPrivate *priv)
|
|||
for (hostCpuIdInfo = hostCpuIdInfoList; hostCpuIdInfo != NULL;
|
||||
hostCpuIdInfo = hostCpuIdInfo->_next) {
|
||||
if (hostCpuIdInfo->level->value == -2147483647) { /* 0x80000001 */
|
||||
#define _SKIP4 "%*c%*c%*c%*c"
|
||||
#define _SKIP12 _SKIP4":"_SKIP4":"_SKIP4
|
||||
#define _SKIP4 "%*c%*c%*c%*c"
|
||||
#define _SKIP12 _SKIP4":"_SKIP4":"_SKIP4
|
||||
|
||||
/* Expected format: "--X-:----:----:----:----:----:----:----" */
|
||||
if (sscanf(hostCpuIdInfo->edx,
|
||||
|
@ -114,8 +114,8 @@ esxSupportsLongMode(esxPrivate *priv)
|
|||
goto failure;
|
||||
}
|
||||
|
||||
#undef _SKIP4
|
||||
#undef _SKIP12
|
||||
#undef _SKIP4
|
||||
#undef _SKIP12
|
||||
|
||||
if (edxLongModeBit == '1') {
|
||||
priv->supportsLongMode = esxVI_Boolean_True;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_DRIVER_H__
|
||||
#define __ESX_DRIVER_H__
|
||||
# define __ESX_DRIVER_H__
|
||||
|
||||
int esxRegister(void);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_INTERFACE_DRIVER_H__
|
||||
#define __ESX_INTERFACE_DRIVER_H__
|
||||
# define __ESX_INTERFACE_DRIVER_H__
|
||||
|
||||
int esxInterfaceRegister(void);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_NETWORK_DRIVER_H__
|
||||
#define __ESX_NETWORK_DRIVER_H__
|
||||
# define __ESX_NETWORK_DRIVER_H__
|
||||
|
||||
int esxNetworkRegister(void);
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_PRIVATE_H__
|
||||
#define __ESX_PRIVATE_H__
|
||||
# define __ESX_PRIVATE_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "capabilities.h"
|
||||
#include "esx_vi.h"
|
||||
# include "internal.h"
|
||||
# include "capabilities.h"
|
||||
# include "esx_vi.h"
|
||||
|
||||
typedef struct _esxPrivate {
|
||||
esxVI_Context *host;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_SECRET_DRIVER_H__
|
||||
#define __ESX_SECRET_DRIVER_H__
|
||||
# define __ESX_SECRET_DRIVER_H__
|
||||
|
||||
int esxSecretRegister(void);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_STORAGE_DRIVER_H__
|
||||
#define __ESX_STORAGE_DRIVER_H__
|
||||
# define __ESX_STORAGE_DRIVER_H__
|
||||
|
||||
int esxStorageRegister(void);
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_UTIL_H__
|
||||
#define __ESX_UTIL_H__
|
||||
# define __ESX_UTIL_H__
|
||||
|
||||
#include <libxml/uri.h>
|
||||
# include <libxml/uri.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "conf.h"
|
||||
# include "internal.h"
|
||||
# include "conf.h"
|
||||
|
||||
char *esxUtil_RequestUsername(virConnectAuthPtr auth,
|
||||
const char *defaultUsername,
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_VI_H__
|
||||
#define __ESX_VI_H__
|
||||
# define __ESX_VI_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <curl/curl.h>
|
||||
# include <libxml/tree.h>
|
||||
# include <libxml/xpath.h>
|
||||
# include <curl/curl.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "datatypes.h"
|
||||
#include "esx_vi_types.h"
|
||||
# include "internal.h"
|
||||
# include "datatypes.h"
|
||||
# include "esx_vi_types.h"
|
||||
|
||||
typedef enum _esxVI_APIVersion esxVI_APIVersion;
|
||||
typedef enum _esxVI_ProductVersion esxVI_ProductVersion;
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_VI_METHODS_H__
|
||||
#define __ESX_VI_METHODS_H__
|
||||
# define __ESX_VI_METHODS_H__
|
||||
|
||||
#include "esx_vi.h"
|
||||
#include "esx_vi_types.h"
|
||||
# include "esx_vi.h"
|
||||
# include "esx_vi_types.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -628,7 +628,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||
}
|
||||
}
|
||||
|
||||
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
|
||||
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \
|
||||
do { \
|
||||
if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \
|
||||
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
|
||||
|
@ -672,7 +672,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
|||
_DESERIALIZE_NUMBER(Long, "xsd:long", int64, INT64_MIN, INT64_MAX);
|
||||
}
|
||||
|
||||
#undef _DESERIALIZE_NUMBER
|
||||
#undef _DESERIALIZE_NUMBER
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_VI_TYPES_H__
|
||||
#define __ESX_VI_TYPES_H__
|
||||
# define __ESX_VI_TYPES_H__
|
||||
|
||||
#include "buf.h"
|
||||
# include "buf.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
*/
|
||||
|
||||
#ifndef __ESX_VMX_H__
|
||||
#define __ESX_VMX_H__
|
||||
# define __ESX_VMX_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "conf.h"
|
||||
#include "domain_conf.h"
|
||||
#include "esx_vi.h"
|
||||
# include "internal.h"
|
||||
# include "conf.h"
|
||||
# include "domain_conf.h"
|
||||
# include "esx_vi.h"
|
||||
|
||||
int
|
||||
esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id);
|
||||
|
|
|
@ -22,16 +22,16 @@
|
|||
|
||||
#ifndef LIBVIRT_GNUTLS_1_0_COMPAT_H__
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#ifdef GNUTLS_1_0_COMPAT
|
||||
#define gnutls_session_t gnutls_session
|
||||
#define gnutls_x509_crt_t gnutls_x509_crt
|
||||
#define gnutls_dh_params_t gnutls_dh_params
|
||||
#define gnutls_transport_ptr_t gnutls_transport_ptr
|
||||
#define gnutls_datum_t gnutls_datum
|
||||
#define gnutls_certificate_credentials_t gnutls_certificate_credentials
|
||||
#define gnutls_cipher_algorithm_t gnutls_cipher_algorithm
|
||||
#endif
|
||||
# ifdef GNUTLS_1_0_COMPAT
|
||||
# define gnutls_session_t gnutls_session
|
||||
# define gnutls_x509_crt_t gnutls_x509_crt
|
||||
# define gnutls_dh_params_t gnutls_dh_params
|
||||
# define gnutls_transport_ptr_t gnutls_transport_ptr
|
||||
# define gnutls_datum_t gnutls_datum
|
||||
# define gnutls_certificate_credentials_t gnutls_certificate_credentials
|
||||
# define gnutls_cipher_algorithm_t gnutls_cipher_algorithm
|
||||
# endif
|
||||
|
||||
#endif /* LIBVIRT_GNUTLS_1_0_COMPAT_H__ */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#ifndef __VIR_INTERFACE__DRIVER_H
|
||||
#define __VIR_INTERFACE__DRIVER_H
|
||||
# define __VIR_INTERFACE__DRIVER_H
|
||||
|
||||
int interfaceRegister(void);
|
||||
|
||||
|
|
184
src/internal.h
184
src/internal.h
|
@ -3,28 +3,28 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_INTERNAL_H__
|
||||
#define __VIR_INTERNAL_H__
|
||||
# define __VIR_INTERNAL_H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <verify.h>
|
||||
# include <errno.h>
|
||||
# include <limits.h>
|
||||
# include <verify.h>
|
||||
|
||||
#ifdef HAVE_SYS_SYSLIMITS_H
|
||||
#include <sys/syslimits.h>
|
||||
#endif
|
||||
# ifdef HAVE_SYS_SYSLIMITS_H
|
||||
# include <sys/syslimits.h>
|
||||
# endif
|
||||
|
||||
/* The library itself is allowed to use deprecated functions /
|
||||
* variables, so effectively undefine the deprecated attribute
|
||||
* which would otherwise be defined in libvirt.h.
|
||||
*/
|
||||
#define VIR_DEPRECATED /*empty*/
|
||||
# define VIR_DEPRECATED /*empty*/
|
||||
|
||||
#include "gettext.h"
|
||||
# include "gettext.h"
|
||||
|
||||
#include "libvirt/libvirt.h"
|
||||
#include "libvirt/virterror.h"
|
||||
# include "libvirt/libvirt.h"
|
||||
# include "libvirt/virterror.h"
|
||||
|
||||
#include "libvirt_internal.h"
|
||||
# include "libvirt_internal.h"
|
||||
|
||||
/* On architectures which lack these limits, define them (ie. Cygwin).
|
||||
* Note that the libvirt code should be robust enough to handle the
|
||||
|
@ -32,78 +32,78 @@
|
|||
* length correctly in second argument to gethostname and by always
|
||||
* using strncpy instead of strcpy).
|
||||
*/
|
||||
#ifndef HOST_NAME_MAX
|
||||
#define HOST_NAME_MAX 256
|
||||
#endif
|
||||
# ifndef HOST_NAME_MAX
|
||||
# define HOST_NAME_MAX 256
|
||||
# endif
|
||||
|
||||
#ifndef IF_NAMESIZE
|
||||
#define IF_NAMESIZE 16
|
||||
#endif
|
||||
# ifndef IF_NAMESIZE
|
||||
# define IF_NAMESIZE 16
|
||||
# endif
|
||||
|
||||
#ifndef INET_ADDRSTRLEN
|
||||
#define INET_ADDRSTRLEN 16
|
||||
#endif
|
||||
# ifndef INET_ADDRSTRLEN
|
||||
# define INET_ADDRSTRLEN 16
|
||||
# endif
|
||||
|
||||
#define _(str) dgettext(GETTEXT_PACKAGE, (str))
|
||||
#define N_(str) str
|
||||
# define _(str) dgettext(GETTEXT_PACKAGE, (str))
|
||||
# define N_(str) str
|
||||
|
||||
/* String equality tests, suggested by Jim Meyering. */
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define STRCASEEQ(a,b) (strcasecmp(a,b) == 0)
|
||||
#define STRNEQ(a,b) (strcmp(a,b) != 0)
|
||||
#define STRCASENEQ(a,b) (strcasecmp(a,b) != 0)
|
||||
#define STREQLEN(a,b,n) (strncmp(a,b,n) == 0)
|
||||
#define STRCASEEQLEN(a,b,n) (strncasecmp(a,b,n) == 0)
|
||||
#define STRNEQLEN(a,b,n) (strncmp(a,b,n) != 0)
|
||||
#define STRCASENEQLEN(a,b,n) (strncasecmp(a,b,n) != 0)
|
||||
#define STRPREFIX(a,b) (strncmp(a,b,strlen(b)) == 0)
|
||||
# define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
# define STRCASEEQ(a,b) (strcasecmp(a,b) == 0)
|
||||
# define STRNEQ(a,b) (strcmp(a,b) != 0)
|
||||
# define STRCASENEQ(a,b) (strcasecmp(a,b) != 0)
|
||||
# define STREQLEN(a,b,n) (strncmp(a,b,n) == 0)
|
||||
# define STRCASEEQLEN(a,b,n) (strncasecmp(a,b,n) == 0)
|
||||
# define STRNEQLEN(a,b,n) (strncmp(a,b,n) != 0)
|
||||
# define STRCASENEQLEN(a,b,n) (strncasecmp(a,b,n) != 0)
|
||||
# define STRPREFIX(a,b) (strncmp(a,b,strlen(b)) == 0)
|
||||
|
||||
#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
|
||||
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
# define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
|
||||
/* C99 uses __func__. __FUNCTION__ is legacy. */
|
||||
#ifndef __GNUC__
|
||||
#define __FUNCTION__ __func__
|
||||
#endif
|
||||
# ifndef __GNUC__
|
||||
# define __FUNCTION__ __func__
|
||||
# endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# ifdef __GNUC__
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
#if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
# ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
#define __GNUC_PREREQ(maj,min) 0
|
||||
#endif
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj,min) 0
|
||||
# endif
|
||||
|
||||
/* Work around broken limits.h on debian etch */
|
||||
#if defined _GCC_LIMITS_H_ && ! defined ULLONG_MAX
|
||||
#define ULLONG_MAX ULONG_LONG_MAX
|
||||
#endif
|
||||
# if defined _GCC_LIMITS_H_ && ! defined ULLONG_MAX
|
||||
# define ULLONG_MAX ULONG_LONG_MAX
|
||||
# endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
# endif /* __GNUC__ */
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* Macro to flag conciously unused parameters to functions
|
||||
*/
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
# endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_SENTINEL:
|
||||
*
|
||||
* Macro to check for NULL-terminated varargs lists
|
||||
*/
|
||||
#ifndef ATTRIBUTE_SENTINEL
|
||||
#if __GNUC_PREREQ (4, 0)
|
||||
#define ATTRIBUTE_SENTINEL __attribute__((__sentinel__))
|
||||
#else
|
||||
#define ATTRIBUTE_SENTINEL
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_SENTINEL
|
||||
# if __GNUC_PREREQ (4, 0)
|
||||
# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__))
|
||||
# else
|
||||
# define ATTRIBUTE_SENTINEL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_FMT_PRINTF
|
||||
|
@ -115,46 +115,46 @@
|
|||
* printf format specifiers even on broken Win32 platforms
|
||||
* hence we have to force 'gnu_printf' for new GCC
|
||||
*/
|
||||
#ifndef ATTRIBUTE_FMT_PRINTF
|
||||
#if __GNUC_PREREQ (4, 4)
|
||||
#define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (gnu_printf, fmtpos,argpos)))
|
||||
#else
|
||||
#define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (printf, fmtpos,argpos)))
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_FMT_PRINTF
|
||||
# if __GNUC_PREREQ (4, 4)
|
||||
# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (gnu_printf, fmtpos,argpos)))
|
||||
# else
|
||||
# define ATTRIBUTE_FMT_PRINTF(fmtpos,argpos) __attribute__((__format__ (printf, fmtpos,argpos)))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifndef ATTRIBUTE_RETURN_CHECK
|
||||
#if __GNUC_PREREQ (3, 4)
|
||||
#define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define ATTRIBUTE_RETURN_CHECK
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_RETURN_CHECK
|
||||
# if __GNUC_PREREQ (3, 4)
|
||||
# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
|
||||
# else
|
||||
# define ATTRIBUTE_RETURN_CHECK
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef ATTRIBUTE_NONNULL
|
||||
# if __GNUC_PREREQ (3, 3)
|
||||
# define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m)))
|
||||
# else
|
||||
# define ATTRIBUTE_NONNULL(m)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifndef ATTRIBUTE_NONNULL
|
||||
# if __GNUC_PREREQ (3, 3)
|
||||
# define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m)))
|
||||
# else
|
||||
# define ATTRIBUTE_NONNULL(m)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_FMT_PRINTF
|
||||
#define ATTRIBUTE_FMT_PRINTF(...)
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_RETURN_CHECK
|
||||
#define ATTRIBUTE_RETURN_CHECK
|
||||
#endif
|
||||
#endif /* __GNUC__ */
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED
|
||||
# endif
|
||||
# ifndef ATTRIBUTE_FMT_PRINTF
|
||||
# define ATTRIBUTE_FMT_PRINTF(...)
|
||||
# endif
|
||||
# ifndef ATTRIBUTE_RETURN_CHECK
|
||||
# define ATTRIBUTE_RETURN_CHECK
|
||||
# endif
|
||||
# endif /* __GNUC__ */
|
||||
|
||||
/*
|
||||
* Use this when passing possibly-NULL strings to printf-a-likes.
|
||||
*/
|
||||
#define NULLSTR(s) \
|
||||
# define NULLSTR(s) \
|
||||
((void)verify_true(sizeof *(s) == sizeof (char)), \
|
||||
(s) ? (s) : "(null)")
|
||||
|
||||
|
@ -163,7 +163,7 @@
|
|||
*
|
||||
* macro to flag unimplemented blocks
|
||||
*/
|
||||
#define TODO \
|
||||
# define TODO \
|
||||
fprintf(stderr, "Unimplemented block at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
|
|
118
src/libvirt.c
118
src/libvirt.c
|
@ -19,7 +19,7 @@
|
|||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <gcrypt.h>
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include "getpass.h"
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "virterror_internal.h"
|
||||
|
@ -43,27 +43,27 @@
|
|||
#include "memory.h"
|
||||
|
||||
#ifndef WITH_DRIVER_MODULES
|
||||
#ifdef WITH_TEST
|
||||
#include "test/test_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_XEN
|
||||
#include "xen/xen_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_REMOTE
|
||||
#include "remote/remote_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_OPENVZ
|
||||
#include "openvz/openvz_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_PHYP
|
||||
#include "phyp/phyp_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_VBOX
|
||||
#include "vbox/vbox_driver.h"
|
||||
#endif
|
||||
#ifdef WITH_ESX
|
||||
#include "esx/esx_driver.h"
|
||||
#endif
|
||||
# ifdef WITH_TEST
|
||||
# include "test/test_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_XEN
|
||||
# include "xen/xen_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_REMOTE
|
||||
# include "remote/remote_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_OPENVZ
|
||||
# include "openvz/openvz_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_PHYP
|
||||
# include "phyp/phyp_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
# include "vbox/vbox_driver.h"
|
||||
# endif
|
||||
# ifdef WITH_ESX
|
||||
# include "esx/esx_driver.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
@ -359,27 +359,27 @@ virInitialize(void)
|
|||
virDriverLoadModule("esx");
|
||||
virDriverLoadModule("remote");
|
||||
#else
|
||||
#ifdef WITH_TEST
|
||||
# ifdef WITH_TEST
|
||||
if (testRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_XEN
|
||||
# endif
|
||||
# ifdef WITH_XEN
|
||||
if (xenRegister () == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_OPENVZ
|
||||
# endif
|
||||
# ifdef WITH_OPENVZ
|
||||
if (openvzRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_PHYP
|
||||
# endif
|
||||
# ifdef WITH_PHYP
|
||||
if (phypRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_VBOX
|
||||
# endif
|
||||
# ifdef WITH_VBOX
|
||||
if (vboxRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_ESX
|
||||
# endif
|
||||
# ifdef WITH_ESX
|
||||
if (esxRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_REMOTE
|
||||
# endif
|
||||
# ifdef WITH_REMOTE
|
||||
if (remoteRegister () == -1) return -1;
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
|
@ -991,50 +991,50 @@ virGetVersion(unsigned long *libVer, const char *type,
|
|||
#else
|
||||
*typeVer = 0;
|
||||
|
||||
#if WITH_XEN
|
||||
# if WITH_XEN
|
||||
if (STRCASEEQ(type, "Xen"))
|
||||
*typeVer = xenUnifiedVersion();
|
||||
#endif
|
||||
#if WITH_TEST
|
||||
# endif
|
||||
# if WITH_TEST
|
||||
if (STRCASEEQ(type, "Test"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_QEMU
|
||||
# endif
|
||||
# if WITH_QEMU
|
||||
if (STRCASEEQ(type, "QEMU"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_LXC
|
||||
# endif
|
||||
# if WITH_LXC
|
||||
if (STRCASEEQ(type, "LXC"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_PHYP
|
||||
# endif
|
||||
# if WITH_PHYP
|
||||
if (STRCASEEQ(type, "phyp"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_OPENVZ
|
||||
# endif
|
||||
# if WITH_OPENVZ
|
||||
if (STRCASEEQ(type, "OpenVZ"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_VBOX
|
||||
# endif
|
||||
# if WITH_VBOX
|
||||
if (STRCASEEQ(type, "VBox"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_UML
|
||||
# endif
|
||||
# if WITH_UML
|
||||
if (STRCASEEQ(type, "UML"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_ONE
|
||||
# endif
|
||||
# if WITH_ONE
|
||||
if (STRCASEEQ(type, "ONE"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_ESX
|
||||
# endif
|
||||
# if WITH_ESX
|
||||
if (STRCASEEQ(type, "ESX"))
|
||||
*typeVer = LIBVIR_VERSION_NUMBER;
|
||||
#endif
|
||||
#if WITH_REMOTE
|
||||
# endif
|
||||
# if WITH_REMOTE
|
||||
if (STRCASEEQ(type, "Remote"))
|
||||
*typeVer = remoteVersion();
|
||||
#endif
|
||||
# endif
|
||||
if (*typeVer == 0) {
|
||||
virLibConnError(NULL, VIR_ERR_NO_SUPPORT, type);
|
||||
goto error;
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
*/
|
||||
|
||||
#ifndef __LIBVIRT_H_
|
||||
#define __LIBVIRT_H_
|
||||
# define __LIBVIRT_H_
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
#ifdef WITH_LIBVIRTD
|
||||
# ifdef WITH_LIBVIRTD
|
||||
int virStateInitialize(int privileged);
|
||||
int virStateCleanup(void);
|
||||
int virStateReload(void);
|
||||
int virStateActive(void);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Feature detection. This is a libvirt-private interface for determining
|
||||
* what features are supported by the driver.
|
||||
|
|
|
@ -23,21 +23,21 @@
|
|||
*/
|
||||
|
||||
#ifndef LXC_CONF_H
|
||||
#define LXC_CONF_H
|
||||
# define LXC_CONF_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "domain_conf.h"
|
||||
#include "domain_event.h"
|
||||
#include "capabilities.h"
|
||||
#include "threads.h"
|
||||
#include "cgroup.h"
|
||||
# include "internal.h"
|
||||
# include "domain_conf.h"
|
||||
# include "domain_event.h"
|
||||
# include "capabilities.h"
|
||||
# include "threads.h"
|
||||
# include "cgroup.h"
|
||||
|
||||
#define LXC_CONFIG_DIR SYSCONF_DIR "/libvirt/lxc"
|
||||
#define LXC_STATE_DIR LOCAL_STATE_DIR "/run/libvirt/lxc"
|
||||
#define LXC_LOG_DIR LOCAL_STATE_DIR "/log/libvirt/lxc"
|
||||
#define LXC_AUTOSTART_DIR LXC_CONFIG_DIR "/autostart"
|
||||
# define LXC_CONFIG_DIR SYSCONF_DIR "/libvirt/lxc"
|
||||
# define LXC_STATE_DIR LOCAL_STATE_DIR "/run/libvirt/lxc"
|
||||
# define LXC_LOG_DIR LOCAL_STATE_DIR "/log/libvirt/lxc"
|
||||
# define LXC_AUTOSTART_DIR LXC_CONFIG_DIR "/autostart"
|
||||
|
||||
typedef struct __lxc_driver lxc_driver_t;
|
||||
struct __lxc_driver {
|
||||
|
@ -64,7 +64,7 @@ struct __lxc_driver {
|
|||
int lxcLoadDriverConfig(lxc_driver_t *driver);
|
||||
virCapsPtr lxcCapsInit(void);
|
||||
|
||||
#define lxcError(code, ...) \
|
||||
# define lxcError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_LXC, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <linux/fs.h>
|
||||
|
||||
#if HAVE_CAPNG
|
||||
#include <cap-ng.h>
|
||||
# include <cap-ng.h>
|
||||
#endif
|
||||
|
||||
#include "virterror_internal.h"
|
||||
|
@ -61,19 +61,19 @@
|
|||
*/
|
||||
|
||||
#ifndef CLONE_NEWPID
|
||||
#define CLONE_NEWPID 0x20000000
|
||||
# define CLONE_NEWPID 0x20000000
|
||||
#endif
|
||||
#ifndef CLONE_NEWUTS
|
||||
#define CLONE_NEWUTS 0x04000000
|
||||
# define CLONE_NEWUTS 0x04000000
|
||||
#endif
|
||||
#ifndef CLONE_NEWUSER
|
||||
#define CLONE_NEWUSER 0x10000000
|
||||
# define CLONE_NEWUSER 0x10000000
|
||||
#endif
|
||||
#ifndef CLONE_NEWIPC
|
||||
#define CLONE_NEWIPC 0x08000000
|
||||
# define CLONE_NEWIPC 0x08000000
|
||||
#endif
|
||||
#ifndef CLONE_NEWNET
|
||||
#define CLONE_NEWNET 0x40000000 /* New network namespace */
|
||||
# define CLONE_NEWNET 0x40000000 /* New network namespace */
|
||||
#endif
|
||||
|
||||
/* messages between parent and container */
|
||||
|
@ -289,19 +289,19 @@ static int lxcContainerChildMountSort(const void *a, const void *b)
|
|||
}
|
||||
|
||||
#ifndef MS_REC
|
||||
#define MS_REC 16384
|
||||
# define MS_REC 16384
|
||||
#endif
|
||||
|
||||
#ifndef MNT_DETACH
|
||||
#define MNT_DETACH 0x00000002
|
||||
# define MNT_DETACH 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef MS_PRIVATE
|
||||
#define MS_PRIVATE (1<<18)
|
||||
# define MS_PRIVATE (1<<18)
|
||||
#endif
|
||||
|
||||
#ifndef MS_SLAVE
|
||||
#define MS_SLAVE (1<<19)
|
||||
# define MS_SLAVE (1<<19)
|
||||
#endif
|
||||
|
||||
static int lxcContainerPivotRoot(virDomainFSDefPtr root)
|
||||
|
|
|
@ -22,28 +22,28 @@
|
|||
*/
|
||||
|
||||
#ifndef LXC_CONTAINER_H
|
||||
#define LXC_CONTAINER_H
|
||||
# define LXC_CONTAINER_H
|
||||
|
||||
#include "lxc_conf.h"
|
||||
# include "lxc_conf.h"
|
||||
|
||||
enum {
|
||||
LXC_CONTAINER_FEATURE_NET = (1 << 0),
|
||||
LXC_CONTAINER_FEATURE_USER = (1 << 1),
|
||||
};
|
||||
|
||||
#define LXC_DEV_MAJ_MEMORY 1
|
||||
#define LXC_DEV_MIN_NULL 3
|
||||
#define LXC_DEV_MIN_ZERO 5
|
||||
#define LXC_DEV_MIN_FULL 7
|
||||
#define LXC_DEV_MIN_RANDOM 8
|
||||
#define LXC_DEV_MIN_URANDOM 9
|
||||
# define LXC_DEV_MAJ_MEMORY 1
|
||||
# define LXC_DEV_MIN_NULL 3
|
||||
# define LXC_DEV_MIN_ZERO 5
|
||||
# define LXC_DEV_MIN_FULL 7
|
||||
# define LXC_DEV_MIN_RANDOM 8
|
||||
# define LXC_DEV_MIN_URANDOM 9
|
||||
|
||||
#define LXC_DEV_MAJ_TTY 5
|
||||
#define LXC_DEV_MIN_TTY 0
|
||||
#define LXC_DEV_MIN_CONSOLE 1
|
||||
#define LXC_DEV_MIN_PTMX 2
|
||||
# define LXC_DEV_MAJ_TTY 5
|
||||
# define LXC_DEV_MIN_TTY 0
|
||||
# define LXC_DEV_MIN_CONSOLE 1
|
||||
# define LXC_DEV_MIN_PTMX 2
|
||||
|
||||
#define LXC_DEV_MAJ_PTY 136
|
||||
# define LXC_DEV_MAJ_PTY 136
|
||||
|
||||
int lxcContainerSendContinue(int control);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <sys/mount.h>
|
||||
|
||||
#if HAVE_CAPNG
|
||||
#include <cap-ng.h>
|
||||
# include <cap-ng.h>
|
||||
#endif
|
||||
|
||||
#include "virterror_internal.h"
|
||||
|
@ -485,11 +485,11 @@ static int lxcControllerCleanupInterfaces(unsigned int nveths,
|
|||
}
|
||||
|
||||
#ifndef MS_REC
|
||||
#define MS_REC 16384
|
||||
# define MS_REC 16384
|
||||
#endif
|
||||
|
||||
#ifndef MS_SLAVE
|
||||
#define MS_SLAVE (1<<19)
|
||||
# define MS_SLAVE (1<<19)
|
||||
#endif
|
||||
|
||||
static int
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef LXC_DRIVER_H
|
||||
#define LXC_DRIVER_H
|
||||
# define LXC_DRIVER_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
/* Function declarations */
|
||||
int lxcRegister(void);
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
*/
|
||||
|
||||
#ifndef VETH_H
|
||||
#define VETH_H
|
||||
# define VETH_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
/* Function declarations */
|
||||
int vethCreate(char* veth1, int veth1MaxLen, char* veth2,
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
|
||||
|
||||
#ifndef __VIR_NETWORK__DRIVER_H
|
||||
#define __VIR_NETWORK__DRIVER_H
|
||||
# define __VIR_NETWORK__DRIVER_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
int networkRegister(void);
|
||||
|
||||
|
|
|
@ -662,11 +662,11 @@ int nodedevRegister(void) {
|
|||
return udevNodeRegister();
|
||||
return 0;
|
||||
#else
|
||||
#ifdef HAVE_HAL
|
||||
# ifdef HAVE_HAL
|
||||
return halNodeRegister();
|
||||
#endif
|
||||
#ifdef HAVE_UDEV
|
||||
# endif
|
||||
# ifdef HAVE_UDEV
|
||||
return udevNodeRegister();
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -22,33 +22,33 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_NODE_DEVICE_H__
|
||||
#define __VIR_NODE_DEVICE_H__
|
||||
# define __VIR_NODE_DEVICE_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "driver.h"
|
||||
#include "node_device_conf.h"
|
||||
# include "internal.h"
|
||||
# include "driver.h"
|
||||
# include "node_device_conf.h"
|
||||
|
||||
#define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host"
|
||||
#define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
||||
#define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/"
|
||||
# define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host"
|
||||
# define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
||||
# define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/"
|
||||
|
||||
#define VPORT_CREATE 0
|
||||
#define VPORT_DELETE 1
|
||||
#define LINUX_SYSFS_VPORT_CREATE_POSTFIX "/vport_create"
|
||||
#define LINUX_SYSFS_VPORT_DELETE_POSTFIX "/vport_delete"
|
||||
# define VPORT_CREATE 0
|
||||
# define VPORT_DELETE 1
|
||||
# define LINUX_SYSFS_VPORT_CREATE_POSTFIX "/vport_create"
|
||||
# define LINUX_SYSFS_VPORT_DELETE_POSTFIX "/vport_delete"
|
||||
|
||||
#define SRIOV_FOUND 0
|
||||
#define SRIOV_NOT_FOUND 1
|
||||
#define SRIOV_ERROR -1
|
||||
# define SRIOV_FOUND 0
|
||||
# define SRIOV_NOT_FOUND 1
|
||||
# define SRIOV_ERROR -1
|
||||
|
||||
#define LINUX_NEW_DEVICE_WAIT_TIME 60
|
||||
# define LINUX_NEW_DEVICE_WAIT_TIME 60
|
||||
|
||||
#ifdef HAVE_HAL
|
||||
# ifdef HAVE_HAL
|
||||
int halNodeRegister(void);
|
||||
#endif
|
||||
#ifdef HAVE_UDEV
|
||||
# endif
|
||||
# ifdef HAVE_UDEV
|
||||
int udevNodeRegister(void);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
void nodeDeviceLock(virDeviceMonitorStatePtr driver);
|
||||
void nodeDeviceUnlock(virDeviceMonitorStatePtr driver);
|
||||
|
@ -57,33 +57,33 @@ void registerCommonNodeFuncs(virDeviceMonitorPtr mon);
|
|||
|
||||
int nodedevRegister(void);
|
||||
|
||||
#ifdef __linux__
|
||||
# ifdef __linux__
|
||||
|
||||
#define check_fc_host(d) check_fc_host_linux(d)
|
||||
# define check_fc_host(d) check_fc_host_linux(d)
|
||||
int check_fc_host_linux(union _virNodeDevCapData *d);
|
||||
|
||||
#define check_vport_capable(d) check_vport_capable_linux(d)
|
||||
# define check_vport_capable(d) check_vport_capable_linux(d)
|
||||
int check_vport_capable_linux(union _virNodeDevCapData *d);
|
||||
|
||||
#define get_physical_function(s,d) get_physical_function_linux(s,d)
|
||||
# define get_physical_function(s,d) get_physical_function_linux(s,d)
|
||||
int get_physical_function_linux(const char *sysfs_path,
|
||||
union _virNodeDevCapData *d);
|
||||
|
||||
#define get_virtual_functions(s,d) get_virtual_functions_linux(s,d)
|
||||
# define get_virtual_functions(s,d) get_virtual_functions_linux(s,d)
|
||||
int get_virtual_functions_linux(const char *sysfs_path,
|
||||
union _virNodeDevCapData *d);
|
||||
|
||||
#define read_wwn(host, file, wwn) read_wwn_linux(host, file, wwn)
|
||||
# define read_wwn(host, file, wwn) read_wwn_linux(host, file, wwn)
|
||||
int read_wwn_linux(int host, const char *file, char **wwn);
|
||||
|
||||
#else /* __linux__ */
|
||||
# else /* __linux__ */
|
||||
|
||||
#define check_fc_host(d)
|
||||
#define check_vport_capable(d)
|
||||
#define get_physical_function(sysfs_path, d)
|
||||
#define get_virtual_functions(sysfs_path, d)
|
||||
#define read_wwn(host, file, wwn)
|
||||
# define check_fc_host(d)
|
||||
# define check_vport_capable(d)
|
||||
# define get_physical_function(sysfs_path, d)
|
||||
# define get_virtual_functions(sysfs_path, d)
|
||||
# define read_wwn(host, file, wwn)
|
||||
|
||||
#endif /* __linux__ */
|
||||
# endif /* __linux__ */
|
||||
|
||||
#endif /* __VIR_NODE_DEVICE_H__ */
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_NODE_DEVICE_HAL_H__
|
||||
#define __VIR_NODE_DEVICE_HAL_H__
|
||||
# define __VIR_NODE_DEVICE_HAL_H__
|
||||
|
||||
#endif /* __VIR_NODE_DEVICE_HAL_H__ */
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
#include <sys/utsname.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#include "c-ctype.h"
|
||||
|
@ -56,8 +56,8 @@
|
|||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
#ifdef __linux__
|
||||
#define CPUINFO_PATH "/proc/cpuinfo"
|
||||
#define CPU_SYS_PATH "/sys/devices/system/cpu"
|
||||
# define CPUINFO_PATH "/proc/cpuinfo"
|
||||
# define CPU_SYS_PATH "/sys/devices/system/cpu"
|
||||
|
||||
/* NB, this is not static as we need to call it from the testsuite */
|
||||
int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_NODEINFO_H__
|
||||
#define __VIR_NODEINFO_H__
|
||||
# define __VIR_NODEINFO_H__
|
||||
|
||||
#include "libvirt/libvirt.h"
|
||||
#include "capabilities.h"
|
||||
# include "libvirt/libvirt.h"
|
||||
# include "capabilities.h"
|
||||
|
||||
int nodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo);
|
||||
int nodeCapsInitNUMA(virCapsPtr caps);
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
*/
|
||||
|
||||
#ifndef ONE_CLIENT_H_
|
||||
#define ONE_CLIENT_H_
|
||||
# define ONE_CLIENT_H_
|
||||
|
||||
#include <xmlrpc-c/base.h>
|
||||
#include <xmlrpc-c/client.h>
|
||||
# include <xmlrpc-c/base.h>
|
||||
# include <xmlrpc-c/client.h>
|
||||
|
||||
struct _oneClient {
|
||||
xmlrpc_env env;
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ONE_CONF_H
|
||||
#define ONE_CONF_H
|
||||
# define ONE_CONF_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "domain_conf.h"
|
||||
#include "capabilities.h"
|
||||
#include "threads.h"
|
||||
#include "one_client.h"
|
||||
# include "internal.h"
|
||||
# include "domain_conf.h"
|
||||
# include "capabilities.h"
|
||||
# include "threads.h"
|
||||
# include "one_client.h"
|
||||
|
||||
struct one_driver{
|
||||
virMutex lock;
|
||||
|
@ -47,7 +47,7 @@ int oneSubmitVM(virConnectPtr conn ,one_driver_t* driver, virDomainObjPtr vm);
|
|||
|
||||
char* xmlOneTemplate(virDomainDefPtr def);
|
||||
|
||||
#define oneError(conn, dom, code, ...) \
|
||||
# define oneError(conn, dom, code, ...) \
|
||||
virReportErrorHelper(conn, VIR_FROM_ONE, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
|
||||
#ifndef ONE_DRIVER_H
|
||||
#define ONE_DRIVER_H
|
||||
# define ONE_DRIVER_H
|
||||
|
||||
#include <config.h>
|
||||
#include "one_client.h"
|
||||
# include <config.h>
|
||||
# include "one_client.h"
|
||||
|
||||
int oneRegister(void);
|
||||
|
||||
|
|
|
@ -27,25 +27,25 @@
|
|||
*/
|
||||
|
||||
#ifndef OPENVZ_CONF_H
|
||||
#define OPENVZ_CONF_H
|
||||
# define OPENVZ_CONF_H
|
||||
|
||||
#include "internal.h"
|
||||
#include "domain_conf.h"
|
||||
#include "threads.h"
|
||||
# include "internal.h"
|
||||
# include "domain_conf.h"
|
||||
# include "threads.h"
|
||||
|
||||
enum { OPENVZ_WARN, OPENVZ_ERR };
|
||||
|
||||
#define openvzError(conn, code, ...) \
|
||||
# define openvzError(conn, code, ...) \
|
||||
virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
||||
/* OpenVZ commands - Replace with wrapper scripts later? */
|
||||
#define VZLIST "/usr/sbin/vzlist"
|
||||
#define VZCTL "/usr/sbin/vzctl"
|
||||
#define VZ_CONF_FILE "/etc/vz/vz.conf"
|
||||
# define VZLIST "/usr/sbin/vzlist"
|
||||
# define VZCTL "/usr/sbin/vzctl"
|
||||
# define VZ_CONF_FILE "/etc/vz/vz.conf"
|
||||
|
||||
#define VZCTL_BRIDGE_MIN_VERSION ((3 * 1000 * 1000) + (0 * 1000) + 22 + 1)
|
||||
# define VZCTL_BRIDGE_MIN_VERSION ((3 * 1000 * 1000) + (0 * 1000) + 22 + 1)
|
||||
|
||||
struct openvz_driver {
|
||||
virMutex lock;
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
|
||||
#ifndef OPENVZ_DRIVER_H
|
||||
#define OPENVZ_DRIVER_H
|
||||
# define OPENVZ_DRIVER_H
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
int openvzRegister(void);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __QEMUD_BRIDGE_FILTER_H__
|
||||
#define __QEMUD_BRIDGE_FILTER_H__
|
||||
# define __QEMUD_BRIDGE_FILTER_H__
|
||||
|
||||
|
||||
int networkAllowMacOnPort(struct qemud_driver *driver,
|
||||
|
|
|
@ -22,27 +22,27 @@
|
|||
*/
|
||||
|
||||
#ifndef __QEMUD_CONF_H
|
||||
#define __QEMUD_CONF_H
|
||||
# define __QEMUD_CONF_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#include "ebtables.h"
|
||||
#include "internal.h"
|
||||
#include "bridge.h"
|
||||
#include "capabilities.h"
|
||||
#include "network_conf.h"
|
||||
#include "domain_conf.h"
|
||||
#include "domain_event.h"
|
||||
#include "threads.h"
|
||||
#include "security/security_driver.h"
|
||||
#include "cgroup.h"
|
||||
#include "pci.h"
|
||||
#include "cpu_conf.h"
|
||||
#include "driver.h"
|
||||
# include "ebtables.h"
|
||||
# include "internal.h"
|
||||
# include "bridge.h"
|
||||
# include "capabilities.h"
|
||||
# include "network_conf.h"
|
||||
# include "domain_conf.h"
|
||||
# include "domain_event.h"
|
||||
# include "threads.h"
|
||||
# include "security/security_driver.h"
|
||||
# include "cgroup.h"
|
||||
# include "pci.h"
|
||||
# include "cpu_conf.h"
|
||||
# include "driver.h"
|
||||
|
||||
#define qemudDebug(fmt, ...) do {} while(0)
|
||||
# define qemudDebug(fmt, ...) do {} while(0)
|
||||
|
||||
#define QEMUD_CPUMASK_LEN CPU_SETSIZE
|
||||
# define QEMUD_CPUMASK_LEN CPU_SETSIZE
|
||||
|
||||
/* Internal flags to keep track of qemu command line capabilities */
|
||||
enum qemud_cmd_flags {
|
||||
|
@ -152,16 +152,16 @@ typedef struct _qemuDomainPCIAddressSet qemuDomainPCIAddressSet;
|
|||
typedef qemuDomainPCIAddressSet *qemuDomainPCIAddressSetPtr;
|
||||
|
||||
/* Port numbers used for KVM migration. */
|
||||
#define QEMUD_MIGRATION_FIRST_PORT 49152
|
||||
#define QEMUD_MIGRATION_NUM_PORTS 64
|
||||
# define QEMUD_MIGRATION_FIRST_PORT 49152
|
||||
# define QEMUD_MIGRATION_NUM_PORTS 64
|
||||
|
||||
/* Config type for XML import/export conversions */
|
||||
#define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
|
||||
# define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
|
||||
|
||||
#define QEMU_DRIVE_HOST_PREFIX "drive-"
|
||||
#define QEMU_VIRTIO_SERIAL_PREFIX "virtio-serial"
|
||||
# define QEMU_DRIVE_HOST_PREFIX "drive-"
|
||||
# define QEMU_VIRTIO_SERIAL_PREFIX "virtio-serial"
|
||||
|
||||
#define qemuReportError(code, ...) \
|
||||
# define qemuReportError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@
|
|||
#include <sys/un.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/vfs.h>
|
||||
#ifndef NFS_SUPER_MAGIC
|
||||
#define NFS_SUPER_MAGIC 0x6969
|
||||
#endif /* NFS_SUPER_MAGIC */
|
||||
# include <sys/vfs.h>
|
||||
# ifndef NFS_SUPER_MAGIC
|
||||
# define NFS_SUPER_MAGIC 0x6969
|
||||
# endif /* NFS_SUPER_MAGIC */
|
||||
#endif /* __linux__ */
|
||||
|
||||
#include "virterror_internal.h"
|
||||
|
|
|
@ -23,29 +23,29 @@
|
|||
|
||||
|
||||
#ifndef QEMUD_DRIVER_H
|
||||
#define QEMUD_DRIVER_H
|
||||
# define QEMUD_DRIVER_H
|
||||
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
#if HAVE_LINUX_KVM_H
|
||||
#include <linux/kvm.h>
|
||||
#endif
|
||||
# if HAVE_LINUX_KVM_H
|
||||
# include <linux/kvm.h>
|
||||
# endif
|
||||
|
||||
/* device for kvm ioctls */
|
||||
#define KVM_DEVICE "/dev/kvm"
|
||||
# define KVM_DEVICE "/dev/kvm"
|
||||
|
||||
/* add definitions missing in older linux/kvm.h */
|
||||
#ifndef KVMIO
|
||||
# ifndef KVMIO
|
||||
# define KVMIO 0xAE
|
||||
#endif
|
||||
#ifndef KVM_CHECK_EXTENSION
|
||||
# endif
|
||||
# ifndef KVM_CHECK_EXTENSION
|
||||
# define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
|
||||
#endif
|
||||
#ifndef KVM_CAP_NR_VCPUS
|
||||
# endif
|
||||
# ifndef KVM_CAP_NR_VCPUS
|
||||
# define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */
|
||||
#endif
|
||||
# endif
|
||||
|
||||
int qemuRegister(void);
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ char *qemuMonitorEscapeShell(const char *in)
|
|||
|
||||
|
||||
#if QEMU_DEBUG_RAW_IO
|
||||
#include <c-ctype.h>
|
||||
# include <c-ctype.h>
|
||||
static char * qemuMonitorEscapeNonPrintable(const char *text)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
|
||||
#ifndef QEMU_MONITOR_H
|
||||
#define QEMU_MONITOR_H
|
||||
# define QEMU_MONITOR_H
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
#include "domain_conf.h"
|
||||
#include "hash.h"
|
||||
# include "domain_conf.h"
|
||||
# include "hash.h"
|
||||
|
||||
typedef struct _qemuMonitor qemuMonitor;
|
||||
typedef qemuMonitor *qemuMonitorPtr;
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
|
||||
|
||||
#ifndef QEMU_MONITOR_JSON_H
|
||||
#define QEMU_MONITOR_JSON_H
|
||||
# define QEMU_MONITOR_JSON_H
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
#include "qemu_monitor.h"
|
||||
# include "qemu_monitor.h"
|
||||
|
||||
int qemuMonitorJSONIOProcess(qemuMonitorPtr mon,
|
||||
const char *data,
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
|
||||
#ifndef QEMU_MONITOR_TEXT_H
|
||||
#define QEMU_MONITOR_TEXT_H
|
||||
# define QEMU_MONITOR_TEXT_H
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
#include "qemu_monitor.h"
|
||||
#include "hash.h"
|
||||
# include "qemu_monitor.h"
|
||||
# include "hash.h"
|
||||
|
||||
int qemuMonitorTextIOProcess(qemuMonitorPtr mon,
|
||||
const char *data,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "qemu_conf.h"
|
||||
|
||||
#ifndef __QEMU_SECURITY_DAC
|
||||
#define __QEMU_SECURITY_DAC
|
||||
# define __QEMU_SECURITY_DAC
|
||||
|
||||
extern virSecurityDriver qemuDACSecurityDriver;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "qemu_conf.h"
|
||||
|
||||
#ifndef __QEMU_SECURITY_STACKED
|
||||
#define __QEMU_SECURITY_STACKED
|
||||
# define __QEMU_SECURITY_STACKED
|
||||
|
||||
extern virSecurityDriver qemuStackedSecurityDriver;
|
||||
|
||||
|
|
|
@ -45,15 +45,15 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PATHS_H
|
||||
#include <paths.h>
|
||||
# include <paths.h>
|
||||
#endif
|
||||
|
||||
#include <rpc/types.h>
|
||||
|
@ -62,7 +62,7 @@
|
|||
#include <gnutls/x509.h>
|
||||
#include "gnutls_1_0_compat.h"
|
||||
#if HAVE_SASL
|
||||
#include <sasl/sasl.h>
|
||||
# include <sasl/sasl.h>
|
||||
#endif
|
||||
#include <libxml/uri.h>
|
||||
|
||||
|
@ -92,7 +92,7 @@
|
|||
#define VIR_FROM_THIS VIR_FROM_REMOTE
|
||||
|
||||
#ifdef WIN32
|
||||
#define pipe(fds) _pipe(fds,4096, _O_BINARY)
|
||||
# define pipe(fds) _pipe(fds,4096, _O_BINARY)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -679,9 +679,9 @@ doRemoteOpen (virConnectPtr conn,
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef UNIX_PATH_MAX
|
||||
#define UNIX_PATH_MAX(addr) (sizeof (addr).sun_path)
|
||||
#endif
|
||||
# ifndef UNIX_PATH_MAX
|
||||
# define UNIX_PATH_MAX(addr) (sizeof (addr).sun_path)
|
||||
# endif
|
||||
struct sockaddr_un addr;
|
||||
int trials = 0;
|
||||
|
||||
|
@ -6710,7 +6710,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||
|
||||
|
||||
#if HAVE_POLKIT
|
||||
#if HAVE_POLKIT1
|
||||
# if HAVE_POLKIT1
|
||||
static int
|
||||
remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED)
|
||||
|
@ -6728,7 +6728,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||
DEBUG0("PolicyKit-1 authentication complete");
|
||||
return 0;
|
||||
}
|
||||
#elif HAVE_POLKIT0
|
||||
# elif HAVE_POLKIT0
|
||||
/* Perform the PolicyKit authentication process
|
||||
*/
|
||||
static int
|
||||
|
@ -6780,7 +6780,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||
DEBUG0("PolicyKit-0 authentication complete");
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_POLKIT0 */
|
||||
# endif /* HAVE_POLKIT0 */
|
||||
#endif /* HAVE_POLKIT */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -22,29 +22,29 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_REMOTE_INTERNAL_H__
|
||||
#define __VIR_REMOTE_INTERNAL_H__
|
||||
# define __VIR_REMOTE_INTERNAL_H__
|
||||
|
||||
#include "libvirt/virterror.h"
|
||||
# include "libvirt/virterror.h"
|
||||
|
||||
int remoteRegister (void);
|
||||
|
||||
unsigned long remoteVersion(void);
|
||||
|
||||
#define LIBVIRTD_LISTEN_ADDR NULL
|
||||
#define LIBVIRTD_TLS_PORT "16514"
|
||||
#define LIBVIRTD_TCP_PORT "16509"
|
||||
#define LIBVIRTD_PRIV_UNIX_SOCKET LOCAL_STATE_DIR "/run/libvirt/libvirt-sock"
|
||||
#define LIBVIRTD_PRIV_UNIX_SOCKET_RO LOCAL_STATE_DIR "/run/libvirt/libvirt-sock-ro"
|
||||
#define LIBVIRTD_USER_UNIX_SOCKET "/.libvirt/libvirt-sock"
|
||||
#define LIBVIRTD_CONFIGURATION_FILE SYSCONF_DIR "/libvirtd.conf"
|
||||
# define LIBVIRTD_LISTEN_ADDR NULL
|
||||
# define LIBVIRTD_TLS_PORT "16514"
|
||||
# define LIBVIRTD_TCP_PORT "16509"
|
||||
# define LIBVIRTD_PRIV_UNIX_SOCKET LOCAL_STATE_DIR "/run/libvirt/libvirt-sock"
|
||||
# define LIBVIRTD_PRIV_UNIX_SOCKET_RO LOCAL_STATE_DIR "/run/libvirt/libvirt-sock-ro"
|
||||
# define LIBVIRTD_USER_UNIX_SOCKET "/.libvirt/libvirt-sock"
|
||||
# define LIBVIRTD_CONFIGURATION_FILE SYSCONF_DIR "/libvirtd.conf"
|
||||
|
||||
/* Defaults for PKI directory. */
|
||||
#define LIBVIRT_PKI_DIR SYSCONF_DIR "/pki"
|
||||
#define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
|
||||
#define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
|
||||
#define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
|
||||
#define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem"
|
||||
#define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem"
|
||||
# define LIBVIRT_PKI_DIR SYSCONF_DIR "/pki"
|
||||
# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
|
||||
# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
|
||||
# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
|
||||
# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem"
|
||||
# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem"
|
||||
|
||||
|
||||
#endif /* __VIR_REMOTE_INTERNAL_H__ */
|
||||
|
|
|
@ -4,51 +4,51 @@
|
|||
*/
|
||||
|
||||
#ifndef _RP_H_RPCGEN
|
||||
#define _RP_H_RPCGEN
|
||||
# define _RP_H_RPCGEN
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
# include <rpc/rpc.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#include "internal.h"
|
||||
#include <arpa/inet.h>
|
||||
#define REMOTE_MESSAGE_MAX 262144
|
||||
#define REMOTE_MESSAGE_HEADER_MAX 24
|
||||
#define REMOTE_MESSAGE_PAYLOAD_MAX 262120
|
||||
#define REMOTE_STRING_MAX 65536
|
||||
# include "internal.h"
|
||||
# include <arpa/inet.h>
|
||||
# define REMOTE_MESSAGE_MAX 262144
|
||||
# define REMOTE_MESSAGE_HEADER_MAX 24
|
||||
# define REMOTE_MESSAGE_PAYLOAD_MAX 262120
|
||||
# define REMOTE_STRING_MAX 65536
|
||||
|
||||
typedef char *remote_nonnull_string;
|
||||
|
||||
typedef remote_nonnull_string *remote_string;
|
||||
#define REMOTE_DOMAIN_ID_LIST_MAX 16384
|
||||
#define REMOTE_DOMAIN_NAME_LIST_MAX 1024
|
||||
#define REMOTE_CPUMAP_MAX 256
|
||||
#define REMOTE_VCPUINFO_MAX 2048
|
||||
#define REMOTE_CPUMAPS_MAX 16384
|
||||
#define REMOTE_MIGRATE_COOKIE_MAX 256
|
||||
#define REMOTE_NETWORK_NAME_LIST_MAX 256
|
||||
#define REMOTE_INTERFACE_NAME_LIST_MAX 256
|
||||
#define REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX 256
|
||||
#define REMOTE_STORAGE_POOL_NAME_LIST_MAX 256
|
||||
#define REMOTE_STORAGE_VOL_NAME_LIST_MAX 1024
|
||||
#define REMOTE_NODE_DEVICE_NAME_LIST_MAX 16384
|
||||
#define REMOTE_NODE_DEVICE_CAPS_LIST_MAX 16384
|
||||
#define REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX 16
|
||||
#define REMOTE_NODE_MAX_CELLS 1024
|
||||
#define REMOTE_AUTH_SASL_DATA_MAX 65536
|
||||
#define REMOTE_AUTH_TYPE_LIST_MAX 20
|
||||
#define REMOTE_DOMAIN_MEMORY_STATS_MAX 1024
|
||||
#define REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX 65536
|
||||
#define REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX 65536
|
||||
#define REMOTE_SECURITY_MODEL_MAX VIR_SECURITY_MODEL_BUFLEN
|
||||
#define REMOTE_SECURITY_LABEL_MAX VIR_SECURITY_LABEL_BUFLEN
|
||||
#define REMOTE_SECURITY_DOI_MAX VIR_SECURITY_DOI_BUFLEN
|
||||
#define REMOTE_SECRET_VALUE_MAX 65536
|
||||
#define REMOTE_SECRET_UUID_LIST_MAX 16384
|
||||
#define REMOTE_CPU_BASELINE_MAX 256
|
||||
# define REMOTE_DOMAIN_ID_LIST_MAX 16384
|
||||
# define REMOTE_DOMAIN_NAME_LIST_MAX 1024
|
||||
# define REMOTE_CPUMAP_MAX 256
|
||||
# define REMOTE_VCPUINFO_MAX 2048
|
||||
# define REMOTE_CPUMAPS_MAX 16384
|
||||
# define REMOTE_MIGRATE_COOKIE_MAX 256
|
||||
# define REMOTE_NETWORK_NAME_LIST_MAX 256
|
||||
# define REMOTE_INTERFACE_NAME_LIST_MAX 256
|
||||
# define REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX 256
|
||||
# define REMOTE_STORAGE_POOL_NAME_LIST_MAX 256
|
||||
# define REMOTE_STORAGE_VOL_NAME_LIST_MAX 1024
|
||||
# define REMOTE_NODE_DEVICE_NAME_LIST_MAX 16384
|
||||
# define REMOTE_NODE_DEVICE_CAPS_LIST_MAX 16384
|
||||
# define REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX 16
|
||||
# define REMOTE_NODE_MAX_CELLS 1024
|
||||
# define REMOTE_AUTH_SASL_DATA_MAX 65536
|
||||
# define REMOTE_AUTH_TYPE_LIST_MAX 20
|
||||
# define REMOTE_DOMAIN_MEMORY_STATS_MAX 1024
|
||||
# define REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX 65536
|
||||
# define REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX 65536
|
||||
# define REMOTE_SECURITY_MODEL_MAX VIR_SECURITY_MODEL_BUFLEN
|
||||
# define REMOTE_SECURITY_LABEL_MAX VIR_SECURITY_LABEL_BUFLEN
|
||||
# define REMOTE_SECURITY_DOI_MAX VIR_SECURITY_DOI_BUFLEN
|
||||
# define REMOTE_SECRET_VALUE_MAX 65536
|
||||
# define REMOTE_SECRET_UUID_LIST_MAX 16384
|
||||
# define REMOTE_CPU_BASELINE_MAX 256
|
||||
|
||||
typedef char remote_uuid[VIR_UUID_BUFLEN];
|
||||
|
||||
|
@ -1704,8 +1704,8 @@ struct remote_domain_abort_job_args {
|
|||
remote_nonnull_domain dom;
|
||||
};
|
||||
typedef struct remote_domain_abort_job_args remote_domain_abort_job_args;
|
||||
#define REMOTE_PROGRAM 0x20008086
|
||||
#define REMOTE_PROTOCOL_VERSION 1
|
||||
# define REMOTE_PROGRAM 0x20008086
|
||||
# define REMOTE_PROTOCOL_VERSION 1
|
||||
|
||||
enum remote_procedure {
|
||||
REMOTE_PROC_OPEN = 1,
|
||||
|
@ -1889,7 +1889,7 @@ enum remote_message_status {
|
|||
REMOTE_CONTINUE = 2,
|
||||
};
|
||||
typedef enum remote_message_status remote_message_status;
|
||||
#define REMOTE_MESSAGE_HEADER_XDR_LEN 4
|
||||
# define REMOTE_MESSAGE_HEADER_XDR_LEN 4
|
||||
|
||||
struct remote_message_header {
|
||||
u_int prog;
|
||||
|
@ -1903,7 +1903,7 @@ typedef struct remote_message_header remote_message_header;
|
|||
|
||||
/* the xdr functions */
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
extern bool_t xdr_remote_nonnull_string (XDR *, remote_nonnull_string*);
|
||||
extern bool_t xdr_remote_string (XDR *, remote_string*);
|
||||
extern bool_t xdr_remote_uuid (XDR *, remote_uuid);
|
||||
|
@ -2186,7 +2186,7 @@ extern bool_t xdr_remote_message_type (XDR *, remote_message_type*);
|
|||
extern bool_t xdr_remote_message_status (XDR *, remote_message_status*);
|
||||
extern bool_t xdr_remote_message_header (XDR *, remote_message_header*);
|
||||
|
||||
#else /* K&R C */
|
||||
# else /* K&R C */
|
||||
extern bool_t xdr_remote_nonnull_string ();
|
||||
extern bool_t xdr_remote_string ();
|
||||
extern bool_t xdr_remote_uuid ();
|
||||
|
@ -2469,10 +2469,10 @@ extern bool_t xdr_remote_message_type ();
|
|||
extern bool_t xdr_remote_message_status ();
|
||||
extern bool_t xdr_remote_message_header ();
|
||||
|
||||
#endif /* K&R C */
|
||||
# endif /* K&R C */
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif /* !_RP_H_RPCGEN */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_SECRET_DRIVER_H__
|
||||
#define __VIR_SECRET_DRIVER_H__
|
||||
# define __VIR_SECRET_DRIVER_H__
|
||||
|
||||
int secretRegister(void);
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
*
|
||||
*/
|
||||
#ifndef __VIR_SECURITY_APPARMOR_H__
|
||||
#define __VIR_SECURITY_APPARMOR_H__
|
||||
# define __VIR_SECURITY_APPARMOR_H__
|
||||
|
||||
extern virSecurityDriver virAppArmorSecurityDriver;
|
||||
|
||||
#define AA_PREFIX "libvirt-"
|
||||
#define PROFILE_NAME_SIZE 8 + VIR_UUID_STRING_BUFLEN /* AA_PREFIX + uuid */
|
||||
#define MAX_FILE_LEN (1024*1024*10) /* 10MB limit for sanity check */
|
||||
# define AA_PREFIX "libvirt-"
|
||||
# define PROFILE_NAME_SIZE 8 + VIR_UUID_STRING_BUFLEN /* AA_PREFIX + uuid */
|
||||
# define MAX_FILE_LEN (1024*1024*10) /* 10MB limit for sanity check */
|
||||
|
||||
#endif /* __VIR_SECURITY_APPARMOR_H__ */
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
#include "security_driver.h"
|
||||
#ifdef WITH_SECDRIVER_SELINUX
|
||||
#include "security_selinux.h"
|
||||
# include "security_selinux.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SECDRIVER_APPARMOR
|
||||
#include "security_apparmor.h"
|
||||
# include "security_apparmor.h"
|
||||
#endif
|
||||
|
||||
static virSecurityDriverPtr security_drivers[] = {
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
*
|
||||
*/
|
||||
#ifndef __VIR_SECURITY_H__
|
||||
#define __VIR_SECURITY_H__
|
||||
# define __VIR_SECURITY_H__
|
||||
|
||||
#include "internal.h"
|
||||
#include "domain_conf.h"
|
||||
# include "internal.h"
|
||||
# include "domain_conf.h"
|
||||
|
||||
/*
|
||||
* Return values for security driver probing: the driver will determine
|
||||
|
@ -88,7 +88,7 @@ int virSecurityDriverStartup(virSecurityDriverPtr *drv,
|
|||
int
|
||||
virSecurityDriverVerify(virDomainDefPtr def);
|
||||
|
||||
#define virSecurityReportError(code, ...) \
|
||||
# define virSecurityReportError(code, ...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_SECURITY, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
*/
|
||||
#ifndef __VIR_SECURITY_SELINUX_H__
|
||||
#define __VIR_SECURITY_SELINUX_H__
|
||||
# define __VIR_SECURITY_SELINUX_H__
|
||||
|
||||
extern virSecurityDriver virSELinuxSecurityDriver;
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
# include <regex.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include <dirent.h>
|
||||
|
||||
#if HAVE_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
# include <selinux/selinux.h>
|
||||
#endif
|
||||
|
||||
#include "datatypes.h"
|
||||
|
@ -55,26 +55,26 @@
|
|||
#include "logging.h"
|
||||
|
||||
#if WITH_STORAGE_LVM
|
||||
#include "storage_backend_logical.h"
|
||||
# include "storage_backend_logical.h"
|
||||
#endif
|
||||
#if WITH_STORAGE_ISCSI
|
||||
#include "storage_backend_iscsi.h"
|
||||
# include "storage_backend_iscsi.h"
|
||||
#endif
|
||||
#if WITH_STORAGE_SCSI
|
||||
#include "storage_backend_scsi.h"
|
||||
# include "storage_backend_scsi.h"
|
||||
#endif
|
||||
#if WITH_STORAGE_MPATH
|
||||
#include "storage_backend_mpath.h"
|
||||
# include "storage_backend_mpath.h"
|
||||
#endif
|
||||
#if WITH_STORAGE_DISK
|
||||
#include "storage_backend_disk.h"
|
||||
# include "storage_backend_disk.h"
|
||||
#endif
|
||||
#if WITH_STORAGE_DIR
|
||||
#include "storage_backend_fs.h"
|
||||
# include "storage_backend_fs.h"
|
||||
#endif
|
||||
|
||||
#ifndef DEV_BSIZE
|
||||
#define DEV_BSIZE 512
|
||||
# define DEV_BSIZE 512
|
||||
#endif
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_STORAGE
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_H__
|
||||
#define __VIR_STORAGE_BACKEND_H__
|
||||
# define __VIR_STORAGE_BACKEND_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "internal.h"
|
||||
#include "storage_conf.h"
|
||||
# include <stdint.h>
|
||||
# include "internal.h"
|
||||
# include "storage_conf.h"
|
||||
|
||||
typedef char * (*virStorageBackendFindPoolSources)(virConnectPtr conn, const char *srcSpec, unsigned int flags);
|
||||
typedef int (*virStorageBackendStartPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_DISK_H__
|
||||
#define __VIR_STORAGE_BACKEND_DISK_H__
|
||||
# define __VIR_STORAGE_BACKEND_DISK_H__
|
||||
|
||||
#include "storage_backend.h"
|
||||
# include "storage_backend.h"
|
||||
|
||||
extern virStorageBackend virStorageBackendDisk;
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
|
|||
|
||||
#if WITH_STORAGE_FS
|
||||
|
||||
#include <mntent.h>
|
||||
# include <mntent.h>
|
||||
|
||||
struct _virNetfsDiscoverState {
|
||||
const char *host;
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_FS_H__
|
||||
#define __VIR_STORAGE_BACKEND_FS_H__
|
||||
# define __VIR_STORAGE_BACKEND_FS_H__
|
||||
|
||||
#include "storage_backend.h"
|
||||
# include "storage_backend.h"
|
||||
|
||||
#if WITH_STORAGE_FS
|
||||
# if WITH_STORAGE_FS
|
||||
extern virStorageBackend virStorageBackendFileSystem;
|
||||
extern virStorageBackend virStorageBackendNetFileSystem;
|
||||
#endif
|
||||
# endif
|
||||
extern virStorageBackend virStorageBackendDirectory;
|
||||
|
||||
#endif /* __VIR_STORAGE_BACKEND_FS_H__ */
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_ISCSI_H__
|
||||
#define __VIR_STORAGE_BACKEND_ISCSI_H__
|
||||
# define __VIR_STORAGE_BACKEND_ISCSI_H__
|
||||
|
||||
#include "storage_backend.h"
|
||||
# include "storage_backend.h"
|
||||
|
||||
extern virStorageBackend virStorageBackendISCSI;
|
||||
|
||||
#define IQN_FOUND 1
|
||||
#define IQN_MISSING 0
|
||||
#define IQN_ERROR -1
|
||||
# define IQN_FOUND 1
|
||||
# define IQN_MISSING 0
|
||||
# define IQN_ERROR -1
|
||||
|
||||
#endif /* __VIR_STORAGE_BACKEND_ISCSI_H__ */
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_LOGICAL_H__
|
||||
#define __VIR_STORAGE_BACKEND_LOGICAL_H__
|
||||
# define __VIR_STORAGE_BACKEND_LOGICAL_H__
|
||||
|
||||
#include "storage_backend.h"
|
||||
# include "storage_backend.h"
|
||||
|
||||
extern virStorageBackend virStorageBackendLogical;
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_MPATH_H__
|
||||
#define __VIR_STORAGE_BACKEND_MPATH_H__
|
||||
# define __VIR_STORAGE_BACKEND_MPATH_H__
|
||||
|
||||
#include "storage_backend.h"
|
||||
# include "storage_backend.h"
|
||||
|
||||
extern virStorageBackend virStorageBackendMpath;
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_BACKEND_SCSI_H__
|
||||
#define __VIR_STORAGE_BACKEND_SCSI_H__
|
||||
# define __VIR_STORAGE_BACKEND_SCSI_H__
|
||||
|
||||
#include "storage_backend.h"
|
||||
# include "storage_backend.h"
|
||||
|
||||
#define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host"
|
||||
#define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
||||
#define LINUX_SYSFS_SCSI_HOST_SCAN_STRING "- - -"
|
||||
# define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host"
|
||||
# define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
||||
# define LINUX_SYSFS_SCSI_HOST_SCAN_STRING "- - -"
|
||||
|
||||
extern virStorageBackend virStorageBackendSCSI;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#if HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_STORAGE_DRIVER_H__
|
||||
#define __VIR_STORAGE_DRIVER_H__
|
||||
# define __VIR_STORAGE_DRIVER_H__
|
||||
|
||||
#include "storage_conf.h"
|
||||
# include "storage_conf.h"
|
||||
|
||||
int storageRegister(void);
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
#ifndef __VIR_TEST_INTERNAL_H__
|
||||
#define __VIR_TEST_INTERNAL_H__
|
||||
# define __VIR_TEST_INTERNAL_H__
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
int testRegister(void);
|
||||
|
||||
|
|
|
@ -22,21 +22,21 @@
|
|||
*/
|
||||
|
||||
#ifndef __UML_CONF_H
|
||||
#define __UML_CONF_H
|
||||
# define __UML_CONF_H
|
||||
|
||||
#include "internal.h"
|
||||
#include "bridge.h"
|
||||
#include "capabilities.h"
|
||||
#include "network_conf.h"
|
||||
#include "domain_conf.h"
|
||||
#include "virterror_internal.h"
|
||||
#include "threads.h"
|
||||
# include "internal.h"
|
||||
# include "bridge.h"
|
||||
# include "capabilities.h"
|
||||
# include "network_conf.h"
|
||||
# include "domain_conf.h"
|
||||
# include "virterror_internal.h"
|
||||
# include "threads.h"
|
||||
|
||||
#define umlDebug(fmt, ...) do {} while(0)
|
||||
# define umlDebug(fmt, ...) do {} while(0)
|
||||
|
||||
#define UML_CPUMASK_LEN CPU_SETSIZE
|
||||
# define UML_CPUMASK_LEN CPU_SETSIZE
|
||||
|
||||
#define UML_MAX_CHAR_DEVICE 16
|
||||
# define UML_MAX_CHAR_DEVICE 16
|
||||
|
||||
/* Main driver state */
|
||||
struct uml_driver {
|
||||
|
@ -62,7 +62,7 @@ struct uml_driver {
|
|||
};
|
||||
|
||||
|
||||
#define umlReportError(conn, dom, net, code, ...) \
|
||||
# define umlReportError(conn, dom, net, code, ...) \
|
||||
virReportErrorHelper(conn, VIR_FROM_UML, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
|
||||
#ifndef UML_DRIVER_H
|
||||
#define UML_DRIVER_H
|
||||
# define UML_DRIVER_H
|
||||
|
||||
#include "internal.h"
|
||||
# include "internal.h"
|
||||
|
||||
int umlRegister(void);
|
||||
|
||||
|
|
|
@ -23,34 +23,34 @@
|
|||
|
||||
#if defined(WITH_BRIDGE)
|
||||
|
||||
#include "bridge.h"
|
||||
# include "bridge.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <paths.h>
|
||||
#include <sys/wait.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <errno.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <paths.h>
|
||||
# include <sys/wait.h>
|
||||
|
||||
#include <linux/param.h> /* HZ */
|
||||
#include <linux/sockios.h> /* SIOCBRADDBR etc. */
|
||||
#include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
|
||||
#include <linux/if_tun.h> /* IFF_TUN, IFF_NO_PI */
|
||||
#include <net/if_arp.h> /* ARPHRD_ETHER */
|
||||
# include <linux/param.h> /* HZ */
|
||||
# include <linux/sockios.h> /* SIOCBRADDBR etc. */
|
||||
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
|
||||
# include <linux/if_tun.h> /* IFF_TUN, IFF_NO_PI */
|
||||
# include <net/if_arp.h> /* ARPHRD_ETHER */
|
||||
|
||||
#include "internal.h"
|
||||
#include "memory.h"
|
||||
#include "util.h"
|
||||
#include "logging.h"
|
||||
# include "internal.h"
|
||||
# include "memory.h"
|
||||
# include "util.h"
|
||||
# include "logging.h"
|
||||
|
||||
#define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
|
||||
#define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
|
||||
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
|
||||
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
|
||||
|
||||
struct _brControl {
|
||||
int fd;
|
||||
|
@ -122,7 +122,7 @@ brShutdown(brControl *ctl)
|
|||
*
|
||||
* Returns 0 in case of success or an errno code in case of failure.
|
||||
*/
|
||||
#ifdef SIOCBRADDBR
|
||||
# ifdef SIOCBRADDBR
|
||||
int
|
||||
brAddBridge(brControl *ctl,
|
||||
const char *name)
|
||||
|
@ -135,15 +135,15 @@ brAddBridge(brControl *ctl,
|
|||
|
||||
return errno;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
int brAddBridge (brControl *ctl ATTRIBUTE_UNUSED,
|
||||
const char *name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef SIOCBRDELBR
|
||||
# ifdef SIOCBRDELBR
|
||||
int
|
||||
brHasBridge(brControl *ctl,
|
||||
const char *name)
|
||||
|
@ -167,14 +167,14 @@ brHasBridge(brControl *ctl,
|
|||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
int
|
||||
brHasBridge(brControl *ctl ATTRIBUTE_UNUSED,
|
||||
const char *name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* brDeleteBridge:
|
||||
|
@ -185,7 +185,7 @@ brHasBridge(brControl *ctl ATTRIBUTE_UNUSED,
|
|||
*
|
||||
* Returns 0 in case of success or an errno code in case of failure.
|
||||
*/
|
||||
#ifdef SIOCBRDELBR
|
||||
# ifdef SIOCBRDELBR
|
||||
int
|
||||
brDeleteBridge(brControl *ctl,
|
||||
const char *name)
|
||||
|
@ -195,16 +195,16 @@ brDeleteBridge(brControl *ctl,
|
|||
|
||||
return ioctl(ctl->fd, SIOCBRDELBR, name) == 0 ? 0 : errno;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
int
|
||||
brDeleteBridge(brControl *ctl ATTRIBUTE_UNUSED,
|
||||
const char *name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if defined(SIOCBRADDIF) && defined(SIOCBRDELIF)
|
||||
# if defined(SIOCBRADDIF) && defined(SIOCBRDELIF)
|
||||
static int
|
||||
brAddDelInterface(brControl *ctl,
|
||||
int cmd,
|
||||
|
@ -226,7 +226,7 @@ brAddDelInterface(brControl *ctl,
|
|||
|
||||
return ioctl(ctl->fd, cmd, &ifr) == 0 ? 0 : errno;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* brAddInterface:
|
||||
|
@ -238,7 +238,7 @@ brAddDelInterface(brControl *ctl,
|
|||
*
|
||||
* Returns 0 in case of success or an errno code in case of failure.
|
||||
*/
|
||||
#ifdef SIOCBRADDIF
|
||||
# ifdef SIOCBRADDIF
|
||||
int
|
||||
brAddInterface(brControl *ctl,
|
||||
const char *bridge,
|
||||
|
@ -246,7 +246,7 @@ brAddInterface(brControl *ctl,
|
|||
{
|
||||
return brAddDelInterface(ctl, SIOCBRADDIF, bridge, iface);
|
||||
}
|
||||
#else
|
||||
# else
|
||||
int
|
||||
brAddInterface(brControl *ctl ATTRIBUTE_UNUSED,
|
||||
const char *bridge ATTRIBUTE_UNUSED,
|
||||
|
@ -254,7 +254,7 @@ brAddInterface(brControl *ctl ATTRIBUTE_UNUSED,
|
|||
{
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* brDeleteInterface:
|
||||
|
@ -266,7 +266,7 @@ brAddInterface(brControl *ctl ATTRIBUTE_UNUSED,
|
|||
*
|
||||
* Returns 0 in case of success or an errno code in case of failure.
|
||||
*/
|
||||
#ifdef SIOCBRDELIF
|
||||
# ifdef SIOCBRDELIF
|
||||
int
|
||||
brDeleteInterface(brControl *ctl,
|
||||
const char *bridge,
|
||||
|
@ -274,7 +274,7 @@ brDeleteInterface(brControl *ctl,
|
|||
{
|
||||
return brAddDelInterface(ctl, SIOCBRDELIF, bridge, iface);
|
||||
}
|
||||
#else
|
||||
# else
|
||||
int
|
||||
brDeleteInterface(brControl *ctl ATTRIBUTE_UNUSED,
|
||||
const char *bridge ATTRIBUTE_UNUSED,
|
||||
|
@ -282,7 +282,7 @@ brDeleteInterface(brControl *ctl ATTRIBUTE_UNUSED,
|
|||
{
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* ifGetMtu
|
||||
|
@ -385,11 +385,11 @@ static int brSetInterfaceMtu(brControl *ctl,
|
|||
*
|
||||
* Returns 0 in case of success or an errno code in case of failure.
|
||||
*/
|
||||
#ifdef IFF_VNET_HDR
|
||||
# ifdef IFF_VNET_HDR
|
||||
static int
|
||||
brProbeVnetHdr(int tapfd)
|
||||
{
|
||||
#if defined(IFF_VNET_HDR) && defined(TUNGETFEATURES) && defined(TUNGETIFF)
|
||||
# if defined(IFF_VNET_HDR) && defined(TUNGETFEATURES) && defined(TUNGETIFF)
|
||||
unsigned int features;
|
||||
struct ifreq dummy;
|
||||
|
||||
|
@ -417,13 +417,13 @@ brProbeVnetHdr(int tapfd)
|
|||
VIR_INFO0(_("Enabling IFF_VNET_HDR"));
|
||||
|
||||
return 1;
|
||||
#else
|
||||
# else
|
||||
(void) tapfd;
|
||||
VIR_INFO0(_("Not enabling IFF_VNET_HDR; disabled at build time"));
|
||||
return 0;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* brAddTap:
|
||||
|
@ -463,12 +463,12 @@ brAddTap(brControl *ctl,
|
|||
|
||||
ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
|
||||
|
||||
#ifdef IFF_VNET_HDR
|
||||
# ifdef IFF_VNET_HDR
|
||||
if (vnet_hdr && brProbeVnetHdr(fd))
|
||||
ifr.ifr_flags |= IFF_VNET_HDR;
|
||||
#else
|
||||
# else
|
||||
(void) vnet_hdr;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (virStrcpyStatic(ifr.ifr_name, *ifname) == NULL) {
|
||||
errno = EINVAL;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue