#include <common.h>
-#if (CONFIG_COMMANDS & CFG_CMD_EXT2)
+#if defined(CONFIG_CMD_EXT2)
#include <ext2fs.h>
#include <malloc.h>
#include <asm/byteorder.h>
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) {
printf (" ");
break;
default:
- printf ("<???> ");
+ printf ("< ? > ");
break;
}
printf ("%10d %s\n",
symlinknest = 0;
- if (!path || path[0] != '/') {
+ if (!path) {
return (0);
}
int len;
if (ext2fs_root == NULL) {
- return (0);
+ return (-1);
}
ext2fs_file = NULL;
status = ext2fs_find_file (filename, &ext2fs_root->diropen, &fdiro,
ext2fs_file = fdiro;
return (len);
- fail:
+fail:
ext2fs_free_node (fdiro, &ext2fs_root->diropen);
- return (0);
+ return (-1);
}
return (0);
}
-#endif /* CFG_CMD_EXT2FS */
+#endif