* [PATCH 1/2] bbu: Search for cdev names aswell
@ 2017-03-08 9:24 Oleksij Rempel
2017-03-08 9:24 ` [PATCH 2/2] usb: fastboot: umount device before writing to it Oleksij Rempel
0 siblings, 1 reply; 5+ messages in thread
From: Oleksij Rempel @ 2017-03-08 9:24 UTC (permalink / raw)
To: barebox
From: Sascha Hauer <s.hauer@pengutronix.de>
In bbu_find_handler_by_device() search for cdev names aswell since some
update handlers are registered with their cdev name and not the full
path.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/bbu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/common/bbu.c b/common/bbu.c
index c5dda8c8b..031c43382 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -113,6 +113,15 @@ static struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
if (!strcmp(handler->devicefile, devicepath))
return handler;
+ if (strncmp(devicepath, "/dev/", 5))
+ return NULL;
+
+ devicepath += 5;
+
+ list_for_each_entry(handler, &bbu_image_handlers, list)
+ if (!strcmp(handler->devicefile, devicepath))
+ return handler;
+
return NULL;
}
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] usb: fastboot: umount device before writing to it
2017-03-08 9:24 [PATCH 1/2] bbu: Search for cdev names aswell Oleksij Rempel
@ 2017-03-08 9:24 ` Oleksij Rempel
2017-03-10 7:32 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Oleksij Rempel @ 2017-03-08 9:24 UTC (permalink / raw)
To: barebox
From: Sascha Hauer <s.hauer@pengutronix.de>
When a fastboot target refers to a device and we are going to write
to it, umount it beforehand, so that we do not end up with corrupt
data after writing.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/gadget/f_fastboot.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a6192b9eb..8d69aea8b 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -754,6 +754,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
goto out;
}
+ umount(filename);
copy:
ret = copy_file(FASTBOOT_TMPFILE, filename, 1);
if (ret) {
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] usb: fastboot: umount device before writing to it
2017-03-08 9:24 ` [PATCH 2/2] usb: fastboot: umount device before writing to it Oleksij Rempel
@ 2017-03-10 7:32 ` Sascha Hauer
2017-03-10 9:14 ` Oleksij Rempel
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2017-03-10 7:32 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
On Wed, Mar 08, 2017 at 10:24:02AM +0100, Oleksij Rempel wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> When a fastboot target refers to a device and we are going to write
> to it, umount it beforehand, so that we do not end up with corrupt
> data after writing.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/usb/gadget/f_fastboot.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index a6192b9eb..8d69aea8b 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -754,6 +754,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
> goto out;
> }
>
> + umount(filename);
I'm not sure about this one. We should probably rather bail out with an
error when it's mounted. When it's mounted then the result is undesired,
even when we unmount it before flashing.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] usb: fastboot: umount device before writing to it
2017-03-10 7:32 ` Sascha Hauer
@ 2017-03-10 9:14 ` Oleksij Rempel
2017-03-10 9:17 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Oleksij Rempel @ 2017-03-10 9:14 UTC (permalink / raw)
To: Sascha Hauer, Oleksij Rempel; +Cc: barebox
On 03/10/2017 08:32 AM, Sascha Hauer wrote:
> On Wed, Mar 08, 2017 at 10:24:02AM +0100, Oleksij Rempel wrote:
>> From: Sascha Hauer <s.hauer@pengutronix.de>
>>
>> When a fastboot target refers to a device and we are going to write
>> to it, umount it beforehand, so that we do not end up with corrupt
>> data after writing.
>>
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>> drivers/usb/gadget/f_fastboot.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
>> index a6192b9eb..8d69aea8b 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -754,6 +754,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
>> goto out;
>> }
>>
>> + umount(filename);
>
> I'm not sure about this one. We should probably rather bail out with an
> error when it's mounted. When it's mounted then the result is undesired,
> even when we unmount it before flashing.
hm... for this case we will probably need some function to check if
device is mounted. something like: is_mounted(path). Or, is there some
other way to do this?
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] usb: fastboot: umount device before writing to it
2017-03-10 9:14 ` Oleksij Rempel
@ 2017-03-10 9:17 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2017-03-10 9:17 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: Oleksij Rempel, barebox
On Fri, Mar 10, 2017 at 10:14:46AM +0100, Oleksij Rempel wrote:
>
>
> On 03/10/2017 08:32 AM, Sascha Hauer wrote:
> > On Wed, Mar 08, 2017 at 10:24:02AM +0100, Oleksij Rempel wrote:
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > >
> > > When a fastboot target refers to a device and we are going to write
> > > to it, umount it beforehand, so that we do not end up with corrupt
> > > data after writing.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > ---
> > > drivers/usb/gadget/f_fastboot.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> > > index a6192b9eb..8d69aea8b 100644
> > > --- a/drivers/usb/gadget/f_fastboot.c
> > > +++ b/drivers/usb/gadget/f_fastboot.c
> > > @@ -754,6 +754,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
> > > goto out;
> > > }
> > >
> > > + umount(filename);
> >
> > I'm not sure about this one. We should probably rather bail out with an
> > error when it's mounted. When it's mounted then the result is undesired,
> > even when we unmount it before flashing.
>
> hm... for this case we will probably need some function to check if device
> is mounted. something like: is_mounted(path). Or, is there some other way to
> do this?
Yeah, you'll need a function for this. Right now there is no way to
determine if a device is mounted.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-10 9:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08 9:24 [PATCH 1/2] bbu: Search for cdev names aswell Oleksij Rempel
2017-03-08 9:24 ` [PATCH 2/2] usb: fastboot: umount device before writing to it Oleksij Rempel
2017-03-10 7:32 ` Sascha Hauer
2017-03-10 9:14 ` Oleksij Rempel
2017-03-10 9:17 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox