X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=fs%2F9p%2Fvfs_file.c;h=c7b6772538432150b0ab9e717175b108087d9de9;hb=2793274298c4423d79701e9a8190f2940bf3c785;hp=6c78343cf69023e5220c6a50127b33325c0f1c97;hpb=ef29498655b18d2bfd69048e20835d19333981ab;p=powerpc.git diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 6c78343cf6..c7b6772538 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -42,6 +42,8 @@ #include "v9fs_vfs.h" #include "fid.h" +static const struct file_operations v9fs_cached_file_operations; + /** * v9fs_file_open - open a file (or directory) * @inode: inode to be opened @@ -79,6 +81,13 @@ int v9fs_file_open(struct inode *inode, struct file *file) vfid->filp = file; kfree(fcall); + if((vfid->qid.version) && (v9ses->cache)) { + dprintk(DEBUG_VFS, "cached"); + /* enable cached file options */ + if(file->f_op == &v9fs_file_operations) + file->f_op = &v9fs_cached_file_operations; + } + return 0; Clunk_Fid: @@ -238,6 +247,17 @@ v9fs_file_write(struct file *filp, const char __user * data, return total; } +static const struct file_operations v9fs_cached_file_operations = { + .llseek = generic_file_llseek, + .read = do_sync_read, + .aio_read = generic_file_aio_read, + .write = v9fs_file_write, + .open = v9fs_file_open, + .release = v9fs_dir_release, + .lock = v9fs_file_lock, + .mmap = generic_file_mmap, +}; + const struct file_operations v9fs_file_operations = { .llseek = generic_file_llseek, .read = v9fs_file_read,