]> git.sur5r.net Git - u-boot/blobdiff - fs/ext2/ext2fs.c
fs/: Remove obsolete references to CONFIG_COMMANDS
[u-boot] / fs / ext2 / ext2fs.c
index a2d698abc7a47a64f7da0199049512ded67fc8bd..e65e39b5abfa7e2dfbe23888d3b00c1d9640d0a4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <common.h>
 
-#if (CONFIG_COMMANDS & CFG_CMD_EXT2)
+#if defined(CONFIG_CMD_EXT2)
 #include <ext2fs.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
@@ -389,7 +389,7 @@ int ext2fs_read_file
        int blockcnt;
        int log2blocksize = LOG2_EXT2_BLOCK_SIZE (node->data);
        int blocksize = 1 << (log2blocksize + DISK_SECTOR_BITS);
-       unsigned int filesize = node->inode.size;
+       unsigned int filesize = __le32_to_cpu(node->inode.size);
 
        /* Adjust len so it we can't read past the end of the file.  */
        if (len > filesize) {
@@ -561,7 +561,7 @@ static int ext2fs_iterate_dir (ext2fs_node_t dir, char *name, ext2fs_node_t * fn
                                        printf ("      ");
                                        break;
                                default:
-                                       printf ("<???> ");
+                                       printf ("< ? > ");
                                        break;
                                }
                                printf ("%10d %s\n",
@@ -724,7 +724,7 @@ int ext2fs_find_file
 
 
        symlinknest = 0;
-       if (!path || path[0] != '/') {
+       if (!path) {
                return (0);
        }
 
@@ -769,7 +769,7 @@ int ext2fs_open (char *filename) {
        int len;
 
        if (ext2fs_root == NULL) {
-               return (0);
+               return (-1);
        }
        ext2fs_file = NULL;
        status = ext2fs_find_file (filename, &ext2fs_root->diropen, &fdiro,
@@ -788,9 +788,9 @@ int ext2fs_open (char *filename) {
        ext2fs_file = fdiro;
        return (len);
 
-      fail:
+fail:
        ext2fs_free_node (fdiro, &ext2fs_root->diropen);
-       return (0);
+       return (-1);
 }