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()
37 hmdfs_get_lower_path(file->f_path.dentry, &lower_path); in hmdfs_file_open_local()
38 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_file_open_local()
45 file->private_data = gfi; in hmdfs_file_open_local()
51 int hmdfs_file_release_local(struct inode *inode, struct file *file) in hmdfs_file_release_local() argument
53 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_file_release_local()
55 file->private_data = NULL; in hmdfs_file_release_local()
61 static void hmdfs_file_accessed(struct file *file) in hmdfs_file_accessed() argument
63 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_accessed()
64 struct inode *inode = file_inode(file); in hmdfs_file_accessed()
67 if (file->f_flags & O_NOATIME) in hmdfs_file_accessed()
73 ssize_t hmdfs_do_read_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_read_iter() argument
77 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_read_iter()
83 hmdfs_file_accessed(file); in hmdfs_do_read_iter()
93 static void hmdfs_file_modified(struct file *file) in hmdfs_file_modified() argument
95 struct inode *inode = file_inode(file); in hmdfs_file_modified()
96 struct dentry *dentry = file_dentry(file); in hmdfs_file_modified()
97 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_modified()
109 ssize_t hmdfs_do_write_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_write_iter() argument
113 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_write_iter()
114 struct inode *inode = file_inode(file); in hmdfs_do_write_iter()
121 ret = file_remove_privs(file); in hmdfs_do_write_iter()
129 hmdfs_file_modified(file); in hmdfs_do_write_iter()
141 int hmdfs_fsync_local(struct file *file, loff_t start, loff_t end, int datasync) in hmdfs_fsync_local() argument
144 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_fsync_local()
146 err = __generic_file_fsync(file, start, end, datasync); in hmdfs_fsync_local()
155 loff_t hmdfs_file_llseek_local(struct file *file, loff_t offset, int whence) in hmdfs_file_llseek_local() argument
158 struct file *lower_file; in hmdfs_file_llseek_local()
160 lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_llseek_local()
161 lower_file->f_pos = file->f_pos; in hmdfs_file_llseek_local()
163 file->f_pos = lower_file->f_pos; in hmdfs_file_llseek_local()
168 int hmdfs_file_mmap_local(struct file *file, struct vm_area_struct *vma) in hmdfs_file_mmap_local() argument
170 struct hmdfs_file_info *private_data = file->private_data; in hmdfs_file_mmap_local()
171 struct file *realfile = NULL; in hmdfs_file_mmap_local()
184 if (WARN_ON(file != vma->vm_file)) in hmdfs_file_mmap_local()
192 fput(file); in hmdfs_file_mmap_local()
194 file_accessed(file); in hmdfs_file_mmap_local()
212 static int hmdfs_iterate_local(struct file *file, struct dir_context *ctx) in hmdfs_iterate_local() argument
216 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_iterate_local()
221 lower_file->f_pos = file->f_pos; in hmdfs_iterate_local()
223 file->f_pos = lower_file->f_pos; in hmdfs_iterate_local()
228 trace_hmdfs_iterate_local(file->f_path.dentry, start_pos, ctx->pos, in hmdfs_iterate_local()
233 int hmdfs_dir_open_local(struct inode *inode, struct file *file) in hmdfs_dir_open_local() argument
236 struct file *lower_file = NULL; in hmdfs_dir_open_local()
237 struct dentry *dentry = file->f_path.dentry; in hmdfs_dir_open_local()
251 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_dir_open_local()
258 file->private_data = gfi; in hmdfs_dir_open_local()
267 static int hmdfs_dir_release_local(struct inode *inode, struct file *file) in hmdfs_dir_release_local() argument
269 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_dir_release_local()
271 file->private_data = NULL; in hmdfs_dir_release_local()
285 static int __hmdfs_ioc_set_share_path(struct file *file, in __hmdfs_ioc_set_share_path() argument
288 struct super_block *sb = file->f_inode->i_sb; in __hmdfs_ioc_set_share_path()
299 if (!src.file) in __hmdfs_ioc_set_share_path()
302 /* only reg file can be shared */ in __hmdfs_ioc_set_share_path()
303 if (!S_ISREG(src.file->f_inode->i_mode)) { in __hmdfs_ioc_set_share_path()
308 /* share file is not allowed to be shared */ in __hmdfs_ioc_set_share_path()
309 if (hmdfs_is_share_file(src.file)) { in __hmdfs_ioc_set_share_path()
314 dentry = src.file->f_path.dentry; in __hmdfs_ioc_set_share_path()
320 dir_path = hmdfs_get_dentry_relative_path(file->f_path.dentry); in __hmdfs_ioc_set_share_path()
337 err = insert_share_item(st, &relative_path, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
344 update_share_item(item, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
356 static int hmdfs_ioc_set_share_path(struct file *file, unsigned long arg) in hmdfs_ioc_set_share_path() argument
364 return __hmdfs_ioc_set_share_path(file, &sc); in hmdfs_ioc_set_share_path()
367 static long hmdfs_dir_ioctl_local(struct file *file, unsigned int cmd, in hmdfs_dir_ioctl_local() argument
372 return hmdfs_ioc_set_share_path(file, arg); in hmdfs_dir_ioctl_local()