All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/libxc: Identify problematic file in error messages
@ 2015-12-07 13:09 Andrew Cooper
  2015-12-08 17:20 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2015-12-07 13:09 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Wei Liu

Error messages along the lines of:

   xc: error: panic: xc_dom_core.c:207: failed to open file: No such file or
   directory: Internal error

are of very little use.

Include the filename in the error messages, so the user does not have to
resort to debug level logging to identify the problem.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxc/xc_dom_core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 841e7dc..2061ba6 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -203,16 +203,16 @@ void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
     fd = open(filename, O_RDONLY);
     if ( fd == -1 ) {
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
-                     "failed to open file: %s",
-                     strerror(errno));
+                     "failed to open file '%s': %s",
+                     filename, strerror(errno));
         goto err;
     }
 
     if ( (lseek(fd, 0, SEEK_SET) == -1) ||
          ((offset = lseek(fd, 0, SEEK_END)) == -1) ) {
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
-                     "failed to seek on file: %s",
-                     strerror(errno));
+                     "failed to seek on file '%s': %s",
+                     filename, strerror(errno));
         goto err;
     }
 
@@ -239,8 +239,8 @@ void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
                            MAP_SHARED, fd, 0);
     if ( block->ptr == MAP_FAILED ) {
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
-                     "failed to mmap file: %s",
-                     strerror(errno));
+                     "failed to mmap file '%s': %s",
+                     filename, strerror(errno));
         goto err;
     }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools/libxc: Identify problematic file in error messages
  2015-12-07 13:09 [PATCH] tools/libxc: Identify problematic file in error messages Andrew Cooper
@ 2015-12-08 17:20 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2015-12-08 17:20 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel; +Cc: Wei Liu, Ian Jackson

On Mon, 2015-12-07 at 13:09 +0000, Andrew Cooper wrote:
> Error messages along the lines of:
> 
>    xc: error: panic: xc_dom_core.c:207: failed to open file: No such file
> or
>    directory: Internal error
> 
> are of very little use.
> 
> Include the filename in the error messages, so the user does not have to
> resort to debug level logging to identify the problem.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked + applied.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-08 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 13:09 [PATCH] tools/libxc: Identify problematic file in error messages Andrew Cooper
2015-12-08 17:20 ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.