.close = fat_close,
.ls = file_fat_ls,
.read = fat_read_file,
+ .write = fs_write_unsupported,
},
#endif
#ifdef CONFIG_FS_EXT4
.close = ext4fs_close,
.ls = ext4fs_ls,
.read = ext4_read_file,
+ .write = fs_write_unsupported,
},
#endif
#ifdef CONFIG_SANDBOX
void *buf;
int ret;
- /*
- * We don't actually know how many bytes are being read, since len==0
- * means read the whole file.
- */
buf = map_sysmem(addr, len);
ret = info->write(filename, buf, offset, len);
unmap_sysmem(buf);
- /* If we requested a specific number of bytes, check we got it */
- if (ret >= 0 && len && ret != len) {
+ if (ret >= 0 && ret != len) {
printf("** Unable to write file %s **\n", filename);
ret = -1;
}
*/
int fs_read(const char *filename, ulong addr, int offset, int len);
+/*
+ * Write file "filename" to the partition previously set by fs_set_blk_dev(),
+ * from address "addr", starting at byte offset "offset", and writing "len"
+ * bytes. "offset" may be 0 to write to the start of the file. Note that not
+ * all filesystem types support offset!=0.
+ *
+ * Returns number of bytes read on success. Returns <= 0 on error.
+ */
+int fs_write(const char *filename, ulong addr, int offset, int len);
+
/*
* Common implementation for various filesystem commands, optionally limited
* to a specific filesystem type via the fstype parameter.