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 01/12] define a new set of functions for error and debug logging
Date: Mon, 2 Nov 2009 20:39:59 -0600 [thread overview]
Message-ID: <20091103023959.GA19697@us.ibm.com> (raw)
In-Reply-To: <20091102232439.GK14023-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
Quoting Matt Helsley (matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> On Mon, Nov 02, 2009 at 04:23:29PM -0600, serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org wrote:
> > From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
...
> I haven't gotten through the series but this looks like either a stale
> comment (re: "ctx->fmt_buf_lock"), or it's premature -- I don't see you
> introduce or use this lock in this patch.
Yup, stale comment, thanks. No fmt_buf_lock this time around.
> > + */
> > +void _ckpt_generate_fmt(struct ckpt_ctx *ctx, char *fmt)
> > +{
> > + char *s = ctx->fmt;
> > + int len = 0;
> > + int first = 1;
> > +
> > + for (; *fmt && len < CKPT_MSG_LEN; fmt++) {
> > + if (!is_special_flag(fmt)) {
> > + s[len++] = *fmt;
> > + continue;
> > + }
> > + if (!first)
> > + s[len++] = ' ';
> > + else
> > + first = 0;
>
> I'm tempted to say leave the space out. The square brackets delimit
> these enough. And if the caller really needs the space then it can be
> done: "%(E) %(O)foo".
Works for me.
> > +void _ckpt_msg_append(struct ckpt_ctx *ctx, char *fmt, ...)
> > +{
> > + va_list ap;
> > +
> > + va_start(ap, fmt);
> > + _ckpt_msg_appendv(ctx, fmt, ap);
> > + va_end(ap);
> > +}
> > +
> > +void _ckpt_msg_complete(struct ckpt_ctx *ctx)
> > +{
> > + int ret;
>
> In the case of do_ckpt_msg() it's clear this won't happen. However
> since _do_ckpt_msg() is separate from _ckpt_msg_complete() (looking
> at the second patch) it's not clear that this will always be maintained
> correctly.
>
> BUG_ON(ctx->msglen < 1); /* detect msg_complete calls without any
> messages */
Well, just return if ctx->msglen < 1, but point taken, will fix.
>
> > +
> > + if (ctx->kflags & CKPT_CTX_CHECKPOINT) {
> > + ret = ckpt_write_obj_type(ctx, NULL, 0, CKPT_HDR_ERROR);
> > + if (!ret)
> > + ret = ckpt_write_string(ctx, ctx->msg, ctx->msglen);
> > + if (ret < 0)
> > + printk(KERN_NOTICE "c/r: error string unsaved (%d): %s\n",
> > + ret, ctx->msg+1);
> > + }
> > +#if 0
> > + if (ctx->logfile) {
> > + mm_segment_t fs = get_fs();
> > + set_fs(KERNEL_DS);
> > + ret = _ckpt_kwrite(ctx->logfile, ctx->msg+1, ctx->msglen-1);
> > + set_fs(fs);
> > + }
> > +#endif
> > +#ifdef CONFIG_CHECKPOINT_DEBUG
> > + printk(KERN_DEBUG "%s", ctx->msg+1);
> > +#endif
>
> Then clear:
>
> ctx->msglen = 0;
>
> <snip>
>
> > +/*
> > + * Expand fmt into ctx->fmt.
> > + * This expands enhanced format flags such as %(T), which takes no
> > + * arguments, and %(E), which will require a properly positioned
> > + * int error argument. Flags include:
> > + * T: Task
> > + * E: Errno
> > + * O: Objref
> > + * P: Pointer
> > + * S: string
> > + * V: Variable (symbol)
> > + * May be called under spinlock.
> > + * Must be called under ckpt_msg_lock.
> > + */
> > +extern void _ckpt_generate_fmt(struct ckpt_ctx *ctx, char *fmt);
>
> I'm not seeing why this is needed outside checkpoint/sys.c. In a future
> patch?
Hmm, no... in an earlier patchset. I don't think there will be any
external callers of this fn. Should be static.
> > +#define _ckpt_err(ctx, fmt, args...) do { \
> > + _do_ckpt_msg(ctx, "[ error %s:%d]" fmt, __func__, __LINE__, ##args); \
> > +} while (0)
> > +
> > +/* ckpt_logmsg() or ckpt_msg() will do do_ckpt_msg with an added
> > + * prefix */
>
> nit: This comment is about future code. It should perhaps be part of
> the patch description rather than in the code as comment.
Sure - and if there are no basic objectiosn then apart from addressing
these I'll also aim to put some meaningful ckpt_errs() on restart failure
paths tomorrow.
thanks,
-serge
next prev parent reply other threads:[~2009-11-03 2:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-02 22:23 [PATCH 00/12] Standardize c/r error reporting (v3) serue-r/Jw6+rmf7HQT0dZR+AlfA
[not found] ` <1257200620-15499-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-02 22:23 ` [PATCH 01/12] define a new set of functions for error and debug logging serue-r/Jw6+rmf7HQT0dZR+AlfA
[not found] ` <1257200620-15499-2-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-02 23:24 ` Matt Helsley
[not found] ` <20091102232439.GK14023-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-11-03 2:39 ` Serge E. Hallyn [this message]
[not found] ` <20091103023959.GA19697-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-03 7:24 ` Matt Helsley
2009-11-03 16:58 ` Oren Laadan
2009-11-02 22:23 ` [PATCH 02/12] switch ckpt_write_err callers to ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 03/12] checkpoint/files.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 04/12] checkpoint/memory.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 05/12] checkpoint/objhash.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 06/12] checkpoint/process.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 07/12] checkpoint/signal.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 08/12] drivers/char/tty_io.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 09/12] fs/eventpoll.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 10/12] net/{,unix}/checkpoint.c ckpt_write_err->ckpt_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 11/12] remove ckpt_write_err serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-02 22:23 ` [PATCH 12/12] add logfd to c/r api serue-r/Jw6+rmf7HQT0dZR+AlfA
2009-11-03 16:51 ` [PATCH 00/12] Standardize c/r error reporting (v3) Oren Laadan
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=20091103023959.GA19697@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.