* Userspace write to UBI partitions
@ 2012-02-07 15:20 Ricard Wanderlof
2012-02-07 16:29 ` Shmulik Ladkani
0 siblings, 1 reply; 11+ messages in thread
From: Ricard Wanderlof @ 2012-02-07 15:20 UTC (permalink / raw)
To: Linux mtd
Is it possible to do a userspace write to a UBI volume as if it were plain
flash memory, i.e. should I be able to do "cat somefile > /dev/ubi0_0" ? I
get a 'Write Error: Operation not permitted' when I do this (Linux 2.6.35)
but I'm pretty sure that I've used UBI volumes that way in the past, may
have been with older kernels then.
Since there are ioctls for volume update and atomic logical ereasblock
change, it would seem natural that writing to UBI volumes must be preceded
by these ioctls, still I can't seem to see anywhere that doing a plain
write would not be allowed, and as I say I'm pretty sure I've done so in
the past.
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-07 15:20 Userspace write to UBI partitions Ricard Wanderlof
@ 2012-02-07 16:29 ` Shmulik Ladkani
2012-02-07 16:36 ` Ricard Wanderlof
0 siblings, 1 reply; 11+ messages in thread
From: Shmulik Ladkani @ 2012-02-07 16:29 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: Linux mtd
On Tue, 7 Feb 2012 16:20:58 +0100 (CET) Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
>
> Is it possible to do a userspace write to a UBI volume as if it were plain
> flash memory, i.e. should I be able to do "cat somefile > /dev/ubi0_0" ? I
> get a 'Write Error: Operation not permitted' when I do this (Linux 2.6.35)
> but I'm pretty sure that I've used UBI volumes that way in the past, may
> have been with older kernels then.
Is your volume dynamic or static?
If dynamic, have you tried setting the UBI_VOL_PROP_DIRECT_WRITE
property by issuing a UBI_IOCSETVOLPROP volume ioctl?
(formerly named UBI_PROP_DIRECT_WRITE and UBI_IOCSETPROP)
Regards,
Shmulik
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-07 16:29 ` Shmulik Ladkani
@ 2012-02-07 16:36 ` Ricard Wanderlof
2012-02-07 17:09 ` Shmulik Ladkani
2012-02-08 11:59 ` Artem Bityutskiy
0 siblings, 2 replies; 11+ messages in thread
From: Ricard Wanderlof @ 2012-02-07 16:36 UTC (permalink / raw)
To: Shmulik Ladkani; +Cc: Linux mtd
On Tue, 7 Feb 2012, Shmulik Ladkani wrote:
> On Tue, 7 Feb 2012 16:20:58 +0100 (CET) Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
>>
>> Is it possible to do a userspace write to a UBI volume as if it were plain
>> flash memory, i.e. should I be able to do "cat somefile > /dev/ubi0_0" ? I
>> get a 'Write Error: Operation not permitted' when I do this (Linux 2.6.35)
>> but I'm pretty sure that I've used UBI volumes that way in the past, may
>> have been with older kernels then.
>
> Is your volume dynamic or static?
I tried both, but given the nature of the data we want to keep in the
volume it should really be dynamic.
> If dynamic, have you tried setting the UBI_VOL_PROP_DIRECT_WRITE
> property by issuing a UBI_IOCSETVOLPROP volume ioctl?
> (formerly named UBI_PROP_DIRECT_WRITE and UBI_IOCSETPROP)
Thanks for the pointer, I've never noticed this ioctl before.
I'll try this out. In the meantime, there doesn't seem to be an ioctl for
erasing blocks?
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-07 16:36 ` Ricard Wanderlof
@ 2012-02-07 17:09 ` Shmulik Ladkani
2012-02-08 7:35 ` Ricard Wanderlof
2012-02-08 11:59 ` Artem Bityutskiy
1 sibling, 1 reply; 11+ messages in thread
From: Shmulik Ladkani @ 2012-02-07 17:09 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: Linux mtd
On Tue, 7 Feb 2012 17:36:25 +0100 (CET) Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
>
> On Tue, 7 Feb 2012, Shmulik Ladkani wrote:
>
> > On Tue, 7 Feb 2012 16:20:58 +0100 (CET) Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
> >>
> >> Is it possible to do a userspace write to a UBI volume as if it were plain
> >> flash memory, i.e. should I be able to do "cat somefile > /dev/ubi0_0" ? I
> >> get a 'Write Error: Operation not permitted' when I do this (Linux 2.6.35)
> >> but I'm pretty sure that I've used UBI volumes that way in the past, may
> >> have been with older kernels then.
> >
> > Is your volume dynamic or static?
>
> I tried both, but given the nature of the data we want to keep in the
> volume it should really be dynamic.
>
> > If dynamic, have you tried setting the UBI_VOL_PROP_DIRECT_WRITE
> > property by issuing a UBI_IOCSETVOLPROP volume ioctl?
> > (formerly named UBI_PROP_DIRECT_WRITE and UBI_IOCSETPROP)
>
> Thanks for the pointer, I've never noticed this ioctl before.
>
> I'll try this out. In the meantime, there doesn't seem to be an ioctl for
> erasing blocks?
>
Well, another option would be using Gluebi - (CONFIG_MTD_UBI_GLUEBI).
It exposes a "regular" mtd for every existing volume.
You'd be able to work using standard mtd interfaces on it (mtdchar
ioctls, e.g. MEMERASE, or even the mtdblock abstraction).
Regards,
Shmulik
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-07 17:09 ` Shmulik Ladkani
@ 2012-02-08 7:35 ` Ricard Wanderlof
2012-02-08 12:00 ` Artem Bityutskiy
0 siblings, 1 reply; 11+ messages in thread
From: Ricard Wanderlof @ 2012-02-08 7:35 UTC (permalink / raw)
To: Shmulik Ladkani; +Cc: Linux mtd
On Tue, 7 Feb 2012, Shmulik Ladkani wrote:
>> I'll try this out. In the meantime, there doesn't seem to be an ioctl for
>> erasing blocks?
>>
> Well, another option would be using Gluebi - (CONFIG_MTD_UBI_GLUEBI).
> It exposes a "regular" mtd for every existing volume.
>
> You'd be able to work using standard mtd interfaces on it (mtdchar
> ioctls, e.g. MEMERASE, or even the mtdblock abstraction).
For other reasons, gluebi is not a viable alternative for us. Mainly
because it puts an mtd device on _every_ ubi volume, meaning that volumes
can't be removed or resized while gluebi is enabled.
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-07 16:36 ` Ricard Wanderlof
2012-02-07 17:09 ` Shmulik Ladkani
@ 2012-02-08 11:59 ` Artem Bityutskiy
2012-02-08 12:18 ` Ricard Wanderlof
1 sibling, 1 reply; 11+ messages in thread
From: Artem Bityutskiy @ 2012-02-08 11:59 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: Linux mtd, Shmulik Ladkani
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
On Tue, 2012-02-07 at 17:36 +0100, Ricard Wanderlof wrote:
> > If dynamic, have you tried setting the UBI_VOL_PROP_DIRECT_WRITE
> > property by issuing a UBI_IOCSETVOLPROP volume ioctl?
> > (formerly named UBI_PROP_DIRECT_WRITE and UBI_IOCSETPROP)
>
> Thanks for the pointer, I've never noticed this ioctl before.
>
> I'll try this out.
It should help.
> In the meantime, there doesn't seem to be an ioctl for
> erasing blocks?
In UBI it is called "unmap" instead of "erase":
http://www.linux-mtd.infradead.org/doc/ubi.html#L_unmap
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-08 7:35 ` Ricard Wanderlof
@ 2012-02-08 12:00 ` Artem Bityutskiy
2012-02-08 12:20 ` Ricard Wanderlof
0 siblings, 1 reply; 11+ messages in thread
From: Artem Bityutskiy @ 2012-02-08 12:00 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: Linux mtd, Shmulik Ladkani
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
On Wed, 2012-02-08 at 08:35 +0100, Ricard Wanderlof wrote:
> On Tue, 7 Feb 2012, Shmulik Ladkani wrote:
>
> >> I'll try this out. In the meantime, there doesn't seem to be an ioctl for
> >> erasing blocks?
> >>
> > Well, another option would be using Gluebi - (CONFIG_MTD_UBI_GLUEBI).
> > It exposes a "regular" mtd for every existing volume.
> >
> > You'd be able to work using standard mtd interfaces on it (mtdchar
> > ioctls, e.g. MEMERASE, or even the mtdblock abstraction).
>
> For other reasons, gluebi is not a viable alternative for us. Mainly
> because it puts an mtd device on _every_ ubi volume, meaning that volumes
> can't be removed or resized while gluebi is enabled.
I do not recommend to use gluebi in general - it is just a hack, but the
limitation you brought up is fixable if you really need to :-)
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-08 11:59 ` Artem Bityutskiy
@ 2012-02-08 12:18 ` Ricard Wanderlof
2012-02-08 13:49 ` Atlant Schmidt
0 siblings, 1 reply; 11+ messages in thread
From: Ricard Wanderlof @ 2012-02-08 12:18 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: Ricard Wanderlof, Linux mtd, Shmulik Ladkani
> > In the meantime, there doesn't seem to be an ioctl for erasing
> > blocks?
>
> In UBI it is called "unmap" instead of "erase":
>
> http://www.linux-mtd.infradead.org/doc/ubi.html#L_unmap
Thanks. I've been staring at the UBI page for too long now I guess, didn't
realize that was what I should have been looking for...
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Userspace write to UBI partitions
2012-02-08 12:00 ` Artem Bityutskiy
@ 2012-02-08 12:20 ` Ricard Wanderlof
0 siblings, 0 replies; 11+ messages in thread
From: Ricard Wanderlof @ 2012-02-08 12:20 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: Ricard Wanderlöf, Linux mtd, Shmulik Ladkani
> > For other reasons, gluebi is not a viable alternative for us. Mainly
> > because it puts an mtd device on _every_ ubi volume, meaning that
> > volumes can't be removed or resized while gluebi is enabled.
>
> I do not recommend to use gluebi in general - it is just a hack, but the
> limitation you brought up is fixable if you really need to :-)
Yes, I think there was a discussion here on the list a while ago about it.
It seemed to me that the work that might be put into making gluebi more
flexible would be better spent in making applications we have that rely on
mtd use ubi instead.
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Userspace write to UBI partitions
2012-02-08 12:18 ` Ricard Wanderlof
@ 2012-02-08 13:49 ` Atlant Schmidt
2012-02-08 13:58 ` Artem Bityutskiy
0 siblings, 1 reply; 11+ messages in thread
From: Atlant Schmidt @ 2012-02-08 13:49 UTC (permalink / raw)
To: 'Ricard Wanderlof', Artem Bityutskiy
Cc: Ricard Wanderlof, Linux mtd, Shmulik Ladkani
All:
But there are times when you really want a block erased
and erased NOW; in that case, "unmap" isn't what you
want as it only schedules the PEB for erasure at some
future time. And if a power cut intervenes, that
scheduling for erasure may be lost and the ultimate
erasure may not take place for a long, long time.
So if you really intended to destroy the data, "unmap"
is not the correct function to call.
Atlant
-----Original Message-----
From: linux-mtd-bounces@lists.infradead.org [mailto:linux-mtd-bounces@lists.infradead.org] On Behalf Of Ricard Wanderlof
Sent: Wednesday, February 08, 2012 07:19
To: Artem Bityutskiy
Cc: Ricard Wanderlof; Linux mtd; Shmulik Ladkani
Subject: Re: Userspace write to UBI partitions
> > In the meantime, there doesn't seem to be an ioctl for erasing
> > blocks?
>
> In UBI it is called "unmap" instead of "erase":
>
> http://www.linux-mtd.infradead.org/doc/ubi.html#L_unmap
Thanks. I've been staring at the UBI page for too long now I guess, didn't
realize that was what I should have been looking for...
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Click https://www.mailcontrol.com/sr/iNq3RabdjW!TndxI!oX7UskfEqpntbSQBh5+L1x62eAEpsHd6qIu4!3pOM!83jtSy7QxM5RExv!1lqOECv!Swg== to report this email as spam.
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.
Thank you.
Please consider the environment before printing this email.
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Userspace write to UBI partitions
2012-02-08 13:49 ` Atlant Schmidt
@ 2012-02-08 13:58 ` Artem Bityutskiy
0 siblings, 0 replies; 11+ messages in thread
From: Artem Bityutskiy @ 2012-02-08 13:58 UTC (permalink / raw)
To: Atlant Schmidt
Cc: Linux mtd, Ricard Wanderlof, 'Ricard Wanderlof', Shmulik Ladkani
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
On Wed, 2012-02-08 at 08:49 -0500, Atlant Schmidt wrote:
> All:
>
> But there are times when you really want a block erased
> and erased NOW; in that case, "unmap" isn't what you
> want as it only schedules the PEB for erasure at some
> future time. And if a power cut intervenes, that
> scheduling for erasure may be lost and the ultimate
> erasure may not take place for a long, long time.
>
> So if you really intended to destroy the data, "unmap"
> is not the correct function to call.
In this case you should first unmap and than map:
http://www.linux-mtd.infradead.org/doc/ubi.html#L_map
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-02-08 13:56 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 15:20 Userspace write to UBI partitions Ricard Wanderlof
2012-02-07 16:29 ` Shmulik Ladkani
2012-02-07 16:36 ` Ricard Wanderlof
2012-02-07 17:09 ` Shmulik Ladkani
2012-02-08 7:35 ` Ricard Wanderlof
2012-02-08 12:00 ` Artem Bityutskiy
2012-02-08 12:20 ` Ricard Wanderlof
2012-02-08 11:59 ` Artem Bityutskiy
2012-02-08 12:18 ` Ricard Wanderlof
2012-02-08 13:49 ` Atlant Schmidt
2012-02-08 13:58 ` Artem Bityutskiy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.