direct-io.hg

changeset 12342:eccbf694ba0b

Added a destroy method for each object. Based upon the code for VM.destroy
by Jim Fehlig.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Nov 09 11:37:35 2006 +0000 (2006-11-09)
parents e3d42ea643b0
children 62376b480034
files tools/libxen/include/xen_host.h tools/libxen/include/xen_host_cpu.h tools/libxen/include/xen_network.h tools/libxen/include/xen_pif.h tools/libxen/include/xen_sr.h tools/libxen/include/xen_user.h tools/libxen/include/xen_vbd.h tools/libxen/include/xen_vdi.h tools/libxen/include/xen_vif.h tools/libxen/include/xen_vm.h tools/libxen/include/xen_vtpm.h tools/libxen/src/xen_host.c tools/libxen/src/xen_host_cpu.c tools/libxen/src/xen_network.c tools/libxen/src/xen_pif.c tools/libxen/src/xen_sr.c tools/libxen/src/xen_user.c tools/libxen/src/xen_vbd.c tools/libxen/src/xen_vdi.c tools/libxen/src/xen_vif.c tools/libxen/src/xen_vm.c tools/libxen/src/xen_vtpm.c
line diff
     1.1 --- a/tools/libxen/include/xen_host.h	Thu Nov 09 11:23:09 2006 +0000
     1.2 +++ b/tools/libxen/include/xen_host.h	Thu Nov 09 11:37:35 2006 +0000
     1.3 @@ -175,6 +175,13 @@ xen_host_create(xen_session *session, xe
     1.4  
     1.5  
     1.6  /**
     1.7 + * Destroy the specified host instance.
     1.8 + */
     1.9 +extern bool
    1.10 +xen_host_destroy(xen_session *session, xen_host host);
    1.11 +
    1.12 +
    1.13 +/**
    1.14   * Get all the host instances with the given label.
    1.15   */
    1.16  extern bool
     2.1 --- a/tools/libxen/include/xen_host_cpu.h	Thu Nov 09 11:23:09 2006 +0000
     2.2 +++ b/tools/libxen/include/xen_host_cpu.h	Thu Nov 09 11:37:35 2006 +0000
     2.3 @@ -174,6 +174,13 @@ xen_host_cpu_create(xen_session *session
     2.4  
     2.5  
     2.6  /**
     2.7 + * Destroy the specified host_cpu instance.
     2.8 + */
     2.9 +extern bool
    2.10 +xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu);
    2.11 +
    2.12 +
    2.13 +/**
    2.14   * Get the uuid field of the given host_cpu.
    2.15   */
    2.16  extern bool
     3.1 --- a/tools/libxen/include/xen_network.h	Thu Nov 09 11:23:09 2006 +0000
     3.2 +++ b/tools/libxen/include/xen_network.h	Thu Nov 09 11:37:35 2006 +0000
     3.3 @@ -173,6 +173,13 @@ xen_network_create(xen_session *session,
     3.4  
     3.5  
     3.6  /**
     3.7 + * Destroy the specified network instance.
     3.8 + */
     3.9 +extern bool
    3.10 +xen_network_destroy(xen_session *session, xen_network network);
    3.11 +
    3.12 +
    3.13 +/**
    3.14   * Get all the network instances with the given label.
    3.15   */
    3.16  extern bool
     4.1 --- a/tools/libxen/include/xen_pif.h	Thu Nov 09 11:23:09 2006 +0000
     4.2 +++ b/tools/libxen/include/xen_pif.h	Thu Nov 09 11:37:35 2006 +0000
     4.3 @@ -176,6 +176,13 @@ xen_pif_create(xen_session *session, xen
     4.4  
     4.5  
     4.6  /**
     4.7 + * Destroy the specified PIF instance.
     4.8 + */
     4.9 +extern bool
    4.10 +xen_pif_destroy(xen_session *session, xen_pif pif);
    4.11 +
    4.12 +
    4.13 +/**
    4.14   * Get the uuid field of the given PIF.
    4.15   */
    4.16  extern bool
     5.1 --- a/tools/libxen/include/xen_sr.h	Thu Nov 09 11:23:09 2006 +0000
     5.2 +++ b/tools/libxen/include/xen_sr.h	Thu Nov 09 11:37:35 2006 +0000
     5.3 @@ -174,6 +174,13 @@ xen_sr_create(xen_session *session, xen_
     5.4  
     5.5  
     5.6  /**
     5.7 + * Destroy the specified SR instance.
     5.8 + */
     5.9 +extern bool
    5.10 +xen_sr_destroy(xen_session *session, xen_sr sr);
    5.11 +
    5.12 +
    5.13 +/**
    5.14   * Get all the SR instances with the given label.
    5.15   */
    5.16  extern bool
     6.1 --- a/tools/libxen/include/xen_user.h	Thu Nov 09 11:23:09 2006 +0000
     6.2 +++ b/tools/libxen/include/xen_user.h	Thu Nov 09 11:37:35 2006 +0000
     6.3 @@ -167,6 +167,13 @@ xen_user_create(xen_session *session, xe
     6.4  
     6.5  
     6.6  /**
     6.7 + * Destroy the specified user instance.
     6.8 + */
     6.9 +extern bool
    6.10 +xen_user_destroy(xen_session *session, xen_user user);
    6.11 +
    6.12 +
    6.13 +/**
    6.14   * Get the uuid field of the given user.
    6.15   */
    6.16  extern bool
     7.1 --- a/tools/libxen/include/xen_vbd.h	Thu Nov 09 11:23:09 2006 +0000
     7.2 +++ b/tools/libxen/include/xen_vbd.h	Thu Nov 09 11:37:35 2006 +0000
     7.3 @@ -177,6 +177,13 @@ xen_vbd_create(xen_session *session, xen
     7.4  
     7.5  
     7.6  /**
     7.7 + * Destroy the specified VBD instance.
     7.8 + */
     7.9 +extern bool
    7.10 +xen_vbd_destroy(xen_session *session, xen_vbd vbd);
    7.11 +
    7.12 +
    7.13 +/**
    7.14   * Get the uuid field of the given VBD.
    7.15   */
    7.16  extern bool
     8.1 --- a/tools/libxen/include/xen_vdi.h	Thu Nov 09 11:23:09 2006 +0000
     8.2 +++ b/tools/libxen/include/xen_vdi.h	Thu Nov 09 11:37:35 2006 +0000
     8.3 @@ -180,6 +180,13 @@ xen_vdi_create(xen_session *session, xen
     8.4  
     8.5  
     8.6  /**
     8.7 + * Destroy the specified VDI instance.
     8.8 + */
     8.9 +extern bool
    8.10 +xen_vdi_destroy(xen_session *session, xen_vdi vdi);
    8.11 +
    8.12 +
    8.13 +/**
    8.14   * Get all the VDI instances with the given label.
    8.15   */
    8.16  extern bool
     9.1 --- a/tools/libxen/include/xen_vif.h	Thu Nov 09 11:23:09 2006 +0000
     9.2 +++ b/tools/libxen/include/xen_vif.h	Thu Nov 09 11:37:35 2006 +0000
     9.3 @@ -177,6 +177,13 @@ xen_vif_create(xen_session *session, xen
     9.4  
     9.5  
     9.6  /**
     9.7 + * Destroy the specified VIF instance.
     9.8 + */
     9.9 +extern bool
    9.10 +xen_vif_destroy(xen_session *session, xen_vif vif);
    9.11 +
    9.12 +
    9.13 +/**
    9.14   * Get the uuid field of the given VIF.
    9.15   */
    9.16  extern bool
    10.1 --- a/tools/libxen/include/xen_vm.h	Thu Nov 09 11:23:09 2006 +0000
    10.2 +++ b/tools/libxen/include/xen_vm.h	Thu Nov 09 11:37:35 2006 +0000
    10.3 @@ -217,6 +217,15 @@ xen_vm_create(xen_session *session, xen_
    10.4  
    10.5  
    10.6  /**
    10.7 + * Destroy the specified VM.  The VM is completely removed from the
    10.8 + * system.  This function can only be called when the VM is in the Halted
    10.9 + * State.
   10.10 + */
   10.11 +extern bool
   10.12 +xen_vm_destroy(xen_session *session, xen_vm vm);
   10.13 +
   10.14 +
   10.15 +/**
   10.16   * Get all the VM instances with the given label.
   10.17   */
   10.18  extern bool
    11.1 --- a/tools/libxen/include/xen_vtpm.h	Thu Nov 09 11:23:09 2006 +0000
    11.2 +++ b/tools/libxen/include/xen_vtpm.h	Thu Nov 09 11:37:35 2006 +0000
    11.3 @@ -172,6 +172,13 @@ xen_vtpm_create(xen_session *session, xe
    11.4  
    11.5  
    11.6  /**
    11.7 + * Destroy the specified VTPM instance.
    11.8 + */
    11.9 +extern bool
   11.10 +xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
   11.11 +
   11.12 +
   11.13 +/**
   11.14   * Get the uuid field of the given VTPM.
   11.15   */
   11.16  extern bool
    12.1 --- a/tools/libxen/src/xen_host.c	Thu Nov 09 11:23:09 2006 +0000
    12.2 +++ b/tools/libxen/src/xen_host.c	Thu Nov 09 11:37:35 2006 +0000
    12.3 @@ -150,6 +150,20 @@ xen_host_create(xen_session *session, xe
    12.4  
    12.5  
    12.6  bool
    12.7 +xen_host_destroy(xen_session *session, xen_host host)
    12.8 +{
    12.9 +    abstract_value param_values[] =
   12.10 +        {
   12.11 +            { .type = &abstract_type_string,
   12.12 +              .u.string_val = host }
   12.13 +        };
   12.14 +
   12.15 +    xen_call_(session, "host.destroy", param_values, 1, NULL, NULL);
   12.16 +    return session->ok;
   12.17 +}
   12.18 +
   12.19 +
   12.20 +bool
   12.21  xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label)
   12.22  {
   12.23      abstract_value param_values[] =
    13.1 --- a/tools/libxen/src/xen_host_cpu.c	Thu Nov 09 11:23:09 2006 +0000
    13.2 +++ b/tools/libxen/src/xen_host_cpu.c	Thu Nov 09 11:37:35 2006 +0000
    13.3 @@ -150,6 +150,20 @@ xen_host_cpu_create(xen_session *session
    13.4  
    13.5  
    13.6  bool
    13.7 +xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu)
    13.8 +{
    13.9 +    abstract_value param_values[] =
   13.10 +        {
   13.11 +            { .type = &abstract_type_string,
   13.12 +              .u.string_val = host_cpu }
   13.13 +        };
   13.14 +
   13.15 +    xen_call_(session, "host_cpu.destroy", param_values, 1, NULL, NULL);
   13.16 +    return session->ok;
   13.17 +}
   13.18 +
   13.19 +
   13.20 +bool
   13.21  xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu)
   13.22  {
   13.23      abstract_value param_values[] =
    14.1 --- a/tools/libxen/src/xen_network.c	Thu Nov 09 11:23:09 2006 +0000
    14.2 +++ b/tools/libxen/src/xen_network.c	Thu Nov 09 11:37:35 2006 +0000
    14.3 @@ -148,6 +148,20 @@ xen_network_create(xen_session *session,
    14.4  
    14.5  
    14.6  bool
    14.7 +xen_network_destroy(xen_session *session, xen_network network)
    14.8 +{
    14.9 +    abstract_value param_values[] =
   14.10 +        {
   14.11 +            { .type = &abstract_type_string,
   14.12 +              .u.string_val = network }
   14.13 +        };
   14.14 +
   14.15 +    xen_call_(session, "network.destroy", param_values, 1, NULL, NULL);
   14.16 +    return session->ok;
   14.17 +}
   14.18 +
   14.19 +
   14.20 +bool
   14.21  xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label)
   14.22  {
   14.23      abstract_value param_values[] =
    15.1 --- a/tools/libxen/src/xen_pif.c	Thu Nov 09 11:23:09 2006 +0000
    15.2 +++ b/tools/libxen/src/xen_pif.c	Thu Nov 09 11:37:35 2006 +0000
    15.3 @@ -153,6 +153,20 @@ xen_pif_create(xen_session *session, xen
    15.4  
    15.5  
    15.6  bool
    15.7 +xen_pif_destroy(xen_session *session, xen_pif pif)
    15.8 +{
    15.9 +    abstract_value param_values[] =
   15.10 +        {
   15.11 +            { .type = &abstract_type_string,
   15.12 +              .u.string_val = pif }
   15.13 +        };
   15.14 +
   15.15 +    xen_call_(session, "PIF.destroy", param_values, 1, NULL, NULL);
   15.16 +    return session->ok;
   15.17 +}
   15.18 +
   15.19 +
   15.20 +bool
   15.21  xen_pif_get_name(xen_session *session, char **result, xen_pif pif)
   15.22  {
   15.23      abstract_value param_values[] =
    16.1 --- a/tools/libxen/src/xen_sr.c	Thu Nov 09 11:23:09 2006 +0000
    16.2 +++ b/tools/libxen/src/xen_sr.c	Thu Nov 09 11:37:35 2006 +0000
    16.3 @@ -152,6 +152,20 @@ xen_sr_create(xen_session *session, xen_
    16.4  
    16.5  
    16.6  bool
    16.7 +xen_sr_destroy(xen_session *session, xen_sr sr)
    16.8 +{
    16.9 +    abstract_value param_values[] =
   16.10 +        {
   16.11 +            { .type = &abstract_type_string,
   16.12 +              .u.string_val = sr }
   16.13 +        };
   16.14 +
   16.15 +    xen_call_(session, "SR.destroy", param_values, 1, NULL, NULL);
   16.16 +    return session->ok;
   16.17 +}
   16.18 +
   16.19 +
   16.20 +bool
   16.21  xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label)
   16.22  {
   16.23      abstract_value param_values[] =
    17.1 --- a/tools/libxen/src/xen_user.c	Thu Nov 09 11:23:09 2006 +0000
    17.2 +++ b/tools/libxen/src/xen_user.c	Thu Nov 09 11:37:35 2006 +0000
    17.3 @@ -130,6 +130,20 @@ xen_user_create(xen_session *session, xe
    17.4  
    17.5  
    17.6  bool
    17.7 +xen_user_destroy(xen_session *session, xen_user user)
    17.8 +{
    17.9 +    abstract_value param_values[] =
   17.10 +        {
   17.11 +            { .type = &abstract_type_string,
   17.12 +              .u.string_val = user }
   17.13 +        };
   17.14 +
   17.15 +    xen_call_(session, "user.destroy", param_values, 1, NULL, NULL);
   17.16 +    return session->ok;
   17.17 +}
   17.18 +
   17.19 +
   17.20 +bool
   17.21  xen_user_get_short_name(xen_session *session, char **result, xen_user user)
   17.22  {
   17.23      abstract_value param_values[] =
    18.1 --- a/tools/libxen/src/xen_vbd.c	Thu Nov 09 11:23:09 2006 +0000
    18.2 +++ b/tools/libxen/src/xen_vbd.c	Thu Nov 09 11:37:35 2006 +0000
    18.3 @@ -153,6 +153,20 @@ xen_vbd_create(xen_session *session, xen
    18.4  
    18.5  
    18.6  bool
    18.7 +xen_vbd_destroy(xen_session *session, xen_vbd vbd)
    18.8 +{
    18.9 +    abstract_value param_values[] =
   18.10 +        {
   18.11 +            { .type = &abstract_type_string,
   18.12 +              .u.string_val = vbd }
   18.13 +        };
   18.14 +
   18.15 +    xen_call_(session, "VBD.destroy", param_values, 1, NULL, NULL);
   18.16 +    return session->ok;
   18.17 +}
   18.18 +
   18.19 +
   18.20 +bool
   18.21  xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd)
   18.22  {
   18.23      abstract_value param_values[] =
    19.1 --- a/tools/libxen/src/xen_vdi.c	Thu Nov 09 11:23:09 2006 +0000
    19.2 +++ b/tools/libxen/src/xen_vdi.c	Thu Nov 09 11:37:35 2006 +0000
    19.3 @@ -167,6 +167,20 @@ xen_vdi_create(xen_session *session, xen
    19.4  
    19.5  
    19.6  bool
    19.7 +xen_vdi_destroy(xen_session *session, xen_vdi vdi)
    19.8 +{
    19.9 +    abstract_value param_values[] =
   19.10 +        {
   19.11 +            { .type = &abstract_type_string,
   19.12 +              .u.string_val = vdi }
   19.13 +        };
   19.14 +
   19.15 +    xen_call_(session, "VDI.destroy", param_values, 1, NULL, NULL);
   19.16 +    return session->ok;
   19.17 +}
   19.18 +
   19.19 +
   19.20 +bool
   19.21  xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, char *label)
   19.22  {
   19.23      abstract_value param_values[] =
    20.1 --- a/tools/libxen/src/xen_vif.c	Thu Nov 09 11:23:09 2006 +0000
    20.2 +++ b/tools/libxen/src/xen_vif.c	Thu Nov 09 11:37:35 2006 +0000
    20.3 @@ -157,6 +157,20 @@ xen_vif_create(xen_session *session, xen
    20.4  
    20.5  
    20.6  bool
    20.7 +xen_vif_destroy(xen_session *session, xen_vif vif)
    20.8 +{
    20.9 +    abstract_value param_values[] =
   20.10 +        {
   20.11 +            { .type = &abstract_type_string,
   20.12 +              .u.string_val = vif }
   20.13 +        };
   20.14 +
   20.15 +    xen_call_(session, "VIF.destroy", param_values, 1, NULL, NULL);
   20.16 +    return session->ok;
   20.17 +}
   20.18 +
   20.19 +
   20.20 +bool
   20.21  xen_vif_get_name(xen_session *session, char **result, xen_vif vif)
   20.22  {
   20.23      abstract_value param_values[] =
    21.1 --- a/tools/libxen/src/xen_vm.c	Thu Nov 09 11:23:09 2006 +0000
    21.2 +++ b/tools/libxen/src/xen_vm.c	Thu Nov 09 11:37:35 2006 +0000
    21.3 @@ -280,6 +280,20 @@ xen_vm_create(xen_session *session, xen_
    21.4  
    21.5  
    21.6  bool
    21.7 +xen_vm_destroy(xen_session *session, xen_vm vm)
    21.8 +{
    21.9 +    abstract_value param_values[] =
   21.10 +        {
   21.11 +            { .type = &abstract_type_string,
   21.12 +              .u.string_val = vm }
   21.13 +        };
   21.14 +
   21.15 +    xen_call_(session, "VM.destroy", param_values, 1, NULL, NULL);
   21.16 +    return session->ok;
   21.17 +}
   21.18 +
   21.19 +
   21.20 +bool
   21.21  xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, char *label)
   21.22  {
   21.23      abstract_value param_values[] =
   21.24 @@ -1580,17 +1594,3 @@ xen_vm_get_uuid(xen_session *session, ch
   21.25      *result = session->ok ? xen_strdup_((char *)vm) : NULL;
   21.26      return session->ok;
   21.27  }
   21.28 -
   21.29 -
   21.30 -bool
   21.31 -xen_vm_destroy(xen_session *session, xen_vm vm)
   21.32 -{
   21.33 -    abstract_value param_values[] =
   21.34 -        {
   21.35 -            { .type = &abstract_type_string,
   21.36 -              .u.string_val = vm }
   21.37 -        };
   21.38 -
   21.39 -    xen_call_(session, "VM.destroy", param_values, 1, NULL, NULL);
   21.40 -    return session->ok;
   21.41 -}
    22.1 --- a/tools/libxen/src/xen_vtpm.c	Thu Nov 09 11:23:09 2006 +0000
    22.2 +++ b/tools/libxen/src/xen_vtpm.c	Thu Nov 09 11:37:35 2006 +0000
    22.3 @@ -139,6 +139,20 @@ xen_vtpm_create(xen_session *session, xe
    22.4  
    22.5  
    22.6  bool
    22.7 +xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm)
    22.8 +{
    22.9 +    abstract_value param_values[] =
   22.10 +        {
   22.11 +            { .type = &abstract_type_string,
   22.12 +              .u.string_val = vtpm }
   22.13 +        };
   22.14 +
   22.15 +    xen_call_(session, "VTPM.destroy", param_values, 1, NULL, NULL);
   22.16 +    return session->ok;
   22.17 +}
   22.18 +
   22.19 +
   22.20 +bool
   22.21  xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm)
   22.22  {
   22.23      abstract_value param_values[] =