All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH 04/22] Change to the new enhanced error string format
Date: Mon, 2 Nov 2009 10:52:20 -0600	[thread overview]
Message-ID: <20091102165220.GA32067@us.ibm.com> (raw)
In-Reply-To: <20091102163327.GH14023-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>

Quoting Matt Helsley (matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> On Fri, Oct 30, 2009 at 06:00:26PM -0500, serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org wrote:
> > From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > 
> > Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > ---
> 
> <snip>
> 
> > - * This generates a unified format of checkpoint error messages, to
> > - * ease (after the failure) inspection by userspace tools. It converts
> > - * the (printf) message @fmt into a new format: "[PREFMT]: fmt".
> > + * The special flags are surrounded by %() to help them visually stand
> > + * out.  For instance, %(O) means an objref.  The following special
> > + * flags are recognized:
> > + *	E: error
> > + *	O: objref
> > + *	P: pointer
> > + *	T: task
> > + *	S: string
> > + *	V: variable
> >   *
> 
> Something for the future: It might be good to have "F: File" as well. It
> may sometimes be useful to print out a file name instead of just the struct
> file pointer. It'd be useful for epoll, file checkpoint ops in general, and
> file-backed VMAs.

Sure...  As callers want it, we can add it - I also expect %A for
ctx->active_pid (which won't take an argument) to be added.

...

> > +	for (; *fmt && len < CKPT_MSG_BUFSZ; fmt++) {
> > +		if (*fmt != '%' || fmt[1] != '(' || fmt[2] == '\0' ||
> > +							fmt[3] != ')') {
> > +			s[len++] = *fmt;
> > +			continue;
> > +		}
> > +		if (!first)
> > +			s[len++] = ' ';
> > +		else
> > +			first = 0;
> > +		switch (fmt[2]) {
> > +		case 'E':
> > +			len += sprintf(s+len, "[%s]", "err %d");
> 
> Why not use snprintf ?

Yup, thanks for keeping me honest - just switched my new patchset
to do that.

...

> > +		default:
> > +			printk(KERN_ERR "c/r: bad format specifier %c\n",
> > +					fmt[2]);
> > +			BUG();
> 
> Perhaps BUG() isn't such a good idea since this will be used in

I disagree - this fmt is passed in by the kernel, so if we get a flag
we don't understand, then it is a bug in our c/r code.

-serge

  parent reply	other threads:[~2009-11-02 16:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-30 23:00 [PATCH 00/22] Standardize c/r error reporting (v2) serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <1256943629-4531-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-30 23:00   ` [PATCH 01/22] Make __ckpt_generate_fmt public serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-10-30 23:00   ` [PATCH 02/22] Add format and message buffers to ctx and make err_str bigger serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-10-30 23:00   ` [PATCH 03/22] switch ckpt_generate_err to use ctx fields serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-10-30 23:00   ` [PATCH 04/22] Change to the new enhanced error string format serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <1256943629-4531-5-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-02 16:33       ` Matt Helsley
     [not found]         ` <20091102163327.GH14023-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-11-02 16:52           ` Serge E. Hallyn [this message]
     [not found]             ` <20091102165220.GA32067-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-02 17:10               ` Matt Helsley
2009-11-02 17:34       ` Matt Helsley
2009-10-30 23:00   ` [PATCH 13/22] add logfd to c/r api serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-10-30 23:00   ` [PATCH 14/22] define ckpt_error and implement ckpt_do_write_msg serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-10-30 23:00   ` [PATCH 15/22] explain locking for write_err_msg serue-r/Jw6+rmf7HQT0dZR+AlfA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091102165220.GA32067@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.