[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090428020805.GF22104@mit.edu>
Date: Mon, 27 Apr 2009 22:08:05 -0400
From: Theodore Tso <tytso@....edu>
To: Andreas Dilger <adilger@....com>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 1/2] have e2fsck/problem.c verify problem.h error codes
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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists