[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/6] tools/xenstored: use atexit to close interfaces



On 17.09.21 17:46, Roger Pau Monne wrote:
Exploiting the talloc clean up routines to close the Xen interfaces
is cumbersome, specially when atexit can be used to the same effect.

Convert xc and gnttab to use atexit which allows to drop one
indirection from the storing variables.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
  tools/xenstore/xenstored_core.h   |  2 +-
  tools/xenstore/xenstored_domain.c | 57 +++++++++++++------------------
  2 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/tools/xenstore/xenstored_domain.c 
b/tools/xenstore/xenstored_domain.c
index 47e9107c14..8930303773 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -737,35 +725,38 @@ void dom0_init(void)
        xenevtchn_notify(xce_handle, dom0->port);
  }
+void interface_cleanup(void)
+{
+       if (xc_handle) {
+               xc_interface_close(xc_handle);
+               xc_handle = NULL;
+       }
+       if (xgt_handle) {
+               xengnttab_close(xgt_handle);
+               xgt_handle = NULL;
+       }

Could you please add closing of xce_handle(), too?


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.