[Ocfs2-tools-devel] [PATCH 1/1] Ocfs2-tools: Define new corrupt code to make it compatible with fsck.ocfs2.
Joel Becker
Joel.Becker at oracle.com
Mon Jun 8 14:36:46 PDT 2009
On Mon, Jun 08, 2009 at 06:50:15PM +0800, Tristan Ye wrote:
> In main.c, we redefine the corrupt_codes array to let it become FSCK_TYPE specific,
> which can be provided as comma-separated-values string to fswreck binary.
>
> As our goal is to change the logic of corrupt operation as few as possible, their
> associated handling funcs will still use former corrupt_* func family.
>
Almost there. A couple things.
> +#define define_prompt_code(_type, _func, _desc) \
> + [_type] = { \
> + .type = _type, \
> + .str = #_type, \
> + .func = _func, \
> + .desc = _desc, \
> + }
Don't define this in main.h, it's not needed outside of main.c.
See below for what I mean.
> +struct prompt_code {
> +
> + enum fsck_type type;
> + char *str;
> + void (*func)(ocfs2_filesys *fs, enum fsck_type code, uint16_t slotnum);
> char *desc;
> };
Define 'define_prompt_code()' right here. Then after the close
of the prompt_codes array, #undef it. It's a convenience macro for the
prompt_codes array, and doesn't need to be visible anywhere else.
> +static struct prompt_code prompt_codes[NUM_FSCK_TYPE] = {
> +
> + define_prompt_code(EB_BLKNO, corrupt_file,
> + "Corrupt an extent block's eb_blkno field"),
The descriptions are much better. The rest of the patch is
fine.
Joel
--
Life's Little Instruction Book #335
"Every so often, push your luck."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list