goto dump;
dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ;
+
+ if (UBIFS_COMPR_LZ4K == le16_to_cpu(dn->compr_type))
+ out_len = len; //Jack modify for lz4k decompress
+ else
out_len = UBIFS_BLOCK_SIZE;
err = ubifs_decompress(&dn->data, dlen, addr, &out_len,
le16_to_cpu(dn->compr_type));
goto out_err;
dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ;
+
+ if (UBIFS_COMPR_LZ4K == le16_to_cpu(dn->compr_type))
+ out_len = len; //Jack modify for lz4k decompress
+ else
out_len = UBIFS_BLOCK_SIZE;
err = ubifs_decompress(&dn->data, dlen, addr, &out_len,
le16_to_cpu(dn->compr_type));
return 0;
}
+//MTK add for cts
+long ubifs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
+{
+ int err;
+ struct inode *inode = file->f_mapping->host;
+ struct ubifs_info *c = inode->i_sb->s_fs_info;
+ struct iattr newattrs;
+
+ loff_t new_len = offset + len;
+ if (len < 0 || offset < 0)
+ return -EINVAL;
+
+ if(new_len < inode->i_size)
+ return -EINVAL;
+
+ newattrs.ia_size = new_len;
+ newattrs.ia_valid = ATTR_SIZE | ATTR_MTIME|ATTR_CTIME;
+ newattrs.ia_file = file;
+ newattrs.ia_valid |= ATTR_FILE;
+
+
+ err = do_setattr(c, inode, &newattrs);
+ return err;
+}
+
const struct address_space_operations ubifs_file_address_operations = {
.readpage = ubifs_readpage,
.writepage = ubifs_writepage,
.follow_link = ubifs_follow_link,
.setattr = ubifs_setattr,
.getattr = ubifs_getattr,
+ .setxattr = ubifs_setxattr,
+ .getxattr = ubifs_getxattr,
+ .listxattr = ubifs_listxattr,
+ .removexattr = ubifs_removexattr,
};
const struct file_operations ubifs_file_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = ubifs_compat_ioctl,
#endif
+ .fallocate = ubifs_fallocate,
};