reiser4-add-crc-sendfile.patch]
PATCH 1/8 reiser4-add-crc-sendfile.patch]
.
From: Edward Shishkin <[email protected]>
This patch adds sendfile method for cryptcompress files.
Signed-off-by Vladimir V. Saveliev <[email protected]>
fs/reiser4/plugin/file/cryptcompress.c | 35 +++++++++++++++++++++++++++++++-- fs/reiser4/plugin/file/file.h | 2 + fs/reiser4/plugin/object.c | 3 +- 3 files changed, 37 insertions(+), 3 deletions(-)
fs/reiser4/plugin/file/cryptcompress.c renamed from fs/reiser4/plugin/file/cryptcompress.c~reiser4-add-crc-sendfile +33 -2
@@ -3670,8 +3670,8 @@ int capturepage_cryptcompress(struct pag/* plugin->u.file.mmap */ int mmap_cryptcompress (struct file *file,struct vm_area_struct *vma) { -return -ENOSYS ; -//return generic_file_mmap(file, vma); +//return -ENOSYS; +return generic_file_mmap (file, vma); }/* plugin->u.file.release */
@@ -3834,6 +3834,37 @@ int setattr_cryptcompress(struct dentryreturn result; } +/* sendfile_cryptcompress - sendfile of struct file_operations */ +ssize_t +sendfile_cryptcompress (struct file *file,loff_t *ppos,size_t count, +read_actor_t actor,void *target) +{ +reiser4_context *ctx; +ssize_t result; +struct inode *inode; +cryptcompress_info_t *info; + + inode = file->f_dentry->d_inode; + ctx =init_context (inode->i_sb); +if (IS_ERR (ctx)) +return PTR_ERR (ctx); +/* +* generic_file_sndfile may want to call update_atime. Grab space for +* stat data update +*/ + result =reiser4_grab_space (estimate_update_common (inode), +BA_CAN_COMMIT ); +if (result) + goto exit; + info =cryptcompress_inode_data (inode); +down_read (&info->lock); + result =generic_file_sendfile (file, ppos, count, actor, target); +up_read (&info->lock); + exit: +reiser4_exit_context (ctx); +return result; +} +static int save_len_cryptcompress_plugin (struct inode *inode,reiser4_plugin * plugin) {
fs/reiser4/plugin/file/file.h renamed from fs/reiser4/plugin/file/file.h~reiser4-add-crc-sendfile +2 -0
@@ -169,6 +169,8 @@ ssize_t read_cryptcompress(struct file *ssize_t write_cryptcompress (struct file *,const char __user *buf,size_t write_amount,loff_t * off);int mmap_cryptcompress (struct file *,struct vm_area_struct *); +ssize_t sendfile_cryptcompress (struct file *file,loff_t *ppos,size_t count, +read_actor_t actor,void *target);/* address space operations */ extern int readpage_cryptcompress (struct file *,struct page *);
fs/reiser4/plugin/object.c renamed from fs/reiser4/plugin/object.c~reiser4-add-crc-sendfile +2 -1
@@ -306,7 +306,7 @@ file_plugin file_plugins[LAST_FILE_PLUGI .write = write_cryptcompress, .mmap = mmap_cryptcompress, .fsync = sync_common, - .sendfile = sendfile_common + .sendfile = sendfile_cryptcompress }, .as_ops = { .writepage = reiser4_writepage,
@@ -331,6 +331,7 @@ file_plugin file_plugins[LAST_FILE_PLUGI .owns_item = owns_item_common, .can_add_link = can_add_link_common, .detach = dummyop, + .bind = dummyop, .safelink = safelink_common, .estimate = { .create = estimate_create_common,
_