partt partition table parser
David Woodhouse
dwmw2 at infradead.org
Tue Oct 2 16:20:54 EDT 2001
In general, it looks relatively sane. Can you justify the use of
CONFIG_MTD_PARTT_INDIRECT?
What systems use this partition table format?
> +++ mtd/util/mkpartt.c Tue Sep 25 20:15:58 2001
> +#include "/usr/src/linux/include/linux/mtd/ibmpartt.h"
No. Pull the definitions into the C file or take a copy. Don't look too
hard at the mkfs.jffs2 code - do as I say, not as I do :)
> +void x_order_32 (__u32 *old32)
> +{
> + __u32 new32;
> + __u8 *new8 = (__u8*)&new32;
> + __u8 *old8 = (__u8*)old32;
> + new8[0] = old8[3];
> + new8[1] = old8[2];
> + new8[2] = old8[1];
> + new8[3] = old8[0];
> + *old32 = new32;
> +}
That's going to break. In the kernel, we compile with -fno-strict-aliasing
just because we've always had evil code there and nobody's yet looked too
hard at cleaning it up. For userspace, we need to write real C code.
> + columns = sscanf (buf, " %20s %x %x %x", /* FIXME: Replace 20 with NAME_MAX_LEN */
"%" #NAME_MAX_LEN "s %x %x %x"
How about making big-endian and little-endian options too, instead of just
cross-endian?
--
dwmw2
More information about the linux-mtd
mailing list