From: Sascha Hauer <s.hauer@pengutronix.de>
To: Vicente Bergas <vicencb@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 0/2] Some corrections on archosG9
Date: Mon, 26 Nov 2012 09:00:30 +0100 [thread overview]
Message-ID: <20121126080030.GT10369@pengutronix.de> (raw)
In-Reply-To: <1353727464-15175-1-git-send-email-vicencb@gmail.com>
On Sat, Nov 24, 2012 at 04:24:22AM +0100, Vicente Bergas wrote:
> In the patch series for archosG9 there were an attempt to improve file
> transfers by reading files at once, but finally this solution was discarded.
> Today I've checked the repository and found this solution there, perhaps this
> is a misunderstanding and it's corrected here.
> Sorry for not checking before.
>
> The other change is just the inverse: a submitted patch that was not applied.
>
> Vicente Bergas (2):
> uimage: fix misunderstanding in common/uimage.c
> archosg9: improve configuration
>
> arch/arm/boards/archosg9/env/config | 4 +++-
> arch/arm/boards/archosg9/env/init/usbboot | 9 +++++----
> arch/arm/configs/archosg9_defconfig | 2 +-
> common/uimage.c | 24 ------------------------
> 4 files changed, 9 insertions(+), 30 deletions(-)
Applied, thanks
As a side note, I still have this patch in my queue which fixes
read_file for tftp severs which do not pass the size. My tftp server at
home is one of these, I'll repost the patch once I tested it again.
Sascha
From 1508618b3bc53abf122b9c7473f468e67b391b19 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Sun, 18 Mar 2012 17:59:46 +0100
Subject: [PATCH] read_file: Make it work on tftp servers which do not pass
size
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 11 +++++++++++
fs/tftp.c | 5 ++++-
include/fs.h | 2 ++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/fs/fs.c b/fs/fs.c
index db4621a..871dc26 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -41,10 +41,21 @@ void *read_file(const char *filename, size_t *size)
int fd;
struct stat s;
void *buf = NULL;
+ const char *tmpfile = "/_read_file_tmp";
+ int ret;
+again:
if (stat(filename, &s))
return NULL;
+ if (s.st_size == FILESIZE_MAX) {
+ ret = copy_file(filename, tmpfile, 0);
+ if (ret)
+ return NULL;
+ filename = tmpfile;
+ goto again;
+ }
+
buf = xzalloc(s.st_size + 1);
fd = open(filename, O_RDONLY);
diff --git a/fs/tftp.c b/fs/tftp.c
index b58d6fc..13e117a 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -590,7 +590,10 @@ static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s)
return PTR_ERR(priv);
s->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO;
- s->st_size = priv->filesize;
+ if (priv->filesize)
+ s->st_size = priv->filesize;
+ else
+ s->st_size = FILESIZE_MAX;
tftp_do_close(priv);
diff --git a/include/fs.h b/include/fs.h
index 3d5714c..b6a46bb 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -147,6 +147,8 @@ int protect(int fd, size_t count, unsigned long offset, int prot);
int protect_file(const char *file, int prot);
void *memmap(int fd, int flags);
+#define FILESIZE_MAX ((size_t)-1)
+
#define PROT_READ 1
#define PROT_WRITE 2
--
1.7.10.4
--
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
prev parent reply other threads:[~2012-11-26 8:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-24 3:24 Vicente Bergas
2012-11-24 3:24 ` [PATCH 1/2] uimage: fix misunderstanding in common/uimage.c Vicente Bergas
2012-11-24 8:45 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-24 13:31 ` vj
2012-11-24 3:24 ` [PATCH 2/2] archosg9: improve configuration Vicente Bergas
2012-11-26 8:00 ` Sascha Hauer [this message]
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=20121126080030.GT10369@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=vicencb@gmail.com \
/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