]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - fs/ext4/ext4_write.c
karo: tx6: remove unused code from flash.c
[karo-tx-uboot.git] / fs / ext4 / ext4_write.c
index 648a59672c31eec1fcd0b409a185eb079670004a..fbc4c4b1cc1a48e2f458a0ef30df97b451d40675 100644 (file)
@@ -975,3 +975,38 @@ fail:
 
        return -1;
 }
+
+int ext4_write_file(const char *filename, void *buf, loff_t offset,
+                   loff_t len, loff_t *actwrite)
+{
+       int ret;
+
+       if (offset != 0) {
+               printf("** Cannot support non-zero offset **\n");
+               return -1;
+       }
+
+       /* mount the filesystem */
+       if (!ext4fs_mount(0)) {
+               printf("** Error Bad ext4 partition **\n");
+               goto fail;
+       }
+
+       ret = ext4fs_write(filename, buf, len);
+
+       if (ret) {
+               printf("** Error ext4fs_write() **\n");
+               goto fail;
+       }
+       ext4fs_close();
+
+       *actwrite = len;
+
+       return 0;
+
+fail:
+       ext4fs_close();
+       *actwrite = 0;
+
+       return -1;
+}