changeset 2387:09f5e65f57b1

* src/fs/fileio.c: Temporary kludge to treat flash correctly if either flash v1 or flash v2 used with this file. (do_mount): silence warning. Include accidentally omitted printf arg. (do_list): silence warning.
author jlarmour
date Wed, 11 Apr 2007 13:49:22 +0000
parents 7f29b752c9f9
children 6058d3874cd8
files packages/redboot/current/ChangeLog packages/redboot/current/src/fs/fileio.c
diffstat 2 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,11 @@
+2007-04-11  Gary Thomas  <gary@mlbassoc.com>
+2007-04-11  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/fs/fileio.c: Temporary kludge to treat flash correctly if either
+	flash v1 or flash v2 used with this file.
+	(do_mount): silence warning. Include accidentally omitted printf arg.
+	(do_list): silence warning.
+
 2007-01-22  Peter Korsgaard  <peter.korsgaard@barco.com>
 
 	* src/load.c (do_load): Reset entry address before load so
--- a/packages/redboot/current/src/fs/fileio.c
+++ b/packages/redboot/current/src/fs/fileio.c
@@ -64,6 +64,7 @@
 #include <unistd.h>
 #include <string.h>
 #ifdef CYGPKG_IO_FLASH
+#include <pkgconf/io_flash.h>
 #include <cyg/io/io.h>
 #include <cyg/io/flash.h>
 #include <cyg/io/config_keys.h>
@@ -108,6 +109,17 @@ static struct
 static void do_mount(int argc, char *argv[]);
 static void do_umount(int argc, char *argv[]);
 
+/* Temporary hack until flashv2 merged to trunk. We can't tell whether we're
+ * working with flash v1 or v2 from the package version. So if legacy device isn't
+ * defined we check whether, if there is a block device, there's a tell-tale define
+ * that only exists with the v1 version.
+ */
+#if !defined(CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY) && \
+     defined(CYGPKG_IO_FLASH_BLOCK_DEVICE) && \
+     defined(CYGINT_IO_FLASH_BLOCK_CFG_1)
+# define CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY 1
+#endif
+
 #ifdef CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY
 #define FLASHPART "[-f <partition>] "
 #else
@@ -174,7 +186,7 @@ do_mount(int argc, char *argv[])
     
 #ifdef CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY
     if (part_set) {
-        int len;
+        cyg_uint32 len;
         cyg_io_handle_t h;
 
         if (dev_set && strcmp(dev_str, CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1)) {
@@ -183,11 +195,11 @@ do_mount(int argc, char *argv[])
         }
 
         dev_str = CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1;
-        len = strlen(part_str);
+        len = (cyg_uint32)strlen(part_str);
 
         err = cyg_io_lookup(dev_str, &h);
         if (err < 0) {
-            err_printf("fs mount: cyg_io_lookup of \"%s\" returned %d\n", err);
+            err_printf("fs mount: cyg_io_lookup of \"%s\" returned %d\n", dev_str, err);
             return;
         }
         err = cyg_io_set_config(h, CYG_IO_SET_CONFIG_FLASH_FIS_NAME,
@@ -342,7 +354,7 @@ do_list(int argc, char * argv[])
                       rwx[(sbuf.st_mode & S_IRWXG) >> 19],
                       rwx[(sbuf.st_mode & S_IRWXO) >> 22]);
           diag_printf(" %2d size %6d %s\n",
-                      sbuf.st_nlink,sbuf.st_size, 
+                      sbuf.st_nlink,(int)sbuf.st_size, 
                       entry->d_name);
      }