Lines Matching full:file
8 #include <linux/file.h>
23 int hmdfs_file_open_local(struct inode *inode, struct file *file) in hmdfs_file_open_local() argument
26 struct file *lower_file = NULL; in hmdfs_file_open_local()
38 hmdfs_get_lower_path(file->f_path.dentry, &lower_path); in hmdfs_file_open_local()
41 lower_file = dentry_open(&lower_path, file->f_flags | O_DIRECT, in hmdfs_file_open_local()
44 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_file_open_local()
51 file->private_data = gfi; in hmdfs_file_open_local()
52 hmdfs_update_upper_file(file, lower_file); in hmdfs_file_open_local()
53 if (file->f_flags & (O_RDWR | O_WRONLY)) in hmdfs_file_open_local()
60 int hmdfs_file_release_local(struct inode *inode, struct file *file) in hmdfs_file_release_local() argument
62 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_file_release_local()
65 if (file->f_flags & (O_RDWR | O_WRONLY)) in hmdfs_file_release_local()
67 file->private_data = NULL; in hmdfs_file_release_local()
73 static void hmdfs_file_accessed(struct file *file) in hmdfs_file_accessed() argument
75 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_accessed()
76 struct inode *inode = file_inode(file); in hmdfs_file_accessed()
79 if (file->f_flags & O_NOATIME) in hmdfs_file_accessed()
85 ssize_t hmdfs_do_read_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_read_iter() argument
89 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_read_iter()
95 if (file->f_inode->i_mapping != NULL && in hmdfs_do_read_iter()
96 file->f_inode->i_mapping->a_ops == &hmdfs_aops_cloud) { in hmdfs_do_read_iter()
102 hmdfs_file_accessed(file); in hmdfs_do_read_iter()
112 static void hmdfs_file_modified(struct file *file) in hmdfs_file_modified() argument
114 struct inode *inode = file_inode(file); in hmdfs_file_modified()
115 struct dentry *dentry = file_dentry(file); in hmdfs_file_modified()
116 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_modified()
128 ssize_t hmdfs_do_write_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_write_iter() argument
132 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_write_iter()
133 struct inode *inode = file_inode(file); in hmdfs_do_write_iter()
140 ret = file_remove_privs(file); in hmdfs_do_write_iter()
148 hmdfs_file_modified(file); in hmdfs_do_write_iter()
160 int hmdfs_fsync_local(struct file *file, loff_t start, loff_t end, int datasync) in hmdfs_fsync_local() argument
163 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_fsync_local()
165 err = __generic_file_fsync(file, start, end, datasync); in hmdfs_fsync_local()
174 loff_t hmdfs_file_llseek_local(struct file *file, loff_t offset, int whence) in hmdfs_file_llseek_local() argument
177 struct file *lower_file; in hmdfs_file_llseek_local()
179 lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_llseek_local()
180 lower_file->f_pos = file->f_pos; in hmdfs_file_llseek_local()
182 file->f_pos = lower_file->f_pos; in hmdfs_file_llseek_local()
187 int hmdfs_file_mmap_local(struct file *file, struct vm_area_struct *vma) in hmdfs_file_mmap_local() argument
189 struct hmdfs_file_info *private_data = file->private_data; in hmdfs_file_mmap_local()
190 struct file *realfile = NULL; in hmdfs_file_mmap_local()
203 if (WARN_ON(file != vma->vm_file)) in hmdfs_file_mmap_local()
211 fput(file); in hmdfs_file_mmap_local()
213 file_accessed(file); in hmdfs_file_mmap_local()
231 static int hmdfs_iterate_local(struct file *file, struct dir_context *ctx) in hmdfs_iterate_local() argument
235 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_iterate_local()
240 lower_file->f_pos = file->f_pos; in hmdfs_iterate_local()
242 file->f_pos = lower_file->f_pos; in hmdfs_iterate_local()
247 trace_hmdfs_iterate_local(file->f_path.dentry, start_pos, ctx->pos, in hmdfs_iterate_local()
252 int hmdfs_dir_open_local(struct inode *inode, struct file *file) in hmdfs_dir_open_local() argument
255 struct file *lower_file = NULL; in hmdfs_dir_open_local()
256 struct dentry *dentry = file->f_path.dentry; in hmdfs_dir_open_local()
270 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_dir_open_local()
277 file->private_data = gfi; in hmdfs_dir_open_local()
286 static int hmdfs_dir_release_local(struct inode *inode, struct file *file) in hmdfs_dir_release_local() argument
288 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_dir_release_local()
290 file->private_data = NULL; in hmdfs_dir_release_local()
304 static int __hmdfs_ioc_set_share_path(struct file *file, in __hmdfs_ioc_set_share_path() argument
307 struct super_block *sb = file->f_inode->i_sb; in __hmdfs_ioc_set_share_path()
318 if (!src.file) in __hmdfs_ioc_set_share_path()
321 /* only reg file can be shared */ in __hmdfs_ioc_set_share_path()
322 if (!S_ISREG(src.file->f_inode->i_mode)) { in __hmdfs_ioc_set_share_path()
327 /* share file is not allowed to be shared */ in __hmdfs_ioc_set_share_path()
328 if (hmdfs_is_share_file(src.file)) { in __hmdfs_ioc_set_share_path()
333 dentry = src.file->f_path.dentry; in __hmdfs_ioc_set_share_path()
339 dir_path = hmdfs_get_dentry_relative_path(file->f_path.dentry); in __hmdfs_ioc_set_share_path()
356 err = insert_share_item(st, &relative_path, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
363 update_share_item(item, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
375 static int hmdfs_ioc_set_share_path(struct file *file, unsigned long arg) in hmdfs_ioc_set_share_path() argument
383 return __hmdfs_ioc_set_share_path(file, &sc); in hmdfs_ioc_set_share_path()
386 static long hmdfs_dir_ioctl_local(struct file *file, unsigned int cmd, in hmdfs_dir_ioctl_local() argument
391 return hmdfs_ioc_set_share_path(file, arg); in hmdfs_dir_ioctl_local()