mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
libvirt: introduce libvirt/libvirt-common.h.in
As it turned out, we need to share some enums and declarations between libvirt.h and libvirt-admin.h, but since our policy forbids direct includes of libvirt*.h, there has to be some header exempt from this rule. This patch moves the relevant part of code from libvirt.h.in to libvirt-common.h.in. Moreover, since there is no need to have libvirt.h generated anymore, introduce a new header libvirt.h which was previosly ignored from git and make the common header ignored and generated instead.
This commit is contained in:
parent
06198b9c73
commit
a20b623748
2
.gitignore
vendored
2
.gitignore
vendored
@ -87,7 +87,7 @@
|
|||||||
/gnulib/lib/*
|
/gnulib/lib/*
|
||||||
/gnulib/m4/*
|
/gnulib/m4/*
|
||||||
/gnulib/tests/*
|
/gnulib/tests/*
|
||||||
/include/libvirt/libvirt.h
|
/include/libvirt/libvirt-common.h
|
||||||
/libtool
|
/libtool
|
||||||
/libvirt-*.tar.gz
|
/libvirt-*.tar.gz
|
||||||
/libvirt-[0-9]*
|
/libvirt-[0-9]*
|
||||||
|
2
cfg.mk
2
cfg.mk
@ -1215,7 +1215,7 @@ exclude_file_name_regexp--sc_prohibit_include_public_headers_quote = \
|
|||||||
^(src/internal\.h$$|tools/wireshark/src/packet-libvirt.h$$)
|
^(src/internal\.h$$|tools/wireshark/src/packet-libvirt.h$$)
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
|
exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
|
||||||
^(tools/|examples/|include/libvirt/(virterror|libvirt-(qemu|lxc))\.h$$)
|
^(tools/|examples/|include/libvirt/(virterror|libvirt(-(admin|qemu|lxc))?)\.h$$)
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_int_ijk = \
|
exclude_file_name_regexp--sc_prohibit_int_ijk = \
|
||||||
^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
|
^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
|
||||||
|
@ -2789,7 +2789,7 @@ AC_CONFIG_FILES([\
|
|||||||
src/libvirt-lxc.pc \
|
src/libvirt-lxc.pc \
|
||||||
libvirt.spec mingw-libvirt.spec \
|
libvirt.spec mingw-libvirt.spec \
|
||||||
po/Makefile.in \
|
po/Makefile.in \
|
||||||
include/libvirt/Makefile include/libvirt/libvirt.h \
|
include/libvirt/Makefile include/libvirt/libvirt-common.h \
|
||||||
daemon/Makefile \
|
daemon/Makefile \
|
||||||
tools/Makefile \
|
tools/Makefile \
|
||||||
tests/Makefile \
|
tests/Makefile \
|
||||||
|
@ -301,7 +301,8 @@ EXTRA_DIST += $(APIBUILD_STAMP)
|
|||||||
$(python_generated_files): $(APIBUILD_STAMP)
|
$(python_generated_files): $(APIBUILD_STAMP)
|
||||||
|
|
||||||
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
||||||
$(top_srcdir)/include/libvirt/libvirt.h.in \
|
$(top_srcdir)/include/libvirt/libvirt.h \
|
||||||
|
$(top_srcdir)/include/libvirt/libvirt-common.h.in \
|
||||||
$(top_srcdir)/include/libvirt/libvirt-domain-snapshot.h \
|
$(top_srcdir)/include/libvirt/libvirt-domain-snapshot.h \
|
||||||
$(top_srcdir)/include/libvirt/libvirt-domain.h \
|
$(top_srcdir)/include/libvirt/libvirt-domain.h \
|
||||||
$(top_srcdir)/include/libvirt/libvirt-event.h \
|
$(top_srcdir)/include/libvirt/libvirt-event.h \
|
||||||
|
@ -37,7 +37,7 @@ virinc_HEADERS = libvirt.h \
|
|||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
$(mkinstalldirs) $(DESTDIR)$(virincdir)
|
$(mkinstalldirs) $(DESTDIR)$(virincdir)
|
||||||
|
|
||||||
EXTRA_DIST = libvirt.h.in
|
EXTRA_DIST = libvirt-common.h.in
|
||||||
|
|
||||||
# Temporarily disabled, but we need it for building
|
# Temporarily disabled, but we need it for building
|
||||||
EXTRA_DIST += libvirt-admin.h
|
EXTRA_DIST += libvirt-admin.h
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# define __VIR_ADMIN_H_INCLUDES__
|
||||||
|
# include <libvirt/libvirt-common.h>
|
||||||
|
# undef __VIR_ADMIN_H_INCLUDES__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virAdmConnect:
|
* virAdmConnect:
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* -*- c -*-
|
/* -*- c -*-
|
||||||
* libvirt.h: Core interfaces for the libvirt library
|
* libvirt-common.h
|
||||||
* Summary: core interfaces for the libvirt library
|
* Summary: common macros and enums for the libvirt and libvirt-admin library
|
||||||
* Description: Provides the interfaces of the libvirt library to handle
|
* Description: Provides common macros and enums needed by both libvirt and
|
||||||
* virtualized domains
|
* libvirt-admin libraries
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2006, 2010-2014 Red Hat, Inc.
|
* Copyright (C) 2015 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,11 +20,15 @@
|
|||||||
* License along with this library. If not, see
|
* License along with this library. If not, see
|
||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Author: Daniel Veillard <veillard@redhat.com>
|
* Author: Erik Skultety <eskultet@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __VIR_VIRLIB_H__
|
#if !defined __VIR_LIBVIRT_H_INCLUDES__ && !defined __VIR_ADMIN_H_INCLUDES__
|
||||||
# define __VIR_VIRLIB_H__
|
# error "Don't include this file directly"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VIR_VIRCOMMON_H__
|
||||||
|
# define __VIR_VIRCOMMON_H__
|
||||||
|
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
|
|
||||||
@ -88,22 +92,36 @@ extern "C" {
|
|||||||
# define LIBVIR_CHECK_VERSION(major, minor, micro) \
|
# define LIBVIR_CHECK_VERSION(major, minor, micro) \
|
||||||
((major) * 1000000 + (minor) * 1000 + (micro) <= LIBVIR_VERSION_NUMBER)
|
((major) * 1000000 + (minor) * 1000 + (micro) <= LIBVIR_VERSION_NUMBER)
|
||||||
|
|
||||||
# define __VIR_LIBVIRT_H_INCLUDES__
|
/*
|
||||||
# include <libvirt/libvirt-host.h>
|
* virFreeCallback:
|
||||||
# include <libvirt/libvirt-domain.h>
|
* @opaque: opaque user data provided at registration
|
||||||
# include <libvirt/libvirt-domain-snapshot.h>
|
*
|
||||||
# include <libvirt/libvirt-event.h>
|
* Type for a callback cleanup function to be paired with a callback. This
|
||||||
# include <libvirt/libvirt-interface.h>
|
* function will be called as a final chance to clean up the @opaque
|
||||||
# include <libvirt/libvirt-network.h>
|
* registered with the primary callback, at the time when the primary
|
||||||
# include <libvirt/libvirt-nodedev.h>
|
* callback is deregistered.
|
||||||
# include <libvirt/libvirt-nwfilter.h>
|
*
|
||||||
# include <libvirt/libvirt-secret.h>
|
* It is forbidden to call any other libvirt APIs from an
|
||||||
# include <libvirt/libvirt-storage.h>
|
* implementation of this callback, since it can be invoked
|
||||||
# include <libvirt/libvirt-stream.h>
|
* from a context which is not re-entrant safe. Failure to
|
||||||
# undef __VIR_LIBVIRT_H_INCLUDES__
|
* abide by this requirement may lead to application deadlocks
|
||||||
|
* or crashes.
|
||||||
|
*/
|
||||||
|
typedef void (*virFreeCallback)(void *opaque);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
VIR_CONNECT_CLOSE_REASON_ERROR = 0, /* Misc I/O error */
|
||||||
|
VIR_CONNECT_CLOSE_REASON_EOF = 1, /* End-of-file from server */
|
||||||
|
VIR_CONNECT_CLOSE_REASON_KEEPALIVE = 2, /* Keepalive timer triggered */
|
||||||
|
VIR_CONNECT_CLOSE_REASON_CLIENT = 3, /* Client requested it */
|
||||||
|
|
||||||
|
# ifdef VIR_ENUM_SENTINELS
|
||||||
|
VIR_CONNECT_CLOSE_REASON_LAST
|
||||||
|
# endif
|
||||||
|
} virConnectCloseReason;
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif /* __VIR_VIRLIB_H__ */
|
#endif /* __VIR_VIRCOMMON_H__ */
|
@ -29,24 +29,6 @@
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* virFreeCallback:
|
|
||||||
* @opaque: opaque user data provided at registration
|
|
||||||
*
|
|
||||||
* Type for a callback cleanup function to be paired with a callback. This
|
|
||||||
* function will be called as a final chance to clean up the @opaque
|
|
||||||
* registered with the primary callback, at the time when the primary
|
|
||||||
* callback is deregistered.
|
|
||||||
*
|
|
||||||
* It is forbidden to call any other libvirt APIs from an
|
|
||||||
* implementation of this callback, since it can be invoked
|
|
||||||
* from a context which is not re-entrant safe. Failure to
|
|
||||||
* abide by this requirement may lead to application deadlocks
|
|
||||||
* or crashes.
|
|
||||||
*/
|
|
||||||
typedef void (*virFreeCallback)(void *opaque);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virConnect:
|
* virConnect:
|
||||||
*
|
*
|
||||||
@ -755,18 +737,6 @@ char * virConnectGetSysinfo (virConnectPtr conn,
|
|||||||
int virConnectSetKeepAlive(virConnectPtr conn,
|
int virConnectSetKeepAlive(virConnectPtr conn,
|
||||||
int interval,
|
int interval,
|
||||||
unsigned int count);
|
unsigned int count);
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
VIR_CONNECT_CLOSE_REASON_ERROR = 0, /* Misc I/O error */
|
|
||||||
VIR_CONNECT_CLOSE_REASON_EOF = 1, /* End-of-file from server */
|
|
||||||
VIR_CONNECT_CLOSE_REASON_KEEPALIVE = 2, /* Keepalive timer triggered */
|
|
||||||
VIR_CONNECT_CLOSE_REASON_CLIENT = 3, /* Client requested it */
|
|
||||||
|
|
||||||
# ifdef VIR_ENUM_SENTINELS
|
|
||||||
VIR_CONNECT_CLOSE_REASON_LAST
|
|
||||||
# endif
|
|
||||||
} virConnectCloseReason;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virConnectCloseFunc:
|
* virConnectCloseFunc:
|
||||||
* @conn: virConnect connection
|
* @conn: virConnect connection
|
||||||
|
54
include/libvirt/libvirt.h
Normal file
54
include/libvirt/libvirt.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* -*- c -*-
|
||||||
|
* libvirt.h: Core interfaces for the libvirt library
|
||||||
|
* Summary: core interfaces for the libvirt library
|
||||||
|
* Description: Provides the interfaces of the libvirt library to handle
|
||||||
|
* virtualized domains
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005-2006, 2010-2014 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Daniel Veillard <veillard@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __VIR_VIRLIB_H__
|
||||||
|
# define __VIR_VIRLIB_H__
|
||||||
|
|
||||||
|
# include <sys/types.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define __VIR_LIBVIRT_H_INCLUDES__
|
||||||
|
# include <libvirt/libvirt-common.h>
|
||||||
|
# include <libvirt/libvirt-host.h>
|
||||||
|
# include <libvirt/libvirt-domain.h>
|
||||||
|
# include <libvirt/libvirt-domain-snapshot.h>
|
||||||
|
# include <libvirt/libvirt-event.h>
|
||||||
|
# include <libvirt/libvirt-interface.h>
|
||||||
|
# include <libvirt/libvirt-network.h>
|
||||||
|
# include <libvirt/libvirt-nodedev.h>
|
||||||
|
# include <libvirt/libvirt-nwfilter.h>
|
||||||
|
# include <libvirt/libvirt-secret.h>
|
||||||
|
# include <libvirt/libvirt-storage.h>
|
||||||
|
# include <libvirt/libvirt-stream.h>
|
||||||
|
# undef __VIR_LIBVIRT_H_INCLUDES__
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* __VIR_VIRLIB_H__ */
|
Loading…
Reference in New Issue
Block a user