inode.c (96cafb9ccb153f6a82ff2c9bde68916d9d65501e) | inode.c (d7167b149943e38ad610191ecbb0800c78bbced9) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Minimal file system backend for holding eBPF maps and programs, 4 * used by bpf(2) object pinning. 5 * 6 * Authors: 7 * 8 * Daniel Borkmann <daniel@iogearbox.net> --- 573 unchanged lines hidden (view full) --- 582 .show_options = bpf_show_options, 583 .free_inode = bpf_free_inode, 584}; 585 586enum { 587 OPT_MODE, 588}; 589 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Minimal file system backend for holding eBPF maps and programs, 4 * used by bpf(2) object pinning. 5 * 6 * Authors: 7 * 8 * Daniel Borkmann <daniel@iogearbox.net> --- 573 unchanged lines hidden (view full) --- 582 .show_options = bpf_show_options, 583 .free_inode = bpf_free_inode, 584}; 585 586enum { 587 OPT_MODE, 588}; 589 |
590static const struct fs_parameter_spec bpf_param_specs[] = { | 590static const struct fs_parameter_spec bpf_fs_parameters[] = { |
591 fsparam_u32oct ("mode", OPT_MODE), 592 {} 593}; 594 | 591 fsparam_u32oct ("mode", OPT_MODE), 592 {} 593}; 594 |
595static const struct fs_parameter_description bpf_fs_parameters = { 596 .specs = bpf_param_specs, 597}; 598 | |
599struct bpf_mount_opts { 600 umode_t mode; 601}; 602 603static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param) 604{ 605 struct bpf_mount_opts *opts = fc->fs_private; 606 struct fs_parse_result result; 607 int opt; 608 | 595struct bpf_mount_opts { 596 umode_t mode; 597}; 598 599static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param) 600{ 601 struct bpf_mount_opts *opts = fc->fs_private; 602 struct fs_parse_result result; 603 int opt; 604 |
609 opt = fs_parse(fc, &bpf_fs_parameters, param, &result); | 605 opt = fs_parse(fc, bpf_fs_parameters, param, &result); |
610 if (opt < 0) 611 /* We might like to report bad mount options here, but 612 * traditionally we've ignored all mount options, so we'd 613 * better continue to ignore non-existing options for bpf. 614 */ 615 return opt == -ENOPARAM ? 0 : opt; 616 617 switch (opt) { --- 59 unchanged lines hidden (view full) --- 677 fc->ops = &bpf_context_ops; 678 return 0; 679} 680 681static struct file_system_type bpf_fs_type = { 682 .owner = THIS_MODULE, 683 .name = "bpf", 684 .init_fs_context = bpf_init_fs_context, | 606 if (opt < 0) 607 /* We might like to report bad mount options here, but 608 * traditionally we've ignored all mount options, so we'd 609 * better continue to ignore non-existing options for bpf. 610 */ 611 return opt == -ENOPARAM ? 0 : opt; 612 613 switch (opt) { --- 59 unchanged lines hidden (view full) --- 673 fc->ops = &bpf_context_ops; 674 return 0; 675} 676 677static struct file_system_type bpf_fs_type = { 678 .owner = THIS_MODULE, 679 .name = "bpf", 680 .init_fs_context = bpf_init_fs_context, |
685 .parameters = &bpf_fs_parameters, | 681 .parameters = bpf_fs_parameters, |
686 .kill_sb = kill_litter_super, 687}; 688 689static int __init bpf_init(void) 690{ 691 int ret; 692 693 ret = sysfs_create_mount_point(fs_kobj, "bpf"); 694 if (ret) 695 return ret; 696 697 ret = register_filesystem(&bpf_fs_type); 698 if (ret) 699 sysfs_remove_mount_point(fs_kobj, "bpf"); 700 701 return ret; 702} 703fs_initcall(bpf_init); | 682 .kill_sb = kill_litter_super, 683}; 684 685static int __init bpf_init(void) 686{ 687 int ret; 688 689 ret = sysfs_create_mount_point(fs_kobj, "bpf"); 690 if (ret) 691 return ret; 692 693 ret = register_filesystem(&bpf_fs_type); 694 if (ret) 695 sysfs_remove_mount_point(fs_kobj, "bpf"); 696 697 return ret; 698} 699fs_initcall(bpf_init); |