All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] tools/libxc: Correct read_exact() error messages
@ 2014-01-07 10:04 Andrew Cooper
  2014-01-08 14:20 ` Ian Campbell
  2014-01-09 15:49 ` Ian Campbell
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cooper @ 2014-01-07 10:04 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell

The errors have been incorrectly identifying their function since c/s
861aef6e1558bebad8fc60c1c723f0706fd3ed87 which did a lot of error handling
cleanup.

Use __func__ to ensure the name remains correct in the future.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxc/xc_domain_restore.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 80769a7..ca2fb51 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -87,7 +87,7 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
             if ( len == -1 && errno == EINTR )
                 continue;
             if ( !FD_ISSET(fd, &rfds) ) {
-                ERROR("read_exact_timed failed (select returned %zd)", len);
+                ERROR("%s failed (select returned %zd)", __func__, len);
                 errno = ETIMEDOUT;
                 return -1;
             }
@@ -101,7 +101,7 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
             errno = 0;
         }
         if ( len <= 0 ) {
-            ERROR("read_exact_timed failed (read rc: %d, errno: %d)", len, errno);
+            ERROR("%s failed (read rc: %d, errno: %d)", __func__, len, errno);
             return -1;
         }
         offset += len;
-- 
1.7.10.4

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

* Re: [Patch] tools/libxc: Correct read_exact() error messages
  2014-01-07 10:04 [Patch] tools/libxc: Correct read_exact() error messages Andrew Cooper
@ 2014-01-08 14:20 ` Ian Campbell
  2014-01-08 14:38   ` Andrew Cooper
  2014-01-09 15:49 ` Ian Campbell
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2014-01-08 14:20 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ian Jackson, Xen-devel

On Tue, 2014-01-07 at 10:04 +0000, Andrew Cooper wrote:
> The errors have been incorrectly identifying their function since c/s
> 861aef6e1558bebad8fc60c1c723f0706fd3ed87 which did a lot of error handling
> cleanup.
> 
> Use __func__ to ensure the name remains correct in the future.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>

A simple string change seems harmless from a release PoV, so on that
front 
Release-Acked-by: Ian Campbell.

For the actual change though, most uses of ERROR in this function just
have a descriptive error without the function name. If we are going to
change it then I'm not convinced "rdexact failed..." is as useful as
something like "Failed to read exactly %d bytes (select returned...)".
Other thoughts?

(that said, I'm still somewhat inclined to just bung this one in...)

Ian.

> ---
>  tools/libxc/xc_domain_restore.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
> index 80769a7..ca2fb51 100644
> --- a/tools/libxc/xc_domain_restore.c
> +++ b/tools/libxc/xc_domain_restore.c
> @@ -87,7 +87,7 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
>              if ( len == -1 && errno == EINTR )
>                  continue;
>              if ( !FD_ISSET(fd, &rfds) ) {
> -                ERROR("read_exact_timed failed (select returned %zd)", len);
> +                ERROR("%s failed (select returned %zd)", __func__, len);
>                  errno = ETIMEDOUT;
>                  return -1;
>              }
> @@ -101,7 +101,7 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
>              errno = 0;
>          }
>          if ( len <= 0 ) {
> -            ERROR("read_exact_timed failed (read rc: %d, errno: %d)", len, errno);
> +            ERROR("%s failed (read rc: %d, errno: %d)", __func__, len, errno);
>              return -1;
>          }
>          offset += len;

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

* Re: [Patch] tools/libxc: Correct read_exact() error messages
  2014-01-08 14:20 ` Ian Campbell
@ 2014-01-08 14:38   ` Andrew Cooper
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2014-01-08 14:38 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ian Jackson, Xen-devel

On 08/01/14 14:20, Ian Campbell wrote:
> On Tue, 2014-01-07 at 10:04 +0000, Andrew Cooper wrote:
>> The errors have been incorrectly identifying their function since c/s
>> 861aef6e1558bebad8fc60c1c723f0706fd3ed87 which did a lot of error handling
>> cleanup.
>>
>> Use __func__ to ensure the name remains correct in the future.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> CC: Ian Campbell <Ian.Campbell@citrix.com>
>> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> A simple string change seems harmless from a release PoV, so on that
> front 
> Release-Acked-by: Ian Campbell.
>
> For the actual change though, most uses of ERROR in this function just
> have a descriptive error without the function name. If we are going to
> change it then I'm not convinced "rdexact failed..." is as useful as
> something like "Failed to read exactly %d bytes (select returned...)".
> Other thoughts?
>
> (that said, I'm still somewhat inclined to just bung this one in...)
>
> Ian.

When triaging problems after-the-fact from logfiles along, a lack of
file/line/function references is often makes debugging harder than it
should be.

In the specific case I encountered, the error as was sufficed for
working out what had gone wrong (an -EIO).

I would possibly throw it straight in now, with a note that there needs
to be some consistency applied to the error reporting in this and other
areas of libxc.

~Andrew

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

* Re: [Patch] tools/libxc: Correct read_exact() error messages
  2014-01-07 10:04 [Patch] tools/libxc: Correct read_exact() error messages Andrew Cooper
  2014-01-08 14:20 ` Ian Campbell
@ 2014-01-09 15:49 ` Ian Campbell
  2014-03-14 14:25   ` Ian Jackson
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2014-01-09 15:49 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ian Jackson, Xen-devel

On Tue, 2014-01-07 at 10:04 +0000, Andrew Cooper wrote:
> The errors have been incorrectly identifying their function since c/s
> 861aef6e1558bebad8fc60c1c723f0706fd3ed87 which did a lot of error handling
> cleanup.
> 
> Use __func__ to ensure the name remains correct in the future.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Ian Campbell <Ian.Campbell@citrix.com>

Acked + applied, thanks.

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

* Re: [Patch] tools/libxc: Correct read_exact() error messages
  2014-01-09 15:49 ` Ian Campbell
@ 2014-03-14 14:25   ` Ian Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2014-03-14 14:25 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Andrew Cooper, Xen-devel

Ian Campbell writes ("Re: [Xen-devel] [Patch] tools/libxc: Correct read_exact() error messages"):
> On Tue, 2014-01-07 at 10:04 +0000, Andrew Cooper wrote:
> > The errors have been incorrectly identifying their function since c/s
> > 861aef6e1558bebad8fc60c1c723f0706fd3ed87 which did a lot of error handling
> > cleanup.
> > 
> > Use __func__ to ensure the name remains correct in the future.
> > 
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > CC: Ian Campbell <Ian.Campbell@citrix.com>
> 
> Acked + applied, thanks.

Backported to 4.3 and 4.2.

Ian.

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

end of thread, other threads:[~2014-03-14 14:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07 10:04 [Patch] tools/libxc: Correct read_exact() error messages Andrew Cooper
2014-01-08 14:20 ` Ian Campbell
2014-01-08 14:38   ` Andrew Cooper
2014-01-09 15:49 ` Ian Campbell
2014-03-14 14:25   ` Ian Jackson

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.