From: Matteo Croce <technoboy85@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-mips@linux-mips.org, Felix Fietkau <nbd@openwrt.org>,
Eugene Konev <ejka@imfi.kspu.ru>,
linux-mtd@lists.infradead.org,
Andrew Morton <akpm@linux-foundation.org>,
dwmw2@infradead.org
Subject: Re: [PATCH][MIPS][2/7] AR7: mtd partition map
Date: Thu, 20 Sep 2007 20:34:21 +0200 [thread overview]
Message-ID: <200709202034.21764.technoboy85@gmail.com> (raw)
In-Reply-To: <20070920175204.GA26132@lst.de>
Il Thursday 20 September 2007 19:52:05 hai scritto:
> > +#include <linux/squashfs_fs.h>
>
> As Ralf mentioned this is not in mainline, so you can't include it.
> Fortunately for you including it seems to be a rather dumb idea anyway,
> see below for further comments.
You're right, i'll move the magic into linux/magic.h
> > +static struct mtd_partition ar7_parts[5];
>
> Can we please get a symbolic name for that 5? Then again we only
> seems to use 3 anyway, and create_mtd_partitions returns 4..
we use 4, and bootloader is right, it returns 4
The fourth partition is empty, the kernel formats it as jffs2
when mounting
> > + unsigned int root_offset = 0xe0000;
>
> Please provide a symbolic name for this one.
Ok
> > + printk(KERN_INFO "Parsing AR7 partition map...\n");
>
> Do we really need this printk?
No?
> > + if (header.checksum == 0xfeedfa42)
> > + break;
> > + if (header.checksum == 0xfeed1281)
> > + break;
>
> These two want symbolic names, please:
>
> enum {
> /* some comment */
> FOO_PART_MAGIC = 0xfeedfa42,
>
> /* more comment */
> BAR_PART_MAGIC = 0xfeed1281,
> };
>
> > + switch (header.checksum) {
> > + case 0xfeedfa42:
> > + while (header.length) {
> > + offset += sizeof(header) + header.length;
> > + master->read(master, offset, sizeof(header),
> > + &len, (u_char *)&header);
> > + }
> > + root_offset = offset + sizeof(header) + 4;
> > + break;
> > + case 0xfeed1281:
>
> Especially as you use them here again.
Right, will do
> > + default:
> > + printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum);
> > + break;
> > + }
> > +
> > + master->read(master, root_offset,
> > + sizeof(header), &len, (u_char *)&header);
> > + if (header.checksum != SQUASHFS_MAGIC) {
> > + root_offset += master->erasesize - 1;
> > + root_offset &= ~(master->erasesize - 1);
> > + }
>
> And after this I'm pretty sure either of the two hex constants above
> is SQUASHFS_MAGIC. But not actually the magic in the squashfs
> superblock, but someone decided to reuse it for the partitions magic.
> So one of the comments for *_PART_MAGIC becomes:
>
> /* same as SQUASHFS_MAGIC for some odd reason.. */
No. There are MIPS instructions. We look for the loader
start offset since it is in the first partition
next prev parent reply other threads:[~2007-09-20 18:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200709201728.10866.technoboy85@gmail.com>
2007-09-20 15:55 ` [PATCH][MIPS][2/7] AR7: mtd partition map Matteo Croce
2007-09-20 16:53 ` Ralf Baechle
2007-09-20 17:52 ` Christoph Hellwig
2007-09-20 18:34 ` Matteo Croce [this message]
2007-09-20 19:29 ` Matteo Croce
2007-09-20 19:35 ` Christoph Hellwig
2007-09-20 20:00 ` Jörn Engel
2007-09-21 2:09 ` Matteo Croce
2007-09-21 2:20 ` Jörn Engel
2007-09-21 8:03 ` Christoph Hellwig
2007-09-21 8:18 ` Geert Uytterhoeven
[not found] <200709080143.12345.technoboy85@gmail.com>
2007-09-08 0:19 ` Matteo Croce
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=200709202034.21764.technoboy85@gmail.com \
--to=technoboy85@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=ejka@imfi.kspu.ru \
--cc=hch@lst.de \
--cc=linux-mips@linux-mips.org \
--cc=linux-mtd@lists.infradead.org \
--cc=nbd@openwrt.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