Lines Matching refs:f
55 #define backing_file(f) container_of(f, struct backing_file, file) argument
57 struct path *backing_file_user_path(const struct file *f) in backing_file_user_path() argument
59 return &backing_file(f)->user_path; in backing_file_user_path()
63 void backing_file_set_user_path(struct file *f, const struct path *path) in backing_file_set_user_path() argument
65 backing_file(f)->user_path = *path; in backing_file_set_user_path()
69 static inline void file_free(struct file *f) in file_free() argument
71 security_file_free(f); in file_free()
72 if (likely(!(f->f_mode & FMODE_NOACCOUNT))) in file_free()
74 put_cred(f->f_cred); in file_free()
75 if (unlikely(f->f_mode & FMODE_BACKING)) { in file_free()
76 path_put(backing_file_user_path(f)); in file_free()
77 kmem_cache_free(bfilp_cachep, backing_file(f)); in file_free()
79 kmem_cache_free(filp_cachep, f); in file_free()
154 static int init_file(struct file *f, int flags, const struct cred *cred) in init_file() argument
158 f->f_cred = get_cred(cred); in init_file()
159 error = security_file_alloc(f); in init_file()
161 put_cred(f->f_cred); in init_file()
165 spin_lock_init(&f->f_lock); in init_file()
173 mutex_init(&f->f_pos_lock); in init_file()
174 memset(&f->f_path, 0, sizeof(f->f_path)); in init_file()
175 memset(&f->f_ra, 0, sizeof(f->f_ra)); in init_file()
177 f->f_flags = flags; in init_file()
178 f->f_mode = OPEN_FMODE(flags); in init_file()
180 f->f_op = NULL; in init_file()
181 f->f_mapping = NULL; in init_file()
182 f->private_data = NULL; in init_file()
183 f->f_inode = NULL; in init_file()
184 f->f_owner = NULL; in init_file()
186 f->f_ep = NULL; in init_file()
189 f->f_iocb_flags = 0; in init_file()
190 f->f_pos = 0; in init_file()
191 f->f_wb_err = 0; in init_file()
192 f->f_sb_err = 0; in init_file()
199 file_ref_init(&f->f_ref, 1); in init_file()
204 file_set_fsnotify_mode(f, FMODE_NONOTIFY_PERM); in init_file()
221 struct file *f; in alloc_empty_file() local
237 f = kmem_cache_alloc(filp_cachep, GFP_KERNEL); in alloc_empty_file()
238 if (unlikely(!f)) in alloc_empty_file()
241 error = init_file(f, flags, cred); in alloc_empty_file()
243 kmem_cache_free(filp_cachep, f); in alloc_empty_file()
249 return f; in alloc_empty_file()
268 struct file *f; in alloc_empty_file_noaccount() local
271 f = kmem_cache_alloc(filp_cachep, GFP_KERNEL); in alloc_empty_file_noaccount()
272 if (unlikely(!f)) in alloc_empty_file_noaccount()
275 error = init_file(f, flags, cred); in alloc_empty_file_noaccount()
277 kmem_cache_free(filp_cachep, f); in alloc_empty_file_noaccount()
281 f->f_mode |= FMODE_NOACCOUNT; in alloc_empty_file_noaccount()
283 return f; in alloc_empty_file_noaccount()
430 struct file *f; in alloc_file_clone() local
432 f = alloc_file(&base->f_path, flags, fops); in alloc_file_clone()
433 if (!IS_ERR(f)) { in alloc_file_clone()
434 path_get(&f->f_path); in alloc_file_clone()
435 f->f_mapping = base->f_mapping; in alloc_file_clone()
437 return f; in alloc_file_clone()
488 struct file *f, *t; in delayed_fput() local
490 llist_for_each_entry_safe(f, t, node, f_llist) in delayed_fput()
491 __fput(f); in delayed_fput()