[U-Boot] [PATCH] UBIFS: Change ubifsload to set the filesize variable

This is the same behaviour like tftp or fatload command.
Signed-off-by: Bastian Ruppert Bastian.Ruppert@Sewerin.de CC: kmpark@infradead.org --- fs/ubifs/ubifs.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 5a5c739..2b9d2d2 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -688,6 +688,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) int i; int count; int last_block_size = 0; + char buf [10];
c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY); /* ubifs_findfile will resolve symlinks, so we know that we get @@ -719,6 +720,9 @@ int ubifs_load(char *filename, u32 addr, u32 size) printf("Loading file '%s' to addr 0x%08x with size %d (0x%08x)...\n", filename, addr, size, size);
+ sprintf(buf, "%lX", size); + setenv("filesize", buf); + page.addr = (void *)addr; page.index = 0; page.inode = inode;

Dear Bastian Ruppert,
In message 1315220629-9192-1-git-send-email-Bastian.Ruppert@Sewerin.de you wrote:
This is the same behaviour like tftp or fatload command.
@@ -719,6 +720,9 @@ int ubifs_load(char *filename, u32 addr, u32 size) printf("Loading file '%s' to addr 0x%08x with size %d (0x%08x)...\n", filename, addr, size, size);
- sprintf(buf, "%lX", size);
- setenv("filesize", buf);
Please insert this piece of code _after_ the file has successfully been loaded to RAM (not before starting to load it).
Best regards,
Wolfgang Denk

This is the same behaviour like tftp or fatload command.
Signed-off-by: Bastian Ruppert Bastian.Ruppert@Sewerin.de CC: kmpark@infradead.org --- fs/ubifs/ubifs.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 5a5c739..75a2edc 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -688,6 +688,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) int i; int count; int last_block_size = 0; + char buf [10];
c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY); /* ubifs_findfile will resolve symlinks, so we know that we get @@ -739,8 +740,11 @@ int ubifs_load(char *filename, u32 addr, u32 size)
if (err) printf("Error reading file '%s'\n", filename); - else + else { + sprintf(buf, "%lX", size); + setenv("filesize", buf); printf("Done\n"); + }
ubifs_iput(inode);

Hi Bastian,
This is the same behaviour like tftp or fatload command.
Signed-off-by: Bastian Ruppert Bastian.Ruppert@Sewerin.de CC: kmpark@infradead.org
Acked-by: Detlev Zundel dzu@denx.de
Cheers Detlev

Dear Bastian Ruppert,
In message 1315227837-17714-1-git-send-email-Bastian.Ruppert@Sewerin.de you wrote:
This is the same behaviour like tftp or fatload command.
Signed-off-by: Bastian Ruppert Bastian.Ruppert@Sewerin.de CC: kmpark@infradead.org
fs/ubifs/ubifs.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Commit 46d7274 "UBIFS: Change ubifsload to set the filesize variable" introduced the follwing compiler warning:
ubifs.c: In function 'ubifs_load': ubifs.c:742: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'u32'
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Bastian Ruppert Bastian.Ruppert@Sewerin.de --- fs/ubifs/ubifs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 2e6313a..604eb8f 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -739,7 +739,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) if (err) printf("Error reading file '%s'\n", filename); else { - sprintf(buf, "%lX", size); + sprintf(buf, "%X", size); setenv("filesize", buf); printf("Done\n"); }

Dear Wolfgang Denk,
In message 1315608216-7425-1-git-send-email-wd@denx.de you wrote:
Commit 46d7274 "UBIFS: Change ubifsload to set the filesize variable" introduced the follwing compiler warning:
ubifs.c: In function 'ubifs_load': ubifs.c:742: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'u32'
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Bastian Ruppert Bastian.Ruppert@Sewerin.de
fs/ubifs/ubifs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

On Monday, September 05, 2011 01:03:49 PM Bastian Ruppert wrote:
This is the same behaviour like tftp or fatload command.
Signed-off-by: Bastian Ruppert Bastian.Ruppert@Sewerin.de CC: kmpark@infradead.org
fs/ubifs/ubifs.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 5a5c739..2b9d2d2 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -688,6 +688,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) int i; int count; int last_block_size = 0;
char buf [10];
c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY); /* ubifs_findfile will resolve symlinks, so we know that we get
@@ -719,6 +720,9 @@ int ubifs_load(char *filename, u32 addr, u32 size) printf("Loading file '%s' to addr 0x%08x with size %d (0x%08x)...\n", filename, addr, size, size);
- sprintf(buf, "%lX", size);
- setenv("filesize", buf);
Hi,
maybe you want to check set_local_var() too ?
page.addr = (void *)addr; page.index = 0; page.inode = inode;

Dear Marek Vasut,
In message 201109051512.48148.marek.vasut@gmail.com you wrote:
- setenv("filesize", buf);
maybe you want to check set_local_var() too ?
Yes, we should clean up all these auto-generated environment variables one day. But what you propose here is not a good approach:
(1) not all boards use the hush shell, and set_local_var() is only available there. (2) if you make such a change, then you must make it everywhere, and you must make sure not to break existent use of these things.
Both is definitely out of the scope of this patch.
Best regards,
Wolfgang Denk

On Monday, September 05, 2011 04:27:28 PM Wolfgang Denk wrote:
Dear Marek Vasut,
In message 201109051512.48148.marek.vasut@gmail.com you wrote:
- setenv("filesize", buf);
maybe you want to check set_local_var() too ?
Yes, we should clean up all these auto-generated environment variables one day. But what you propose here is not a good approach:
(1) not all boards use the hush shell, and set_local_var() is only available there. (2) if you make such a change, then you must make it everywhere, and you must make sure not to break existent use of these things.
Both is definitely out of the scope of this patch.
You're definitelly right on this thing.
Best regards,
Wolfgang Denk
participants (4)
-
Bastian Ruppert
-
Detlev Zundel
-
Marek Vasut
-
Wolfgang Denk