From 086a0ffe4fff7436f4f8c9b294758cfc89fa73dc Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 8 Dec 2005 16:42:56 +0000 Subject: [PATCH] * include/libvir.h src/libvir.c src/libvir_sym.version: adding virDomainFree() * docs/*: regenerated the docs Daniel --- ChangeLog | 6 +++ docs/APIchunk0.html | 41 ++++++++---------- docs/APIchunk1.html | 84 ++++++++++++++++-------------------- docs/APIfiles.html | 1 + docs/APIfunctions.html | 1 + docs/APIsymbols.html | 1 + docs/html/libxml-libvir.html | 5 ++- docs/libvir-api.xml | 8 +++- docs/libvir-refs.xml | 59 ++++++++++++++++++++++--- include/libvir.h | 1 + src/libvir.c | 44 ++++++++++++++++--- src/libvir_sym.version | 4 +- 12 files changed, 168 insertions(+), 87 deletions(-) diff --git a/ChangeLog b/ChangeLog index 511411ea8e..d17e1b6d98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Dec 8 17:43:11 CET 2005 Daniel Veillard + + * include/libvir.h src/libvir.c src/libvir_sym.version: adding + virDomainFree() + * docs/*: regenerated the docs + Thu Dec 8 16:07:07 CET 2005 Daniel Veillard * configure.in include/libvir.h.in include/libvir.h src/Makefile.am diff --git a/docs/APIchunk0.html b/docs/APIchunk0.html index 62f18f09fd..5c78ed5663 100644 --- a/docs/APIchunk0.html +++ b/docs/APIchunk0.html @@ -7,9 +7,9 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -API Alphabetic Index A-h for libvir
Red Hat Logo

Libvir the Linux virtualization API

API Alphabetic Index A-h for libvir

Developer Menu
API Indexes
Related links

A-h -i-w -x-z +API Alphabetic Index A-g for libvir
Red Hat Logo

Libvir the Linux virtualization API

API Alphabetic Index A-g for libvir

Developer Menu
API Indexes
Related links

A-g +h-t +u-z

Letter A:

ABI
_virDomainInfo
APIs
virConnectOpenReadOnly

Letter C:

CPU
virDomainSuspend
@@ -19,6 +19,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainSetMaxMemory
Dynamically
virDomainSetMaxMemory

Letter E:

Extract
virDomainGetInfo
+

Letter F:

Free
virDomainFree

Letter G:

Get
virConnectGetType
virConnectGetVersion
virDomainGetID
@@ -71,6 +72,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainSuspend
add
_virDomainInfo
against
virGetVersion
+
alive
virDomainFree
all
virDomainDestroy
allocated
virDomainGetInfo
virDomainGetMaxMemory
@@ -100,6 +102,7 @@ A:link, A:visited, A:active { text-decoration: underline }
but
virDomainSuspend

Letter c:

call
_virDomainInfo
virConnectGetVersion
+virDomainDestroy
called
virConnectClose
virConnectOpen
virConnectOpenReadOnly
@@ -117,6 +120,7 @@ A:link, A:visited, A:active { text-decoration: underline } virConnectOpenReadOnly
virDomainCreateLinux
virDomainDestroy
+virDomainFree
virDomainGetID
virDomainGetInfo
virDomainGetMaxMemory
@@ -148,7 +152,10 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainLookupByName
currently
virConnectOpen
virConnectOpenReadOnly
-

Letter d:

deallocated
virDomainGetName
+

Letter d:

data
virDomainDestroy
+virDomainFree
+
deallocated
virDomainGetName
+
does
virDomainDestroy
domains
virConnectListDomains
virConnectNumOfDomains
down
virDomainDestroy
@@ -159,6 +166,7 @@ A:link, A:visited, A:active { text-decoration: underline } virConnectNumOfDomains
virConnectOpen
virConnectOpenReadOnly
+virDomainDestroy
virDomainGetID
virDomainGetMaxMemory
virGetVersion
@@ -168,6 +176,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainGetInfo

Letter f:

failure
virDomainCreateLinux
virDomainDestroy
+virDomainFree
virDomainGetInfo
virDomainLookupByID
virDomainLookupByName
@@ -189,6 +198,8 @@ A:link, A:visited, A:active { text-decoration: underline }
format
virGetVersion
found
virConnectListDomains
virConnectNumOfDomains
+
freed
virDomainDestroy
+virDomainFree
from
_virDomainInfo
virDomainResume
frozen
virDomainResume
@@ -206,23 +217,7 @@ A:link, A:visited, A:active { text-decoration: underline }
given
virDomainDestroy
virDomainLookupByName
guest
virDomainCreateLinux
-

Letter h:

have
virGetVersion
-
hypervisor
_virDomainInfo
-virConnectClose
-virConnectGetType
-virConnectGetVersion
-virConnectListDomains
-virConnectNumOfDomains
-virConnectOpen
-virConnectOpenReadOnly
-virDomainCreateLinux
-virDomainDestroy
-virDomainGetID
-virDomainLookupByID
-virDomainLookupByName
-virDomainSuspend
-virGetVersion
-

A-h -i-w -x-z +

A-g +h-t +u-z

Daniel Veillard

diff --git a/docs/APIchunk1.html b/docs/APIchunk1.html index e906726ce1..ed5a55cfb4 100644 --- a/docs/APIchunk1.html +++ b/docs/APIchunk1.html @@ -7,19 +7,37 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -API Alphabetic Index i-w for libvir
Red Hat Logo

Libvir the Linux virtualization API

API Alphabetic Index i-w for libvir

Developer Menu
API Indexes
Related links

A-h -i-w -x-z -

Letter i:

image
virDomainCreateLinux
+API Alphabetic Index h-t for libvir
Red Hat Logo

Libvir the Linux virtualization API

API Alphabetic Index h-t for libvir

Developer Menu
API Indexes
Related links

A-g +h-t +u-z +

Letter h:

have
virGetVersion
+
hypervisor
_virDomainInfo
+virConnectClose
+virConnectGetType
+virConnectGetVersion
+virConnectListDomains
+virConnectNumOfDomains
+virConnectOpen
+virConnectOpenReadOnly
+virDomainCreateLinux
+virDomainDestroy
+virDomainGetID
+virDomainLookupByID
+virDomainLookupByName
+virDomainSuspend
+virGetVersion
+

Letter i:

image
virDomainCreateLinux
information
virDomainGetInfo
virGetVersion
informations
virDomainGetInfo
initrd
virDomainCreateLinux
instance
virDomainDestroy
+virDomainFree
int
virDomainGetID
interaction
virConnectClose
its
virDomainGetName
-

Letter k:

kernel
virDomainCreateLinux
+

Letter k:

kept
virDomainFree
+
kernel
virDomainCreateLinux
kilobytes
virDomainCreateLinux
virDomainGetMaxMemory
virDomainSetMaxMemory
@@ -63,6 +81,7 @@ A:link, A:visited, A:active { text-decoration: underline }
not
virConnectClose
virConnectGetVersion
virDomainDestroy
+virDomainFree
virDomainGetName
virGetVersion
number
virConnectListDomains
@@ -71,6 +90,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainLookupByID

Letter o:

object
virDomainCreateLinux
virDomainDestroy
+virDomainFree
virDomainGetID
virDomainGetInfo
virDomainGetMaxMemory
@@ -129,6 +149,7 @@ A:link, A:visited, A:active { text-decoration: underline }
restarted
virDomainResume
restricted
virConnectOpenReadOnly
return
virConnectGetVersion
+virDomainDestroy
virGetVersion
returned
virGetVersion
returns
virConnectGetVersion
@@ -136,6 +157,7 @@ A:link, A:visited, A:active { text-decoration: underline } virConnectClose
virConnectGetVersion
virDomainDestroy
+virDomainFree
runs
virDomainGetMaxMemory
virDomainSetMaxMemory

Letter s:

same
virDomainGetName
@@ -145,6 +167,8 @@ A:link, A:visited, A:active { text-decoration: underline }
should
virConnectClose
virConnectOpen
virConnectOpenReadOnly
+virDomainDestroy
+virDomainFree
shutdown
virDomainDestroy
size
virConnectListDomains
virDomainCreateLinux
@@ -161,9 +185,12 @@ A:link, A:visited, A:active { text-decoration: underline }
string
virConnectGetType
virDomainGetName
structure
_virDomainInfo
+virDomainDestroy
+virDomainFree
virDomainGetInfo
success
virConnectClose
virDomainDestroy
+virDomainFree
virDomainGetInfo
virDomainResume
virDomainSetMaxMemory
@@ -178,51 +205,14 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainGetMaxMemory
virDomainSetMaxMemory
there
virConnectClose
+
thereafter
virDomainDestroy
+virDomainFree
this
_virDomainInfo
virDomainGetMaxMemory
virDomainSetMaxMemory
two
virGetVersion
type
virGetVersion
-

Letter u:

unknown
virGetVersion
-
unsigned
virDomainGetID
-
unused
virConnectOpen
-virConnectOpenReadOnly
-
usable
virConnectOpenReadOnly
-
used
_virDomainInfo
-virConnectGetType
-virDomainDestroy
-virDomainGetInfo
-virDomainSuspend
-
user
virDomainGetInfo
-

Letter v:

value
virConnectGetVersion
-virGetVersion
-
values
virGetVersion
-
version
LIBVIR_VERSION_NUMBER
-virConnectGetVersion
-virGetVersion
-
virDomainFlags
_virDomainInfo
-virDomainCreateLinux
-
virDomainInfo
virDomainGetInfo
-
virDomainResume
virDomainSuspend
-
virSuspendDomain
virDomainResume
-

Letter w:

was
virDomainResume
-virGetVersion
-
what
_virDomainInfo
-
where
virDomainGetMaxMemory
-virDomainResume
-virDomainSetMaxMemory
-
which
virConnectClose
-virGetVersion
-
while
virGetVersion
-
will
virDomainGetName
-virDomainSuspend
-virGetVersion
-
with
_virDomainInfo
-virConnectClose
-virConnectGetVersion
-
without
virDomainSuspend
-
work
virConnectGetVersion
-

A-h -i-w -x-z +

A-g +h-t +u-z

Daniel Veillard

diff --git a/docs/APIfiles.html b/docs/APIfiles.html index cb60c57c1c..161fb6ed77 100644 --- a/docs/APIfiles.html +++ b/docs/APIfiles.html @@ -29,6 +29,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainCreateLinux
virDomainDestroy
virDomainFlags
+virDomainFree
virDomainGetID
virDomainGetInfo
virDomainGetMaxMemory
diff --git a/docs/APIfunctions.html b/docs/APIfunctions.html index 2d52812a76..9eecf65d4d 100644 --- a/docs/APIfunctions.html +++ b/docs/APIfunctions.html @@ -23,6 +23,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainLookupByName

Type virDomainInfoPtr:

virDomainGetInfo

Type virDomainPtr:

virDomainDestroy
+virDomainFree
virDomainGetID
virDomainGetInfo
virDomainGetMaxMemory
diff --git a/docs/APIsymbols.html b/docs/APIsymbols.html index 22822e5548..b7fce8f4a7 100644 --- a/docs/APIsymbols.html +++ b/docs/APIsymbols.html @@ -29,6 +29,7 @@ A:link, A:visited, A:active { text-decoration: underline } virDomainCreateLinux
virDomainDestroy
virDomainFlags
+virDomainFree
virDomainGetID
virDomainGetInfo
virDomainGetMaxMemory
diff --git a/docs/html/libxml-libvir.html b/docs/html/libxml-libvir.html index d1ec48cb22..584ca5f7fb 100644 --- a/docs/html/libxml-libvir.html +++ b/docs/html/libxml-libvir.html @@ -29,6 +29,7 @@ The content of this structure is not made public by the API.

virConnectPtr	virConnectOpenReadOnly	(const char * name)
virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * kernel_path,
const char * initrd_path,
const char * cmdline,
unsigned long memory,
unsigned int flags)
int	virDomainDestroy		(virDomainPtr domain)
+
int	virDomainFree			(virDomainPtr domain)
unsigned int	virDomainGetID		(virDomainPtr domain)
int	virDomainGetInfo		(virDomainPtr domain, 
virDomainInfoPtr info)
unsigned long	virDomainGetMaxMemory	(virDomainPtr domain)
@@ -85,7 +86,9 @@ The content of this structure is not made public by the API.
name:optional argument currently unused, pass NULL
Returns:a pointer to the hypervisor connection or NULL in case of error

Function: virDomainCreateLinux

virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * kernel_path,
const char * initrd_path,
const char * cmdline,
unsigned long memory,
unsigned int flags)

Launch a new Linux guest domain

conn:pointer to the hypervisor connection
kernel_path:the file path to the kernel image
initrd_path:an optional file path to an initrd
cmdline:optional command line parameters for the kernel
memory:the memory size in kilobytes
flags:an optional set of virDomainFlags
Returns:a new domain object or NULL in case of failure

Function: virDomainDestroy

int	virDomainDestroy		(virDomainPtr domain)
-

Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor.

+

Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. The data structure is freed and should not be used thereafter if the call does not return an error.

+
domain:a domain object
Returns:0 in case of success and -1 in case of failure.

Function: virDomainFree

int	virDomainFree			(virDomainPtr domain)
+

Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

Function: virDomainGetID

unsigned int	virDomainGetID		(virDomainPtr domain)

Get the hypervisor ID number for the domain

domain:a domain object
Returns:the domain ID number or (unsigned int) -1 in case of error

Function: virDomainGetInfo

int	virDomainGetInfo		(virDomainPtr domain, 
virDomainInfoPtr info)
diff --git a/docs/libvir-api.xml b/docs/libvir-api.xml index 70ad4a12f0..06974d0c55 100644 --- a/docs/libvir-api.xml +++ b/docs/libvir-api.xml @@ -26,6 +26,7 @@ + @@ -129,7 +130,12 @@ - Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. + Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. The data structure is freed and should not be used thereafter if the call does not return an error. + + + + + Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter. diff --git a/docs/libvir-refs.xml b/docs/libvir-refs.xml index 89b97dce93..9f2cf04e6c 100644 --- a/docs/libvir-refs.xml +++ b/docs/libvir-refs.xml @@ -23,6 +23,7 @@ + @@ -68,6 +69,7 @@ + @@ -131,6 +133,7 @@ + @@ -164,6 +167,7 @@ + @@ -215,6 +219,11 @@ + + + + + @@ -348,6 +357,9 @@ + + + @@ -414,6 +426,7 @@ + @@ -441,6 +454,7 @@ + @@ -495,9 +509,16 @@ + + + + + + + @@ -515,6 +536,7 @@ + @@ -532,6 +554,7 @@ + @@ -566,6 +589,10 @@ + + + + @@ -602,6 +629,8 @@ + + @@ -624,8 +653,6 @@ - - @@ -642,6 +669,7 @@ + @@ -654,6 +682,9 @@ + + + @@ -749,6 +780,7 @@ + @@ -763,6 +795,7 @@ + @@ -877,6 +910,7 @@ + @@ -890,6 +924,7 @@ + @@ -909,6 +944,8 @@ + + @@ -943,11 +980,14 @@ + + + @@ -979,6 +1019,10 @@ + + + + @@ -991,6 +1035,8 @@ + + @@ -1009,6 +1055,7 @@ + @@ -1080,8 +1127,6 @@ - - @@ -1098,9 +1143,9 @@ - - - + + + diff --git a/include/libvir.h b/include/libvir.h index f7cba9d501..c47720acdf 100644 --- a/include/libvir.h +++ b/include/libvir.h @@ -161,6 +161,7 @@ virDomainPtr virDomainLookupByName (virConnectPtr conn, virDomainPtr virDomainLookupByID (virConnectPtr conn, int id); int virDomainDestroy (virDomainPtr domain); +int virDomainFree (virDomainPtr domain); /* * Domain suspend/resume diff --git a/src/libvir.c b/src/libvir.c index be27d266a9..d846e03699 100644 --- a/src/libvir.c +++ b/src/libvir.c @@ -195,7 +195,7 @@ failed: } /** - * virDomainDestroyName: + * virDomainFreeName: * @domain: a domain object * * Destroy the domain object, this is just used by the domain hash callback. @@ -203,8 +203,8 @@ failed: * Returns 0 in case of success and -1 in case of failure. */ static int -virDomainDestroyName(virDomainPtr domain, const char *name ATTRIBUTE_UNUSED) { - return(virDomainDestroy(domain)); +virDomainFreeName(virDomainPtr domain, const char *name ATTRIBUTE_UNUSED) { + return(virDomainFree(domain)); } /** @@ -223,7 +223,7 @@ virConnectClose(virConnectPtr conn) { if ((conn == NULL) || (conn->magic != VIR_CONNECT_MAGIC)) return(-1); - virHashFree(conn->domains, (virHashDeallocator) virDomainDestroyName); + virHashFree(conn->domains, (virHashDeallocator) virDomainFreeName); conn->magic = -1; xs_daemon_close(conn->xshandle); conn->xshandle = NULL; @@ -333,6 +333,8 @@ done: * virConnectNumOfDomains: * @conn: pointer to the hypervisor connection * + * Provides the number of active domains. + * * Returns the number of domain found or -1 in case of error */ int @@ -372,8 +374,10 @@ virConnectNumOfDomains(virConnectPtr conn) { */ virDomainPtr virDomainCreateLinux(virConnectPtr conn, const char *kernel_path, - const char *initrd_path, const char *cmdline, - unsigned long memory, unsigned int flags) { + const char *initrd_path ATTRIBUTE_UNUSED, + const char *cmdline ATTRIBUTE_UNUSED, + unsigned long memory, + unsigned int flags ATTRIBUTE_UNUSED) { if ((conn == NULL) || (conn->magic != VIR_CONNECT_MAGIC) || (kernel_path == NULL) || (memory < 4096)) return(NULL); @@ -527,6 +531,8 @@ virDomainLookupByID(virConnectPtr conn, int id) { * * Destroy the domain object. The running instance is shutdown if not down * already and all resources used by it are given back to the hypervisor. + * The data structure is freed and should not be used thereafter if the + * call does not return an error. * * Returns 0 in case of success and -1 in case of failure. */ @@ -535,7 +541,31 @@ virDomainDestroy(virDomainPtr domain) { if ((domain == NULL) || (domain->magic != VIR_DOMAIN_MAGIC)) return(-1); TODO - return(-1); + + return(virDomainFree(domain)); +} + +/** + * virDomainFree: + * @domain: a domain object + * + * Free the domain object. The running instance is kept alive. + * The data structure is freed and should not be used thereafter. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +virDomainFree(virDomainPtr domain) { + if ((domain == NULL) || (domain->magic != VIR_DOMAIN_MAGIC)) + return(-1); + domain->magic = -1; + domain->handle = -1; + if (domain->path != NULL) + free(domain->path); + if (domain->name) + free(domain->name); + free(domain); + return(0); } /** diff --git a/src/libvir_sym.version b/src/libvir_sym.version index 7fa7d7c3bd..ead0d41ec3 100644 --- a/src/libvir_sym.version +++ b/src/libvir_sym.version @@ -1,6 +1,7 @@ { global: virConnectClose; + virConnectGetType; virConnectGetVersion; virConnectListDomains; virConnectNumOfDomains; @@ -8,15 +9,16 @@ virConnectOpenReadOnly; virDomainCreateLinux; virDomainDestroy; + virDomainFree; virDomainGetID; virDomainGetInfo; virDomainGetMaxMemory; virDomainGetName; - virConnectGetType; virDomainLookupByID; virDomainLookupByName; virDomainResume; virDomainSetMaxMemory; virDomainSuspend; + virGetVersion; local: *; };