Skip to contentSkip to conversation

Update filesize environment variable on ubifs_load

PATCH New Rod Boyce 2 participants 2 messages Jun 18, 2011 – Jun 29, 2011 UBI file system (UBIFS)

lore
Share & tools
lore

Rod Boyce

author
#0 lore raw

PATCH 1/1 Update filesize environment variable on ubifs_load

Add functionality to update filesize environment variable when ubifs_load is called to read a file from filesystem

------------------------------- fs/ubifs/ubifs.c
------------------------------

fs/ubifs/ubifs.c +3 -0
index 61f70b2..17097f2 100644
@@ -686,6 +686,7 @@
      int i;
      int count;
      int last_block_size = 0;
+    char buf[32];
 
      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
@@ -716,6 +717,8 @@
      count = (size + UBIFS_BLOCK_SIZE - 1) >> UBIFS_BLOCK_SHIFT;
      printf("Loading file '%s' to addr 0x%08x with size %d (0x%08x)...\n",
             filename, addr, size, size);
+    sprintf( buf, "%X", size );
+    setenv( "filesize", buf );
 
      page.addr = (void *)addr;
      page.index = 0;
#1 lore raw

PATCH 1/1 Update filesize environment variable on ubifs_load

Hi Rod,

Quoted 19 lines · On Saturday 18 June 2011 12:30:18 Rod Boyce wrote:

Add functionality to update filesize environment variable when ubifs_load is called to read a file from filesystem

------------------------------- fs/ubifs/ubifs.c
------------------------------

fs/ubifs/ubifs.c +1 -0
index 61f70b2..17097f2 100644
@@ -686,6 +686,7 @@
      int i;
      int count;
      int last_block_size = 0;
+    char buf[32];
 
      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

fs/ubifs/ubifs.c line 721

Quoted 5 lines
fs/ubifs/ubifs.c +2 -0
@@ -716,6 +717,8 @@
      count = (size + UBIFS_BLOCK_SIZE - 1) >> UBIFS_BLOCK_SHIFT;
      printf("Loading file '%s' to addr 0x%08x with size %d (0x%08x)...\n",
             filename, addr, size, size);
+    sprintf( buf, "%X", size );
+    setenv( "filesize", buf );

Again, patch does not apply (indentation seems broken). Please see my comments in the last mail. And please don't add a space after "(" and before ")":

+ sprintf(buf, "%X", size);
+ setenv("filesize", buf);

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de