mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +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/m4/*
|
||||
/gnulib/tests/*
|
||||
/include/libvirt/libvirt.h
|
||||
/include/libvirt/libvirt-common.h
|
||||
/libtool
|
||||
/libvirt-*.tar.gz
|
||||
/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$$)
|
||||
|
||||
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 = \
|
||||
^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$
|
||||
|
@ -2789,7 +2789,7 @@ AC_CONFIG_FILES([\
|
||||
src/libvirt-lxc.pc \
|
||||
libvirt.spec mingw-libvirt.spec \
|
||||
po/Makefile.in \
|
||||
include/libvirt/Makefile include/libvirt/libvirt.h \
|
||||
include/libvirt/Makefile include/libvirt/libvirt-common.h \
|
||||
daemon/Makefile \
|
||||
tools/Makefile \
|
||||
tests/Makefile \
|
||||
|
@ -301,7 +301,8 @@ EXTRA_DIST += $(APIBUILD_STAMP)
|
||||
$(python_generated_files): $(APIBUILD_STAMP)
|
||||
|
||||
$(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.h \
|
||||
$(top_srcdir)/include/libvirt/libvirt-event.h \
|
||||
|
@ -37,7 +37,7 @@ virinc_HEADERS = libvirt.h \
|
||||
install-exec-hook:
|
||||
$(mkinstalldirs) $(DESTDIR)$(virincdir)
|
||||
|
||||
EXTRA_DIST = libvirt.h.in
|
||||
EXTRA_DIST = libvirt-common.h.in
|
||||
|
||||
# Temporarily disabled, but we need it for building
|
||||
EXTRA_DIST += libvirt-admin.h
|
||||
|
@ -30,6 +30,9 @@
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define __VIR_ADMIN_H_INCLUDES__
|
||||
# include <libvirt/libvirt-common.h>
|
||||
# undef __VIR_ADMIN_H_INCLUDES__
|
||||
|
||||
/**
|
||||
* virAdmConnect:
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* -*- 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
|
||||
* libvirt-common.h
|
||||
* Summary: common macros and enums for the libvirt and libvirt-admin library
|
||||
* Description: Provides common macros and enums needed by both libvirt and
|
||||
* 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
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -20,11 +20,15 @@
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Daniel Veillard <veillard@redhat.com>
|
||||
* Author: Erik Skultety <eskultet@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __VIR_VIRLIB_H__
|
||||
# define __VIR_VIRLIB_H__
|
||||
#if !defined __VIR_LIBVIRT_H_INCLUDES__ && !defined __VIR_ADMIN_H_INCLUDES__
|
||||
# error "Don't include this file directly"
|
||||
#endif
|
||||
|
||||
#ifndef __VIR_VIRCOMMON_H__
|
||||
# define __VIR_VIRCOMMON_H__
|
||||
|
||||
# include <sys/types.h>
|
||||
|
||||
@ -88,22 +92,36 @@ extern "C" {
|
||||
# define LIBVIR_CHECK_VERSION(major, minor, micro) \
|
||||
((major) * 1000000 + (minor) * 1000 + (micro) <= LIBVIR_VERSION_NUMBER)
|
||||
|
||||
# define __VIR_LIBVIRT_H_INCLUDES__
|
||||
# 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__
|
||||
/*
|
||||
* 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);
|
||||
|
||||
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
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* __VIR_VIRLIB_H__ */
|
||||
#endif /* __VIR_VIRCOMMON_H__ */
|
@ -29,24 +29,6 @@
|
||||
# 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:
|
||||
*
|
||||
@ -755,18 +737,6 @@ char * virConnectGetSysinfo (virConnectPtr conn,
|
||||
int virConnectSetKeepAlive(virConnectPtr conn,
|
||||
int interval,
|
||||
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:
|
||||
* @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