Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull ->s_options removal from Al Viro:
"Preparations for fsmount/fsopen stuff (coming next cycle). Everything
gets moved to explicit ->show_options(), killing ->s_options off +
some cosmetic bits around fs/namespace.c and friends. Basically, the
stuff needed to work with fsmount series with minimum of conflicts
with other work.

It's not strictly required for this merge window, but it would reduce
the PITA during the coming cycle, so it would be nice to have those
bits and pieces out of the way"

* 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
isofs: Fix isofs_show_options()
VFS: Kill off s_options and helpers
orangefs: Implement show_options
9p: Implement show_options
isofs: Implement show_options
afs: Implement show_options
affs: Implement show_options
befs: Implement show_options
spufs: Implement show_options
bpf: Implement show_options
ramfs: Implement show_options
pstore: Implement show_options
omfs: Implement show_options
hugetlbfs: Implement show_options
VFS: Don't use save/replace_mount_options if not using generic_show_options
VFS: Provide empty name qstr
VFS: Make get_filesystem() return the affected filesystem
VFS: Clean up whitespace in fs/namespace.c and fs/super.c
Provide a function to create a NUL-terminated string from unterminated data

+531 -163
-6
Documentation/filesystems/vfs.txt
··· 1225 1225 mount can be accurately replicated (e.g. umounting and mounting again) 1226 1226 based on the information found in /proc/mounts. 1227 1227 1228 - A simple method of saving options at mount/remount time and showing 1229 - them is provided with the save_mount_options() and 1230 - generic_show_options() helper functions. Please note, that using 1231 - these may have drawbacks. For more info see header comments for these 1232 - functions in fs/namespace.c. 1233 - 1234 1228 Resources 1235 1229 ========= 1236 1230
+19 -3
arch/powerpc/platforms/cell/spufs/inode.c
··· 605 605 { Opt_err, NULL }, 606 606 }; 607 607 608 + static int spufs_show_options(struct seq_file *m, struct dentry *root) 609 + { 610 + struct spufs_sb_info *sbi = spufs_get_sb_info(root->d_sb); 611 + struct inode *inode = root->d_inode; 612 + 613 + if (!uid_eq(inode->i_uid, GLOBAL_ROOT_UID)) 614 + seq_printf(m, ",uid=%u", 615 + from_kuid_munged(&init_user_ns, inode->i_uid)); 616 + if (!gid_eq(inode->i_gid, GLOBAL_ROOT_GID)) 617 + seq_printf(m, ",gid=%u", 618 + from_kgid_munged(&init_user_ns, inode->i_gid)); 619 + if ((inode->i_mode & S_IALLUGO) != 0775) 620 + seq_printf(m, ",mode=%o", inode->i_mode); 621 + if (sbi->debug) 622 + seq_puts(m, ",debug"); 623 + return 0; 624 + } 625 + 608 626 static int 609 627 spufs_parse_options(struct super_block *sb, char *options, struct inode *root) 610 628 { ··· 742 724 .destroy_inode = spufs_destroy_inode, 743 725 .statfs = simple_statfs, 744 726 .evict_inode = spufs_evict_inode, 745 - .show_options = generic_show_options, 727 + .show_options = spufs_show_options, 746 728 }; 747 - 748 - save_mount_options(sb, data); 749 729 750 730 info = kzalloc(sizeof(*info), GFP_KERNEL); 751 731 if (!info)
+61
fs/9p/v9fs.c
··· 33 33 #include <linux/parser.h> 34 34 #include <linux/idr.h> 35 35 #include <linux/slab.h> 36 + #include <linux/seq_file.h> 36 37 #include <net/9p/9p.h> 37 38 #include <net/9p/client.h> 38 39 #include <net/9p/transport.h> ··· 83 82 {Opt_err, NULL} 84 83 }; 85 84 85 + static const char *const v9fs_cache_modes[nr__p9_cache_modes] = { 86 + [CACHE_NONE] = "none", 87 + [CACHE_MMAP] = "mmap", 88 + [CACHE_LOOSE] = "loose", 89 + [CACHE_FSCACHE] = "fscache", 90 + }; 91 + 86 92 /* Interpret mount options for cache mode */ 87 93 static int get_cache_mode(char *s) 88 94 { ··· 110 102 } else 111 103 pr_info("Unknown Cache mode %s\n", s); 112 104 return version; 105 + } 106 + 107 + /* 108 + * Display the mount options in /proc/mounts. 109 + */ 110 + int v9fs_show_options(struct seq_file *m, struct dentry *root) 111 + { 112 + struct v9fs_session_info *v9ses = root->d_sb->s_fs_info; 113 + 114 + if (v9ses->debug) 115 + seq_printf(m, ",debug=%x", v9ses->debug); 116 + if (!uid_eq(v9ses->dfltuid, V9FS_DEFUID)) 117 + seq_printf(m, ",dfltuid=%u", 118 + from_kuid_munged(&init_user_ns, v9ses->dfltuid)); 119 + if (!gid_eq(v9ses->dfltgid, V9FS_DEFGID)) 120 + seq_printf(m, ",dfltgid=%u", 121 + from_kgid_munged(&init_user_ns, v9ses->dfltgid)); 122 + if (v9ses->afid != ~0) 123 + seq_printf(m, ",afid=%u", v9ses->afid); 124 + if (strcmp(v9ses->uname, V9FS_DEFUSER) != 0) 125 + seq_printf(m, ",uname=%s", v9ses->uname); 126 + if (strcmp(v9ses->aname, V9FS_DEFANAME) != 0) 127 + seq_printf(m, ",aname=%s", v9ses->aname); 128 + if (v9ses->nodev) 129 + seq_puts(m, ",nodevmap"); 130 + if (v9ses->cache) 131 + seq_printf(m, ",%s", v9fs_cache_modes[v9ses->cache]); 132 + #ifdef CONFIG_9P_FSCACHE 133 + if (v9ses->cachetag && v9ses->cache == CACHE_FSCACHE) 134 + seq_printf(m, ",cachetag=%s", v9ses->cachetag); 135 + #endif 136 + 137 + switch (v9ses->flags & V9FS_ACCESS_MASK) { 138 + case V9FS_ACCESS_USER: 139 + seq_puts(m, ",access=user"); 140 + break; 141 + case V9FS_ACCESS_ANY: 142 + seq_puts(m, ",access=any"); 143 + break; 144 + case V9FS_ACCESS_CLIENT: 145 + seq_puts(m, ",access=client"); 146 + break; 147 + case V9FS_ACCESS_SINGLE: 148 + seq_printf(m, ",access=%u", 149 + from_kuid_munged(&init_user_ns, v9ses->uid)); 150 + break; 151 + } 152 + 153 + if (v9ses->flags & V9FS_POSIX_ACL) 154 + seq_puts(m, ",posixacl"); 155 + 156 + return p9_show_client_options(m, v9ses->clnt); 113 157 } 114 158 115 159 /** ··· 290 230 break; 291 231 case Opt_cachetag: 292 232 #ifdef CONFIG_9P_FSCACHE 233 + kfree(v9ses->cachetag); 293 234 v9ses->cachetag = match_strdup(&args[0]); 294 235 #endif 295 236 break;
+3
fs/9p/v9fs.h
··· 67 67 CACHE_MMAP, 68 68 CACHE_LOOSE, 69 69 CACHE_FSCACHE, 70 + nr__p9_cache_modes 70 71 }; 71 72 72 73 /** ··· 137 136 { 138 137 return container_of(inode, struct v9fs_inode, vfs_inode); 139 138 } 139 + 140 + extern int v9fs_show_options(struct seq_file *m, struct dentry *root); 140 141 141 142 struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, 142 143 char *);
+2 -4
fs/9p/vfs_super.c
··· 33 33 #include <linux/string.h> 34 34 #include <linux/inet.h> 35 35 #include <linux/pagemap.h> 36 - #include <linux/seq_file.h> 37 36 #include <linux/mount.h> 38 37 #include <linux/idr.h> 39 38 #include <linux/sched.h> ··· 103 104 sb->s_flags |= MS_POSIXACL; 104 105 #endif 105 106 106 - save_mount_options(sb, data); 107 107 return 0; 108 108 } 109 109 ··· 347 349 .destroy_inode = v9fs_destroy_inode, 348 350 .statfs = simple_statfs, 349 351 .evict_inode = v9fs_evict_inode, 350 - .show_options = generic_show_options, 352 + .show_options = v9fs_show_options, 351 353 .umount_begin = v9fs_umount_begin, 352 354 .write_inode = v9fs_write_inode, 353 355 }; ··· 358 360 .statfs = v9fs_statfs, 359 361 .drop_inode = v9fs_drop_inode, 360 362 .evict_inode = v9fs_evict_inode, 361 - .show_options = generic_show_options, 363 + .show_options = v9fs_show_options, 362 364 .umount_begin = v9fs_umount_begin, 363 365 .write_inode = v9fs_write_inode_dotl, 364 366 };
+37 -5
fs/affs/super.c
··· 20 20 #include <linux/slab.h> 21 21 #include <linux/writeback.h> 22 22 #include <linux/blkdev.h> 23 + #include <linux/seq_file.h> 23 24 #include "affs.h" 24 25 25 26 static int affs_statfs(struct dentry *dentry, struct kstatfs *buf); 27 + static int affs_show_options(struct seq_file *m, struct dentry *root); 26 28 static int affs_remount (struct super_block *sb, int *flags, char *data); 27 29 28 30 static void ··· 161 159 .sync_fs = affs_sync_fs, 162 160 .statfs = affs_statfs, 163 161 .remount_fs = affs_remount, 164 - .show_options = generic_show_options, 162 + .show_options = affs_show_options, 165 163 }; 166 164 167 165 enum { ··· 295 293 return 1; 296 294 } 297 295 296 + static int affs_show_options(struct seq_file *m, struct dentry *root) 297 + { 298 + struct super_block *sb = root->d_sb; 299 + struct affs_sb_info *sbi = AFFS_SB(sb); 300 + 301 + if (sb->s_blocksize) 302 + seq_printf(m, ",bs=%lu", sb->s_blocksize); 303 + if (affs_test_opt(sbi->s_flags, SF_SETMODE)) 304 + seq_printf(m, ",mode=%o", sbi->s_mode); 305 + if (affs_test_opt(sbi->s_flags, SF_MUFS)) 306 + seq_puts(m, ",mufs"); 307 + if (affs_test_opt(sbi->s_flags, SF_NO_TRUNCATE)) 308 + seq_puts(m, ",nofilenametruncate"); 309 + if (affs_test_opt(sbi->s_flags, SF_PREFIX)) 310 + seq_printf(m, ",prefix=%s", sbi->s_prefix); 311 + if (affs_test_opt(sbi->s_flags, SF_IMMUTABLE)) 312 + seq_puts(m, ",protect"); 313 + if (sbi->s_reserved != 2) 314 + seq_printf(m, ",reserved=%u", sbi->s_reserved); 315 + if (sbi->s_root_block != (sbi->s_reserved + sbi->s_partition_size - 1) / 2) 316 + seq_printf(m, ",root=%u", sbi->s_root_block); 317 + if (affs_test_opt(sbi->s_flags, SF_SETGID)) 318 + seq_printf(m, ",setgid=%u", 319 + from_kgid_munged(&init_user_ns, sbi->s_gid)); 320 + if (affs_test_opt(sbi->s_flags, SF_SETUID)) 321 + seq_printf(m, ",setuid=%u", 322 + from_kuid_munged(&init_user_ns, sbi->s_uid)); 323 + if (affs_test_opt(sbi->s_flags, SF_VERBOSE)) 324 + seq_puts(m, ",verbose"); 325 + if (sbi->s_volume[0]) 326 + seq_printf(m, ",volume=%s", sbi->s_volume); 327 + return 0; 328 + } 329 + 298 330 /* This function definitely needs to be split up. Some fine day I'll 299 331 * hopefully have the guts to do so. Until then: sorry for the mess. 300 332 */ ··· 351 315 int tmp_flags; /* fix remount prototype... */ 352 316 u8 sig[4]; 353 317 int ret; 354 - 355 - save_mount_options(sb, data); 356 318 357 319 pr_debug("read_super(%s)\n", data ? (const char *)data : "no options"); 358 320 ··· 582 548 } 583 549 584 550 flush_delayed_work(&sbi->sb_work); 585 - if (new_opts) 586 - replace_mount_options(sb, new_opts); 587 551 588 552 sbi->s_flags = mount_flags; 589 553 sbi->s_mode = mode;
+43 -2
fs/afs/super.c
··· 37 37 static struct inode *afs_alloc_inode(struct super_block *sb); 38 38 static void afs_destroy_inode(struct inode *inode); 39 39 static int afs_statfs(struct dentry *dentry, struct kstatfs *buf); 40 + static int afs_show_devname(struct seq_file *m, struct dentry *root); 41 + static int afs_show_options(struct seq_file *m, struct dentry *root); 40 42 41 43 struct file_system_type afs_fs_type = { 42 44 .owner = THIS_MODULE, ··· 55 53 .drop_inode = afs_drop_inode, 56 54 .destroy_inode = afs_destroy_inode, 57 55 .evict_inode = afs_evict_inode, 58 - .show_options = generic_show_options, 56 + .show_devname = afs_show_devname, 57 + .show_options = afs_show_options, 59 58 }; 60 59 61 60 static struct kmem_cache *afs_inode_cachep; ··· 136 133 rcu_barrier(); 137 134 kmem_cache_destroy(afs_inode_cachep); 138 135 _leave(""); 136 + } 137 + 138 + /* 139 + * Display the mount device name in /proc/mounts. 140 + */ 141 + static int afs_show_devname(struct seq_file *m, struct dentry *root) 142 + { 143 + struct afs_super_info *as = root->d_sb->s_fs_info; 144 + struct afs_volume *volume = as->volume; 145 + struct afs_cell *cell = volume->cell; 146 + const char *suf = ""; 147 + char pref = '%'; 148 + 149 + switch (volume->type) { 150 + case AFSVL_RWVOL: 151 + break; 152 + case AFSVL_ROVOL: 153 + pref = '#'; 154 + if (volume->type_force) 155 + suf = ".readonly"; 156 + break; 157 + case AFSVL_BACKVOL: 158 + pref = '#'; 159 + suf = ".backup"; 160 + break; 161 + } 162 + 163 + seq_printf(m, "%c%s:%s%s", pref, cell->name, volume->vlocation->vldb.name, suf); 164 + return 0; 165 + } 166 + 167 + /* 168 + * Display the mount options in /proc/mounts. 169 + */ 170 + static int afs_show_options(struct seq_file *m, struct dentry *root) 171 + { 172 + if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(d_inode(root))->flags)) 173 + seq_puts(m, "autocell"); 174 + return 0; 139 175 } 140 176 141 177 /* ··· 469 427 deactivate_locked_super(sb); 470 428 goto error; 471 429 } 472 - save_mount_options(sb, new_opts); 473 430 sb->s_flags |= MS_ACTIVE; 474 431 } else { 475 432 _debug("reuse");
+21 -3
fs/befs/linuxvfs.c
··· 20 20 #include <linux/sched.h> 21 21 #include <linux/cred.h> 22 22 #include <linux/exportfs.h> 23 + #include <linux/seq_file.h> 23 24 24 25 #include "befs.h" 25 26 #include "btree.h" ··· 54 53 static void befs_put_super(struct super_block *); 55 54 static int befs_remount(struct super_block *, int *, char *); 56 55 static int befs_statfs(struct dentry *, struct kstatfs *); 56 + static int befs_show_options(struct seq_file *, struct dentry *); 57 57 static int parse_options(char *, struct befs_mount_options *); 58 58 static struct dentry *befs_fh_to_dentry(struct super_block *sb, 59 59 struct fid *fid, int fh_len, int fh_type); ··· 68 66 .put_super = befs_put_super, /* uninit super */ 69 67 .statfs = befs_statfs, /* statfs */ 70 68 .remount_fs = befs_remount, 71 - .show_options = generic_show_options, 69 + .show_options = befs_show_options, 72 70 }; 73 71 74 72 /* slab cache for befs_inode_info objects */ ··· 773 771 return 1; 774 772 } 775 773 774 + static int befs_show_options(struct seq_file *m, struct dentry *root) 775 + { 776 + struct befs_sb_info *befs_sb = BEFS_SB(root->d_sb); 777 + struct befs_mount_options *opts = &befs_sb->mount_opts; 778 + 779 + if (!uid_eq(opts->uid, GLOBAL_ROOT_UID)) 780 + seq_printf(m, ",uid=%u", 781 + from_kuid_munged(&init_user_ns, opts->uid)); 782 + if (!gid_eq(opts->gid, GLOBAL_ROOT_GID)) 783 + seq_printf(m, ",gid=%u", 784 + from_kgid_munged(&init_user_ns, opts->gid)); 785 + if (opts->iocharset) 786 + seq_printf(m, ",charset=%s", opts->iocharset); 787 + if (opts->debug) 788 + seq_puts(m, ",debug"); 789 + return 0; 790 + } 791 + 776 792 /* This function has the responsibiltiy of getting the 777 793 * filesystem ready for unmounting. 778 794 * Basically, we free everything that we allocated in ··· 823 803 const unsigned long sb_block = 0; 824 804 const off_t x86_sb_off = 512; 825 805 int blocksize; 826 - 827 - save_mount_options(sb, data); 828 806 829 807 sb->s_fs_info = kzalloc(sizeof(*befs_sb), GFP_KERNEL); 830 808 if (sb->s_fs_info == NULL)
-1
fs/btrfs/super.c
··· 1154 1154 goto fail_close; 1155 1155 } 1156 1156 1157 - save_mount_options(sb, data); 1158 1157 cleancache_init_fs(sb); 1159 1158 sb->s_flags |= MS_ACTIVE; 1160 1159 return 0;
+6 -2
fs/dcache.c
··· 90 90 91 91 static struct kmem_cache *dentry_cache __read_mostly; 92 92 93 + const struct qstr empty_name = QSTR_INIT("", 0); 94 + EXPORT_SYMBOL(empty_name); 95 + const struct qstr slash_name = QSTR_INIT("/", 1); 96 + EXPORT_SYMBOL(slash_name); 97 + 93 98 /* 94 99 * This is the single most critical data structure when it comes 95 100 * to the dcache: the hashtable for lookups. Somebody should try ··· 1611 1606 */ 1612 1607 dentry->d_iname[DNAME_INLINE_LEN-1] = 0; 1613 1608 if (unlikely(!name)) { 1614 - static const struct qstr anon = QSTR_INIT("/", 1); 1615 - name = &anon; 1609 + name = &slash_name; 1616 1610 dname = dentry->d_iname; 1617 1611 } else if (name->len > DNAME_INLINE_LEN-1) { 1618 1612 size_t size = offsetof(struct external_name, name[1]);
-2
fs/debugfs/inode.c
··· 203 203 struct debugfs_fs_info *fsi; 204 204 int err; 205 205 206 - save_mount_options(sb, data); 207 - 208 206 fsi = kzalloc(sizeof(struct debugfs_fs_info), GFP_KERNEL); 209 207 sb->s_fs_info = fsi; 210 208 if (!fsi) {
-1
fs/efivarfs/super.c
··· 29 29 .statfs = simple_statfs, 30 30 .drop_inode = generic_delete_inode, 31 31 .evict_inode = efivarfs_evict_inode, 32 - .show_options = generic_show_options, 33 32 }; 34 33 35 34 static struct super_block *efivarfs_sb;
+2 -1
fs/filesystems.c
··· 33 33 static DEFINE_RWLOCK(file_systems_lock); 34 34 35 35 /* WARNING: This can be used only if we _already_ own a reference */ 36 - void get_filesystem(struct file_system_type *fs) 36 + struct file_system_type *get_filesystem(struct file_system_type *fs) 37 37 { 38 38 __module_get(fs->owner); 39 + return fs; 39 40 } 40 41 41 42 void put_filesystem(struct file_system_type *fs)
+1 -2
fs/gfs2/dir.c
··· 872 872 struct buffer_head *bh; 873 873 struct gfs2_leaf *leaf; 874 874 struct gfs2_dirent *dent; 875 - struct qstr name = { .name = "" }; 876 875 struct timespec tv = current_time(inode); 877 876 878 877 error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL); ··· 895 896 leaf->lf_sec = cpu_to_be64(tv.tv_sec); 896 897 memset(leaf->lf_reserved2, 0, sizeof(leaf->lf_reserved2)); 897 898 dent = (struct gfs2_dirent *)(leaf+1); 898 - gfs2_qstr2dirent(&name, bh->b_size - sizeof(struct gfs2_leaf), dent); 899 + gfs2_qstr2dirent(&empty_name, bh->b_size - sizeof(struct gfs2_leaf), dent); 899 900 *pbh = bh; 900 901 return leaf; 901 902 }
+56 -14
fs/hugetlbfs/inode.c
··· 46 46 static const struct inode_operations hugetlbfs_inode_operations; 47 47 48 48 struct hugetlbfs_config { 49 - kuid_t uid; 50 - kgid_t gid; 51 - umode_t mode; 52 - long max_hpages; 53 - long nr_inodes; 54 - struct hstate *hstate; 55 - long min_hpages; 49 + struct hstate *hstate; 50 + long max_hpages; 51 + long nr_inodes; 52 + long min_hpages; 53 + kuid_t uid; 54 + kgid_t gid; 55 + umode_t mode; 56 56 }; 57 57 58 58 struct hugetlbfs_inode_info { ··· 861 861 return 0; 862 862 } 863 863 864 + /* 865 + * Display the mount options in /proc/mounts. 866 + */ 867 + static int hugetlbfs_show_options(struct seq_file *m, struct dentry *root) 868 + { 869 + struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(root->d_sb); 870 + struct hugepage_subpool *spool = sbinfo->spool; 871 + unsigned long hpage_size = huge_page_size(sbinfo->hstate); 872 + unsigned hpage_shift = huge_page_shift(sbinfo->hstate); 873 + char mod; 874 + 875 + if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID)) 876 + seq_printf(m, ",uid=%u", 877 + from_kuid_munged(&init_user_ns, sbinfo->uid)); 878 + if (!gid_eq(sbinfo->gid, GLOBAL_ROOT_GID)) 879 + seq_printf(m, ",gid=%u", 880 + from_kgid_munged(&init_user_ns, sbinfo->gid)); 881 + if (sbinfo->mode != 0755) 882 + seq_printf(m, ",mode=%o", sbinfo->mode); 883 + if (sbinfo->max_inodes != -1) 884 + seq_printf(m, ",nr_inodes=%lu", sbinfo->max_inodes); 885 + 886 + hpage_size /= 1024; 887 + mod = 'K'; 888 + if (hpage_size >= 1024) { 889 + hpage_size /= 1024; 890 + mod = 'M'; 891 + } 892 + seq_printf(m, ",pagesize=%lu%c", hpage_size, mod); 893 + if (spool) { 894 + if (spool->max_hpages != -1) 895 + seq_printf(m, ",size=%llu", 896 + (unsigned long long)spool->max_hpages << hpage_shift); 897 + if (spool->min_hpages != -1) 898 + seq_printf(m, ",min_size=%llu", 899 + (unsigned long long)spool->min_hpages << hpage_shift); 900 + } 901 + return 0; 902 + } 903 + 864 904 static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) 865 905 { 866 906 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb); ··· 1059 1019 .evict_inode = hugetlbfs_evict_inode, 1060 1020 .statfs = hugetlbfs_statfs, 1061 1021 .put_super = hugetlbfs_put_super, 1062 - .show_options = generic_show_options, 1022 + .show_options = hugetlbfs_show_options, 1063 1023 }; 1064 1024 1065 - enum { NO_SIZE, SIZE_STD, SIZE_PERCENT }; 1025 + enum hugetlbfs_size_type { NO_SIZE, SIZE_STD, SIZE_PERCENT }; 1066 1026 1067 1027 /* 1068 1028 * Convert size option passed from command line to number of huge pages 1069 1029 * in the pool specified by hstate. Size option could be in bytes 1070 1030 * (val_type == SIZE_STD) or percentage of the pool (val_type == SIZE_PERCENT). 1071 1031 */ 1072 - static long long 1032 + static long 1073 1033 hugetlbfs_size_to_hpages(struct hstate *h, unsigned long long size_opt, 1074 - int val_type) 1034 + enum hugetlbfs_size_type val_type) 1075 1035 { 1076 1036 if (val_type == NO_SIZE) 1077 1037 return -1; ··· 1093 1053 substring_t args[MAX_OPT_ARGS]; 1094 1054 int option; 1095 1055 unsigned long long max_size_opt = 0, min_size_opt = 0; 1096 - int max_val_type = NO_SIZE, min_val_type = NO_SIZE; 1056 + enum hugetlbfs_size_type max_val_type = NO_SIZE, min_val_type = NO_SIZE; 1097 1057 1098 1058 if (!options) 1099 1059 return 0; ··· 1207 1167 struct hugetlbfs_config config; 1208 1168 struct hugetlbfs_sb_info *sbinfo; 1209 1169 1210 - save_mount_options(sb, data); 1211 - 1212 1170 config.max_hpages = -1; /* No limit on size by default */ 1213 1171 config.nr_inodes = -1; /* No limit on number of inodes by default */ 1214 1172 config.uid = current_fsuid(); ··· 1227 1189 sbinfo->max_inodes = config.nr_inodes; 1228 1190 sbinfo->free_inodes = config.nr_inodes; 1229 1191 sbinfo->spool = NULL; 1192 + sbinfo->uid = config.uid; 1193 + sbinfo->gid = config.gid; 1194 + sbinfo->mode = config.mode; 1195 + 1230 1196 /* 1231 1197 * Allocate and initialize subpool if maximum or minimum size is 1232 1198 * specified. Any needed reservations (for minimim size) are taken
+48 -3
fs/isofs/inode.c
··· 23 23 #include <linux/parser.h> 24 24 #include <linux/mpage.h> 25 25 #include <linux/user_namespace.h> 26 + #include <linux/seq_file.h> 26 27 27 28 #include "isofs.h" 28 29 #include "zisofs.h" ··· 58 57 59 58 static int isofs_read_inode(struct inode *, int relocated); 60 59 static int isofs_statfs (struct dentry *, struct kstatfs *); 60 + static int isofs_show_options(struct seq_file *, struct dentry *); 61 61 62 62 static struct kmem_cache *isofs_inode_cachep; 63 63 ··· 125 123 .put_super = isofs_put_super, 126 124 .statfs = isofs_statfs, 127 125 .remount_fs = isofs_remount, 128 - .show_options = generic_show_options, 126 + .show_options = isofs_show_options, 129 127 }; 130 128 131 129 ··· 475 473 } 476 474 477 475 /* 476 + * Display the mount options in /proc/mounts. 477 + */ 478 + static int isofs_show_options(struct seq_file *m, struct dentry *root) 479 + { 480 + struct isofs_sb_info *sbi = ISOFS_SB(root->d_sb); 481 + 482 + if (!sbi->s_rock) seq_puts(m, ",norock"); 483 + else if (!sbi->s_joliet_level) seq_puts(m, ",nojoliet"); 484 + if (sbi->s_cruft) seq_puts(m, ",cruft"); 485 + if (sbi->s_hide) seq_puts(m, ",hide"); 486 + if (sbi->s_nocompress) seq_puts(m, ",nocompress"); 487 + if (sbi->s_overriderockperm) seq_puts(m, ",overriderockperm"); 488 + if (sbi->s_showassoc) seq_puts(m, ",showassoc"); 489 + if (sbi->s_utf8) seq_puts(m, ",utf8"); 490 + 491 + if (sbi->s_check) seq_printf(m, ",check=%c", sbi->s_check); 492 + if (sbi->s_mapping) seq_printf(m, ",map=%c", sbi->s_mapping); 493 + if (sbi->s_session != 255) seq_printf(m, ",session=%u", sbi->s_session - 1); 494 + if (sbi->s_sbsector != -1) seq_printf(m, ",sbsector=%u", sbi->s_sbsector); 495 + 496 + if (root->d_sb->s_blocksize != 1024) 497 + seq_printf(m, ",blocksize=%lu", root->d_sb->s_blocksize); 498 + 499 + if (sbi->s_uid_set) 500 + seq_printf(m, ",uid=%u", 501 + from_kuid_munged(&init_user_ns, sbi->s_uid)); 502 + if (sbi->s_gid_set) 503 + seq_printf(m, ",gid=%u", 504 + from_kgid_munged(&init_user_ns, sbi->s_gid)); 505 + 506 + if (sbi->s_dmode != ISOFS_INVALID_MODE) 507 + seq_printf(m, ",dmode=%o", sbi->s_dmode); 508 + if (sbi->s_fmode != ISOFS_INVALID_MODE) 509 + seq_printf(m, ",fmode=%o", sbi->s_fmode); 510 + 511 + if (sbi->s_nls_iocharset && 512 + strcmp(sbi->s_nls_iocharset->charset, CONFIG_NLS_DEFAULT) != 0) 513 + seq_printf(m, ",iocharset=%s", sbi->s_nls_iocharset->charset); 514 + return 0; 515 + } 516 + 517 + /* 478 518 * look if the driver can tell the multi session redirection value 479 519 * 480 520 * don't change this if you don't know what you do, please! ··· 627 583 int table, error = -EINVAL; 628 584 unsigned int vol_desc_start; 629 585 630 - save_mount_options(s, data); 631 - 632 586 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 633 587 if (!sbi) 634 588 return -ENOMEM; ··· 647 605 opt.blocksize = sb_min_blocksize(s, opt.blocksize); 648 606 649 607 sbi->s_high_sierra = 0; /* default is iso9660 */ 608 + sbi->s_session = opt.session; 609 + sbi->s_sbsector = opt.sbsector; 650 610 651 611 vol_desc_start = (opt.sbsector != -1) ? 652 612 opt.sbsector : isofs_get_last_session(s,opt.session); ··· 955 911 table += 2; 956 912 if (opt.check == 'r') 957 913 table++; 914 + sbi->s_check = opt.check; 958 915 959 916 if (table) 960 917 s->s_d_op = &isofs_dentry_ops[table - 1];
+3
fs/isofs/isofs.h
··· 36 36 unsigned long s_max_size; 37 37 38 38 int s_rock_offset; /* offset of SUSP fields within SU area */ 39 + s32 s_sbsector; 39 40 unsigned char s_joliet_level; 40 41 unsigned char s_mapping; 42 + unsigned char s_check; 43 + unsigned char s_session; 41 44 unsigned int s_high_sierra:1; 42 45 unsigned int s_rock:2; 43 46 unsigned int s_utf8:1;
+1 -2
fs/namei.c
··· 3400 3400 3401 3401 struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag) 3402 3402 { 3403 - static const struct qstr name = QSTR_INIT("/", 1); 3404 3403 struct dentry *child = NULL; 3405 3404 struct inode *dir = dentry->d_inode; 3406 3405 struct inode *inode; ··· 3413 3414 if (!dir->i_op->tmpfile) 3414 3415 goto out_err; 3415 3416 error = -ENOMEM; 3416 - child = d_alloc(dentry, &name); 3417 + child = d_alloc(dentry, &slash_name); 3417 3418 if (unlikely(!child)) 3418 3419 goto out_err; 3419 3420 error = dir->i_op->tmpfile(dir, child, mode);
+2 -61
fs/namespace.c
··· 1238 1238 return &p->mnt; 1239 1239 } 1240 1240 1241 - static inline void mangle(struct seq_file *m, const char *s) 1242 - { 1243 - seq_escape(m, s, " \t\n\\"); 1244 - } 1245 - 1246 - /* 1247 - * Simple .show_options callback for filesystems which don't want to 1248 - * implement more complex mount option showing. 1249 - * 1250 - * See also save_mount_options(). 1251 - */ 1252 - int generic_show_options(struct seq_file *m, struct dentry *root) 1253 - { 1254 - const char *options; 1255 - 1256 - rcu_read_lock(); 1257 - options = rcu_dereference(root->d_sb->s_options); 1258 - 1259 - if (options != NULL && options[0]) { 1260 - seq_putc(m, ','); 1261 - mangle(m, options); 1262 - } 1263 - rcu_read_unlock(); 1264 - 1265 - return 0; 1266 - } 1267 - EXPORT_SYMBOL(generic_show_options); 1268 - 1269 - /* 1270 - * If filesystem uses generic_show_options(), this function should be 1271 - * called from the fill_super() callback. 1272 - * 1273 - * The .remount_fs callback usually needs to be handled in a special 1274 - * way, to make sure, that previous options are not overwritten if the 1275 - * remount fails. 1276 - * 1277 - * Also note, that if the filesystem's .remount_fs function doesn't 1278 - * reset all options to their default value, but changes only newly 1279 - * given options, then the displayed options will not reflect reality 1280 - * any more. 1281 - */ 1282 - void save_mount_options(struct super_block *sb, char *options) 1283 - { 1284 - BUG_ON(sb->s_options); 1285 - rcu_assign_pointer(sb->s_options, kstrdup(options, GFP_KERNEL)); 1286 - } 1287 - EXPORT_SYMBOL(save_mount_options); 1288 - 1289 - void replace_mount_options(struct super_block *sb, char *options) 1290 - { 1291 - char *old = sb->s_options; 1292 - rcu_assign_pointer(sb->s_options, options); 1293 - if (old) { 1294 - synchronize_rcu(); 1295 - kfree(old); 1296 - } 1297 - } 1298 - EXPORT_SYMBOL(replace_mount_options); 1299 - 1300 1241 #ifdef CONFIG_PROC_FS 1301 1242 /* iterator; we want it to have access to namespace_sem, thus here... */ 1302 1243 static void *m_start(struct seq_file *m, loff_t *pos) ··· 1598 1657 namespace_unlock(); 1599 1658 } 1600 1659 1601 - /* 1660 + /* 1602 1661 * Is the caller allowed to modify his namespace? 1603 1662 */ 1604 1663 static inline bool may_mount(void) ··· 2152 2211 2153 2212 err = -EINVAL; 2154 2213 if (mnt_ns_loop(old_path.dentry)) 2155 - goto out; 2214 + goto out; 2156 2215 2157 2216 mp = lock_mount(path); 2158 2217 err = PTR_ERR(mp);
+1 -2
fs/nsfs.c
··· 53 53 static void *__ns_get_path(struct path *path, struct ns_common *ns) 54 54 { 55 55 struct vfsmount *mnt = nsfs_mnt; 56 - struct qstr qname = { .name = "", }; 57 56 struct dentry *dentry; 58 57 struct inode *inode; 59 58 unsigned long d; ··· 84 85 inode->i_fop = &ns_file_operations; 85 86 inode->i_private = ns; 86 87 87 - dentry = d_alloc_pseudo(mnt->mnt_sb, &qname); 88 + dentry = d_alloc_pseudo(mnt->mnt_sb, &empty_name); 88 89 if (!dentry) { 89 90 iput(inode); 90 91 return ERR_PTR(-ENOMEM);
+30 -3
fs/omfs/inode.c
··· 13 13 #include <linux/buffer_head.h> 14 14 #include <linux/vmalloc.h> 15 15 #include <linux/writeback.h> 16 + #include <linux/seq_file.h> 16 17 #include <linux/crc-itu-t.h> 17 18 #include "omfs.h" 18 19 ··· 291 290 return 0; 292 291 } 293 292 293 + /* 294 + * Display the mount options in /proc/mounts. 295 + */ 296 + static int omfs_show_options(struct seq_file *m, struct dentry *root) 297 + { 298 + struct omfs_sb_info *sbi = OMFS_SB(root->d_sb); 299 + umode_t cur_umask = current_umask(); 300 + 301 + if (!uid_eq(sbi->s_uid, current_uid())) 302 + seq_printf(m, ",uid=%u", 303 + from_kuid_munged(&init_user_ns, sbi->s_uid)); 304 + if (!gid_eq(sbi->s_gid, current_gid())) 305 + seq_printf(m, ",gid=%u", 306 + from_kgid_munged(&init_user_ns, sbi->s_gid)); 307 + 308 + if (sbi->s_dmask == sbi->s_fmask) { 309 + if (sbi->s_fmask != cur_umask) 310 + seq_printf(m, ",umask=%o", sbi->s_fmask); 311 + } else { 312 + if (sbi->s_dmask != cur_umask) 313 + seq_printf(m, ",dmask=%o", sbi->s_dmask); 314 + if (sbi->s_fmask != cur_umask) 315 + seq_printf(m, ",fmask=%o", sbi->s_fmask); 316 + } 317 + 318 + return 0; 319 + } 320 + 294 321 static const struct super_operations omfs_sops = { 295 322 .write_inode = omfs_write_inode, 296 323 .evict_inode = omfs_evict_inode, 297 324 .put_super = omfs_put_super, 298 325 .statfs = omfs_statfs, 299 - .show_options = generic_show_options, 326 + .show_options = omfs_show_options, 300 327 }; 301 328 302 329 /* ··· 462 433 struct omfs_sb_info *sbi; 463 434 struct inode *root; 464 435 int ret = -EINVAL; 465 - 466 - save_mount_options(sb, (char *) data); 467 436 468 437 sbi = kzalloc(sizeof(struct omfs_sb_info), GFP_KERNEL); 469 438 if (!sbi)
+14 -1
fs/orangefs/super.c
··· 35 35 36 36 uint64_t orangefs_features; 37 37 38 + static int orangefs_show_options(struct seq_file *m, struct dentry *root) 39 + { 40 + struct orangefs_sb_info_s *orangefs_sb = ORANGEFS_SB(root->d_sb); 41 + 42 + if (root->d_sb->s_flags & MS_POSIXACL) 43 + seq_puts(m, ",acl"); 44 + if (orangefs_sb->flags & ORANGEFS_OPT_INTR) 45 + seq_puts(m, ",intr"); 46 + if (orangefs_sb->flags & ORANGEFS_OPT_LOCAL_LOCK) 47 + seq_puts(m, ",local_lock"); 48 + return 0; 49 + } 50 + 38 51 static int parse_mount_options(struct super_block *sb, char *options, 39 52 int silent) 40 53 { ··· 318 305 .drop_inode = generic_delete_inode, 319 306 .statfs = orangefs_statfs, 320 307 .remount_fs = orangefs_remount_fs, 321 - .show_options = generic_show_options, 308 + .show_options = orangefs_show_options, 322 309 }; 323 310 324 311 static struct dentry *orangefs_fh_to_dentry(struct super_block *sb,
+1 -2
fs/pipe.c
··· 739 739 struct inode *inode = get_pipe_inode(); 740 740 struct file *f; 741 741 struct path path; 742 - static struct qstr name = { .name = "" }; 743 742 744 743 if (!inode) 745 744 return -ENFILE; 746 745 747 746 err = -ENOMEM; 748 - path.dentry = d_alloc_pseudo(pipe_mnt->mnt_sb, &name); 747 + path.dentry = d_alloc_pseudo(pipe_mnt->mnt_sb, &empty_name); 749 748 if (!path.dentry) 750 749 goto err_inode; 751 750 path.mnt = mntget(pipe_mnt);
+11 -3
fs/pstore/inode.c
··· 283 283 } 284 284 } 285 285 286 + /* 287 + * Display the mount options in /proc/mounts. 288 + */ 289 + static int pstore_show_options(struct seq_file *m, struct dentry *root) 290 + { 291 + if (kmsg_bytes != PSTORE_DEFAULT_KMSG_BYTES) 292 + seq_printf(m, ",kmsg_bytes=%lu", kmsg_bytes); 293 + return 0; 294 + } 295 + 286 296 static int pstore_remount(struct super_block *sb, int *flags, char *data) 287 297 { 288 298 sync_filesystem(sb); ··· 306 296 .drop_inode = generic_delete_inode, 307 297 .evict_inode = pstore_evict_inode, 308 298 .remount_fs = pstore_remount, 309 - .show_options = generic_show_options, 299 + .show_options = pstore_show_options, 310 300 }; 311 301 312 302 static struct super_block *pstore_sb; ··· 457 447 static int pstore_fill_super(struct super_block *sb, void *data, int silent) 458 448 { 459 449 struct inode *inode; 460 - 461 - save_mount_options(sb, data); 462 450 463 451 pstore_sb = sb; 464 452
+3
fs/pstore/internal.h
··· 5 5 #include <linux/time.h> 6 6 #include <linux/pstore.h> 7 7 8 + #define PSTORE_DEFAULT_KMSG_BYTES 10240 9 + extern unsigned long kmsg_bytes; 10 + 8 11 #ifdef CONFIG_PSTORE_FTRACE 9 12 extern void pstore_register_ftrace(void); 10 13 extern void pstore_unregister_ftrace(void);
+1 -1
fs/pstore/platform.c
··· 99 99 static size_t big_oops_buf_sz; 100 100 101 101 /* How much of the console log to snapshot */ 102 - static unsigned long kmsg_bytes = 10240; 102 + unsigned long kmsg_bytes = PSTORE_DEFAULT_KMSG_BYTES; 103 103 104 104 void pstore_set_kmsg_bytes(int bytes) 105 105 {
+21 -11
fs/ramfs/inode.c
··· 38 38 #include <linux/uaccess.h> 39 39 #include "internal.h" 40 40 41 + struct ramfs_mount_opts { 42 + umode_t mode; 43 + }; 44 + 45 + struct ramfs_fs_info { 46 + struct ramfs_mount_opts mount_opts; 47 + }; 48 + 41 49 #define RAMFS_DEFAULT_MODE 0755 42 50 43 51 static const struct super_operations ramfs_ops; ··· 157 149 .rename = simple_rename, 158 150 }; 159 151 152 + /* 153 + * Display the mount options in /proc/mounts. 154 + */ 155 + static int ramfs_show_options(struct seq_file *m, struct dentry *root) 156 + { 157 + struct ramfs_fs_info *fsi = root->d_sb->s_fs_info; 158 + 159 + if (fsi->mount_opts.mode != RAMFS_DEFAULT_MODE) 160 + seq_printf(m, ",mode=%o", fsi->mount_opts.mode); 161 + return 0; 162 + } 163 + 160 164 static const struct super_operations ramfs_ops = { 161 165 .statfs = simple_statfs, 162 166 .drop_inode = generic_delete_inode, 163 - .show_options = generic_show_options, 164 - }; 165 - 166 - struct ramfs_mount_opts { 167 - umode_t mode; 167 + .show_options = ramfs_show_options, 168 168 }; 169 169 170 170 enum { ··· 183 167 static const match_table_t tokens = { 184 168 {Opt_mode, "mode=%o"}, 185 169 {Opt_err, NULL} 186 - }; 187 - 188 - struct ramfs_fs_info { 189 - struct ramfs_mount_opts mount_opts; 190 170 }; 191 171 192 172 static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts) ··· 222 210 struct ramfs_fs_info *fsi; 223 211 struct inode *inode; 224 212 int err; 225 - 226 - save_mount_options(sb, data); 227 213 228 214 fsi = kzalloc(sizeof(struct ramfs_fs_info), GFP_KERNEL); 229 215 sb->s_fs_info = fsi;
-4
fs/reiserfs/super.c
··· 1599 1599 } 1600 1600 1601 1601 out_ok_unlocked: 1602 - if (new_opts) 1603 - replace_mount_options(s, new_opts); 1604 1602 return 0; 1605 1603 1606 1604 out_err_unlock: ··· 1913 1915 int errval = -EINVAL; 1914 1916 char *qf_names[REISERFS_MAXQUOTAS] = {}; 1915 1917 unsigned int qfmt = 0; 1916 - 1917 - save_mount_options(s, data); 1918 1918 1919 1919 sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); 1920 1920 if (!sbi)
+2 -3
fs/super.c
··· 168 168 WARN_ON(!list_empty(&s->s_mounts)); 169 169 put_user_ns(s->s_user_ns); 170 170 kfree(s->s_subtype); 171 - kfree(s->s_options); 172 171 call_rcu(&s->rcu, destroy_super_rcu); 173 172 } 174 173 ··· 507 508 return ERR_PTR(-ENOMEM); 508 509 goto retry; 509 510 } 510 - 511 + 511 512 err = set(s, data); 512 513 if (err) { 513 514 spin_unlock(&sb_lock); ··· 770 771 spin_unlock(&sb_lock); 771 772 return NULL; 772 773 } 773 - 774 + 774 775 struct super_block *user_get_super(dev_t dev) 775 776 { 776 777 struct super_block *sb;
-2
fs/tracefs/inode.c
··· 270 270 struct tracefs_fs_info *fsi; 271 271 int err; 272 272 273 - save_mount_options(sb, data); 274 - 275 273 fsi = kzalloc(sizeof(struct tracefs_fs_info), GFP_KERNEL); 276 274 sb->s_fs_info = fsi; 277 275 if (!fsi) {
+5
include/linux/dcache.h
··· 55 55 56 56 #define QSTR_INIT(n,l) { { { .len = l } }, .name = n } 57 57 58 + extern const char empty_string[]; 59 + extern const struct qstr empty_name; 60 + extern const char slash_string[]; 61 + extern const struct qstr slash_name; 62 + 58 63 struct dentry_stat_t { 59 64 long nr_dentry; 60 65 long nr_unused;
+1 -10
include/linux/fs.h
··· 1364 1364 */ 1365 1365 char *s_subtype; 1366 1366 1367 - /* 1368 - * Saved mount options for lazy filesystems using 1369 - * generic_show_options() 1370 - */ 1371 - char __rcu *s_options; 1372 1367 const struct dentry_operations *s_d_op; /* default d_op for dentries */ 1373 1368 1374 1369 /* ··· 3041 3046 struct fiemap_extent_info *fieinfo, u64 start, 3042 3047 u64 len, get_block_t *get_block); 3043 3048 3044 - extern void get_filesystem(struct file_system_type *fs); 3049 + extern struct file_system_type *get_filesystem(struct file_system_type *fs); 3045 3050 extern void put_filesystem(struct file_system_type *fs); 3046 3051 extern struct file_system_type *get_fs_type(const char *name); 3047 3052 extern struct super_block *get_super(struct block_device *); ··· 3117 3122 extern void setattr_copy(struct inode *inode, const struct iattr *attr); 3118 3123 3119 3124 extern int file_update_time(struct file *file); 3120 - 3121 - extern int generic_show_options(struct seq_file *m, struct dentry *root); 3122 - extern void save_mount_options(struct super_block *sb, char *options); 3123 - extern void replace_mount_options(struct super_block *sb, char *options); 3124 3125 3125 3126 static inline bool io_is_direct(struct file *filp) 3126 3127 {
+3
include/linux/hugetlb.h
··· 268 268 spinlock_t stat_lock; 269 269 struct hstate *hstate; 270 270 struct hugepage_subpool *spool; 271 + kuid_t uid; 272 + kgid_t gid; 273 + umode_t mode; 271 274 }; 272 275 273 276 static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
+1
include/linux/string.h
··· 137 137 extern const char *kstrdup_const(const char *s, gfp_t gfp); 138 138 extern char *kstrndup(const char *s, size_t len, gfp_t gfp); 139 139 extern void *kmemdup(const void *src, size_t len, gfp_t gfp); 140 + extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); 140 141 141 142 extern char **argv_split(gfp_t gfp, const char *str, int *argcp); 142 143 extern void argv_free(char **argv);
+13
include/net/9p/client.h
··· 157 157 enum p9_trans_status status; 158 158 void *trans; 159 159 160 + union { 161 + struct { 162 + int rfd; 163 + int wfd; 164 + } fd; 165 + struct { 166 + u16 port; 167 + bool privport; 168 + 169 + } tcp; 170 + } trans_opts; 171 + 160 172 struct p9_idpool *fidpool; 161 173 struct list_head fidlist; 162 174 ··· 225 213 226 214 struct iov_iter; 227 215 216 + int p9_show_client_options(struct seq_file *m, struct p9_client *clnt); 228 217 int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); 229 218 int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, 230 219 const char *name);
+1
include/net/9p/transport.h
··· 62 62 int (*cancelled)(struct p9_client *, struct p9_req_t *req); 63 63 int (*zc_request)(struct p9_client *, struct p9_req_t *, 64 64 struct iov_iter *, struct iov_iter *, int , int, int); 65 + int (*show_options)(struct seq_file *, struct p9_client *); 65 66 }; 66 67 67 68 void v9fs_register_trans(struct p9_trans_module *m);
+13 -3
kernel/bpf/inode.c
··· 377 377 bpf_any_put(inode->i_private, type); 378 378 } 379 379 380 + /* 381 + * Display the mount options in /proc/mounts. 382 + */ 383 + static int bpf_show_options(struct seq_file *m, struct dentry *root) 384 + { 385 + umode_t mode = d_inode(root)->i_mode & S_IALLUGO & ~S_ISVTX; 386 + 387 + if (mode != S_IRWXUGO) 388 + seq_printf(m, ",mode=%o", mode); 389 + return 0; 390 + } 391 + 380 392 static const struct super_operations bpf_super_ops = { 381 393 .statfs = simple_statfs, 382 394 .drop_inode = generic_delete_inode, 383 - .show_options = generic_show_options, 395 + .show_options = bpf_show_options, 384 396 .evict_inode = bpf_evict_inode, 385 397 }; 386 398 ··· 445 433 struct bpf_mount_opts opts; 446 434 struct inode *inode; 447 435 int ret; 448 - 449 - save_mount_options(sb, data); 450 436 451 437 ret = bpf_parse_options(data, &opts); 452 438 if (ret)
+24
mm/util.c
··· 83 83 * @s: the string to duplicate 84 84 * @max: read at most @max chars from @s 85 85 * @gfp: the GFP mask used in the kmalloc() call when allocating memory 86 + * 87 + * Note: Use kmemdup_nul() instead if the size is known exactly. 86 88 */ 87 89 char *kstrndup(const char *s, size_t max, gfp_t gfp) 88 90 { ··· 121 119 return p; 122 120 } 123 121 EXPORT_SYMBOL(kmemdup); 122 + 123 + /** 124 + * kmemdup_nul - Create a NUL-terminated string from unterminated data 125 + * @s: The data to stringify 126 + * @len: The size of the data 127 + * @gfp: the GFP mask used in the kmalloc() call when allocating memory 128 + */ 129 + char *kmemdup_nul(const char *s, size_t len, gfp_t gfp) 130 + { 131 + char *buf; 132 + 133 + if (!s) 134 + return NULL; 135 + 136 + buf = kmalloc_track_caller(len + 1, gfp); 137 + if (buf) { 138 + memcpy(buf, s, len); 139 + buf[len] = '\0'; 140 + } 141 + return buf; 142 + } 143 + EXPORT_SYMBOL(kmemdup_nul); 124 144 125 145 /** 126 146 * memdup_user - duplicate memory region from user space
+25
net/9p/client.c
··· 37 37 #include <linux/uio.h> 38 38 #include <net/9p/9p.h> 39 39 #include <linux/parser.h> 40 + #include <linux/seq_file.h> 40 41 #include <net/9p/client.h> 41 42 #include <net/9p/transport.h> 42 43 #include "protocol.h" ··· 77 76 return clnt->proto_version == p9_proto_2000u; 78 77 } 79 78 EXPORT_SYMBOL(p9_is_proto_dotu); 79 + 80 + int p9_show_client_options(struct seq_file *m, struct p9_client *clnt) 81 + { 82 + if (clnt->msize != 8192) 83 + seq_printf(m, ",msize=%u", clnt->msize); 84 + seq_printf(m, "trans=%s", clnt->trans_mod->name); 85 + 86 + switch (clnt->proto_version) { 87 + case p9_proto_legacy: 88 + seq_puts(m, ",noextend"); 89 + break; 90 + case p9_proto_2000u: 91 + seq_puts(m, ",version=9p2000.u"); 92 + break; 93 + case p9_proto_2000L: 94 + /* Default */ 95 + break; 96 + } 97 + 98 + if (clnt->trans_mod->show_options) 99 + return clnt->trans_mod->show_options(m, clnt); 100 + return 0; 101 + } 102 + EXPORT_SYMBOL(p9_show_client_options); 80 103 81 104 /* 82 105 * Some error codes are taken directly from the server replies,
+28 -3
net/9p/trans_fd.c
··· 41 41 #include <linux/file.h> 42 42 #include <linux/parser.h> 43 43 #include <linux/slab.h> 44 + #include <linux/seq_file.h> 44 45 #include <net/9p/9p.h> 45 46 #include <net/9p/client.h> 46 47 #include <net/9p/transport.h> ··· 51 50 #define P9_PORT 564 52 51 #define MAX_SOCK_BUF (64*1024) 53 52 #define MAXPOLLWADDR 2 53 + 54 + static struct p9_trans_module p9_tcp_trans; 55 + static struct p9_trans_module p9_fd_trans; 54 56 55 57 /** 56 58 * struct p9_fd_opts - per-transport options ··· 67 63 int rfd; 68 64 int wfd; 69 65 u16 port; 70 - int privport; 66 + bool privport; 71 67 }; 72 68 73 69 /* ··· 724 720 return 0; 725 721 } 726 722 723 + static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt) 724 + { 725 + if (clnt->trans_mod == &p9_tcp_trans) { 726 + if (clnt->trans_opts.tcp.port != P9_PORT) 727 + seq_printf(m, "port=%u", clnt->trans_opts.tcp.port); 728 + } else if (clnt->trans_mod == &p9_fd_trans) { 729 + if (clnt->trans_opts.fd.rfd != ~0) 730 + seq_printf(m, "rfd=%u", clnt->trans_opts.fd.rfd); 731 + if (clnt->trans_opts.fd.wfd != ~0) 732 + seq_printf(m, "wfd=%u", clnt->trans_opts.fd.wfd); 733 + } 734 + return 0; 735 + } 736 + 727 737 /** 728 738 * parse_opts - parse mount options into p9_fd_opts structure 729 739 * @params: options string passed from mount ··· 756 738 opts->port = P9_PORT; 757 739 opts->rfd = ~0; 758 740 opts->wfd = ~0; 759 - opts->privport = 0; 741 + opts->privport = false; 760 742 761 743 if (!params) 762 744 return 0; ··· 794 776 opts->wfd = option; 795 777 break; 796 778 case Opt_privport: 797 - opts->privport = 1; 779 + opts->privport = true; 798 780 break; 799 781 default: 800 782 continue; ··· 960 942 961 943 csocket = NULL; 962 944 945 + client->trans_opts.tcp.port = opts.port; 946 + client->trans_opts.tcp.privport = opts.privport; 963 947 sin_server.sin_family = AF_INET; 964 948 sin_server.sin_addr.s_addr = in_aton(addr); 965 949 sin_server.sin_port = htons(opts.port); ··· 1040 1020 struct p9_fd_opts opts; 1041 1021 1042 1022 parse_opts(args, &opts); 1023 + client->trans_opts.fd.rfd = opts.rfd; 1024 + client->trans_opts.fd.wfd = opts.wfd; 1043 1025 1044 1026 if (opts.rfd == ~0 || opts.wfd == ~0) { 1045 1027 pr_err("Insufficient options for proto=fd\n"); ··· 1066 1044 .request = p9_fd_request, 1067 1045 .cancel = p9_fd_cancel, 1068 1046 .cancelled = p9_fd_cancelled, 1047 + .show_options = p9_fd_show_options, 1069 1048 .owner = THIS_MODULE, 1070 1049 }; 1071 1050 ··· 1079 1056 .request = p9_fd_request, 1080 1057 .cancel = p9_fd_cancel, 1081 1058 .cancelled = p9_fd_cancelled, 1059 + .show_options = p9_fd_show_options, 1082 1060 .owner = THIS_MODULE, 1083 1061 }; 1084 1062 ··· 1092 1068 .request = p9_fd_request, 1093 1069 .cancel = p9_fd_cancel, 1094 1070 .cancelled = p9_fd_cancelled, 1071 + .show_options = p9_fd_show_options, 1095 1072 .owner = THIS_MODULE, 1096 1073 }; 1097 1074
+28 -3
net/9p/trans_rdma.c
··· 43 43 #include <linux/parser.h> 44 44 #include <linux/semaphore.h> 45 45 #include <linux/slab.h> 46 + #include <linux/seq_file.h> 46 47 #include <net/9p/9p.h> 47 48 #include <net/9p/client.h> 48 49 #include <net/9p/transport.h> ··· 71 70 * @dm_mr: DMA Memory Region pointer 72 71 * @lkey: The local access only memory region key 73 72 * @timeout: Number of uSecs to wait for connection management events 73 + * @privport: Whether a privileged port may be used 74 + * @port: The port to use 74 75 * @sq_depth: The depth of the Send Queue 75 76 * @sq_sem: Semaphore for the SQ 76 77 * @rq_depth: The depth of the Receive Queue. ··· 98 95 struct ib_qp *qp; 99 96 struct ib_cq *cq; 100 97 long timeout; 98 + bool privport; 99 + u16 port; 101 100 int sq_depth; 102 101 struct semaphore sq_sem; 103 102 int rq_depth; ··· 138 133 */ 139 134 struct p9_rdma_opts { 140 135 short port; 136 + bool privport; 141 137 int sq_depth; 142 138 int rq_depth; 143 139 long timeout; 144 - int privport; 145 140 }; 146 141 147 142 /* ··· 164 159 {Opt_err, NULL}, 165 160 }; 166 161 162 + static int p9_rdma_show_options(struct seq_file *m, struct p9_client *clnt) 163 + { 164 + struct p9_trans_rdma *rdma = clnt->trans; 165 + 166 + if (rdma->port != P9_PORT) 167 + seq_printf(m, ",port=%u", rdma->port); 168 + if (rdma->sq_depth != P9_RDMA_SQ_DEPTH) 169 + seq_printf(m, ",sq=%u", rdma->sq_depth); 170 + if (rdma->rq_depth != P9_RDMA_RQ_DEPTH) 171 + seq_printf(m, ",rq=%u", rdma->rq_depth); 172 + if (rdma->timeout != P9_RDMA_TIMEOUT) 173 + seq_printf(m, ",timeout=%lu", rdma->timeout); 174 + if (rdma->privport) 175 + seq_puts(m, ",privport"); 176 + return 0; 177 + } 178 + 167 179 /** 168 180 * parse_opts - parse mount options into rdma options structure 169 181 * @params: options string passed from mount ··· 199 177 opts->sq_depth = P9_RDMA_SQ_DEPTH; 200 178 opts->rq_depth = P9_RDMA_RQ_DEPTH; 201 179 opts->timeout = P9_RDMA_TIMEOUT; 202 - opts->privport = 0; 180 + opts->privport = false; 203 181 204 182 if (!params) 205 183 return 0; ··· 240 218 opts->timeout = option; 241 219 break; 242 220 case Opt_privport: 243 - opts->privport = 1; 221 + opts->privport = true; 244 222 break; 245 223 default: 246 224 continue; ··· 582 560 if (!rdma) 583 561 return NULL; 584 562 563 + rdma->port = opts->port; 564 + rdma->privport = opts->privport; 585 565 rdma->sq_depth = opts->sq_depth; 586 566 rdma->rq_depth = opts->rq_depth; 587 567 rdma->timeout = opts->timeout; ··· 757 733 .request = rdma_request, 758 734 .cancel = rdma_cancel, 759 735 .cancelled = rdma_cancelled, 736 + .show_options = p9_rdma_show_options, 760 737 }; 761 738 762 739 /**