Commit Graph
14 Commits
Author SHA1 Message Date
Christoph Egger d2cd9d41fd Fix copy and paste bug in libxl_run_bootloader
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-10-05 14:22:19 +01:00
Andre Przywara 68c2232d04 libxl: fix compiler warning with fork_exec_bootloader
At least one of my compilers complains about the broken const
qualifier in the fork_exec_bootloader() call (despite the cast).
Fix this properly by propagating the const attribute down the
call stack.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 17:39:33 +01:00
Ian Campbell 461d1b3b6e libxl: Use libxl__ namespace for internal types
It's not clear that the namespace rules described in libxl.h are
intended to apply to internal types but I don't see why not.

sed -i -e 's/\<libxl_device\>/libxl__device/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_device_kinds\>/libxl__device_kinds/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_gc\>/libxl__gc/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_gc_owner\>/libxl__gc_owner/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_spawn_starting\>/libxl__spawn_starting/g'  tools/libxl/*.[ch]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-08 16:48:48 +01:00
Ian Campbell fc850f5680 libxl: Ensure all _hidden functions use libxl__ prefix (autogenerated patch)
This patch covers all those which could be trivially converted automatically.

sed -n -e 's/_hidden.*[ \*]libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \
while read i ; do \
    sed -i -e "s/libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \
done

sed -n -e 's/_hidden.*_libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \
while read i ; do \
    sed -i -e "s/_libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \
done

Check that diffstat includes libxl but not xl.

Fixup tools/libxl/xl_cmdimpl.c which used libxl_device_del instead of
libxl_device_disk_del in a printf.

(Patch runes re-run by Ian Jackson to refresh against tip libxl.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-08 16:44:24 +01:00
Ian Campbell 5545b07a5c libxl+xend: use correct paths for PV console when running bootloader
Makes "{xl,xm} create -c GUEST" work again with pygrub in interactive
mode which was broken by 21994:2e08ec0028e4

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-07 18:50:55 +01:00
Ian Campbell 86316089e4 libxl: do not leak path to dom0 attached disk after running bootloader
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-08-24 18:28:26 +01:00
Ian Campbell 10cf11b436 libxl: implement destroy for libxl_file_reference builtin type
As well as freeing data any file mappings need to be torn down so
implement an explicit destroy function.

Also the map and unmap function are internal to libxl so make that so.

[PATCH 09 of 16 of
 libxl: autogenerate type definitions and destructor functions]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-08-19 15:25:15 +01:00
Gianni Tedesco 94413e51b0 xl: Implement per-API-call garbage-collection lifetime
Currently scratch variables allocated by libxl have the same lifetime as
the context. While this is suitable for one off invocations of xl. It is
not so great for a daemon process linking to libxl. In that case there
will be prolific leakage of heap memory.

My proposed solution involves create a new libxl_gc structure, which
contains a pointer to an owning context as well as the garbage
collection data. Top-level library functions which expect to do a lot of
scratch allocations put gc struct on the stack and initialize it with a
macro. Before returning they then call libxl_free_all on this struct.
This means that static helper functions called by such functions will
usually take a gc instead of a ctx as a first parameter.

The patch touches almost every code-path so a close review and testing
would be much appreciated. I have tested with valgrind all of the parts
I could which looked non-straightforward. Suffice to say that it seems
crash-free even if we have exposed a few real memory leaks. These are
for cases where we return eg. block list to an xl caller but there is no
appropriate block_list_free() function to call. Ian Campbells work in
this area should sew up all these loose ends.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-08-12 18:55:16 +01:00
Christoph Egger 47aa247c1f libxl: Portability fixes for pty handling, in libxl_osdeps.h
This is the same approach used in tools/console, although we have a
separate instance of it as it is difficult to share code between these
two places.

Also add a missing include of <termios.h>, and fix a literal use of
-lutil to refer to UTIL_LIBS.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-29 16:12:50 +01:00
Ian Campbell 528ad3b6e2 libxl: consistently use typedef struct {} libxl_$type
typedef struct seems to be the dominant idiom in the mixture currently
in use.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-07-28 16:18:44 +01:00
Ian Jackson a438f9140a tools/libxl: Revert broken NetBSD portability patches
Revert
 df9d8319bd37 Fix blktap2 NetBSD build and also revert broken change
 e76befc7fe2d portability fixes from tools/console
 24277e3237ca Fix linking error when creating the xl binary.

Now it builds again.
2010-07-23 19:13:29 +01:00
Stefano Stabellini 5db6016998 Attached patch takes over some portability fixes from tools/console
to make libxl build on NetBSD.

blktapctl is build on Linux only. This will be another patch to finally
unbreak libxl.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-07-20 17:26:38 +01:00
Stefano Stabellini 9fc200ae85 make libxl build since 21811
First hunk, I assume is getting the arguments in wrong order on memset.

Second hunk is to kill a compiler warning about mis-use of printf-style
format strings which kills the build on -Werror.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2010-07-19 15:15:32 +01:00
Ian Jackson 6a8f8977a1 libxl, xl: support running bootloader (e.g. pygrub) in domain 0
Much of the bootloader interaction (including the Solaris and NetBSD
portability bits) are translated pretty much directly from the python
in tools/python/xen/xend/XendBootloader.py

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-07-14 16:45:38 +01:00