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()
39 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_file_open_local()
46 file->private_data = gfi; in hmdfs_file_open_local()
47 if (file->f_flags & (O_RDWR | O_WRONLY)) in hmdfs_file_open_local()
54 int hmdfs_file_release_local(struct inode *inode, struct file *file) in hmdfs_file_release_local() argument
56 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_file_release_local()
59 if (file->f_flags & (O_RDWR | O_WRONLY)) in hmdfs_file_release_local()
61 file->private_data = NULL; in hmdfs_file_release_local()
67 static void hmdfs_file_accessed(struct file *file) in hmdfs_file_accessed() argument
69 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_accessed()
70 struct inode *inode = file_inode(file); in hmdfs_file_accessed()
73 if (file->f_flags & O_NOATIME) in hmdfs_file_accessed()
79 ssize_t hmdfs_do_read_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_read_iter() argument
83 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_read_iter()
89 hmdfs_file_accessed(file); in hmdfs_do_read_iter()
99 static void hmdfs_file_modified(struct file *file) in hmdfs_file_modified() argument
101 struct inode *inode = file_inode(file); in hmdfs_file_modified()
102 struct dentry *dentry = file_dentry(file); in hmdfs_file_modified()
103 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_modified()
115 ssize_t hmdfs_do_write_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_write_iter() argument
119 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_write_iter()
120 struct inode *inode = file_inode(file); in hmdfs_do_write_iter()
127 ret = file_remove_privs(file); in hmdfs_do_write_iter()
135 hmdfs_file_modified(file); in hmdfs_do_write_iter()
147 int hmdfs_fsync_local(struct file *file, loff_t start, loff_t end, int datasync) in hmdfs_fsync_local() argument
150 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_fsync_local()
152 err = __generic_file_fsync(file, start, end, datasync); in hmdfs_fsync_local()
161 loff_t hmdfs_file_llseek_local(struct file *file, loff_t offset, int whence) in hmdfs_file_llseek_local() argument
164 struct file *lower_file; in hmdfs_file_llseek_local()
166 lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_llseek_local()
167 lower_file->f_pos = file->f_pos; in hmdfs_file_llseek_local()
169 file->f_pos = lower_file->f_pos; in hmdfs_file_llseek_local()
174 int hmdfs_file_mmap_local(struct file *file, struct vm_area_struct *vma) in hmdfs_file_mmap_local() argument
176 struct hmdfs_file_info *private_data = file->private_data; in hmdfs_file_mmap_local()
177 struct file *realfile = NULL; in hmdfs_file_mmap_local()
190 if (WARN_ON(file != vma->vm_file)) in hmdfs_file_mmap_local()
198 fput(file); in hmdfs_file_mmap_local()
200 file_accessed(file); in hmdfs_file_mmap_local()
218 static int hmdfs_iterate_local(struct file *file, struct dir_context *ctx) in hmdfs_iterate_local() argument
222 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_iterate_local()
227 lower_file->f_pos = file->f_pos; in hmdfs_iterate_local()
229 file->f_pos = lower_file->f_pos; in hmdfs_iterate_local()
234 trace_hmdfs_iterate_local(file->f_path.dentry, start_pos, ctx->pos, in hmdfs_iterate_local()
239 int hmdfs_dir_open_local(struct inode *inode, struct file *file) in hmdfs_dir_open_local() argument
242 struct file *lower_file = NULL; in hmdfs_dir_open_local()
243 struct dentry *dentry = file->f_path.dentry; in hmdfs_dir_open_local()
257 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_dir_open_local()
264 file->private_data = gfi; in hmdfs_dir_open_local()
273 static int hmdfs_dir_release_local(struct inode *inode, struct file *file) in hmdfs_dir_release_local() argument
275 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_dir_release_local()
277 file->private_data = NULL; in hmdfs_dir_release_local()
291 static int __hmdfs_ioc_set_share_path(struct file *file, in __hmdfs_ioc_set_share_path() argument
294 struct super_block *sb = file->f_inode->i_sb; in __hmdfs_ioc_set_share_path()
305 if (!src.file) in __hmdfs_ioc_set_share_path()
308 /* only reg file can be shared */ in __hmdfs_ioc_set_share_path()
309 if (!S_ISREG(src.file->f_inode->i_mode)) { in __hmdfs_ioc_set_share_path()
314 /* share file is not allowed to be shared */ in __hmdfs_ioc_set_share_path()
315 if (hmdfs_is_share_file(src.file)) { in __hmdfs_ioc_set_share_path()
320 dentry = src.file->f_path.dentry; in __hmdfs_ioc_set_share_path()
326 dir_path = hmdfs_get_dentry_relative_path(file->f_path.dentry); in __hmdfs_ioc_set_share_path()
343 err = insert_share_item(st, &relative_path, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
350 update_share_item(item, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
362 static int hmdfs_ioc_set_share_path(struct file *file, unsigned long arg) in hmdfs_ioc_set_share_path() argument
370 return __hmdfs_ioc_set_share_path(file, &sc); in hmdfs_ioc_set_share_path()
373 static long hmdfs_dir_ioctl_local(struct file *file, unsigned int cmd, in hmdfs_dir_ioctl_local() argument
378 return hmdfs_ioc_set_share_path(file, arg); in hmdfs_dir_ioctl_local()