Re: [PATCH 1/2] have e2fsck/problem.c verify problem.h error codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 27, 2009  22:08 -0400, Theodore Ts'o wrote:
> 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)

I was wondering the same, but that would involve a huge amount of
code churn and it probably isn't something you'd accept from someone
else in the end...  It would still likely be desirable to have some
indicator of which phase the problem is related to.

> ... 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

Sure, but my patch exists now, and doesn't add any overhead to the
runtime.  The fact that the test keeps the table sorted also allows
the ability to do a binary search on the table, should we want to.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux