Lines Matching full:file
8 #include <linux/file.h>
23 static inline void update_upper_file(struct file *upper_file, struct file *lower_file) in update_upper_file()
34 int hmdfs_file_open_local(struct inode *inode, struct file *file) in hmdfs_file_open_local() argument
37 struct file *lower_file = NULL; in hmdfs_file_open_local()
49 hmdfs_get_lower_path(file->f_path.dentry, &lower_path); in hmdfs_file_open_local()
52 lower_file = dentry_open(&lower_path, file->f_flags | O_DIRECT, in hmdfs_file_open_local()
55 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_file_open_local()
62 file->private_data = gfi; in hmdfs_file_open_local()
63 update_upper_file(file, lower_file); in hmdfs_file_open_local()
64 if (file->f_flags & (O_RDWR | O_WRONLY)) in hmdfs_file_open_local()
71 int hmdfs_file_release_local(struct inode *inode, struct file *file) in hmdfs_file_release_local() argument
73 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_file_release_local()
76 if (file->f_flags & (O_RDWR | O_WRONLY)) in hmdfs_file_release_local()
78 file->private_data = NULL; in hmdfs_file_release_local()
84 static void hmdfs_file_accessed(struct file *file) in hmdfs_file_accessed() argument
86 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_accessed()
87 struct inode *inode = file_inode(file); in hmdfs_file_accessed()
90 if (file->f_flags & O_NOATIME) in hmdfs_file_accessed()
96 ssize_t hmdfs_do_read_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_read_iter() argument
100 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_read_iter()
106 if (file->f_inode->i_mapping != NULL && in hmdfs_do_read_iter()
107 file->f_inode->i_mapping->a_ops == &hmdfs_aops_cloud) { in hmdfs_do_read_iter()
113 hmdfs_file_accessed(file); in hmdfs_do_read_iter()
123 static void hmdfs_file_modified(struct file *file) in hmdfs_file_modified() argument
125 struct inode *inode = file_inode(file); in hmdfs_file_modified()
126 struct dentry *dentry = file_dentry(file); in hmdfs_file_modified()
127 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_modified()
139 ssize_t hmdfs_do_write_iter(struct file *file, struct iov_iter *iter, in hmdfs_do_write_iter() argument
143 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_do_write_iter()
144 struct inode *inode = file_inode(file); in hmdfs_do_write_iter()
151 ret = file_remove_privs(file); in hmdfs_do_write_iter()
159 hmdfs_file_modified(file); in hmdfs_do_write_iter()
171 int hmdfs_fsync_local(struct file *file, loff_t start, loff_t end, int datasync) in hmdfs_fsync_local() argument
174 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_fsync_local()
176 err = __generic_file_fsync(file, start, end, datasync); in hmdfs_fsync_local()
185 loff_t hmdfs_file_llseek_local(struct file *file, loff_t offset, int whence) in hmdfs_file_llseek_local() argument
188 struct file *lower_file; in hmdfs_file_llseek_local()
190 lower_file = hmdfs_f(file)->lower_file; in hmdfs_file_llseek_local()
191 lower_file->f_pos = file->f_pos; in hmdfs_file_llseek_local()
193 file->f_pos = lower_file->f_pos; in hmdfs_file_llseek_local()
198 int hmdfs_file_mmap_local(struct file *file, struct vm_area_struct *vma) in hmdfs_file_mmap_local() argument
200 struct hmdfs_file_info *private_data = file->private_data; in hmdfs_file_mmap_local()
201 struct file *realfile = NULL; in hmdfs_file_mmap_local()
214 if (WARN_ON(file != vma->vm_file)) in hmdfs_file_mmap_local()
222 fput(file); in hmdfs_file_mmap_local()
224 file_accessed(file); in hmdfs_file_mmap_local()
242 static int hmdfs_iterate_local(struct file *file, struct dir_context *ctx) in hmdfs_iterate_local() argument
246 struct file *lower_file = hmdfs_f(file)->lower_file; in hmdfs_iterate_local()
251 lower_file->f_pos = file->f_pos; in hmdfs_iterate_local()
253 file->f_pos = lower_file->f_pos; in hmdfs_iterate_local()
258 trace_hmdfs_iterate_local(file->f_path.dentry, start_pos, ctx->pos, in hmdfs_iterate_local()
263 int hmdfs_dir_open_local(struct inode *inode, struct file *file) in hmdfs_dir_open_local() argument
266 struct file *lower_file = NULL; in hmdfs_dir_open_local()
267 struct dentry *dentry = file->f_path.dentry; in hmdfs_dir_open_local()
281 lower_file = dentry_open(&lower_path, file->f_flags, cred); in hmdfs_dir_open_local()
288 file->private_data = gfi; in hmdfs_dir_open_local()
297 static int hmdfs_dir_release_local(struct inode *inode, struct file *file) in hmdfs_dir_release_local() argument
299 struct hmdfs_file_info *gfi = hmdfs_f(file); in hmdfs_dir_release_local()
301 file->private_data = NULL; in hmdfs_dir_release_local()
315 static int __hmdfs_ioc_set_share_path(struct file *file, in __hmdfs_ioc_set_share_path() argument
318 struct super_block *sb = file->f_inode->i_sb; in __hmdfs_ioc_set_share_path()
329 if (!src.file) in __hmdfs_ioc_set_share_path()
332 /* only reg file can be shared */ in __hmdfs_ioc_set_share_path()
333 if (!S_ISREG(src.file->f_inode->i_mode)) { in __hmdfs_ioc_set_share_path()
338 /* share file is not allowed to be shared */ in __hmdfs_ioc_set_share_path()
339 if (hmdfs_is_share_file(src.file)) { in __hmdfs_ioc_set_share_path()
344 dentry = src.file->f_path.dentry; in __hmdfs_ioc_set_share_path()
350 dir_path = hmdfs_get_dentry_relative_path(file->f_path.dentry); in __hmdfs_ioc_set_share_path()
367 err = insert_share_item(st, &relative_path, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
374 update_share_item(item, src.file, sc->cid); in __hmdfs_ioc_set_share_path()
386 static int hmdfs_ioc_set_share_path(struct file *file, unsigned long arg) in hmdfs_ioc_set_share_path() argument
394 return __hmdfs_ioc_set_share_path(file, &sc); in hmdfs_ioc_set_share_path()
397 static long hmdfs_dir_ioctl_local(struct file *file, unsigned int cmd, in hmdfs_dir_ioctl_local() argument
402 return hmdfs_ioc_set_share_path(file, arg); in hmdfs_dir_ioctl_local()