Lines Matching refs:fc

50 	struct fs_context *fc = file->private_data;  in fscontext_read()  local
56 err = mutex_lock_interruptible(&fc->uapi_mutex); in fscontext_read()
59 message = fetch_message_locked(fc->log.log, len, &need_free); in fscontext_read()
60 mutex_unlock(&fc->uapi_mutex); in fscontext_read()
75 struct fs_context *fc = file->private_data; in fscontext_release() local
77 if (fc) { in fscontext_release()
79 put_fs_context(fc); in fscontext_release()
92 static int fscontext_create_fd(struct fs_context *fc, unsigned int o_flags) in fscontext_create_fd() argument
96 fd = anon_inode_getfd("[fscontext]", &fscontext_fops, fc, in fscontext_create_fd()
99 put_fs_context(fc); in fscontext_create_fd()
103 static int fscontext_alloc_log(struct fs_context *fc) in fscontext_alloc_log() argument
105 fc->log.log = kzalloc(sizeof(*fc->log.log), GFP_KERNEL); in fscontext_alloc_log()
106 if (!fc->log.log) in fscontext_alloc_log()
108 refcount_set(&fc->log.log->usage, 1); in fscontext_alloc_log()
109 fc->log.log->owner = fc->fs_type->owner; in fscontext_alloc_log()
123 struct fs_context *fc; in SYSCALL_DEFINE2() local
142 fc = fs_context_for_mount(fs_type, 0); in SYSCALL_DEFINE2()
144 if (IS_ERR(fc)) in SYSCALL_DEFINE2()
145 return PTR_ERR(fc); in SYSCALL_DEFINE2()
147 fc->phase = FS_CONTEXT_CREATE_PARAMS; in SYSCALL_DEFINE2()
149 ret = fscontext_alloc_log(fc); in SYSCALL_DEFINE2()
153 return fscontext_create_fd(fc, flags & FSOPEN_CLOEXEC ? O_CLOEXEC : 0); in SYSCALL_DEFINE2()
156 put_fs_context(fc); in SYSCALL_DEFINE2()
165 struct fs_context *fc; in SYSCALL_DEFINE3() local
194 fc = fs_context_for_reconfigure(target.dentry, 0, 0); in SYSCALL_DEFINE3()
195 if (IS_ERR(fc)) { in SYSCALL_DEFINE3()
196 ret = PTR_ERR(fc); in SYSCALL_DEFINE3()
200 fc->phase = FS_CONTEXT_RECONF_PARAMS; in SYSCALL_DEFINE3()
202 ret = fscontext_alloc_log(fc); in SYSCALL_DEFINE3()
207 return fscontext_create_fd(fc, flags & FSPICK_CLOEXEC ? O_CLOEXEC : 0); in SYSCALL_DEFINE3()
210 put_fs_context(fc); in SYSCALL_DEFINE3()
217 static int vfs_cmd_create(struct fs_context *fc, bool exclusive) in vfs_cmd_create() argument
222 if (fc->phase != FS_CONTEXT_CREATE_PARAMS) in vfs_cmd_create()
225 if (!mount_capable(fc)) in vfs_cmd_create()
228 fc->phase = FS_CONTEXT_CREATING; in vfs_cmd_create()
229 fc->exclusive = exclusive; in vfs_cmd_create()
231 ret = vfs_get_tree(fc); in vfs_cmd_create()
233 fc->phase = FS_CONTEXT_FAILED; in vfs_cmd_create()
237 sb = fc->root->d_sb; in vfs_cmd_create()
240 fc_drop_locked(fc); in vfs_cmd_create()
241 fc->phase = FS_CONTEXT_FAILED; in vfs_cmd_create()
247 fc->phase = FS_CONTEXT_AWAITING_MOUNT; in vfs_cmd_create()
251 static int vfs_cmd_reconfigure(struct fs_context *fc) in vfs_cmd_reconfigure() argument
256 if (fc->phase != FS_CONTEXT_RECONF_PARAMS) in vfs_cmd_reconfigure()
259 fc->phase = FS_CONTEXT_RECONFIGURING; in vfs_cmd_reconfigure()
261 sb = fc->root->d_sb; in vfs_cmd_reconfigure()
263 fc->phase = FS_CONTEXT_FAILED; in vfs_cmd_reconfigure()
268 ret = reconfigure_super(fc); in vfs_cmd_reconfigure()
271 fc->phase = FS_CONTEXT_FAILED; in vfs_cmd_reconfigure()
275 vfs_clean_context(fc); in vfs_cmd_reconfigure()
283 static int vfs_fsconfig_locked(struct fs_context *fc, int cmd, in vfs_fsconfig_locked() argument
288 ret = finish_clean_context(fc); in vfs_fsconfig_locked()
293 return vfs_cmd_create(fc, false); in vfs_fsconfig_locked()
295 return vfs_cmd_create(fc, true); in vfs_fsconfig_locked()
297 return vfs_cmd_reconfigure(fc); in vfs_fsconfig_locked()
299 if (fc->phase != FS_CONTEXT_CREATE_PARAMS && in vfs_fsconfig_locked()
300 fc->phase != FS_CONTEXT_RECONF_PARAMS) in vfs_fsconfig_locked()
303 return vfs_parse_fs_param(fc, param); in vfs_fsconfig_locked()
357 struct fs_context *fc; in SYSCALL_DEFINE5() local
406 fc = fd_file(f)->private_data; in SYSCALL_DEFINE5()
407 if (fc->ops == &legacy_fs_context_ops) { in SYSCALL_DEFINE5()
471 ret = mutex_lock_interruptible(&fc->uapi_mutex); in SYSCALL_DEFINE5()
473 ret = vfs_fsconfig_locked(fc, cmd, &param); in SYSCALL_DEFINE5()
474 mutex_unlock(&fc->uapi_mutex); in SYSCALL_DEFINE5()