• Home
  • Raw
  • Download

Lines Matching refs:fc

39 static int legacy_init_fs_context(struct fs_context *fc);
84 static int vfs_parse_sb_flag(struct fs_context *fc, const char *key) in vfs_parse_sb_flag() argument
95 fc->sb_flags |= token; in vfs_parse_sb_flag()
96 fc->sb_flags_mask |= token; in vfs_parse_sb_flag()
102 fc->sb_flags &= ~token; in vfs_parse_sb_flag()
103 fc->sb_flags_mask |= token; in vfs_parse_sb_flag()
126 int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param) in vfs_parse_fs_param() argument
131 return invalf(fc, "Unnamed parameter\n"); in vfs_parse_fs_param()
133 ret = vfs_parse_sb_flag(fc, param->key); in vfs_parse_fs_param()
137 ret = security_fs_context_parse_param(fc, param); in vfs_parse_fs_param()
144 if (fc->ops->parse_param) { in vfs_parse_fs_param()
145 ret = fc->ops->parse_param(fc, param); in vfs_parse_fs_param()
155 return invalf(fc, "VFS: Non-string source"); in vfs_parse_fs_param()
156 if (fc->source) in vfs_parse_fs_param()
157 return invalf(fc, "VFS: Multiple sources"); in vfs_parse_fs_param()
158 fc->source = param->string; in vfs_parse_fs_param()
163 return invalf(fc, "%s: Unknown parameter '%s'", in vfs_parse_fs_param()
164 fc->fs_type->name, param->key); in vfs_parse_fs_param()
171 int vfs_parse_fs_string(struct fs_context *fc, const char *key, in vfs_parse_fs_string() argument
188 ret = vfs_parse_fs_param(fc, &param); in vfs_parse_fs_string()
205 int generic_parse_monolithic(struct fs_context *fc, void *data) in generic_parse_monolithic() argument
213 ret = security_sb_eat_lsm_opts(options, &fc->security); in generic_parse_monolithic()
228 ret = vfs_parse_fs_string(fc, key, value, v_len); in generic_parse_monolithic()
258 struct fs_context *fc; in alloc_fs_context() local
261 fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL); in alloc_fs_context()
262 if (!fc) in alloc_fs_context()
265 fc->purpose = purpose; in alloc_fs_context()
266 fc->sb_flags = sb_flags; in alloc_fs_context()
267 fc->sb_flags_mask = sb_flags_mask; in alloc_fs_context()
268 fc->fs_type = get_filesystem(fs_type); in alloc_fs_context()
269 fc->cred = get_current_cred(); in alloc_fs_context()
270 fc->net_ns = get_net(current->nsproxy->net_ns); in alloc_fs_context()
272 mutex_init(&fc->uapi_mutex); in alloc_fs_context()
276 fc->user_ns = get_user_ns(fc->cred->user_ns); in alloc_fs_context()
279 fc->user_ns = get_user_ns(reference->d_sb->s_user_ns); in alloc_fs_context()
283 fc->user_ns = get_user_ns(reference->d_sb->s_user_ns); in alloc_fs_context()
284 fc->root = dget(reference); in alloc_fs_context()
289 init_fs_context = fc->fs_type->init_fs_context; in alloc_fs_context()
293 ret = init_fs_context(fc); in alloc_fs_context()
296 fc->need_free = true; in alloc_fs_context()
297 return fc; in alloc_fs_context()
300 put_fs_context(fc); in alloc_fs_context()
328 void fc_drop_locked(struct fs_context *fc) in fc_drop_locked() argument
330 struct super_block *sb = fc->root->d_sb; in fc_drop_locked()
331 dput(fc->root); in fc_drop_locked()
332 fc->root = NULL; in fc_drop_locked()
336 static void legacy_fs_context_free(struct fs_context *fc);
344 struct fs_context *fc; in vfs_dup_fs_context() local
350 fc = kmemdup(src_fc, sizeof(struct fs_context), GFP_KERNEL); in vfs_dup_fs_context()
351 if (!fc) in vfs_dup_fs_context()
354 mutex_init(&fc->uapi_mutex); in vfs_dup_fs_context()
356 fc->fs_private = NULL; in vfs_dup_fs_context()
357 fc->s_fs_info = NULL; in vfs_dup_fs_context()
358 fc->source = NULL; in vfs_dup_fs_context()
359 fc->security = NULL; in vfs_dup_fs_context()
360 get_filesystem(fc->fs_type); in vfs_dup_fs_context()
361 get_net(fc->net_ns); in vfs_dup_fs_context()
362 get_user_ns(fc->user_ns); in vfs_dup_fs_context()
363 get_cred(fc->cred); in vfs_dup_fs_context()
364 if (fc->log) in vfs_dup_fs_context()
365 refcount_inc(&fc->log->usage); in vfs_dup_fs_context()
368 ret = fc->ops->dup(fc, src_fc); in vfs_dup_fs_context()
372 ret = security_fs_context_dup(fc, src_fc); in vfs_dup_fs_context()
375 return fc; in vfs_dup_fs_context()
378 put_fs_context(fc); in vfs_dup_fs_context()
388 void logfc(struct fs_context *fc, const char *fmt, ...) in logfc() argument
391 struct fc_log *log = fc ? fc->log : NULL; in logfc()
469 static void put_fc_log(struct fs_context *fc) in put_fc_log() argument
471 struct fc_log *log = fc->log; in put_fc_log()
476 fc->log = NULL; in put_fc_log()
489 void put_fs_context(struct fs_context *fc) in put_fs_context() argument
493 if (fc->root) { in put_fs_context()
494 sb = fc->root->d_sb; in put_fs_context()
495 dput(fc->root); in put_fs_context()
496 fc->root = NULL; in put_fs_context()
500 if (fc->need_free && fc->ops && fc->ops->free) in put_fs_context()
501 fc->ops->free(fc); in put_fs_context()
503 security_free_mnt_opts(&fc->security); in put_fs_context()
504 put_net(fc->net_ns); in put_fs_context()
505 put_user_ns(fc->user_ns); in put_fs_context()
506 put_cred(fc->cred); in put_fs_context()
507 put_fc_log(fc); in put_fs_context()
508 put_filesystem(fc->fs_type); in put_fs_context()
509 kfree(fc->source); in put_fs_context()
510 kfree(fc); in put_fs_context()
517 static void legacy_fs_context_free(struct fs_context *fc) in legacy_fs_context_free() argument
519 struct legacy_fs_context *ctx = fc->fs_private; in legacy_fs_context_free()
531 static int legacy_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc) in legacy_fs_context_dup() argument
549 fc->fs_private = ctx; in legacy_fs_context_dup()
557 static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param) in legacy_parse_param() argument
559 struct legacy_fs_context *ctx = fc->fs_private; in legacy_parse_param()
565 return invalf(fc, "VFS: Legacy: Non-string source"); in legacy_parse_param()
566 if (fc->source) in legacy_parse_param()
567 return invalf(fc, "VFS: Legacy: Multiple sources"); in legacy_parse_param()
568 fc->source = param->string; in legacy_parse_param()
574 return invalf(fc, "VFS: Legacy: Can't mix monolithic and individual options"); in legacy_parse_param()
584 return invalf(fc, "VFS: Legacy: Parameter type for '%s' not supported", in legacy_parse_param()
589 return invalf(fc, "VFS: Legacy: Cumulative options too large"); in legacy_parse_param()
593 return invalf(fc, "VFS: Legacy: Option '%s' contained comma", in legacy_parse_param()
619 static int legacy_parse_monolithic(struct fs_context *fc, void *data) in legacy_parse_monolithic() argument
621 struct legacy_fs_context *ctx = fc->fs_private; in legacy_parse_monolithic()
633 if (fc->fs_type->fs_flags & FS_BINARY_MOUNTDATA) in legacy_parse_monolithic()
635 return security_sb_eat_lsm_opts(ctx->legacy_data, &fc->security); in legacy_parse_monolithic()
641 static int legacy_get_tree(struct fs_context *fc) in legacy_get_tree() argument
643 struct legacy_fs_context *ctx = fc->fs_private; in legacy_get_tree()
647 root = fc->fs_type->mount(fc->fs_type, fc->sb_flags, in legacy_get_tree()
648 fc->source, ctx->legacy_data); in legacy_get_tree()
655 fc->root = root; in legacy_get_tree()
662 static int legacy_reconfigure(struct fs_context *fc) in legacy_reconfigure() argument
664 struct legacy_fs_context *ctx = fc->fs_private; in legacy_reconfigure()
665 struct super_block *sb = fc->root->d_sb; in legacy_reconfigure()
670 return sb->s_op->remount_fs(sb, &fc->sb_flags, in legacy_reconfigure()
687 static int legacy_init_fs_context(struct fs_context *fc) in legacy_init_fs_context() argument
689 fc->fs_private = kzalloc(sizeof(struct legacy_fs_context), GFP_KERNEL); in legacy_init_fs_context()
690 if (!fc->fs_private) in legacy_init_fs_context()
692 fc->ops = &legacy_fs_context_ops; in legacy_init_fs_context()
696 int parse_monolithic_mount_data(struct fs_context *fc, void *data) in parse_monolithic_mount_data() argument
700 monolithic_mount_data = fc->ops->parse_monolithic; in parse_monolithic_mount_data()
704 return monolithic_mount_data(fc, data); in parse_monolithic_mount_data()
720 void vfs_clean_context(struct fs_context *fc) in vfs_clean_context() argument
722 if (fc->need_free && fc->ops && fc->ops->free) in vfs_clean_context()
723 fc->ops->free(fc); in vfs_clean_context()
724 fc->need_free = false; in vfs_clean_context()
725 fc->fs_private = NULL; in vfs_clean_context()
726 fc->s_fs_info = NULL; in vfs_clean_context()
727 fc->sb_flags = 0; in vfs_clean_context()
728 security_free_mnt_opts(&fc->security); in vfs_clean_context()
729 kfree(fc->source); in vfs_clean_context()
730 fc->source = NULL; in vfs_clean_context()
732 fc->purpose = FS_CONTEXT_FOR_RECONFIGURE; in vfs_clean_context()
733 fc->phase = FS_CONTEXT_AWAITING_RECONF; in vfs_clean_context()
736 int finish_clean_context(struct fs_context *fc) in finish_clean_context() argument
740 if (fc->phase != FS_CONTEXT_AWAITING_RECONF) in finish_clean_context()
743 if (fc->fs_type->init_fs_context) in finish_clean_context()
744 error = fc->fs_type->init_fs_context(fc); in finish_clean_context()
746 error = legacy_init_fs_context(fc); in finish_clean_context()
748 fc->phase = FS_CONTEXT_FAILED; in finish_clean_context()
751 fc->need_free = true; in finish_clean_context()
752 fc->phase = FS_CONTEXT_RECONF_PARAMS; in finish_clean_context()