@@ -311,7 +311,7 @@ static struct fstype_info fstypes[] = {
.exists = ubifs_exists,
.size = ubifs_size,
.read = ubifs_read,
- .get_blocksize = fs_get_blocksize_unsupported,
+ .get_blocksize = ubifs_get_blocksize,
.write = fs_write_unsupported,
.uuid = fs_uuid_unsupported,
.opendir = fs_opendir_unsupported,
@@ -846,11 +846,9 @@ int ubifs_read(const char *filename, void *buf, loff_t offset,
*actread = 0;
- if (offset & (PAGE_SIZE - 1)) {
- printf("ubifs: Error offset must be a multiple of %d\n",
- PAGE_SIZE);
- return -1;
- }
+ /* Higher layer should ensure it always pass page aligned range. */
+ assert(IS_ALIGNED(offset, PAGE_SIZE));
+ assert(IS_ALIGNED(size, PAGE_SIZE));
c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY);
/* ubifs_findfile will resolve symlinks, so we know that we get
@@ -920,6 +918,11 @@ out:
return err;
}
+int ubifs_get_blocksize(const char *filename)
+{
+ return PAGE_SIZE;
+}
+
void ubifs_close(void)
{
}
@@ -29,6 +29,7 @@ int ubifs_exists(const char *filename);
int ubifs_size(const char *filename, loff_t *size);
int ubifs_read(const char *filename, void *buf, loff_t offset,
loff_t size, loff_t *actread);
+int ubifs_get_blocksize(const char *filename);
void ubifs_close(void);
#endif /* __UBIFS_UBOOT_H__ */
Currently ubifs doesn't support unaligned read offset, thanks to the recent _fs_read() work to handle unaligned read, we only need to implement ubifs_get_blocksize() to take advantage of it. Now ubifs can do unaligned read without any problem. Signed-off-by: Qu Wenruo <wqu@suse.com> --- Unfortunately I can not test ubifs, as enabling UBI would cause compile failure due to missing of <asm/atomic.h> header. --- fs/fs.c | 2 +- fs/ubifs/ubifs.c | 13 ++++++++----- include/ubifs_uboot.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)