* Should MTD_WRITEABLE be split into MTD_WRITEABLE and MTD_ERASEABLE?
@ 2008-09-22 19:03 Jim Ramsay
2008-09-23 15:27 ` Mike Frysinger
0 siblings, 1 reply; 2+ messages in thread
From: Jim Ramsay @ 2008-09-22 19:03 UTC (permalink / raw)
To: linux-mtd
[-- Attachment #1: Type: text/plain, Size: 1834 bytes --]
Currently, MTD partitions that do not begin and end exactly on an erase
sector boundary are forced to be read-only (The MTD_WRITEABLE flag is
forcibly removed). I understand that this is required so that you
don't try to erase that partition and accidentally blow away other
information on other partitions that may also share the erase sector.
However, in the case of embedded systems, it can be very useful to
create a very small MTD partition for a simple write-once facility
(such as for capturing part of a log file or crash dump), and this
check makes such a partition impossible - Even if the code that
actually adds the partition is clever enough to properly erase that
area of flash before adding it. There is no technical reason of which
I am aware that prevents normal mtd_write code from working on a small
non-erase-aligned partition if it has been previously erased.
So I would suggest that splitting MTD_WRITEABLE into two flags,
MTD_WRITEABLE and MTD_ERASEABLE would be a good idea. The current
check for erase boundaries would then only remove MTD_ERASEABLE, whereas
MTD_WRITEABLE could still be removed via the mtd_partition.mask_flags
when required.
Would this have more side-effects than I currently understand? Or would
it be a useful feature that may be considered for inclusion into MTD if
I were to write up a patch?
The other possibility, which is my current workaround, just adds a
special flag (MTD_UNALIGNED) which when found in
mtd_partition.mask_flags, skips the check erase boundary alignment
checks and allows these small partitions to be writeable. However, I'm
not sure what would happen if I tried to erase this small partition, so
I think splitting the WRITEABLE flag is a much more proper solution.
--
Jim Ramsay
"Me fail English? That's unpossible!"
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Should MTD_WRITEABLE be split into MTD_WRITEABLE and MTD_ERASEABLE?
2008-09-22 19:03 Should MTD_WRITEABLE be split into MTD_WRITEABLE and MTD_ERASEABLE? Jim Ramsay
@ 2008-09-23 15:27 ` Mike Frysinger
0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2008-09-23 15:27 UTC (permalink / raw)
To: Jim Ramsay; +Cc: linux-mtd
On Mon, Sep 22, 2008 at 15:03, Jim Ramsay wrote:
> Currently, MTD partitions that do not begin and end exactly on an erase
> sector boundary are forced to be read-only (The MTD_WRITEABLE flag is
> forcibly removed). I understand that this is required so that you
> don't try to erase that partition and accidentally blow away other
> information on other partitions that may also share the erase sector.
>
> However, in the case of embedded systems, it can be very useful to
> create a very small MTD partition for a simple write-once facility
> (such as for capturing part of a log file or crash dump), and this
> check makes such a partition impossible - Even if the code that
> actually adds the partition is clever enough to properly erase that
> area of flash before adding it. There is no technical reason of which
> I am aware that prevents normal mtd_write code from working on a small
> non-erase-aligned partition if it has been previously erased.
>
> So I would suggest that splitting MTD_WRITEABLE into two flags,
> MTD_WRITEABLE and MTD_ERASEABLE would be a good idea. The current
> check for erase boundaries would then only remove MTD_ERASEABLE, whereas
> MTD_WRITEABLE could still be removed via the mtd_partition.mask_flags
> when required.
if you split it into MTD_ERASEABLE and MTD_APPENDABLE, then you could
keep compatibility with:
#define MTD_WRITABLE (MTD_ERASEABLE | MTD_APPENDABLE)
otherwise you just volunteered to update every single
board/driver/core out there that is using MTD_WRITABLE
-mike
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-23 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 19:03 Should MTD_WRITEABLE be split into MTD_WRITEABLE and MTD_ERASEABLE? Jim Ramsay
2008-09-23 15:27 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox