Trying to pass kernel command line arguments to block2mtd at boot-time does
not work currently. block2mtd_setup() is called so early that kmalloc()
fails nevermind being able to do open_bdev_excl() (which requires rootfs to
be mounted. This patch only saves the option string at the early boot stage,
and parses them later when block2mtd_init() is called. If open_bdev_excl()
fails, open_by_devnum(name_to_dev_t()) is tried instead, which makes it
possible to initialize the driver before rootfs has been mounted. Also gets
rid of the superfluous parse_name() that only checks if name is longer than
80 chars and copies it to a string that is not kfreed.
With this patch, I can boot statically compiled block2mtd, and mount jffs2
as rootfs (without modules or initrd), with lilo config like this:
root=/dev/mtdblock0
append="rootfstype=jffs2 block2mtd.block2mtd=/dev/hdc2,65536"
(Note that rootfstype=jffs2 is required, since the kernel only tries
filesystems without "nodev" attribute by default, and jffs is "nodev").
Compared to first version of this patch, this one does not copy the
parameters to the global buffer if init has already been called, and the
global array is marked as __initdata.
Compared to the second version of this patch, module build is fixed.
Compared to the third version of this patch, statically compiled block2mtd
driver with no boot-time parameter no longer gives spurious error 'cannot
open device ""'
Signed-off-by: Ville Herva <vherva@vianova.fi>
Acked-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Let's not attempt the abolition of mtd->type until/unless it's properly
thought through. And certainly, let's not do it by halves.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Ram devices get the extra capability of MTD_NO_ERASE - not requiring
an explicit erase before writing to it. Currently only mtdblock uses
this capability. Rest of the patch is a simple text replacement.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Removing readv from struct mtd_info broke block2mtd. Remove the
reference and the useless default implementation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
There's a mem leak in drivers/mtd/devices/block2mtd.c::block2mtd_setup()
We can leak 'name' allocated with kmalloc in 'parse_name' if leave via
the 'parse_err' macro since it contains a return but doesn't do any
freeing.
Spotted by coverity checker as bug 615.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Expand the parameter parsing for block2mtd. It now accepts:
Ki, Mi, Gi - the official prefixes for binary multiples,
see http://physics.nist.gov/cuu/Units/binary.html,
ki - mistake on my side and analog to "k" for decimal multiples,
KiB, MiB, GiB - for people that prefer to add a "B" for byte,
kiB - combination of the above.
There were complaints about not accepting "k" for 1024. This has long
been common practice, but is known to lead to confusion. Hence the new
SI units and hence block2mtd only accepts units that cannot be confused
with decimal units. Diverging from common practice doesn't always please
people, even if the change is for the better.
Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch contains the following possible cleanups:
- every file should #include the headers containing the prototypes for
it's global functions
- make needlessly global functions static
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
- Remove Gareth from the Copyrights (at his own request)
- Fix the "fscking embarrassment"
Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!