linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Andreas Dilger <adilger@sun.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] have e2fsck/problem.c verify problem.h error codes
Date: Mon, 27 Apr 2009 22:08:05 -0400	[thread overview]
Message-ID: <20090428020805.GF22104@mit.edu> (raw)
In-Reply-To: <20090427225924.GG3209@webber.adilger.int>

On Mon, Apr 27, 2009 at 04:59:24PM -0600, Andreas Dilger wrote:
> We've hit a number of cases where the error codes in problem.h have
> been assigned duplicate values compared to problems in our own e2fsck
> patches, and this can lead to confusing and difficult to find bugs
> in e2fsck (e.g. wrong problem messages, incorrect repair action, etc).
> 
> Attached is a test case for the problem.c file to ensure that the
> problem table is sorted and does not contain any duplicate values.
> Having the problem table sorted allows the correctness checking to be
> very simple, and if it ever became important for performance we could
> use binary searching of the problem table for the specific problem code.

Hmm, I wonder if we should be doing this a different way.  Maybe what
we should do is to have a single file, call it problem_codes.in, that
has a format somewhat like this:

DEFINE_PROBLEM(PR_1_ROOT_NO_DIR, 0x010001, "@r is not a @d.  ", 
	       PROMPT_CLEAR, 0)

... which then generates problem_code.h and problem_code.c.  That way
there is a single place where these things are defined, and it
wouldn't be that hard to create a perl script which looks for multiply
assigned problem assignments.

In the short term, we can also code up the test script much more
simply:

awk '/^#define/ {print $3}' < e2fsck/problem.h   | sort | uniq -d

    		       	      			   - Ted

  reply	other threads:[~2009-04-28  2:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 22:59 [PATCH 1/2] have e2fsck/problem.c verify problem.h error codes Andreas Dilger
2009-04-28  2:08 ` Theodore Tso [this message]
2009-04-28 19:03   ` Andreas Dilger
2009-05-03  1:11     ` Theodore Tso

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=20090428020805.GF22104@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger@sun.com \
    --cc=linux-ext4@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).