[09/15] libxl_domain: Cleanup libxl__destroy_domid
diff mbox series

Message ID 20190614112444.29980-10-anthony.perard@citrix.com
State New
Headers show
Series
  • Some cleanup of libxl
Related show

Commit Message

Anthony PERARD June 14, 2019, 11:24 a.m. UTC
- dom_path isn't used anymore in that function, remove it.
- Use `r' to store return value of external calls.
- Use `CTX', no need for a local `ctx'.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl_domain.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

Comments

Ian Jackson Sept. 17, 2019, 4:42 p.m. UTC | #1
Anthony PERARD writes ("[PATCH 09/15] libxl_domain: Cleanup libxl__destroy_domid"):
> - dom_path isn't used anymore in that function, remove it.
> - Use `r' to store return value of external calls.
> - Use `CTX', no need for a local `ctx'.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Patch
diff mbox series

diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index aee621b0a5..11a29b235b 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -1023,14 +1023,13 @@  static void domain_destroy_domid_cb(libxl__egc *egc,
 void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
 {
     STATE_AO_GC(dis->ao);
-    libxl_ctx *ctx = CTX;
     uint32_t domid = dis->domid;
-    char *dom_path;
     int rc, dm_present;
+    int r;
 
     libxl__ev_child_init(&dis->destroyer);
 
-    rc = libxl_domain_info(ctx, NULL, domid);
+    rc = libxl_domain_info(CTX, NULL, domid);
     switch(rc) {
     case 0:
         break;
@@ -1058,17 +1057,12 @@  void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
         abort();
     }
 
-    dom_path = libxl__xs_get_dompath(gc, domid);
-    if (!dom_path) {
-        rc = ERROR_FAIL;
-        goto out;
-    }
-
     if (libxl__device_pci_destroy_all(gc, domid) < 0)
         LOGD(ERROR, domid, "Pci shutdown failed");
-    rc = xc_domain_pause(ctx->xch, domid);
-    if (rc < 0) {
-        LOGEVD(ERROR, rc, domid, "xc_domain_pause failed");
+    r = xc_domain_pause(CTX->xch, domid);
+    if (r < 0) {
+        LOGEVD(ERROR, r, domid, "xc_domain_pause failed");
+        rc = ERROR_FAIL;
     }
 
     if (dm_present) {