• Home
  • Raw
  • Download

Lines Matching refs:file

46 	struct file *f = container_of(head, struct file, f_u.fu_rcuhead);  in file_free_rcu()
52 static inline void file_free(struct file *f) in file_free()
95 static struct file *__alloc_file(int flags, const struct cred *cred) in __alloc_file()
97 struct file *f; in __alloc_file()
133 struct file *alloc_empty_file(int flags, const struct cred *cred) in alloc_empty_file()
136 struct file *f; in alloc_empty_file()
170 struct file *alloc_empty_file_noaccount(int flags, const struct cred *cred) in alloc_empty_file_noaccount()
172 struct file *f = __alloc_file(flags, cred); in alloc_empty_file_noaccount()
187 static struct file *alloc_file(const struct path *path, int flags, in alloc_file()
190 struct file *file; in alloc_file() local
192 file = alloc_empty_file(flags, current_cred()); in alloc_file()
193 if (IS_ERR(file)) in alloc_file()
194 return file; in alloc_file()
196 file->f_path = *path; in alloc_file()
197 file->f_inode = path->dentry->d_inode; in alloc_file()
198 file->f_mapping = path->dentry->d_inode->i_mapping; in alloc_file()
199 file->f_wb_err = filemap_sample_wb_err(file->f_mapping); in alloc_file()
200 if ((file->f_mode & FMODE_READ) && in alloc_file()
202 file->f_mode |= FMODE_CAN_READ; in alloc_file()
203 if ((file->f_mode & FMODE_WRITE) && in alloc_file()
205 file->f_mode |= FMODE_CAN_WRITE; in alloc_file()
206 file->f_mode |= FMODE_OPENED; in alloc_file()
207 file->f_op = fop; in alloc_file()
208 if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) in alloc_file()
210 return file; in alloc_file()
213 struct file *alloc_file_pseudo(struct inode *inode, struct vfsmount *mnt, in alloc_file_pseudo()
222 struct file *file; in alloc_file_pseudo() local
231 file = alloc_file(&path, flags, fops); in alloc_file_pseudo()
232 if (IS_ERR(file)) { in alloc_file_pseudo()
236 return file; in alloc_file_pseudo()
240 struct file *alloc_file_clone(struct file *base, int flags, in alloc_file_clone()
243 struct file *f = alloc_file(&base->f_path, flags, fops); in alloc_file_clone()
253 static void __fput(struct file *file) in __fput() argument
255 struct dentry *dentry = file->f_path.dentry; in __fput()
256 struct vfsmount *mnt = file->f_path.mnt; in __fput()
257 struct inode *inode = file->f_inode; in __fput()
259 if (unlikely(!(file->f_mode & FMODE_OPENED))) in __fput()
264 fsnotify_close(file); in __fput()
269 eventpoll_release(file); in __fput()
270 locks_remove_file(file); in __fput()
272 ima_file_free(file); in __fput()
273 if (unlikely(file->f_flags & FASYNC)) { in __fput()
274 if (file->f_op->fasync) in __fput()
275 file->f_op->fasync(-1, file, 0); in __fput()
277 if (file->f_op->release) in __fput()
278 file->f_op->release(inode, file); in __fput()
280 !(file->f_mode & FMODE_PATH))) { in __fput()
283 fops_put(file->f_op); in __fput()
284 put_pid(file->f_owner.pid); in __fput()
285 if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) in __fput()
287 if (file->f_mode & FMODE_WRITER) { in __fput()
294 file_free(file); in __fput()
301 struct file *f, *t; in delayed_fput()
309 __fput(container_of(work, struct file, f_u.fu_rcuhead)); in ____fput()
329 void fput(struct file *file) in fput() argument
331 if (atomic_long_dec_and_test(&file->f_count)) { in fput()
335 init_task_work(&file->f_u.fu_rcuhead, ____fput); in fput()
336 if (!task_work_add(task, &file->f_u.fu_rcuhead, true)) in fput()
345 if (llist_add(&file->f_u.fu_llist, &delayed_fput_list)) in fput()
358 void __fput_sync(struct file *file) in __fput_sync() argument
360 if (atomic_long_dec_and_test(&file->f_count)) { in __fput_sync()
363 __fput(file); in __fput_sync()
372 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, in files_init()