Skip to contentSkip to conversation

libxc: use xc_dom_panic when decompressor is not supported

PATCH In review Wei Liu 3 participants 3 messages Mar 6, 2015 – Mar 11, 2015

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxc: use xc_dom_panic when decompressor is not supported

State explicitly that specific decompressor is not supported by libxc. Without this change, libxc error message only says the provided kernel is invalid, which is misleading.

---
 tools/libxc/xc_dom_bzimageloader.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
tools/libxc/xc_dom_bzimageloader.c +12 -8
index 964ebdc..3bb17dd 100644
@@ -185,8 +185,9 @@ static int xc_try_bzip2_decode(
 static int xc_try_bzip2_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: BZIP2 decompress support unavailable",
-              __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: BZIP2 decompress support unavailable",
+                 __FUNCTION__);
     return -1;
 }
 
@@ -367,16 +368,18 @@ static int xc_try_lzma_decode(
 static int xc_try_xz_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: XZ decompress support unavailable",
-              __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: XZ decompress support unavailable",
+                 __FUNCTION__);
     return -1;
 }
 
 static int xc_try_lzma_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: LZMA decompress support unavailable",
-              __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: LZMA decompress support unavailable",
+                 __FUNCTION__);
     return -1;
 }
 
@@ -577,8 +580,9 @@ static int xc_try_lzo1x_decode(
 static int xc_try_lzo1x_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: LZO1x decompress support unavailable\n",
-                  __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: LZO1x decompress support unavailable\n",
+                 __FUNCTION__);
     return -1;
 }
 
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Wei Liu

State explicitly that specific decompressor is not supported by libxc. Without this change, libxc error message only says the provided kernel is invalid, which is misleading.

I did the triage of this issue when reported on #xen. xl -vvv create... does eventually reveal the issue, where xl create gives an incorrect error message.

(although s/__FUNCTION__/__func__/ to be more C99 if you have cause to resubmit)

Quoted 55 lines
---
 tools/libxc/xc_dom_bzimageloader.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
tools/libxc/xc_dom_bzimageloader.c +12 -8
index 964ebdc..3bb17dd 100644
@@ -185,8 +185,9 @@ static int xc_try_bzip2_decode(
 static int xc_try_bzip2_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: BZIP2 decompress support unavailable",
-              __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: BZIP2 decompress support unavailable",
+                 __FUNCTION__);
     return -1;
 }
 
@@ -367,16 +368,18 @@ static int xc_try_lzma_decode(
 static int xc_try_xz_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: XZ decompress support unavailable",
-              __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: XZ decompress support unavailable",
+                 __FUNCTION__);
     return -1;
 }
 
 static int xc_try_lzma_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: LZMA decompress support unavailable",
-              __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: LZMA decompress support unavailable",
+                 __FUNCTION__);
     return -1;
 }
 
@@ -577,8 +580,9 @@ static int xc_try_lzo1x_decode(
 static int xc_try_lzo1x_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
 {
-    DOMPRINTF("%s: LZO1x decompress support unavailable\n",
-                  __FUNCTION__);
+    xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                 "%s: LZO1x decompress support unavailable\n",
+                 __FUNCTION__);
     return -1;
 }
 
#2 lore raw
Quoted 11 lines · Andrew Cooper
Quoted 8 lines · Wei Liu

State explicitly that specific decompressor is not supported by libxc. Without this change, libxc error message only says the provided kernel is invalid, which is misleading.

Acked + applied.

Quoted 6 lines

I did the triage of this issue when reported on #xen. xl -vvv create... does eventually reveal the issue, where xl create gives an incorrect error message.

(although s/__FUNCTION__/__func__/ to be more C99 if you have cause to resubmit)

FWIW this whole file uses __FUNCTION__, probably would be better to do xc_dom_* in a big sweep instead of piecemeal. In any case I haven't waited for a resubmit.