Lines Matching full:fb
143 struct fuse_backing *fuse_backing_get(struct fuse_backing *fb) in fuse_backing_get() argument
145 if (fb && refcount_inc_not_zero(&fb->count)) in fuse_backing_get()
146 return fb; in fuse_backing_get()
150 static void fuse_backing_free(struct fuse_backing *fb) in fuse_backing_free() argument
152 pr_debug("%s: fb=0x%p\n", __func__, fb); in fuse_backing_free()
154 if (fb->file) in fuse_backing_free()
155 fput(fb->file); in fuse_backing_free()
156 put_cred(fb->cred); in fuse_backing_free()
157 kfree_rcu(fb, rcu); in fuse_backing_free()
160 void fuse_backing_put(struct fuse_backing *fb) in fuse_backing_put() argument
162 if (fb && refcount_dec_and_test(&fb->count)) in fuse_backing_put()
163 fuse_backing_free(fb); in fuse_backing_put()
171 static int fuse_backing_id_alloc(struct fuse_conn *fc, struct fuse_backing *fb) in fuse_backing_id_alloc() argument
178 id = idr_alloc_cyclic(&fc->backing_files_map, fb, 1, 0, GFP_ATOMIC); in fuse_backing_id_alloc()
189 struct fuse_backing *fb; in fuse_backing_id_remove() local
192 fb = idr_remove(&fc->backing_files_map, id); in fuse_backing_id_remove()
195 return fb; in fuse_backing_id_remove()
200 struct fuse_backing *fb = p; in fuse_backing_id_free() local
202 WARN_ON_ONCE(refcount_read(&fb->count) != 1); in fuse_backing_id_free()
203 fuse_backing_free(fb); in fuse_backing_id_free()
217 struct fuse_backing *fb = NULL; in fuse_backing_open() local
241 fb = kmalloc(sizeof(struct fuse_backing), GFP_KERNEL); in fuse_backing_open()
243 if (!fb) in fuse_backing_open()
246 fb->file = file; in fuse_backing_open()
247 fb->cred = prepare_creds(); in fuse_backing_open()
248 refcount_set(&fb->count, 1); in fuse_backing_open()
250 res = fuse_backing_id_alloc(fc, fb); in fuse_backing_open()
252 fuse_backing_free(fb); in fuse_backing_open()
253 fb = NULL; in fuse_backing_open()
257 pr_debug("%s: fb=0x%p, ret=%i\n", __func__, fb, res); in fuse_backing_open()
268 struct fuse_backing *fb = NULL; in fuse_backing_close() local
283 fb = fuse_backing_id_remove(fc, backing_id); in fuse_backing_close()
284 if (!fb) in fuse_backing_close()
287 fuse_backing_put(fb); in fuse_backing_close()
290 pr_debug("%s: fb=0x%p, err=%i\n", __func__, fb, err); in fuse_backing_close()
298 * Returns an fb object with elevated refcount to be stored in fuse inode.
306 struct fuse_backing *fb = NULL; in fuse_passthrough_open() local
315 fb = idr_find(&fc->backing_files_map, backing_id); in fuse_passthrough_open()
316 fb = fuse_backing_get(fb); in fuse_passthrough_open()
320 if (!fb) in fuse_passthrough_open()
325 &fb->file->f_path, fb->cred); in fuse_passthrough_open()
328 fuse_backing_put(fb); in fuse_passthrough_open()
334 ff->cred = get_cred(fb->cred); in fuse_passthrough_open()
336 pr_debug("%s: backing_id=%d, fb=0x%p, backing_file=0x%p, err=%i\n", __func__, in fuse_passthrough_open()
337 backing_id, fb, ff->passthrough, err); in fuse_passthrough_open()
339 return err ? ERR_PTR(err) : fb; in fuse_passthrough_open()
342 void fuse_passthrough_release(struct fuse_file *ff, struct fuse_backing *fb) in fuse_passthrough_release() argument
344 pr_debug("%s: fb=0x%p, backing_file=0x%p\n", __func__, in fuse_passthrough_release()
345 fb, ff->passthrough); in fuse_passthrough_release()