summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-12-26 09:53:33 +0000
committerTom Rini <trini@ti.com>2013-03-04 14:19:56 -0500
commite6d5241534486effa116bf685f7707041492ec7b (patch)
treedc41035f0255983ce66fffb147ffc69a6aaeaae4 /fs/ext4
parent117e050727d1f76bfc465f23eb3aa10f9f15cc1b (diff)
downloadtalos-obmc-uboot-e6d5241534486effa116bf685f7707041492ec7b.tar.gz
talos-obmc-uboot-e6d5241534486effa116bf685f7707041492ec7b.zip
fs: Move ls and read methods into ext4, fat
It doesn't make a lot of sense to have these methods in fs.c. They are filesystem-specific, not generic code. Add each to the relevant filesystem and remove the associated #ifdefs in fs.c. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext4fs.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 7fdb4634c7..4dddde2476 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -191,3 +191,40 @@ int ext4fs_read(char *buf, unsigned len)
return ext4fs_read_file(ext4fs_file, 0, len, buf);
}
+
+int ext4fs_probe(block_dev_desc_t *fs_dev_desc,
+ disk_partition_t *fs_partition)
+{
+ ext4fs_set_blk_dev(fs_dev_desc, fs_partition);
+
+ if (!ext4fs_mount(fs_partition->size)) {
+ ext4fs_close();
+ return -1;
+ }
+
+ return 0;
+}
+
+int ext4_read_file(const char *filename, void *buf, int offset, int len)
+{
+ int file_len;
+ int len_read;
+
+ if (offset != 0) {
+ printf("** Cannot support non-zero offset **\n");
+ return -1;
+ }
+
+ file_len = ext4fs_open(filename);
+ if (file_len < 0) {
+ printf("** File not found %s **\n", filename);
+ return -1;
+ }
+
+ if (len == 0)
+ len = file_len;
+
+ len_read = ext4fs_read(buf, len);
+
+ return len_read;
+}
OpenPOWER on IntegriCloud