提交 b1a94564 编写于 作者: E Eric Blake

maint: this branch is now dead

Upstream is no longer willing to backport patches to a branch
this old.  If you disagree with the policy, please volunteer
to become the branch maintainer on libvir-list@redhat.com
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 d3d33c82

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
.gnulib @ 16290063
Subproject commit 1629006348e1f66f07ce3ddcf3ebd2d14556cfce
<amy.griffis@hp.com> <aron.griffis@hp.com>
<bozzolan@gmail.com> <redshift@gmx.com>
<charles_duffy@messageone.com> <charles@dyfis.net>
<dfj@redhat.com> <dfj@dfj.bne.redhat.com>
<eblake@redhat.com> <ebb9@byu.net>
<gdolley@arpnetworks.com> <gdolley@ucla.edu>
<gerhard.stenzel@de.ibm.com> <gstenzel@linux.vnet.ibm.com>
<jamie@canonical.com> <jamie@ubuntu.com>
<laine@redhat.com> <laine@laine.org>
<meyering@redhat.com> <jim@meyering.net>
<socketpair@gmail.com> <socketpair gmail com>
<soren@canonical.com> <soren@ubuntu.com>
<jfehlig@novell.com> <jfehlig@linux-ypgk.site>
<jclift@redhat.com> <justin@salasaga.org>
<berrange@redhat.com> <dan@berrange.com>
^src/libvirt\.c$
^src/qemu/qemu_driver\.c$
^src/qemu/qemu_monitor\.c$
^src/util/util\.c$
^src/xen/xend_internal\.c$
^daemon/libvirtd.c$
^gnulib/
^ChangeLog$
^ChangeLog-old$
^include/libvirt/virterror\.h$
^daemon/dispatch\.c$
^src/util/virterror\.c$
ChangeLog*
docs/news.html.in
python/libvirt-override.c
python/typewrappers.c
^gnulib/lib/getaddrinfo\.c$
^gnulib/m4/
^src/util/util\.c$
^ChangeLog-old$
ChangeLog*
docs/news.html.in
^gnulib/
^po/
^ChangeLog$
^ChangeLog-old$
^Makefile*
^docs/
^tests/
^tools/virsh\.c$
^tools/console\.c$
^build-aux/
^src/util/util\.c$
^ChangeLog-old$
^gnulib/
^ChangeLog-old$
^docs/
^examples/domain-events/events-c/event-test\.c$
^src/internal\.h$
^src/lxc/lxc_container\.c$
^src/node_device/node_device_devkit\.c$
^src/node_device/node_device_hal\.c$
^src/storage/parthelper\.c$
^examples/
^gnulib/lib/dummy\.c$
^gnulib/tests/dummy\.c$
^ChangeLog$
\.fig$
\.gif$
\.ico$
\.png$
^ChangeLog$
^NEWS$
^docs/.*
docs/apibuild.py
tests/virt-aa-helper-test
libvirt Authors
===============
The libvirt project was initiated by:
Daniel Veillard <veillard@redhat.com> or <daniel@veillard.com>
The primary maintainers and people with commit access rights:
Daniel Veillard <veillard@redhat.com>
Daniel Berrange <berrange@redhat.com>
Richard W.M. Jones <rjones@redhat.com>
Karel Zak <kzak@redhat.com>
Mark McLoughlin <markmc@redhat.com>
Anthony Liguori <aliguori@us.ibm.com>
Jim Meyering <meyering@redhat.com>
Jim Fehlig <jfehlig@novell.com>
Chris Lalancette <clalance@redhat.com>
Atsushi SAKAI <sakaia@jp.fujitsu.com>
Dave Leskovec <dlesko@linux.vnet.ibm.com>
Cole Robinson <crobinso@redhat.com>
Dan Smith <danms@us.ibm.com>
Guido Günther <agx@sigxcpu.org>
John Levon <john.levon@sun.com>
Matthias Bolte <matthias.bolte@googlemail.com>
Jiri Denemark <jdenemar@redhat.com>
Dave Allan <dallan@redhat.com>
Laine Stump <laine@redhat.com>
Stefan Berger <stefanb@us.ibm.com>
Eric Blake <eblake@redhat.com>
Patches have also been contributed by:
David Lutterkort <dlutter@redhat.com>
Andrew Puch <apuch@redhat.com>
Philippe Berthault <philippe.berthault@Bull.net>
Hugh Brock <hbrock@redhat.com>
Michel Ponceau <michel.ponceau@bull.net>
Jeremy Katz <katzj@redhat.com>
Pete Vetere <pvetere@redhat.com>
Kazuki Mizushima <mizushima.kazuk@jp.fujitsu.com>
Saori Fukuta <fukuta.saori@jp.fujitsu.com>
Tatsuro Enokura <fj7716hz@aa.jp.fujitsu.com>
Takahashi Tomohiro <takatom@jp.fujitsu.com>
Nobuhiro Itou <fj0873gn@aa.jp.fujitsu.com>
Masayuki Sunou <fj1826dm@aa.jp.fujitsu.com>
Mark Johnson <johnson.nh@gmail.com>
Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Shuveb Hussain <shuveb@binarykarma.com>
Jim Paris <jim@jtan.com>
Daniel Hokka Zakrisson <daniel@hozac.com>
Mads Chr. Olesen <shiyee@shiyee.dk>
Anton Protopopov <aspsk2@gmail.com>
Stefan de Konink <dekonink@kinkrsoftware.nl>
Kaitlin Rupert <kaitlin@linux.vnet.ibm.com>
Evgeniy Sokolov <evg@openvz.org>
David Lively <dlively@virtualiron.com>
Charles Duffy <Charles_Duffy@messageone.com>
Nguyen Anh Quynh <aquynh@gmail.com>
James Morris <jmorris@namei.org>
Chris Wright <chrisw@redhat.com>
Ben Guthro <ben.guthro@gmail.com>
Shigeki Sakamoto <fj0588di@aa.jp.fujitsu.com>
Gerd von Egidy <lists@egidy.de>
Itamar Heim <iheim@redhat.com>
Markus Armbruster <armbru@redhat.com>
Ryota Ozaki <ozaki.ryota@gmail.com>
James Morris <jmorris@namei.org>
Daniel J Walsh <dwalsh@redhat.com>
Maximilian Wilhelm <max@rfc2324.org>
Pritesh Kothari <Pritesh.Kothari@Sun.COM>
Amit Shah <amit.shah@redhat.com>
Florian Vichot <florian.vichot@diateam.net>
Takahashi Tomohiro <takatom@jp.fujitsu.com>
Serge E. Hallyn <serue@us.ibm.com>
Soren Hansen <soren@canonical.com>
Abel Míguez Rodríguez<amiguezr@pdi.ucm.es>
Doug Goldstein <cardoe@gentoo.org>
Javier Fontan <jfontan@gmail.com>
Federico Simoncelli <federico.simoncelli@gmail.com>
Amy Griffis <amy.griffis@hp.com>
Henrik Persson E <henrik.e.persson@ericsson.com>
Satoru SATOH <satoru.satoh@gmail.com>
Paolo Bonzini <pbonzini@redhat.com>
Miloslav Trmač <mitr@redhat.com>
Jamie Strandboge <jamie@canonical.com>
Gerhard Stenzel <gerhard.stenzel@de.ibm.com>
Matthew Booth <mbooth@redhat.com>
Diego Elio Pettenò <flameeyes@gmail.com>
Adam Litke <agl@us.ibm.com>
Steve Yarmie <steve.yarmie@gmail.com>
Dan Kenigsberg <danken@redhat.com>
Yuji NISHIDA <nishidy@nict.go.jp>
Dustin Xiong <x_k_123@hotmail.com>
Rolf Eike Beer <eike@sf-mail.de>
Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Philipp Hahn <hahn@univention.de>
Ed Swierk <eswierk@aristanetworks.com>
Paolo Smiraglia <paolo.smiraglia@gmail.com>
Sharadha Prabhakar <sharadha.prabhakar@citrix.com>
Chris Wong <wongc-redhat@hoku.net>
Daniel Berteaud <daniel@firewall-services.com>
Dustin Kirkland <kirkland@canonical.com>
Luiz Capitulino <lcapitulino@redhat.com>
Ryan Harper <ryanh@us.ibm.com>
Spencer Shimko <sshimko@tresys.com>
Marco Bozzolan <bozzolan@gmail.com>
Alex Williamson <alex.williamson@redhat.com>
Ersek Laszlo <lacos@caesar.elte.hu>
Kenneth Nagin <NAGIN@il.ibm.com>
Klaus Ethgen <Klaus@Ethgen.de>
Bryan Kearney <bkearney@redhat.com>
Darry L. Pierce <dpierce@redhat.com>
David Jorm <dfj@redhat.com>
Eduardo Otubo <otubo@linux.vnet.ibm.com>
Garry Dolley <gdolley@arpnetworks.com>
Harshavardhana <harsha@gluster.com>
Jonas Eriksson <jonas.j.eriksson@ericsson.com>
Jun Koi <junkoi2004@gmail.com>
Olivier Fourdan <ofourdan@redhat.com>
Ron Yorston <rmy@tigress.co.uk>
Shahar Klein <shaharklein@yahoo.com>
Taizo ITO <taizo.ito@hde.co.jp>
Thomas Treutner <thomas@scripty.at>
Jean-Baptiste Rouault <jean-baptiste.rouault@diateam.net>
Марк Коренберг <socketpair@gmail.com>
Justin Clift <jclift@redhat.com>
Alan Pevec <apevec@redhat.com>
Aurelien Rougemont <beorn@binaries.fr>
[....send patches to get your name here....]
The libvirt Logo was designed by Diana Fong
-- End
;; Local Variables:
;; coding: utf-8
;; End:
此差异已折叠。
此差异已折叠。
-*- buffer-read-only: t -*- vi: set ro:
DO NOT EDIT THIS FILE! IT IS GENERATED AUTOMATICALLY!
Libvirt contributor guidelines
==============================
General tips for contributing patches
=====================================
(1) Discuss any large changes on the mailing list first. Post patches
early and listen to feedback.
(2) Post patches in unified diff format. A command similar to this
should work:
diff -urp libvirt.orig/ libvirt.modified/ > libvirt-myfeature.patch
or:
git diff > libvirt-myfeature.patch
(3) Split large changes into a series of smaller patches, self-contained
if possible, with an explanation of each patch and an explanation of how
the sequence of patches fits together.
(4) Make sure your patches apply against libvirt GIT. Developers
only follow GIT and don't care much about released versions.
(5) Run the automated tests on your code before submitting any changes.
In particular, configure with compile warnings set to -Werror:
./configure --enable-compile-warnings=error
and run the tests:
make check
make syntax-check
make -C tests valgrind
The latter test checks for memory leaks.
If you encounter any failing tests, the VIR_TEST_DEBUG environment variable
may provide extra information to debug the failures. Larger values of
VIR_TEST_DEBUG may provide larger amounts of information:
VIR_TEST_DEBUG=1 make check (or)
VIR_TEST_DEBUG=2 make check
Also, individual tests can be run from inside the 'tests/' directory, like:
./qemuxml2xmltest
(6) Update tests and/or documentation, particularly if you are adding
a new feature or changing the output of a program.
There is more on this subject, including lots of links to background
reading on the subject, on this page:
http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/
Code indentation
================
Libvirt's C source code generally adheres to some basic code-formatting
conventions. The existing code base is not totally consistent on this
front, but we do prefer that contributed code be formatted similarly.
In short, use spaces-not-TABs for indentation, use 4 spaces for each
indentation level, and other than that, follow the K&R style.
If you use Emacs, add the following to one of one of your start-up files
(e.g., ~/.emacs), to help ensure that you get indentation right:
;;; When editing C sources in libvirt, use this style.
(defun libvirt-c-mode ()
"C mode with adjusted defaults for use with libvirt."
(interactive)
(c-set-style "K&R")
(setq indent-tabs-mode nil) ; indent using spaces, not TABs
(setq c-indent-level 4)
(setq c-basic-offset 4))
(add-hook 'c-mode-hook
'(lambda () (if (string-match "/libvirt" (buffer-file-name))
(libvirt-c-mode))))
Code formatting (especially for new code)
=========================================
With new code, we can be even more strict.
Please apply the following function (using GNU indent) to any new code.
Note that this also gives you an idea of the type of spacing we prefer
around operators and keywords:
indent-libvirt()
{
indent -bad -bap -bbb -bli4 -br -ce -brs -cs -i4 -l75 -lc75 \
-sbi4 -psl -saf -sai -saw -sbi4 -ss -sc -cdw -cli4 -npcs -nbc \
--no-tabs "$@"
}
Note that sometimes you'll have to post-process that output further, by
piping it through "expand -i", since some leading TABs can get through.
Usually they're in macro definitions or strings, and should be converted
anyhow.
Curly braces
============
Omit the curly braces around an "if", "while", "for" etc. body only when that
body occupies a single line. In every other case we require the braces. This
ensures that it is trivially easy to identify a single-*statement* loop: each
has only one *line* in its body.
Omitting braces with a single-line body is fine:
while (expr) // one-line body -> omitting curly braces is ok
single_line_stmt ();
However, the moment your loop/if/else body extends onto a second line, for
whatever reason (even if it's just an added comment), then you should add
braces. Otherwise, it would be too easy to insert a statement just before that
comment (without adding braces), thinking it is already a multi-statement
loop:
while (true) // BAD! multi-line body with no braces
/* comment... */
single_line_stmt ();
Do this instead:
while (true) { // Always put braces around a multi-line body.
/* comment... */
single_line_stmt ();
}
There is one exception: when the second body line is not at the same
indentation level as the first body line:
if (expr)
die ("a diagnostic that would make this line"
" extend past the 80-column limit"));
It is safe to omit the braces in the code above, since the further-indented
second body line makes it obvious that this is still a single-statement body.
To reiterate, don't do this:
if (expr) // BAD: no braces around...
while (expr_2) { // ... a multi-line body
...
}
Do this, instead:
if (expr) {
while (expr_2) {
...
}
}
However, there is one exception in the other direction, when even a one-line
block should have braces. That occurs when that one-line, brace-less block is
an "else" block, and the corresponding "then" block *does* use braces. In that
case, either put braces around the "else" block, or negate the "if"-condition
and swap the bodies, putting the one-line block first and making the longer,
multi-line block be the "else" block.
if (expr) {
...
...
}
else
x = y; // BAD: braceless "else" with braced "then"
This is preferred, especially when the multi-line body is more than a few
lines long, because it is easier to read and grasp the semantics of an if-
then-else block when the simpler block occurs first, rather than after the
more involved block:
if (!expr)
x = y; // putting the smaller block first is more readable
else {
...
...
}
If you'd rather not negate the condition, then at least add braces:
if (expr) {
...
...
} else {
x = y;
}
Preprocessor
============
For variadic macros, stick with C99 syntax:
#define vshPrint(_ctl, ...) fprintf(stdout, __VA_ARGS__)
Use parenthesis when checking if a macro is defined, and use
indentation to track nesting:
#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
#endif
C types
=======
Use the right type.
Scalars
-------
If you're using "int" or "long", odds are good that there's a better type.
If a variable is counting something, be sure to declare it with an
unsigned type.
If it's memory-size-related, use size_t (use ssize_t only if required).
If it's file-size related, use uintmax_t, or maybe off_t.
If it's file-offset related (i.e., signed), use off_t.
If it's just counting small numbers use "unsigned int";
(on all but oddball embedded systems, you can assume that that
type is at least four bytes wide).
If a variable has boolean semantics, give it the "bool" type
and use the corresponding "true" and "false" macros. It's ok
to include <stdbool.h>, since libvirt's use of gnulib ensures
that it exists and is usable.
In the unusual event that you require a specific width, use a
standard type like int32_t, uint32_t, uint64_t, etc.
While using "bool" is good for readability, it comes with minor caveats:
- Don't use "bool" in places where the type size must be constant across
all systems, like public interfaces and on-the-wire protocols. Note
that it would be possible (albeit wasteful) to use "bool" in libvirt's
logical wire protocol, since XDR maps that to its lower-level bool_t
type, which *is* fixed-size.
- Don't compare a bool variable against the literal, "true",
since a value with a logical non-false value need not be "1".
I.e., don't write "if (seen == true) ...". Rather, write "if (seen)...".
Of course, take all of the above with a grain of salt. If you're about
to use some system interface that requires a type like size_t, pid_t or
off_t, use matching types for any corresponding variables.
Also, if you try to use e.g., "unsigned int" as a type, and that
conflicts with the signedness of a related variable, sometimes
it's best just to use the *wrong* type, if "pulling the thread"
and fixing all related variables would be too invasive.
Finally, while using descriptive types is important, be careful not to
go overboard. If whatever you're doing causes warnings, or requires
casts, then reconsider or ask for help.
Pointers
--------
Ensure that all of your pointers are "const-correct".
Unless a pointer is used to modify the pointed-to storage,
give it the "const" attribute. That way, the reader knows
up-front that this is a read-only pointer. Perhaps more
importantly, if we're diligent about this, when you see a non-const
pointer, you're guaranteed that it is used to modify the storage
it points to, or it is aliased to another pointer that is.
Low level memory management
===========================
Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
codebase, because they encourage a number of serious coding bugs and do
not enable compile time verification of checks for NULL. Instead of these
routines, use the macros from memory.h
- eg to allocate a single object:
virDomainPtr domain;
if (VIR_ALLOC(domain) < 0) {
virReportOOMError();
return NULL;
}
- eg to allocate an array of objects
virDomainPtr domains;
int ndomains = 10;
if (VIR_ALLOC_N(domains, ndomains) < 0) {
virReportOOMError();
return NULL;
}
- eg to allocate an array of object pointers
virDomainPtr *domains;
int ndomains = 10;
if (VIR_ALLOC_N(domains, ndomains) < 0) {
virReportOOMError();
return NULL;
}
- eg to re-allocate the array of domains to be longer
ndomains = 20
if (VIR_REALLOC_N(domains, ndomains) < 0) {
virReportOOMError();
return NULL;
}
- eg to free the domain
VIR_FREE(domain);
String comparisons
==================
Do not use the strcmp, strncmp, etc functions directly. Instead use
one of the following semantically named macros
- For strict equality:
STREQ(a,b)
STRNEQ(a,b)
- For case insensitive equality:
STRCASEEQ(a,b)
STRCASENEQ(a,b)
- For strict equality of a substring:
STREQLEN(a,b,n)
STRNEQLEN(a,b,n)
- For case insensitive equality of a substring:
STRCASEEQLEN(a,b,n)
STRCASENEQLEN(a,b,n)
- For strict equality of a prefix:
STRPREFIX(a,b)
String copying
==============
Do not use the strncpy function. According to the man page, it does
*not* guarantee a NULL-terminated buffer, which makes it extremely dangerous
to use. Instead, use one of the functionally equivalent functions:
- virStrncpy(char *dest, const char *src, size_t n, size_t destbytes)
The first three arguments have the same meaning as for strncpy; namely the
destination, source, and number of bytes to copy, respectively. The last
argument is the number of bytes available in the destination string; if a
copy of the source string (including a \0) will not fit into the
destination, no bytes are copied and the routine returns NULL.
Otherwise, n bytes from the source are copied into the destination and a
trailing \0 is appended.
- virStrcpy(char *dest, const char *src, size_t destbytes)
Use this variant if you know you want to copy the entire src string
into dest. Note that this is a macro, so arguments could be
evaluated more than once. This is equivalent to
virStrncpy(dest, src, strlen(src), destbytes)
- virStrcpyStatic(char *dest, const char *src)
Use this variant if you know you want to copy the entire src string
into dest *and* you know that your destination string is a static string
(i.e. that sizeof(dest) returns something meaningful). Note that
this is a macro, so arguments could be evaluated more than once. This is
equivalent to virStrncpy(dest, src, strlen(src), sizeof(dest)).
Variable length string buffer
=============================
If there is a need for complex string concatenations, avoid using
the usual sequence of malloc/strcpy/strcat/snprintf functions and
make use of the virBuffer API described in buf.h
eg typical usage is as follows:
char *
somefunction(...) {
virBuffer buf = VIR_BUFFER_INITIALIZER;
...
virBufferAddLit(&buf, "<domain>\n");
virBufferVSprint(&buf, " <memory>%d</memory>\n", memory);
...
virBufferAddLit(&buf, "</domain>\n");
...
if (virBufferError(&buf)) {
virBufferFreeAndReset(&buf);
virReportOOMError();
return NULL;
}
return virBufferContentAndReset(&buf);
}
Include files
=============
There are now quite a large number of include files, both libvirt
internal and external, and system includes. To manage all this
complexity it's best to stick to the following general plan for all
*.c source files:
/*
* Copyright notice
* ....
* ....
* ....
*
*/
#include <config.h> Must come first in every file.
#include <stdio.h> Any system includes you need.
#include <string.h>
#include <limits.h>
#if HAVE_NUMACTL Some system includes aren't supported
# include <numa.h> everywhere so need these #if guards.
#endif
#include "internal.h" Include this first, after system includes.
#include "util.h" Any libvirt internal header files.
#include "buf.h"
static myInternalFunc () The actual code.
{
...
Of particular note: *DO NOT* include libvirt/libvirt.h or
libvirt/virterror.h. It is included by "internal.h" already and there
are some special reasons why you cannot include these files
explicitly.
Printf-style functions
======================
Whenever you add a new printf-style function, i.e., one with a format
string argument and following "..." in its prototype, be sure to use
gcc's printf attribute directive in the prototype. For example, here's
the one for virAsprintf, in util.h:
int virAsprintf(char **strp, const char *fmt, ...)
ATTRIBUTE_FMT_PRINTF(2, 3);
This makes it so gcc's -Wformat and -Wformat-security options can do
their jobs and cross-check format strings with the number and types
of arguments.
Libvirt committer guidelines
============================
The AUTHORS files indicates the list of people with commit access right
who can actually merge the patches.
The general rule for committing a patch is to make sure it has been reviewed
properly in the mailing-list first, usually if a couple of people gave an
ACK or +1 to a patch and nobody raised an objection on the list it should
be good to go. If the patch touches a part of the code where you're not the
main maintainer or not have a very clear idea of how things work, it's better
to wait for a more authoritative feedback though. Before committing please
also rebuild locally and run 'make check syntax-check' and make sure they
don't raise error. Try to look for warnings too for example configure with
--enable-compile-warnings=error
which adds -Werror to compile flags, so no warnings get missed
Exceptions to that 'review and approval on the list first' is fixing failures
to build:
- if a recently committed patch breaks compilation on a platform
or for a given driver then it's fine to commit a minimal fix
directly without getting the review feedback first
- similarly, if make check or make syntax-check breaks, if there is
an obvious fix, it's fine to commit immediately
The patch should still be sent to the list (or tell what the fix was if
trivial) and 'make check syntax-check' should pass too before committing
anything
Similar fixes for documentation and code comments can be managed
in the same way, but still make sure they get reviewed if non-trivial.
## Process this file with automake to produce Makefile.in
LCOV = lcov
GENHTML = genhtml
SUBDIRS = gnulib/lib include src daemon tools proxy docs gnulib/tests \
python tests po examples/domain-events/events-c examples/hellolibvirt \
examples/dominfo examples/domsuspend examples/python examples/apparmor \
examples/xml/nwfilter examples/openauth
ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4
XML_EXAMPLES = \
$(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/examples/xml/, \
test/*.xml storage/*.xml)))
EXTRA_DIST = \
ChangeLog-old \
libvirt.spec libvirt.spec.in \
mingw32-libvirt.spec.in \
libvirt.pc libvirt.pc.in \
autobuild.sh \
.x-sc_avoid_ctype_macros \
.x-sc_avoid_if_before_free \
.x-sc_avoid_write \
.x-sc_m4_quote_check \
.x-sc_prohibit_asprintf \
.x-sc_prohibit_gethostby \
.x-sc_prohibit_gethostname \
.x-sc_prohibit_gettext_noop \
.x-sc_prohibit_have_config_h \
.x-sc_prohibit_HAVE_MBRTOWC \
.x-sc_prohibit_nonreentrant \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_strcmp_and_strncmp \
.x-sc_prohibit_strncpy \
.x-sc_prohibit_test_minus_ao \
.x-sc_prohibit_VIR_ERR_NO_MEMORY \
.x-sc_require_config_h \
.x-sc_require_config_h_first \
.x-sc_trailing_blank \
Makefile.nonreentrant \
autogen.sh \
examples/domain-events/events-python \
$(XML_EXAMPLES)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvirt.pc
NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in
-@(if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet $(top_srcdir)/docs/news.xsl \
$(top_srcdir)/docs/news.html.in \
| perl -0777 -pe 's/\n\n+$$/\n/' \
| perl -pe 's/[ \t]+$$//' \
> $@-t && mv $@-t $@ ; fi );
rpm: clean
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
check-local: all tests
tests:
@(cd docs/examples ; $(MAKE) MAKEFLAGS+=--silent tests)
@(if [ "$(pythondir)" != "" ] ; then cd python ; \
$(MAKE) MAKEFLAGS+=--silent tests ; fi)
cov: clean-cov
mkdir $(top_builddir)/coverage
$(LCOV) -c -o $(top_builddir)/coverage/libvirt.info.tmp \
-d $(top_builddir)/src -d $(top_builddir)/daemon \
-d $(top_builddir)/tests
$(LCOV) -r $(top_builddir)/coverage/libvirt.info.tmp \
-o $(top_builddir)/coverage/libvirt.info
rm $(top_builddir)/coverage/libvirt.info.tmp
$(GENHTML) --show-details -t "libvirt" -o $(top_builddir)/coverage \
--legend $(top_builddir)/coverage/libvirt.info
clean-cov:
rm -rf $(top_builddir)/coverage
MAINTAINERCLEANFILES = .git-module-status
# disable this check
distuninstallcheck:
dist-hook: gen-ChangeLog
# Generate the ChangeLog file (with all entries since the switch to git)
# and insert it into the directory we're about to use to create a tarball.
gen_start_date = 2009-07-04
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
#
# Generated by running the following on Fedora 9:
#
# nm -D --defined-only /lib/libc.so.6 \
# | grep '_r$' \
# | awk '{print $3}' \
# | grep -v __ \
# | grep -v qsort \ # Red herring since we don't need to pass extra args to qsort comparator
# | grep -v readdir \ # This is safe as long as each DIR * instance is only used by one thread
# | sort \
# | uniq \
# | sed -e 's/_r//'
#
NON_REENTRANT =
NON_REENTRANT += asctime
NON_REENTRANT += ctime
NON_REENTRANT += drand48
NON_REENTRANT += ecvt
NON_REENTRANT += erand48
NON_REENTRANT += ether_aton
NON_REENTRANT += ether_ntoa
NON_REENTRANT += fcvt
NON_REENTRANT += fgetgrent
NON_REENTRANT += fgetpwent
NON_REENTRANT += fgetspent
NON_REENTRANT += getaliasbyname
NON_REENTRANT += getaliasent
NON_REENTRANT += getdate
NON_REENTRANT += getgrent
NON_REENTRANT += getgrgid
NON_REENTRANT += getgrnam
NON_REENTRANT += gethostbyaddr
NON_REENTRANT += gethostbyname2
NON_REENTRANT += gethostbyname
NON_REENTRANT += gethostent
NON_REENTRANT += getlogin
NON_REENTRANT += getmntent
NON_REENTRANT += getnetbyaddr
NON_REENTRANT += getnetbyname
NON_REENTRANT += getnetent
NON_REENTRANT += getnetgrent
NON_REENTRANT += getprotobyname
NON_REENTRANT += getprotobynumber
NON_REENTRANT += getprotoent
NON_REENTRANT += getpwent
NON_REENTRANT += getpwnam
NON_REENTRANT += getpwuid
NON_REENTRANT += getrpcbyname
NON_REENTRANT += getrpcbynumber
NON_REENTRANT += getrpcent
NON_REENTRANT += getservbyname
NON_REENTRANT += getservbyport
NON_REENTRANT += getservent
NON_REENTRANT += getspent
NON_REENTRANT += getspnam
NON_REENTRANT += getutent
NON_REENTRANT += getutid
NON_REENTRANT += getutline
NON_REENTRANT += gmtime
NON_REENTRANT += hcreate
NON_REENTRANT += hdestroy
NON_REENTRANT += hsearch
NON_REENTRANT += initstate
NON_REENTRANT += jrand48
NON_REENTRANT += lcong48
NON_REENTRANT += localtime
NON_REENTRANT += lrand48
NON_REENTRANT += mrand48
NON_REENTRANT += nrand48
NON_REENTRANT += ptsname
NON_REENTRANT += qecvt
NON_REENTRANT += qfcvt
NON_REENTRANT += random
NON_REENTRANT += rand
NON_REENTRANT += seed48
NON_REENTRANT += setstate
NON_REENTRANT += sgetspent
NON_REENTRANT += srand48
NON_REENTRANT += srandom
NON_REENTRANT += strerror
NON_REENTRANT += strtok
NON_REENTRANT += tmpnam
NON_REENTRANT += ttyname
LibVirt : simple API for virtualization
Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). It is free software
available under the GNU Lesser General Public License. Virtualization of
the Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the basic
resources are driven by a Linux instance. The library aim at providing
long term stable C API initially for the Xen paravirtualization but
should be able to integrate other virtualization mechanisms if needed.
Daniel Veillard <veillard@redhat.com>
This branch is no longer maintained upstream.
-*- outline -*-
These notes intend to help people working on the checked-out sources.
These requirements do not apply when building from a distribution tarball.
See also HACKING for more detailed libvirt contribution guidelines.
* Requirements
We've opted to keep only the highest-level sources in the GIT repository.
This eases our maintenance burden, (fewer merges etc.), but imposes more
requirements on anyone wishing to build from the just-checked-out sources.
Note the requirements to build the released archive are much less and
are just the requirements of the standard ./configure && make procedure.
Specific development tools and versions will be checked for and listed by
the bootstrap script.
Valgrind <http://valgrind.org/> is also highly recommended, if
Valgrind supports your architecture. See also README-valgrind.
While building from a just-cloned source tree may require installing a
few prerequisites, later, a plain `git pull && make' should be sufficient.
* First GIT checkout
You can get a copy of the source repository like this:
$ git clone git://libvirt.org/libvirt
$ cd libvirt
As an optional step, if you already have a copy of the gnulib git
repository on your hard drive, then you can use it as a reference to
reduce download time and disk space requirements:
$ export GNULIB_SRCDIR=/path/to/gnulib
The next step is to get all required pieces from gnulib,
to run autoreconf, and to invoke ./configure:
$ ./autogen.sh
And there you are! Just
$ make
$ make check
At this point, there should be no difference between your local copy,
and the GIT master copy:
$ git diff
should output no difference.
Enjoy!
Local Variables:
indent-tabs-mode: nil
End:
TODO:
- libvirt_virDomainSetMemory should check memory is > 0
- check how to better handle renaming of domains (xm rename and cache)
- UUID lookup in hash.c
Other environment:
- support for UML
+ UML control layer should be easy at least for one user but incomplete
Probable TODOs:
- event on big domain state change (create, crashed, paused, shutdown, destroy)
- bindings for more languages
Would-be-nice TODO:
- man page for virsh and the libraries entry points
- more documentation and examples on using the toolkit
- examples for the error handling code
Cleanup:
- now that libxml2 is linked in, drop hash.[ch] and get back to libxml2 ones ?
same for the buffers
Autoconf:
- On Debian and other platforms, C++ compiler is required because
autoconf macros to detect libtool depend on it. (This is probably
an autoconf or libtool m4 macro bug, and the fact that it happens
on Debian is a red herring).
dnl
dnl Taken from gnome-common/macros2/gnome-compiler-flags.m4
dnl
dnl We've added:
dnl -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls
dnl We've removed
dnl CFLAGS="$realsave_CFLAGS"
dnl to avoid clobbering user-specified CFLAGS
dnl
AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dnl ******************************
dnl More compiler warnings
dnl ******************************
AC_ARG_ENABLE(compile-warnings,
[AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
[Turn on compiler warnings])],,
[enable_compile_warnings="m4_default([$1],[maximum])"])
warnCFLAGS=
common_flags=
common_flags="$common_flags -Wp,-D_FORTIFY_SOURCE=2"
common_flags="$common_flags -fexceptions"
common_flags="$common_flags -fasynchronous-unwind-tables"
common_flags="$common_flags -fdiagnostics-show-option"
case "$enable_compile_warnings" in
no)
try_compiler_flags=""
;;
minimum)
try_compiler_flags="-Wall -Wformat -Wformat-security $common_flags"
;;
yes)
try_compiler_flags="-Wall -Wformat -Wformat-security -Wmissing-prototypes $common_flags"
;;
maximum|error)
try_compiler_flags="-Wall -Wformat -Wformat-security"
try_compiler_flags="$try_compiler_flags -Wmissing-prototypes"
try_compiler_flags="$try_compiler_flags -Wnested-externs "
try_compiler_flags="$try_compiler_flags -Wpointer-arith"
try_compiler_flags="$try_compiler_flags -Wextra -Wshadow"
try_compiler_flags="$try_compiler_flags -Wcast-align"
try_compiler_flags="$try_compiler_flags -Wwrite-strings"
try_compiler_flags="$try_compiler_flags -Waggregate-return"
try_compiler_flags="$try_compiler_flags -Wstrict-prototypes"
try_compiler_flags="$try_compiler_flags -Winline"
try_compiler_flags="$try_compiler_flags -Wredundant-decls"
try_compiler_flags="$try_compiler_flags -Wno-sign-compare"
try_compiler_flags="$try_compiler_flags -Wlogical-op"
try_compiler_flags="$try_compiler_flags $common_flags"
if test "$enable_compile_warnings" = "error" ; then
try_compiler_flags="$try_compiler_flags -Werror"
fi
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
;;
esac
COMPILER_FLAGS=
for option in $try_compiler_flags; do
gl_COMPILER_FLAGS($option)
done
unset option
unset try_compiler_flags
AC_ARG_ENABLE(iso-c,
AC_HELP_STRING([--enable-iso-c],
[Try to warn if code is not ISO C ]),,
[enable_iso_c=no])
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
complCFLAGS=
if test "x$enable_iso_c" != "xno"; then
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -pedantic" ;;
esac
fi
fi
AC_MSG_RESULT($complCFLAGS)
WARN_CFLAGS="$COMPILER_FLAGS $complCFLAGS"
WARN_LDFLAGS=$WARN_CFLAGS
AC_SUBST([WARN_CFLAGS])
AC_SUBST([WARN_LDFLAGS])
dnl Needed to keep compile quiet on python 2.4
COMPILER_FLAGS=
gl_COMPILER_FLAGS(-Wno-redundant-decls)
WARN_PYTHON_CFLAGS=$COMPILER_FLAGS
AC_SUBST(WARN_PYTHON_CFLAGS)
])
dnl
dnl To support the old pkg-config from RHEL4 vintage, we need
dnl to define the PKG_PROG_PKG_CONFIG macro if its not already
dnl present
m4_ifndef([PKG_PROG_PKG_CONFIG],
[AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])])
#!/bin/sh
set -e
set -v
# Make things clean.
test -n "$1" && RESULTS=$1 || RESULTS=results.log
: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
test -f Makefile && make -k distclean || :
rm -rf coverage
#rm -rf build
#mkdir build
#cd build
./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
--enable-test-coverage \
--enable-compile-warnings=error \
--with-xen-proxy
# If the MAKEFLAGS envvar does not yet include a -j option,
# add -jN where N depends on the number of processors.
case $MAKEFLAGS in
*-j*) ;;
*) n=$(getconf _NPROCESSORS_ONLN 2> /dev/null)
test "$n" -gt 0 || n=1
n=$(expr $n + 1)
MAKEFLAGS="$MAKEFLAGS -j$n"
export MAKEFLAGS
;;
esac
make
make install
# set -o pipefail is a bashism; this use of exec is the POSIX alternative
exec 3>&1
st=$(
exec 4>&1 >&3
{ make check syntax-check 2>&1; echo $? >&4; } | tee "$RESULTS"
)
exec 3>&-
test $st = 0
test -x /usr/bin/lcov && make cov
rm -f *.tar.gz
make dist
if [ -n "$AUTOBUILD_COUNTER" ]; then
EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
else
NOW=`date +"%s"`
EXTRA_RELEASE=".$USER$NOW"
fi
if [ -f /usr/bin/rpmbuild ]; then
rpmbuild --nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean libvirt.spec
fi
if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
make distclean
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig" \
CC="i686-pc-mingw32-gcc" \
./configure \
--build=$(uname -m)-pc-linux \
--host=i686-pc-mingw32 \
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \
--enable-compile-warnings=error \
--without-sasl \
--without-avahi \
--without-polkit \
--without-python \
--without-xen \
--without-qemu \
--without-lxc \
--without-uml \
--without-vbox \
--without-openvz \
--without-one \
--without-phyp \
--without-netcf \
--without-libvirtd
make
make install
#set -o pipefail
#make check 2>&1 | tee "$RESULTS"
if [ -f /usr/bin/rpmbuild ]; then
rpmbuild --nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean mingw32-libvirt.spec
fi
fi
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
THEDIR=`pwd`
cd "$srcdir"
DIE=0
(autopoint --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autopoint installed to compile libvirt."
echo "Download the appropriate package for your distribution,"
echo "or see http://www.gnu.org/software/gettext"
DIE=1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile libvirt."
echo "Download the appropriate package for your distribution,"
echo "or see http://www.gnu.org/software/autoconf"
DIE=1
}
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile libvirt."
echo "Download the appropriate package for your distribution,"
echo "or see http://www.gnu.org/software/libtool"
DIE=1
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
DIE=1
echo "You must have automake installed to compile libvirt."
echo "Download the appropriate package for your distribution,"
echo "or see http://www.gnu.org/software/automake"
}
if test "$DIE" -eq 1; then
exit 1
fi
test -f src/libvirt.c || {
echo "You must run this script in the top-level libvirt directory"
exit 1
}
EXTRA_ARGS=
if test "x$1" = "x--system"; then
shift
EXTRA_ARGS="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
echo "Running ./configure with $EXTRA_ARGS $@"
else
if test -z "$*" && test ! -f "$THEDIR/config.status"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
fi
# Compute the hash we'll use to determine whether rerunning bootstrap
# is required. The first is just the SHA1 that selects a gnulib snapshot.
# The second ensures that whenever we change the set of gnulib modules used
# by this package, we rerun bootstrap to pull in the matching set of files.
bootstrap_hash()
{
git submodule status | sed 's/^[ +-]//;s/ .*//'
git hash-object bootstrap.conf
}
# Ensure that whenever we pull in a gnulib update or otherwise change to a
# different version (i.e., when switching branches), we also rerun ./bootstrap.
curr_status=.git-module-status
t=$(bootstrap_hash; git diff .gnulib)
if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
: # good, it's up to date, all we need is autoreconf
autoreconf -if
else
echo running bootstrap...
./bootstrap && bootstrap_hash > $curr_status \
|| { echo "Failed to bootstrap gnulib, please investigate."; exit 1; }
fi
cd "$THEDIR"
if test "x$OBJ_DIR" != x; then
mkdir -p "$OBJ_DIR"
cd "$OBJ_DIR"
fi
if test -z "$*" && test -f config.status; then
./config.status --recheck
else
$srcdir/configure $EXTRA_ARGS "$@"
fi && {
echo
echo "Now type 'make' to compile libvirt."
}
此差异已折叠。
# Bootstrap configuration.
# Copyright (C) 2010 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 program 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 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# gnulib modules used by this package.
gnulib_modules='
areadlink
base64
c-ctype
canonicalize-lgpl
close
connect
count-one-bits
dirname-lgpl
fcntl-h
getaddrinfo
gethostname
getpass
gettext-h
gettimeofday
gitlog-to-changelog
gnumakefile
ignore-value
inet_pton
ioctl
maintainer-makefile
mkstemp
mktempd
netdb
perror
physmem
poll
posix-shell
pthread
recv
random_r
sched
send
setsockopt
socket
stpcpy
strchrnul
strndup
strerror
strptime
strsep
strtok_r
sys_stat
sys_wait
time_r
timegm
uname
useless-if-before-free
usleep
vasprintf
verify
vc-list-files
'
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--flag=virAsprintf:2:c-format\\\
--from-code=UTF-8\\\
'
# This is not a GNU package, so the default bug address is invalid,
# and the translation project is not in use.
MSGID_BUGS_ADDRESS=libvir-list@redhat.com
COPYRIGHT_HOLDER='Red Hat, Inc.'
SKIP_PO=true
# Enable copy-mode for MSYS/MinGW. MSYS' ln doesn't work well in the way
# bootstrap uses it with relative paths.
if test -n "$MSYSTEM"; then
copy=true
fi
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
# appears in configure.ac, exclude some unnecessary files.
# Without grep's -E option (not portable enough, pre-configure),
# the following test is ugly. Also, this depends on the existence
# of configure.ac, not the obsolescent-named configure.in. But if
# you're using this infrastructure, you should care about such things.
gettext_external=0
grep '^[ ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
gettext_external=1
grep '^[ ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
gettext_external=1
if test $gettext_external = 1; then
# Gettext supplies these files, but we don't need them since
# we don't have an intl subdirectory.
excluded_files='
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
'
fi
# Tell gnulib to:
# require LGPLv2+
# put *.m4 files in new gnulib/m4/ dir
# put *.[ch] files in new gnulib/lib/ dir.
# import gnulib tests in new gnulib/tests/ dir.
gnulib_name=libgnu
m4_base=gnulib/m4
source_base=gnulib/lib
tests_base=gnulib/tests
gnulib_mk=Makefile.am
gnulib_tool_option_extras="\
--lgpl=2\
--with-tests\
"
# Convince bootstrap to use multiple m4 directories.
: ${ACLOCAL=aclocal}
ACLOCAL="$ACLOCAL -I gnulib/m4"
export ACLOCAL
# Build prerequisites
buildreq="\
autoconf 2.59
automake 1.9.6
autopoint -
gettext -
git 1.5.5
gzip -
libtool -
perl 5.5
tar -
"
# Automake requires that ChangeLog exist.
touch ChangeLog || exit 1
bootstrap_epilogue()
{
# Change paths in gnulib/tests/Makefile.am from "../../.." to "../..".
m=gnulib/tests/Makefile.am
sed 's,\.\./\.\./\.\.,../..,g' $m > $m-t
mv -f $m-t $m
}
*
/arg-nonnull.h
/gitlog-to-changelog
/link-warning.h
/mktempd
/useless-if-before-free
/vc-list-files
arg-nonnull.h
c++defs.h
config.rpath
gitlog-to-changelog
mkinstalldirs
mktempd
useless-if-before-free
vc-list-files
warn-on-use.h
# Customize Makefile.maint. -*- makefile -*-
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for major releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-major = ftp.gnu.org
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/coreutils
# We use .gnulib, not gnulib.
gnulib_dir = $(srcdir)/.gnulib
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
changelog-check \
check-AUTHORS \
makefile-check \
makefile_path_separator_check \
patch-check \
sc_GPL_version \
sc_always_defined_macros \
sc_cast_of_alloca_return_value \
sc_cross_check_PATH_usage_in_tests \
sc_dd_max_sym_length \
sc_error_exit_success \
sc_file_system \
sc_immutable_NEWS \
sc_makefile_path_separator_check \
sc_obsolete_symbols \
sc_prohibit_S_IS_definition \
sc_prohibit_atoi_atof \
sc_prohibit_hash_without_use \
sc_prohibit_jm_in_m4 \
sc_prohibit_quote_without_use \
sc_prohibit_quotearg_without_use \
sc_prohibit_stat_st_blocks \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
sc_system_h_headers \
sc_texinfo_acronym \
sc_tight_scope \
sc_two_space_separator_in_usage \
sc_error_message_uppercase \
sc_program_name \
sc_require_test_exit_idiom \
sc_makefile_check \
sc_useless_cpp_parens
useless_free_options = \
--name=VIR_FREE \
--name=sexpr_free \
--name=virBitmapFree \
--name=virCPUDefFree \
--name=virCapabilitiesFree \
--name=virCapabilitiesFreeGuest \
--name=virCapabilitiesFreeGuestDomain \
--name=virCapabilitiesFreeGuestFeature \
--name=virCapabilitiesFreeGuestMachine \
--name=virCapabilitiesFreeHostNUMACell \
--name=virCapabilitiesFreeMachines \
--name=virCgroupFree \
--name=virConfFreeList \
--name=virConfFreeValue \
--name=virDomainChrDefFree \
--name=virDomainControllerDefFree \
--name=virDomainDefFree \
--name=virDomainDeviceDefFree \
--name=virDomainDiskDefFree \
--name=virDomainEventCallbackListFree \
--name=virDomainEventFree \
--name=virDomainEventQueueFree \
--name=virDomainFSDefFree \
--name=virDomainGraphicsDefFree \
--name=virDomainHostdevDefFree \
--name=virDomainInputDefFree \
--name=virDomainNetDefFree \
--name=virDomainObjFree \
--name=virDomainSnapshotDefFree \
--name=virDomainSnapshotObjFree \
--name=virDomainSoundDefFree \
--name=virDomainVideoDefFree \
--name=virDomainWatchdogDefFree \
--name=virInterfaceDefFree \
--name=virInterfaceIpDefFree \
--name=virInterfaceObjFree \
--name=virInterfaceProtocolDefFree \
--name=virJSONValueFree \
--name=virLastErrFreeData \
--name=virNWFilterDefFree \
--name=virNWFilterEntryFree \
--name=virNWFilterHashTableFree \
--name=virNWFilterIPAddrLearnReqFree \
--name=virNWFilterIncludeDefFree \
--name=virNWFilterPoolObjFree \
--name=virNWFilterRuleDefFree \
--name=virNWFilterRuleInstFree \
--name=virNetworkDefFree \
--name=virNetworkObjFree \
--name=virNodeDeviceDefFree \
--name=virNodeDeviceObjFree \
--name=virSecretDefFree \
--name=virStorageEncryptionFree \
--name=virStorageEncryptionSecretFree \
--name=virStoragePoolDefFree \
--name=virStoragePoolObjFree \
--name=virStoragePoolSourceFree \
--name=virStorageVolDefFree \
--name=xmlFree \
--name=xmlXPathFreeContext \
--name=xmlXPathFreeObject
# The following template was generated by this command:
# make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
# N virBufferFreeAndReset
# y virCPUDefFree
# y virCapabilitiesFree
# y virCapabilitiesFreeGuest
# y virCapabilitiesFreeGuestDomain
# y virCapabilitiesFreeGuestFeature
# y virCapabilitiesFreeGuestMachine
# y virCapabilitiesFreeHostNUMACell
# y virCapabilitiesFreeMachines
# N virCapabilitiesFreeNUMAInfo FIXME
# y virCgroupFree
# N virConfFree (diagnoses the "error")
# y virConfFreeList
# y virConfFreeValue
# y virDomainChrDefFree
# y virDomainControllerDefFree
# y virDomainDefFree
# y virDomainDeviceDefFree
# y virDomainDiskDefFree
# y virDomainEventCallbackListFree
# y virDomainEventFree
# y virDomainEventQueueFree
# y virDomainFSDefFree
# n virDomainFree
# n virDomainFreeName (can't fix -- returns int)
# y virDomainGraphicsDefFree
# y virDomainHostdevDefFree
# y virDomainInputDefFree
# y virDomainNetDefFree
# y virDomainObjFree
# y virDomainSnapshotDefFree
# n virDomainSnapshotFree (returns int)
# n virDomainSnapshotFreeName (returns int)
# y virDomainSnapshotObjFree
# y virDomainSoundDefFree
# y virDomainVideoDefFree
# y virDomainWatchdogDefFree
# n virDrvNodeGetCellsFreeMemory (returns int)
# n virDrvNodeGetFreeMemory (returns long long)
# n virFree (dereferences param)
# n virFreeError
# n virHashFree (takes 2 args)
# y virInterfaceDefFree
# n virInterfaceFree (returns int)
# n virInterfaceFreeName
# y virInterfaceIpDefFree
# y virInterfaceObjFree
# n virInterfaceObjListFree
# y virInterfaceProtocolDefFree
# y virJSONValueFree
# y virLastErrFreeData
# y virNWFilterDefFree
# y virNWFilterEntryFree
# n virNWFilterFree (returns int)
# y virNWFilterHashTableFree
# y virNWFilterIPAddrLearnReqFree
# y virNWFilterIncludeDefFree
# n virNWFilterPoolFreeName (returns int)
# y virNWFilterPoolObjFree
# n virNWFilterPoolObjListFree FIXME
# y virNWFilterRuleDefFree
# n virNWFilterRuleFreeInstanceData (typedef)
# y virNWFilterRuleInstFree
# y virNetworkDefFree
# n virNetworkFree (returns int)
# n virNetworkFreeName (returns int)
# y virNetworkObjFree
# n virNetworkObjListFree FIXME
# n virNodeDevCapsDefFree FIXME
# y virNodeDeviceDefFree
# n virNodeDeviceFree (returns int)
# y virNodeDeviceObjFree
# n virNodeDeviceObjListFree FIXME
# n virNodeGetCellsFreeMemory (returns int)
# n virNodeGetFreeMemory (returns non-void)
# y virSecretDefFree
# n virSecretFree (returns non-void)
# n virSecretFreeName (2 args)
# n virSecurityLabelDefFree FIXME
# n virStorageBackendDiskMakeFreeExtent (returns non-void)
# y virStorageEncryptionFree
# y virStorageEncryptionSecretFree
# n virStorageFreeType (enum)
# y virStoragePoolDefFree
# n virStoragePoolFree (returns non-void)
# n virStoragePoolFreeName (returns non-void)
# y virStoragePoolObjFree
# n virStoragePoolObjListFree FIXME
# y virStoragePoolSourceFree
# y virStorageVolDefFree
# n virStorageVolFree (returns non-void)
# n virStorageVolFreeName (returns non-void)
# n virStreamFree
# Avoid uses of write(2). Either switch to streams (fwrite), or use
# the safewrite wrapper.
sc_avoid_write:
@prohibit='\<write *\(' \
in_vc_files='\.c$$' \
halt='consider using safewrite instead of write' \
$(_sc_search_regexp)
# Use STREQ rather than comparing strcmp == 0, or != 0.
# Similarly, use STREQLEN or STRPREFIX rather than strncmp.
sc_prohibit_strcmp_and_strncmp:
@prohibit='strn?cmp *\(' \
halt='use STREQ() in place of the above uses of str[n]cmp' \
$(_sc_search_regexp)
# Use virAsprintf rather than a'sprintf since *strp is undefined on error.
sc_prohibit_asprintf:
@prohibit='\<[a]sprintf\>' \
halt='use virAsprintf, not a'sprintf \
$(_sc_search_regexp)
sc_prohibit_strncpy:
@prohibit='strncpy *\(' \
halt='use virStrncpy, not strncpy' \
$(_sc_search_regexp)
sc_prohibit_readlink:
@prohibit='readlink *\(' \
halt='use virFileResolveLink, not readlink' \
$(_sc_search_regexp)
sc_prohibit_gethostname:
@prohibit='gethostname *\(' \
halt='use virGetHostname, not gethostname' \
$(_sc_search_regexp)
sc_prohibit_gettext_noop:
@prohibit='gettext_noop *\(' \
halt='use N_, not gettext_noop' \
$(_sc_search_regexp)
sc_prohibit_VIR_ERR_NO_MEMORY:
@prohibit='\<V''IR_ERR_NO_MEMORY\>' \
halt='use virReportOOMError, not V'IR_ERR_NO_MEMORY \
$(_sc_search_regexp)
# Use a subshell for each function, to give the optimal warning message.
include $(srcdir)/Makefile.nonreentrant
sc_prohibit_nonreentrant:
@fail=0 ; \
for i in $(NON_REENTRANT) ; \
do \
(prohibit="\\<$$i *\\(" \
halt="use $${i}_r, not $$i" \
$(_sc_search_regexp) \
) || fail=1; \
done ; \
exit $$fail
# Prohibit the inclusion of <ctype.h>.
sc_prohibit_ctype_h:
@prohibit='^# *include *<ctype\.h>' \
halt="don't use ctype.h; instead, use c-ctype.h" \
$(_sc_search_regexp)
# Ensure that no C source file or rng schema uses TABs for
# indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
# files in gnulib, since they're imported.
sc_TAB_in_indentation:
@prohibit='^ * ' \
in_vc_files='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \
halt='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \
$(_sc_search_regexp)
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
sc_avoid_ctype_macros:
@prohibit='\b($(ctype_re)) *\(' \
halt="don't use ctype macros (use c-ctype.h)" \
$(_sc_search_regexp)
sc_prohibit_virBufferAdd_with_string_literal:
@prohibit='\<virBufferAdd *\([^,]+, *"[^"]' \
halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
$(_sc_search_regexp)
# Not only do they fail to deal well with ipv6, but the gethostby*
# functions are also not thread-safe.
sc_prohibit_gethostby:
@prohibit='\<gethostby(addr|name2?) *\(' \
halt='use getaddrinfo, not gethostby*' \
$(_sc_search_regexp)
# Many of the function names below came from this filter:
# git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
# |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
msg_gen_function =
msg_gen_function += ESX_ERROR
msg_gen_function += ESX_VI_ERROR
msg_gen_function += macvtapError
msg_gen_function += remoteError
msg_gen_function += lxcError
msg_gen_function += networkLog
msg_gen_function += networkReportError
msg_gen_function += oneError
msg_gen_function += openvzError
msg_gen_function += qemudDispatchClientFailure
msg_gen_function += qemudReportError
msg_gen_function += regerror
msg_gen_function += remoteDispatchFormatError
msg_gen_function += umlReportError
msg_gen_function += vboxError
msg_gen_function += virConfError
msg_gen_function += virDomainReportError
msg_gen_function += virSecurityReportError
msg_gen_function += virHashError
msg_gen_function += virLibConnError
msg_gen_function += virLibDomainError
msg_gen_function += virNetworkReportError
msg_gen_function += virNodeDeviceReportError
msg_gen_function += virProxyError
msg_gen_function += virRaiseError
msg_gen_function += virReportErrorHelper
msg_gen_function += virReportSystemError
msg_gen_function += virSexprError
msg_gen_function += virStorageReportError
msg_gen_function += virXMLError
msg_gen_function += virXenInotifyError
msg_gen_function += virXenStoreError
msg_gen_function += virXendError
msg_gen_function += xenapiSessionErrorHandler
msg_gen_function += xenUnifiedError
msg_gen_function += xenXMError
msg_gen_function += VIR_ERROR
msg_gen_function += VIR_ERROR0
# Uncomment the following and run "make syntax-check" to see diagnostics
# that are not yet marked for translation, but that need to be rewritten
# so that they are translatable.
# msg_gen_function += fprintf
# msg_gen_function += testError
# msg_gen_function += virXenError
# msg_gen_function += vshPrint
# msg_gen_function += vshError
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
func_re := ($(func_or))
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
# The sed filters eliminate false-positives like these:
# _("...: "
# "%s", _("no storage vol w..."
sc_libvirt_unmarked_diagnostics:
@grep -nE \
'\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
| sed 's/_("[^"][^"]*"//;s/[ ]"%s"//' \
| grep '[ ]"' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Like the above, but prohibit a newline at the end of a diagnostic.
# This is subject to false positives partly because it naively looks for
# `\n"', which may not be the end of the string, and also because it takes
# two lines of context (the -A2) after the line with the function name.
# FIXME: this rule might benefit from a separate function list, in case
# there are functions to which this one applies but that do not get marked
# diagnostics.
sc_prohibit_newline_at_end_of_diagnostic:
@grep -A2 -nE \
'\<$(func_re) *\(' $$($(VC_LIST_EXCEPT)) \
| grep '\\n"' \
&& { echo '$(ME): newline at end of message(s)' 1>&2; \
exit 1; } || :
# Disallow trailing blank lines.
sc_prohibit_trailing_blank_lines:
@$(VC_LIST_EXCEPT) | xargs perl -ln -0777 -e \
'/\n\n+$$/ and print $$ARGV' > $@-t
@found=0; test -s $@-t && { found=1; cat $@-t 1>&2; \
echo '$(ME): found trailing blank line(s)' 1>&2; }; \
rm -f $@-t; \
test $$found = 0
# Regex for grep -E that exempts generated files from style rules.
preprocessor_exempt = ((qemu|remote)_(driver|protocol)\.h)$$
# Enforce recommended preprocessor indentation style.
sc_preprocessor_indentation:
@if cppi --version >/dev/null 2>&1; then \
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' \
| grep -vE '$(preprocessor_exempt)' | xargs cppi -a -c \
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
exit 1; }; \
else \
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
fi
sc_copyright_format:
@require='Copyright .*Red 'Hat', Inc\.' \
containing='Copyright .*Red 'Hat \
halt='Red Hat copyright is missing Inc.' \
$(_sc_search_regexp)
@prohibit='Copyright [^(].*Red 'Hat \
halt='consistently use (C) in Red Hat copyright' \
$(_sc_search_regexp)
# Some functions/macros produce messages intended solely for developers
# and maintainers. Do not mark them for translation.
sc_prohibit_gettext_markup:
@prohibit='\<VIR_(WARN|DEBUG)0? *\(_\(' \
halt='do not mark these strings for translation' \
$(_sc_search_regexp)
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
ifeq (0,$(MAKELEVEL))
_curr_status = .git-module-status
# The sed filter accommodates those who check out on a commit from which
# no tag is reachable. In that case, git submodule status prints a "-"
# in column 1 and does not print a "git describe"-style string after the
# submodule name. Contrast these:
# -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
# b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
# $ cat .git-module-status
# b653eda3ac4864de205419d9f41eec267cb89eeb
_submodule_hash = sed 's/^[ +-]//;s/ .*//'
_update_required := $(shell \
cd '$(srcdir)'; \
actual=$$(git submodule status | $(_submodule_hash); \
git hash-object bootstrap.conf; \
git diff .gnulib); \
stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \
test "$$stamp" = "$$actual"; echo $$?)
_clean_requested = $(filter %clean,$(MAKECMDGOALS))
ifeq (1,$(_update_required)$(_clean_requested))
$(info INFO: gnulib update required; running ./autogen.sh first)
Makefile: _autogen
endif
endif
# Give credit where due:
# Ensure that each commit author email address (possibly mapped via
# git log's .mailmap) appears in our AUTHORS file.
sc_check_author_list:
@fail=0; \
for i in $$(git log --pretty=format:%aE%n|sort -u|grep -v '^$$'); do \
sanitized=$$(echo "$$i"|LC_ALL=C sed 's/\([^a-zA-Z0-9_@-]\)/\\\1/g'); \
grep -iq "<$$sanitized>" $(srcdir)/AUTHORS \
|| { printf '%s\n' "$$i" >&2; fail=1; }; \
done; \
test $$fail = 1 \
&& echo '$(ME): committer(s) not listed in AUTHORS' >&2; \
test $$fail = 0
# It is necessary to call autogen any time gnulib changes. Autogen
# reruns configure, then we regenerate all Makefiles at once.
.PHONY: _autogen
_autogen:
$(srcdir)/autogen.sh
./config.status
# Exempt @...@ uses of these symbols.
_makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/'
此差异已折叠。
*.la
*.lo
.deps
.libs
Makefile
Makefile.in
libvirt_qemud
libvirtd
libvirtd.init
libvirt-guests.init
libvirtd*.logrotate
libvirtd.pod
libvirtd.8
## Process this file with automake to produce Makefile.in
DAEMON_SOURCES = \
event.c event.h \
libvirtd.c libvirtd.h \
remote.c remote.h \
dispatch.c dispatch.h \
stream.c stream.h \
remote_dispatch_prototypes.h \
remote_dispatch_table.h \
remote_dispatch_args.h \
remote_dispatch_ret.h \
qemu_dispatch_prototypes.h \
qemu_dispatch_table.h \
qemu_dispatch_args.h \
qemu_dispatch_ret.h \
../src/remote/remote_protocol.c \
../src/remote/qemu_protocol.c
AVAHI_SOURCES = \
mdns.c mdns.h
DISTCLEANFILES =
EXTRA_DIST = \
remote_generate_stubs.pl \
libvirtd.conf \
libvirtd.init.in \
libvirtd.policy-0 \
libvirtd.policy-1 \
libvirtd.sasl \
libvirtd.sysconf \
libvirtd.aug \
libvirtd.qemu.logrotate.in \
libvirtd.lxc.logrotate.in \
libvirtd.uml.logrotate.in \
test_libvirtd.aug \
THREADING.txt \
libvirt-guests.init.in \
libvirt-guests.sysconf \
libvirtd.pod.in \
$(AVAHI_SOURCES) \
$(DAEMON_SOURCES)
man_MANS = libvirtd.8
BUILT_SOURCES =
if WITH_LIBVIRTD
sbin_PROGRAMS = libvirtd
confdir = $(sysconfdir)/libvirt/
conf_DATA = libvirtd.conf
augeasdir = $(datadir)/augeas/lenses
augeas_DATA = libvirtd.aug
augeastestsdir = $(datadir)/augeas/lenses/tests
augeastests_DATA = test_libvirtd.aug
POD2MAN = pod2man -c "Virtualization Support" \
-r "$(PACKAGE)-$(VERSION)" -s 8
libvirtd.pod: libvirtd.pod.in
sed \
-e 's![@]sysconfdir[@]!$(sysconfdir)!g' \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
-e 's![@]remote_pid_file[@]!$(REMOTE_PID_FILE)!g' \
< $< > $@-t
mv $@-t $@
libvirtd.8: libvirtd.pod
$(AM_V_GEN)$(POD2MAN) $< $@
libvirtd_SOURCES = $(DAEMON_SOURCES)
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
libvirtd_CFLAGS = \
-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/util \
-I$(top_srcdir)/src/conf \
-I$(top_srcdir)/src/remote \
$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
$(POLKIT_CFLAGS) \
$(WARN_CFLAGS) -DLOCAL_STATE_DIR="\"$(localstatedir)\"" \
$(COVERAGE_CFLAGS) \
-DSYSCONF_DIR="\"$(sysconfdir)\"" \
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\"" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\"
libvirtd_LDFLAGS = \
$(WARN_CFLAGS) \
$(COVERAGE_LDFLAGS)
libvirtd_LDADD = \
$(LIBXML_LIBS) \
$(GNUTLS_LIBS) \
$(SASL_LIBS) \
$(POLKIT_LIBS)
libvirtd_LDADD += ../src/libvirt_util.la ../src/libvirt-qemu.la
if WITH_DRIVER_MODULES
libvirtd_LDADD += ../src/libvirt_driver.la
else
if WITH_QEMU
libvirtd_LDADD += ../src/libvirt_driver_qemu.la
endif
if WITH_LXC
libvirtd_LDADD += ../src/libvirt_driver_lxc.la
endif
if WITH_UML
libvirtd_LDADD += ../src/libvirt_driver_uml.la
endif
if WITH_ONE
libvirtd_LDADD += ../src/libvirt_driver_one.la
endif
if WITH_STORAGE_DIR
libvirtd_LDADD += ../src/libvirt_driver_storage.la
endif
if WITH_NETWORK
libvirtd_LDADD += ../src/libvirt_driver_network.la
endif
if WITH_NETCF
libvirtd_LDADD += ../src/libvirt_driver_interface.la
endif
if WITH_NODE_DEVICES
libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
endif
if WITH_SECRETS
libvirtd_LDADD += ../src/libvirt_driver_secret.la
endif
if WITH_NWFILTER
libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la
endif
endif
libvirtd_LDADD += ../src/libvirt.la
if HAVE_POLKIT
if HAVE_POLKIT0
policydir = $(datadir)/PolicyKit/policy
policyfile = libvirtd.policy-0
else
policydir = $(datadir)/polkit-1/actions
policyfile = libvirtd.policy-1
endif
endif
if HAVE_AVAHI
libvirtd_SOURCES += $(AVAHI_SOURCES)
libvirtd_CFLAGS += $(AVAHI_CFLAGS)
libvirtd_LDADD += $(AVAHI_LIBS)
endif
install-data-local: install-init install-data-sasl install-data-polkit \
install-logrotate
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt
mkdir -p $(DESTDIR)$(localstatedir)/run/libvirt
mkdir -p $(DESTDIR)$(localstatedir)/lib/libvirt
uninstall-local:: uninstall-init uninstall-data-sasl uninstall-data-polkit
rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
if HAVE_POLKIT
install-data-polkit:: install-init
mkdir -p $(DESTDIR)$(policydir)
$(INSTALL_DATA) $(srcdir)/$(policyfile) $(DESTDIR)$(policydir)/org.libvirt.unix.policy
uninstall-data-polkit:: install-init
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
else
install-data-polkit::
uninstall-data-polkit::
endif
remote.c: remote_dispatch_prototypes.h \
remote_dispatch_table.h \
remote_dispatch_args.h \
remote_dispatch_ret.h \
qemu_dispatch_prototypes.h \
qemu_dispatch_table.h \
qemu_dispatch_args.h \
qemu_dispatch_ret.h
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
remote_dispatch_prototypes.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -p remote $(REMOTE_PROTOCOL) > $@
remote_dispatch_table.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -t remote $(REMOTE_PROTOCOL) > $@
remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -a remote $(REMOTE_PROTOCOL) > $@
remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -c -r remote $(REMOTE_PROTOCOL) > $@
qemu_dispatch_prototypes.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -p qemu $(QEMU_PROTOCOL) > $@
qemu_dispatch_table.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -t qemu $(QEMU_PROTOCOL) > $@
qemu_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -a qemu $(QEMU_PROTOCOL) > $@
qemu_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
libvirtd.uml.logrotate
BUILT_SOURCES += $(LOGROTATE_CONFS)
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
< $< > $@-t
mv $@-t $@
libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
$(AM_V_GEN)sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
< $< > $@-t && \
mv $@-t $@
libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
$(AM_V_GEN)sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
< $< > $@-t && \
mv $@-t $@
install-logrotate: $(LOGROTATE_CONFS)
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/
mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
$(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
$(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
$(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
if LIBVIRT_INIT_SCRIPT_RED_HAT
install-init: libvirtd.init libvirt-guests.init
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
$(INSTALL_SCRIPT) libvirtd.init \
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
$(INSTALL_SCRIPT) libvirt-guests.init \
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig
$(INSTALL_SCRIPT) $(srcdir)/libvirtd.sysconf \
$(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
$(INSTALL_SCRIPT) $(srcdir)/libvirt-guests.sysconf \
$(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
uninstall-init:
rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd \
$(DESTDIR)$(sysconfdir)/sysconfig/libvirtd \
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests \
$(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
BUILT_SOURCES += libvirtd.init libvirt-guests.init
%.init: %.init.in $(top_builddir)/config.status
$(AM_V_GEN)sed \
-e s!\@localstatedir\@!@localstatedir@!g \
-e s!\@sbindir\@!@sbindir@!g \
-e s!\@sysconfdir\@!@sysconfdir@!g \
< $< > $@-t && \
chmod a+x $@-t && \
mv $@-t $@
check-local:
test -x '$(AUGPARSE)' \
&& '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd.aug || :
else
install-init:
uninstall-init:
libvirtd.init:
endif # LIBVIRT_INIT_SCRIPT_RED_HAT
# This must be added last, since functions it provides/replaces
# are used by nearly every other library.
libvirtd_LDADD += ../gnulib/lib/libgnu.la $(LIBSOCKET)
else # WITH_LIBVIRTD
install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
endif # WITH_LIBVIRTD
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
if HAVE_SASL
install-data-sasl:
mkdir -p $(DESTDIR)$(sysconfdir)/sasl2/
$(INSTALL_DATA) $(srcdir)/libvirtd.sasl $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
uninstall-data-sasl:
rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
rmdir $(DESTDIR)$(sysconfdir)/sasl2/
else
install-data-sasl:
uninstall-data-sasl:
endif
CLEANFILES = $(BUILT_SOURCES) $(man_MANS) libvirtd.pod
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
Threading in the libvirtd daemon
================================
To allow efficient processing of RPC requests, the libvirtd daemon
makes use of threads.
- The process leader. This is the initial thread of control
when the daemon starts running. It is responsible for
initializing all the state, and starting the event loop.
Once that's all done, this thread does nothing except
wait for the event loop to quit, thus indicating an orderly
shutdown is required.
- The event loop. This thread runs the event loop, sitting
in poll() on all monitored file handles, and calculating
and dispatching any timers that may be registered. When
this thread quits, the entire daemon will shutdown.
- The workers. These 'n' threads all sit around waiting to
process incoming RPC requests. Since RPC requests may take
a long time to complete, with long idle periods, there will
be quite a few workers running.
The use of threads obviously requires locking to ensure safety when
accessing/changing data structures.
- the top level lock is on 'struct qemud_server'. This must be
held before acquiring any other lock
- Each 'struct qemud_client' object has a lock. The server lock
must be held before acquiring it. Once the client lock is acquired
the server lock can (optionally) be dropped.
- The event loop has its own self-contained lock. You can ignore
this as a caller of virEvent APIs.
The server lock is used in conjunction with a condition variable
to pass jobs from the event loop thread to the workers. The main
event loop thread handles I/O from the client socket, and once a
complete RPC message has been read off the wire (and optionally
decrypted), it will be placed onto the 'dx' job queue for the
associated client object. The job condition will be signalled and
a worker will wakup and process it.
The worker thread must quickly drop its locks on the server and
client to allow the main event loop thread to continue running
with its other work. Critically important, is that now libvirt
API call will ever be made with the server or client locks held.
-- End
/*
* dispatch.h: RPC message dispatching infrastructure
*
* Copyright (C) 2007, 2008, 2009 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Richard W.M. Jones <rjones@redhat.com>
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
#include "dispatch.h"
#include "remote.h"
#include "memory.h"
/* Convert a libvirt virError object into wire format */
static void
remoteDispatchCopyError (remote_error *rerr,
virErrorPtr verr)
{
rerr->code = verr->code;
rerr->domain = verr->domain;
rerr->message = verr->message ? malloc(sizeof(char*)) : NULL;
if (rerr->message) *rerr->message = strdup(verr->message);
rerr->level = verr->level;
rerr->str1 = verr->str1 ? malloc(sizeof(char*)) : NULL;
if (rerr->str1) *rerr->str1 = strdup(verr->str1);
rerr->str2 = verr->str2 ? malloc(sizeof(char*)) : NULL;
if (rerr->str2) *rerr->str2 = strdup(verr->str2);
rerr->str3 = verr->str3 ? malloc(sizeof(char*)) : NULL;
if (rerr->str3) *rerr->str3 = strdup(verr->str3);
rerr->int1 = verr->int1;
rerr->int2 = verr->int2;
}
/* A set of helpers for sending back errors to client
in various ways .... */
static void
remoteDispatchStringError (remote_error *rerr,
int code, const char *msg)
{
virError verr;
memset(&verr, 0, sizeof verr);
/* Construct the dummy libvirt virError. */
verr.code = code;
verr.domain = VIR_FROM_REMOTE;
verr.message = (char *)msg;
verr.level = VIR_ERR_ERROR;
verr.str1 = (char *)msg;
remoteDispatchCopyError(rerr, &verr);
}
void remoteDispatchAuthError (remote_error *rerr)
{
remoteDispatchStringError (rerr, VIR_ERR_AUTH_FAILED, "authentication failed");
}
void remoteDispatchFormatError (remote_error *rerr,
const char *fmt, ...)
{
va_list args;
char msgbuf[1024];
char *msg = msgbuf;
va_start (args, fmt);
vsnprintf (msgbuf, sizeof msgbuf, fmt, args);
va_end (args);
remoteDispatchStringError (rerr, VIR_ERR_RPC, msg);
}
void remoteDispatchGenericError (remote_error *rerr)
{
remoteDispatchStringError(rerr,
VIR_ERR_INTERNAL_ERROR,
"library function returned error but did not set virterror");
}
void remoteDispatchOOMError (remote_error *rerr)
{
remoteDispatchStringError(rerr,
VIR_ERR_NO_MEMORY,
"out of memory");
}
void remoteDispatchConnError (remote_error *rerr,
virConnectPtr conn)
{
virErrorPtr verr;
if (conn)
verr = virConnGetLastError(conn);
else
verr = virGetLastError();
if (verr)
remoteDispatchCopyError(rerr, verr);
else
remoteDispatchGenericError(rerr);
}
static int
remoteSerializeError(struct qemud_client *client,
remote_error *rerr,
int program,
int version,
int procedure,
int type,
int serial)
{
XDR xdr;
unsigned int len;
struct qemud_client_message *msg = NULL;
DEBUG("prog=%d ver=%d proc=%d type=%d serial=%d, msg=%s",
program, version, procedure, type, serial,
rerr->message ? *rerr->message : "(none)");
if (VIR_ALLOC(msg) < 0)
goto fatal_error;
/* Return header. */
msg->hdr.prog = program;
msg->hdr.vers = version;
msg->hdr.proc = procedure;
msg->hdr.type = type;
msg->hdr.serial = serial;
msg->hdr.status = REMOTE_ERROR;
msg->bufferLength = sizeof(msg->buffer);
/* Serialise the return header. */
xdrmem_create (&xdr,
msg->buffer,
msg->bufferLength,
XDR_ENCODE);
len = 0; /* We'll come back and write this later. */
if (!xdr_u_int (&xdr, &len))
goto xdr_error;
if (!xdr_remote_message_header (&xdr, &msg->hdr))
goto xdr_error;
/* Error was not set, so synthesize a generic error message. */
if (rerr->code == 0)
remoteDispatchGenericError(rerr);
if (!xdr_remote_error (&xdr, rerr))
goto xdr_error;
/* Write the length word. */
len = xdr_getpos (&xdr);
if (xdr_setpos (&xdr, 0) == 0)
goto xdr_error;
if (!xdr_u_int (&xdr, &len))
goto xdr_error;
xdr_destroy (&xdr);
msg->bufferLength = len;
msg->bufferOffset = 0;
/* Put reply on end of tx queue to send out */
qemudClientMessageQueuePush(&client->tx, msg);
qemudUpdateClientEvent(client);
xdr_free((xdrproc_t)xdr_remote_error, (char *)rerr);
return 0;
xdr_error:
xdr_destroy(&xdr);
VIR_FREE(msg);
fatal_error:
xdr_free((xdrproc_t)xdr_remote_error, (char *)rerr);
return -1;
}
/*
* @client: the client to send the error to
* @rerr: the error object to send
* @req: the message this error is in reply to
*
* Send an error message to the client
*
* Returns 0 if the error was sent, -1 upon fatal error
*/
int
remoteSerializeReplyError(struct qemud_client *client,
remote_error *rerr,
remote_message_header *req) {
/*
* For data streams, errors are sent back as data streams
* For method calls, errors are sent back as method replies
*/
return remoteSerializeError(client,
rerr,
req->prog,
req->vers,
req->proc,
req->type == REMOTE_STREAM ? REMOTE_STREAM : REMOTE_REPLY,
req->serial);
}
int
remoteSerializeStreamError(struct qemud_client *client,
remote_error *rerr,
int proc,
int serial)
{
return remoteSerializeError(client,
rerr,
REMOTE_PROGRAM,
REMOTE_PROTOCOL_VERSION,
proc,
REMOTE_STREAM,
serial);
}
/*
* @msg: the complete incoming message, whose header to decode
*
* Decodes the header part of the client message, but does not
* validate the decoded fields in the header. It expects
* bufferLength to refer to length of the data packet. Upon
* return bufferOffset will refer to the amount of the packet
* consumed by decoding of the header.
*
* returns 0 if successfully decoded, -1 upon fatal error
*/
int
remoteDecodeClientMessageHeader (struct qemud_client_message *msg)
{
XDR xdr;
int ret = -1;
msg->bufferOffset = REMOTE_MESSAGE_HEADER_XDR_LEN;
/* Parse the header. */
xdrmem_create (&xdr,
msg->buffer + msg->bufferOffset,
msg->bufferLength - msg->bufferOffset,
XDR_DECODE);
if (!xdr_remote_message_header (&xdr, &msg->hdr))
goto cleanup;
msg->bufferOffset += xdr_getpos(&xdr);
ret = 0;
cleanup:
xdr_destroy(&xdr);
return ret;
}
/*
* @msg: the outgoing message, whose header to encode
*
* Encodes the header part of the client message, setting the
* message offset ready to encode the payload. Leaves space
* for the length field later. Upon return bufferLength will
* refer to the total available space for message, while
* bufferOffset will refer to current space used by header
*
* returns 0 if successfully encoded, -1 upon fatal error
*/
int
remoteEncodeClientMessageHeader (struct qemud_client_message *msg)
{
XDR xdr;
int ret = -1;
unsigned int len = 0;
msg->bufferLength = sizeof(msg->buffer);
msg->bufferOffset = 0;
/* Format the header. */
xdrmem_create (&xdr,
msg->buffer,
msg->bufferLength,
XDR_ENCODE);
/* The real value is filled in shortly */
if (!xdr_u_int (&xdr, &len)) {
goto cleanup;
}
if (!xdr_remote_message_header (&xdr, &msg->hdr))
goto cleanup;
len = xdr_getpos(&xdr);
xdr_setpos(&xdr, 0);
/* Fill in current length - may be re-written later
* if a payload is added
*/
if (!xdr_u_int (&xdr, &len)) {
goto cleanup;
}
msg->bufferOffset += len;
ret = 0;
cleanup:
xdr_destroy(&xdr);
return ret;
}
static int
remoteDispatchClientCall (struct qemud_server *server,
struct qemud_client *client,
struct qemud_client_message *msg,
bool qemu_protocol);
/*
* @server: the unlocked server object
* @client: the locked client object
* @msg: the complete incoming message packet, with header already decoded
*
* This function gets called from qemud when it pulls a incoming
* remote protocol message off the dispatch queue for processing.
*
* The @msg parameter must have had its header decoded already by
* calling remoteDecodeClientMessageHeader
*
* Returns 0 if the message was dispatched, -1 upon fatal error
*/
int
remoteDispatchClientRequest(struct qemud_server *server,
struct qemud_client *client,
struct qemud_client_message *msg)
{
int ret;
remote_error rerr;
bool qemu_call;
DEBUG("prog=%d ver=%d type=%d status=%d serial=%d proc=%d",
msg->hdr.prog, msg->hdr.vers, msg->hdr.type,
msg->hdr.status, msg->hdr.serial, msg->hdr.proc);
memset(&rerr, 0, sizeof rerr);
/* Check version, etc. */
if (msg->hdr.prog == REMOTE_PROGRAM)
qemu_call = false;
else if (msg->hdr.prog == QEMU_PROGRAM)
qemu_call = true;
else {
remoteDispatchFormatError (&rerr,
_("program mismatch (actual %x, expected %x or %x)"),
msg->hdr.prog, REMOTE_PROGRAM, QEMU_PROGRAM);
goto error;
}
if (!qemu_call && msg->hdr.vers != REMOTE_PROTOCOL_VERSION) {
remoteDispatchFormatError (&rerr,
_("version mismatch (actual %x, expected %x)"),
msg->hdr.vers, REMOTE_PROTOCOL_VERSION);
goto error;
}
else if (qemu_call && msg->hdr.vers != QEMU_PROTOCOL_VERSION) {
remoteDispatchFormatError (&rerr,
_("version mismatch (actual %x, expected %x)"),
msg->hdr.vers, QEMU_PROTOCOL_VERSION);
goto error;
}
switch (msg->hdr.type) {
case REMOTE_CALL:
return remoteDispatchClientCall(server, client, msg, qemu_call);
case REMOTE_STREAM:
/* Since stream data is non-acked, async, we may continue to received
* stream packets after we closed down a stream. Just drop & ignore
* these.
*/
VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
msg->hdr.serial, msg->hdr.proc, msg->hdr.status);
qemudClientMessageRelease(client, msg);
break;
default:
remoteDispatchFormatError (&rerr, _("type (%d) != REMOTE_CALL"),
(int) msg->hdr.type);
goto error;
}
return 0;
error:
ret = remoteSerializeReplyError(client, &rerr, &msg->hdr);
if (ret >= 0)
VIR_FREE(msg);
return ret;
}
/*
* @server: the unlocked server object
* @client: the locked client object
* @msg: the complete incoming method call, with header already decoded
*
* This method is used to dispatch an message representing an
* incoming method call from a client. It decodes the payload
* to obtain method call arguments, invokves the method and
* then sends a reply packet with the return values
*
* Returns 0 if the reply was sent, or -1 upon fatal error
*/
static int
remoteDispatchClientCall (struct qemud_server *server,
struct qemud_client *client,
struct qemud_client_message *msg,
bool qemu_protocol)
{
XDR xdr;
remote_error rerr;
dispatch_args args;
dispatch_ret ret;
const dispatch_data *data = NULL;
int rv = -1;
unsigned int len;
virConnectPtr conn = NULL;
memset(&args, 0, sizeof args);
memset(&ret, 0, sizeof ret);
memset(&rerr, 0, sizeof rerr);
if (msg->hdr.status != REMOTE_OK) {
remoteDispatchFormatError (&rerr, _("status (%d) != REMOTE_OK"),
(int) msg->hdr.status);
goto rpc_error;
}
/* If client is marked as needing auth, don't allow any RPC ops,
* except for authentication ones
*/
if (client->auth) {
if (msg->hdr.proc != REMOTE_PROC_AUTH_LIST &&
msg->hdr.proc != REMOTE_PROC_AUTH_SASL_INIT &&
msg->hdr.proc != REMOTE_PROC_AUTH_SASL_START &&
msg->hdr.proc != REMOTE_PROC_AUTH_SASL_STEP &&
msg->hdr.proc != REMOTE_PROC_AUTH_POLKIT
) {
/* Explicitly *NOT* calling remoteDispatchAuthError() because
we want back-compatability with libvirt clients which don't
support the VIR_ERR_AUTH_FAILED error code */
remoteDispatchFormatError (&rerr, "%s", _("authentication required"));
goto rpc_error;
}
}
if (qemu_protocol)
data = qemuGetDispatchData(msg->hdr.proc);
else
data = remoteGetDispatchData(msg->hdr.proc);
if (!data) {
remoteDispatchFormatError (&rerr, _("unknown procedure: %d"),
msg->hdr.proc);
goto rpc_error;
}
/* De-serialize payload with args from the wire message */
xdrmem_create (&xdr,
msg->buffer + msg->bufferOffset,
msg->bufferLength - msg->bufferOffset,
XDR_DECODE);
if (!((data->args_filter)(&xdr, &args))) {
xdr_destroy (&xdr);
remoteDispatchFormatError (&rerr, "%s", _("parse args failed"));
goto rpc_error;
}
xdr_destroy (&xdr);
/* Call function. */
conn = client->conn;
virMutexUnlock(&client->lock);
/*
* When the RPC handler is called:
*
* - Server object is unlocked
* - Client object is unlocked
*
* Without locking, it is safe to use:
*
* 'conn', 'rerr', 'args and 'ret'
*/
rv = (data->fn)(server, client, conn, &msg->hdr, &rerr, &args, &ret);
virMutexLock(&server->lock);
virMutexLock(&client->lock);
virMutexUnlock(&server->lock);
xdr_free (data->args_filter, (char*)&args);
if (rv < 0)
goto rpc_error;
/* Return header. We're re-using same message object, so
* only need to tweak type/status fields */
/*msg->hdr.prog = msg->hdr.prog;*/
/*msg->hdr.vers = msg->hdr.vers;*/
/*msg->hdr.proc = msg->hdr.proc;*/
msg->hdr.type = REMOTE_REPLY;
/*msg->hdr.serial = msg->hdr.serial;*/
msg->hdr.status = REMOTE_OK;
if (remoteEncodeClientMessageHeader(msg) < 0) {
xdr_free (data->ret_filter, (char*)&ret);
goto fatal_error;
}
/* Now for the payload */
xdrmem_create (&xdr,
msg->buffer,
msg->bufferLength,
XDR_ENCODE);
if (xdr_setpos(&xdr, msg->bufferOffset) == 0)
goto xdr_error;
/* If OK, serialise return structure, if error serialise error. */
/* Serialise reply data */
if (!((data->ret_filter) (&xdr, &ret)))
goto xdr_error;
/* Update the length word. */
msg->bufferOffset += xdr_getpos (&xdr);
len = msg->bufferOffset;
if (xdr_setpos (&xdr, 0) == 0)
goto xdr_error;
if (!xdr_u_int (&xdr, &len))
goto xdr_error;
xdr_destroy (&xdr);
xdr_free (data->ret_filter, (char*)&ret);
/* Reset ready for I/O */
msg->bufferLength = len;