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

fs_parse: fold fs_parameter_desc/fs_parameter_spec

The former contains nothing but a pointer to an array of the latter...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro d7167b14 96cafb9c

+106 -198
+3 -7
arch/powerpc/platforms/cell/spufs/inode.c
··· 583 583 Opt_uid, Opt_gid, Opt_mode, Opt_debug, 584 584 }; 585 585 586 - static const struct fs_parameter_spec spufs_param_specs[] = { 586 + static const struct fs_parameter_spec spufs_fs_parameters[] = { 587 587 fsparam_u32 ("gid", Opt_gid), 588 588 fsparam_u32oct ("mode", Opt_mode), 589 589 fsparam_u32 ("uid", Opt_uid), 590 590 fsparam_flag ("debug", Opt_debug), 591 591 {} 592 - }; 593 - 594 - static const struct fs_parameter_description spufs_fs_parameters = { 595 - .specs = spufs_param_specs, 596 592 }; 597 593 598 594 static int spufs_show_options(struct seq_file *m, struct dentry *root) ··· 618 622 kgid_t gid; 619 623 int opt; 620 624 621 - opt = fs_parse(fc, &spufs_fs_parameters, param, &result); 625 + opt = fs_parse(fc, spufs_fs_parameters, param, &result); 622 626 if (opt < 0) 623 627 return opt; 624 628 ··· 769 773 .owner = THIS_MODULE, 770 774 .name = "spufs", 771 775 .init_fs_context = spufs_init_fs_context, 772 - .parameters = &spufs_fs_parameters, 776 + .parameters = spufs_fs_parameters, 773 777 .kill_sb = kill_litter_super, 774 778 }; 775 779 MODULE_ALIAS_FS("spufs");
+3 -7
arch/s390/hypfs/inode.c
··· 209 209 210 210 enum { Opt_uid, Opt_gid, }; 211 211 212 - static const struct fs_parameter_spec hypfs_param_specs[] = { 212 + static const struct fs_parameter_spec hypfs_fs_parameters[] = { 213 213 fsparam_u32("gid", Opt_gid), 214 214 fsparam_u32("uid", Opt_uid), 215 215 {} 216 - }; 217 - 218 - static const struct fs_parameter_description hypfs_fs_parameters = { 219 - .specs = hypfs_param_specs, 220 216 }; 221 217 222 218 static int hypfs_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 223 227 kgid_t gid; 224 228 int opt; 225 229 226 - opt = fs_parse(fc, &hypfs_fs_parameters, param, &result); 230 + opt = fs_parse(fc, hypfs_fs_parameters, param, &result); 227 231 if (opt < 0) 228 232 return opt; 229 233 ··· 450 454 .owner = THIS_MODULE, 451 455 .name = "s390_hypfs", 452 456 .init_fs_context = hypfs_init_fs_context, 453 - .parameters = &hypfs_fs_parameters, 457 + .parameters = hypfs_fs_parameters, 454 458 .kill_sb = hypfs_kill_super 455 459 }; 456 460
+3 -7
arch/x86/kernel/cpu/resctrl/rdtgroup.c
··· 2037 2037 nr__rdt_params 2038 2038 }; 2039 2039 2040 - static const struct fs_parameter_spec rdt_param_specs[] = { 2040 + static const struct fs_parameter_spec rdt_fs_parameters[] = { 2041 2041 fsparam_flag("cdp", Opt_cdp), 2042 2042 fsparam_flag("cdpl2", Opt_cdpl2), 2043 2043 fsparam_flag("mba_MBps", Opt_mba_mbps), 2044 2044 {} 2045 - }; 2046 - 2047 - static const struct fs_parameter_description rdt_fs_parameters = { 2048 - .specs = rdt_param_specs, 2049 2045 }; 2050 2046 2051 2047 static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 2050 2054 struct fs_parse_result result; 2051 2055 int opt; 2052 2056 2053 - opt = fs_parse(fc, &rdt_fs_parameters, param, &result); 2057 + opt = fs_parse(fc, rdt_fs_parameters, param, &result); 2054 2058 if (opt < 0) 2055 2059 return opt; 2056 2060 ··· 2275 2279 static struct file_system_type rdt_fs_type = { 2276 2280 .name = "resctrl", 2277 2281 .init_fs_context = rdt_init_fs_context, 2278 - .parameters = &rdt_fs_parameters, 2282 + .parameters = rdt_fs_parameters, 2279 2283 .kill_sb = rdt_kill_sb, 2280 2284 }; 2281 2285
+2 -2
drivers/base/devtmpfs.c
··· 71 71 .name = "devtmpfs", 72 72 #ifdef CONFIG_TMPFS 73 73 .init_fs_context = shmem_init_fs_context, 74 - .parameters = &shmem_fs_parameters, 74 + .parameters = shmem_fs_parameters, 75 75 #else 76 76 .init_fs_context = ramfs_init_fs_context, 77 - .parameters = &ramfs_fs_parameters, 77 + .parameters = ramfs_fs_parameters, 78 78 #endif 79 79 .kill_sb = kill_litter_super, 80 80 };
+2 -6
drivers/block/rbd.c
··· 848 848 Opt_notrim, 849 849 }; 850 850 851 - static const struct fs_parameter_spec rbd_param_specs[] = { 851 + static const struct fs_parameter_spec rbd_parameters[] = { 852 852 fsparam_u32 ("alloc_size", Opt_alloc_size), 853 853 fsparam_flag ("exclusive", Opt_exclusive), 854 854 fsparam_flag ("lock_on_read", Opt_lock_on_read), ··· 861 861 fsparam_flag ("ro", Opt_read_only), 862 862 fsparam_flag ("rw", Opt_read_write), 863 863 {} 864 - }; 865 - 866 - static const struct fs_parameter_description rbd_parameters = { 867 - .specs = rbd_param_specs, 868 864 }; 869 865 870 866 struct rbd_options { ··· 6355 6359 if (ret != -ENOPARAM) 6356 6360 return ret; 6357 6361 6358 - token = __fs_parse(&log, &rbd_parameters, param, &result); 6362 + token = __fs_parse(&log, rbd_parameters, param, &result); 6359 6363 dout("%s fs_parse '%s' token %d\n", __func__, param->key, token); 6360 6364 if (token < 0) { 6361 6365 if (token == -ENOPARAM)
+3 -7
drivers/usb/gadget/function/f_fs.c
··· 1486 1486 Opt_gid, 1487 1487 }; 1488 1488 1489 - static const struct fs_parameter_spec ffs_fs_param_specs[] = { 1489 + static const struct fs_parameter_spec ffs_fs_fs_parameters[] = { 1490 1490 fsparam_bool ("no_disconnect", Opt_no_disconnect), 1491 1491 fsparam_u32 ("rmode", Opt_rmode), 1492 1492 fsparam_u32 ("fmode", Opt_fmode), ··· 1494 1494 fsparam_u32 ("uid", Opt_uid), 1495 1495 fsparam_u32 ("gid", Opt_gid), 1496 1496 {} 1497 - }; 1498 - 1499 - static const struct fs_parameter_description ffs_fs_fs_parameters = { 1500 - .specs = ffs_fs_param_specs, 1501 1497 }; 1502 1498 1503 1499 static int ffs_fs_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 1504 1508 1505 1509 ENTER(); 1506 1510 1507 - opt = fs_parse(fc, &ffs_fs_fs_parameters, param, &result); 1511 + opt = fs_parse(fc, ffs_fs_fs_parameters, param, &result); 1508 1512 if (opt < 0) 1509 1513 return opt; 1510 1514 ··· 1636 1640 .owner = THIS_MODULE, 1637 1641 .name = "functionfs", 1638 1642 .init_fs_context = ffs_fs_init_fs_context, 1639 - .parameters = &ffs_fs_fs_parameters, 1643 + .parameters = ffs_fs_fs_parameters, 1640 1644 .kill_sb = ffs_fs_kill_sb, 1641 1645 }; 1642 1646 MODULE_ALIAS_FS("functionfs");
+4 -8
fs/afs/super.c
··· 38 38 static int afs_show_devname(struct seq_file *m, struct dentry *root); 39 39 static int afs_show_options(struct seq_file *m, struct dentry *root); 40 40 static int afs_init_fs_context(struct fs_context *fc); 41 - static const struct fs_parameter_description afs_fs_parameters; 41 + static const struct fs_parameter_spec afs_fs_parameters[]; 42 42 43 43 struct file_system_type afs_fs_type = { 44 44 .owner = THIS_MODULE, 45 45 .name = "afs", 46 46 .init_fs_context = afs_init_fs_context, 47 - .parameters = &afs_fs_parameters, 47 + .parameters = afs_fs_parameters, 48 48 .kill_sb = afs_kill_super, 49 49 .fs_flags = FS_RENAME_DOES_D_MOVE, 50 50 }; ··· 81 81 {} 82 82 }; 83 83 84 - static const struct fs_parameter_spec afs_param_specs[] = { 84 + static const struct fs_parameter_spec afs_fs_parameters[] = { 85 85 fsparam_flag ("autocell", Opt_autocell), 86 86 fsparam_flag ("dyn", Opt_dyn), 87 87 fsparam_enum ("flock", Opt_flock, afs_param_flock), 88 88 fsparam_string("source", Opt_source), 89 89 {} 90 - }; 91 - 92 - static const struct fs_parameter_description afs_fs_parameters = { 93 - .specs = afs_param_specs, 94 90 }; 95 91 96 92 /* ··· 317 321 struct afs_fs_context *ctx = fc->fs_private; 318 322 int opt; 319 323 320 - opt = fs_parse(fc, &afs_fs_parameters, param, &result); 324 + opt = fs_parse(fc, afs_fs_parameters, param, &result); 321 325 if (opt < 0) 322 326 return opt; 323 327
+2 -6
fs/ceph/super.c
··· 169 169 {} 170 170 }; 171 171 172 - static const struct fs_parameter_spec ceph_mount_param_specs[] = { 172 + static const struct fs_parameter_spec ceph_mount_parameters[] = { 173 173 fsparam_flag_no ("acl", Opt_acl), 174 174 fsparam_flag_no ("asyncreaddir", Opt_asyncreaddir), 175 175 fsparam_s32 ("caps_max", Opt_caps_max), ··· 196 196 fsparam_string ("source", Opt_source), 197 197 fsparam_u32 ("wsize", Opt_wsize), 198 198 {} 199 - }; 200 - 201 - static const struct fs_parameter_description ceph_mount_parameters = { 202 - .specs = ceph_mount_param_specs, 203 199 }; 204 200 205 201 struct ceph_parse_opts_ctx { ··· 267 271 if (ret != -ENOPARAM) 268 272 return ret; 269 273 270 - token = fs_parse(fc, &ceph_mount_parameters, param, &result); 274 + token = fs_parse(fc, ceph_mount_parameters, param, &result); 271 275 dout("%s fs_parse '%s' token %d\n", __func__, param->key, token); 272 276 if (token < 0) 273 277 return token;
+25 -28
fs/fs_parser.c
··· 47 47 EXPORT_SYMBOL(lookup_constant); 48 48 49 49 static const struct fs_parameter_spec *fs_lookup_key( 50 - const struct fs_parameter_description *desc, 50 + const struct fs_parameter_spec *desc, 51 51 const char *name) 52 52 { 53 53 const struct fs_parameter_spec *p; 54 - 55 - if (!desc->specs) 54 + if (!desc) 56 55 return NULL; 57 56 58 - for (p = desc->specs; p->name; p++) 57 + for (p = desc; p->name; p++) 59 58 if (strcmp(p->name, name) == 0) 60 59 return p; 61 60 ··· 80 81 * the parameter wasn't recognised and unknowns aren't okay. 81 82 */ 82 83 int __fs_parse(struct p_log *log, 83 - const struct fs_parameter_description *desc, 84 + const struct fs_parameter_spec *desc, 84 85 struct fs_parameter *param, 85 86 struct fs_parse_result *result) 86 87 { ··· 354 355 * @desc: The parameter description to validate. 355 356 */ 356 357 bool fs_validate_description(const char *name, 357 - const struct fs_parameter_description *desc) 358 + const struct fs_parameter_spec *desc) 358 359 { 359 360 const struct fs_parameter_spec *param, *p2; 360 361 bool good = true; 361 362 362 363 pr_notice("*** VALIDATE %s ***\n", name); 363 364 364 - if (desc->specs) { 365 - for (param = desc->specs; param->name; param++) { 366 - enum fs_parameter_type t = param->type; 365 + for (param = desc; param->name; param++) { 366 + enum fs_parameter_type t = param->type; 367 367 368 - /* Check that the type is in range */ 369 - if (t == __fs_param_wasnt_defined || 370 - t >= nr__fs_parameter_type) { 371 - pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n", 372 - name, param->name, t); 368 + /* Check that the type is in range */ 369 + if (t == __fs_param_wasnt_defined || 370 + t >= nr__fs_parameter_type) { 371 + pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n", 372 + name, param->name, t); 373 + good = false; 374 + } else if (t == fs_param_is_enum) { 375 + const struct constant_table *e = param->data; 376 + if (!e || !e->name) { 377 + pr_err("VALIDATE %s: PARAM[%s] enum with no values\n", 378 + name, param->name); 373 379 good = false; 374 - } else if (t == fs_param_is_enum) { 375 - const struct constant_table *e = param->data; 376 - if (!e || !e->name) { 377 - pr_err("VALIDATE %s: PARAM[%s] enum with no values\n", 378 - name, param->name); 379 - good = false; 380 - } 381 380 } 381 + } 382 382 383 - /* Check for duplicate parameter names */ 384 - for (p2 = desc->specs; p2 < param; p2++) { 385 - if (strcmp(param->name, p2->name) == 0) { 386 - pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n", 387 - name, param->name); 388 - good = false; 389 - } 383 + /* Check for duplicate parameter names */ 384 + for (p2 = desc; p2 < param; p2++) { 385 + if (strcmp(param->name, p2->name) == 0) { 386 + pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n", 387 + name, param->name); 388 + good = false; 390 389 } 391 390 } 392 391 }
+4 -8
fs/fuse/inode.c
··· 448 448 OPT_ERR 449 449 }; 450 450 451 - static const struct fs_parameter_spec fuse_param_specs[] = { 451 + static const struct fs_parameter_spec fuse_fs_parameters[] = { 452 452 fsparam_string ("source", OPT_SOURCE), 453 453 fsparam_u32 ("fd", OPT_FD), 454 454 fsparam_u32oct ("rootmode", OPT_ROOTMODE), ··· 462 462 {} 463 463 }; 464 464 465 - static const struct fs_parameter_description fuse_fs_parameters = { 466 - .specs = fuse_param_specs, 467 - }; 468 - 469 465 static int fuse_parse_param(struct fs_context *fc, struct fs_parameter *param) 470 466 { 471 467 struct fs_parse_result result; 472 468 struct fuse_fs_context *ctx = fc->fs_private; 473 469 int opt; 474 470 475 - opt = fs_parse(fc, &fuse_fs_parameters, param, &result); 471 + opt = fs_parse(fc, fuse_fs_parameters, param, &result); 476 472 if (opt < 0) 477 473 return opt; 478 474 ··· 1342 1346 .name = "fuse", 1343 1347 .fs_flags = FS_HAS_SUBTYPE | FS_USERNS_MOUNT, 1344 1348 .init_fs_context = fuse_init_fs_context, 1345 - .parameters = &fuse_fs_parameters, 1349 + .parameters = fuse_fs_parameters, 1346 1350 .kill_sb = fuse_kill_sb_anon, 1347 1351 }; 1348 1352 MODULE_ALIAS_FS("fuse"); ··· 1358 1362 .owner = THIS_MODULE, 1359 1363 .name = "fuseblk", 1360 1364 .init_fs_context = fuse_init_fs_context, 1361 - .parameters = &fuse_fs_parameters, 1365 + .parameters = fuse_fs_parameters, 1362 1366 .kill_sb = fuse_kill_sb_blk, 1363 1367 .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE, 1364 1368 };
+3 -7
fs/gfs2/ops_fstype.c
··· 1306 1306 {} 1307 1307 }; 1308 1308 1309 - static const struct fs_parameter_spec gfs2_param_specs[] = { 1309 + static const struct fs_parameter_spec gfs2_fs_parameters[] = { 1310 1310 fsparam_string ("lockproto", Opt_lockproto), 1311 1311 fsparam_string ("locktable", Opt_locktable), 1312 1312 fsparam_string ("hostdata", Opt_hostdata), ··· 1336 1336 {} 1337 1337 }; 1338 1338 1339 - static const struct fs_parameter_description gfs2_fs_parameters = { 1340 - .specs = gfs2_param_specs, 1341 - }; 1342 - 1343 1339 /* Parse a single mount parameter */ 1344 1340 static int gfs2_parse_param(struct fs_context *fc, struct fs_parameter *param) 1345 1341 { ··· 1343 1347 struct fs_parse_result result; 1344 1348 int o; 1345 1349 1346 - o = fs_parse(fc, &gfs2_fs_parameters, param, &result); 1350 + o = fs_parse(fc, gfs2_fs_parameters, param, &result); 1347 1351 if (o < 0) 1348 1352 return o; 1349 1353 ··· 1645 1649 .name = "gfs2", 1646 1650 .fs_flags = FS_REQUIRES_DEV, 1647 1651 .init_fs_context = gfs2_init_fs_context, 1648 - .parameters = &gfs2_fs_parameters, 1652 + .parameters = gfs2_fs_parameters, 1649 1653 .kill_sb = gfs2_kill_sb, 1650 1654 .owner = THIS_MODULE, 1651 1655 };
+3 -7
fs/hugetlbfs/inode.c
··· 73 73 Opt_uid, 74 74 }; 75 75 76 - static const struct fs_parameter_spec hugetlb_param_specs[] = { 76 + static const struct fs_parameter_spec hugetlb_fs_parameters[] = { 77 77 fsparam_u32 ("gid", Opt_gid), 78 78 fsparam_string("min_size", Opt_min_size), 79 79 fsparam_u32 ("mode", Opt_mode), ··· 82 82 fsparam_string("size", Opt_size), 83 83 fsparam_u32 ("uid", Opt_uid), 84 84 {} 85 - }; 86 - 87 - static const struct fs_parameter_description hugetlb_fs_parameters = { 88 - .specs = hugetlb_param_specs, 89 85 }; 90 86 91 87 #ifdef CONFIG_NUMA ··· 1166 1170 unsigned long ps; 1167 1171 int opt; 1168 1172 1169 - opt = fs_parse(fc, &hugetlb_fs_parameters, param, &result); 1173 + opt = fs_parse(fc, hugetlb_fs_parameters, param, &result); 1170 1174 if (opt < 0) 1171 1175 return opt; 1172 1176 ··· 1353 1357 static struct file_system_type hugetlbfs_fs_type = { 1354 1358 .name = "hugetlbfs", 1355 1359 .init_fs_context = hugetlbfs_init_fs_context, 1356 - .parameters = &hugetlb_fs_parameters, 1360 + .parameters = hugetlb_fs_parameters, 1357 1361 .kill_sb = kill_litter_super, 1358 1362 }; 1359 1363
+3 -7
fs/jffs2/super.c
··· 178 178 {} 179 179 }; 180 180 181 - static const struct fs_parameter_spec jffs2_param_specs[] = { 181 + static const struct fs_parameter_spec jffs2_fs_parameters[] = { 182 182 fsparam_enum ("compr", Opt_override_compr, jffs2_param_compr), 183 183 fsparam_u32 ("rp_size", Opt_rp_size), 184 184 {} 185 - }; 186 - 187 - const struct fs_parameter_description jffs2_fs_parameters = { 188 - .specs = jffs2_param_specs, 189 185 }; 190 186 191 187 static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 190 194 struct jffs2_sb_info *c = fc->s_fs_info; 191 195 int opt; 192 196 193 - opt = fs_parse(fc, &jffs2_fs_parameters, param, &result); 197 + opt = fs_parse(fc, jffs2_fs_parameters, param, &result); 194 198 if (opt < 0) 195 199 return opt; 196 200 ··· 333 337 .owner = THIS_MODULE, 334 338 .name = "jffs2", 335 339 .init_fs_context = jffs2_init_fs_context, 336 - .parameters = &jffs2_fs_parameters, 340 + .parameters = jffs2_fs_parameters, 337 341 .kill_sb = jffs2_kill_sb, 338 342 }; 339 343 MODULE_ALIAS_FS("jffs2");
+4 -8
fs/nfs/fs_context.c
··· 111 111 {} 112 112 }; 113 113 114 - static const struct fs_parameter_spec nfs_param_specs[] = { 114 + static const struct fs_parameter_spec nfs_fs_parameters[] = { 115 115 fsparam_flag_no("ac", Opt_ac), 116 116 fsparam_u32 ("acdirmax", Opt_acdirmax), 117 117 fsparam_u32 ("acdirmin", Opt_acdirmin), ··· 171 171 fsparam_string("vers", Opt_vers), 172 172 fsparam_u32 ("wsize", Opt_wsize), 173 173 {} 174 - }; 175 - 176 - static const struct fs_parameter_description nfs_fs_parameters = { 177 - .specs = nfs_param_specs, 178 174 }; 179 175 180 176 enum { ··· 439 443 440 444 dfprintk(MOUNT, "NFS: parsing nfs mount option '%s'\n", param->key); 441 445 442 - opt = fs_parse(fc, &nfs_fs_parameters, param, &result); 446 + opt = fs_parse(fc, nfs_fs_parameters, param, &result); 443 447 if (opt < 0) 444 448 return ctx->sloppy ? 1 : opt; 445 449 ··· 1412 1416 .owner = THIS_MODULE, 1413 1417 .name = "nfs", 1414 1418 .init_fs_context = nfs_init_fs_context, 1415 - .parameters = &nfs_fs_parameters, 1419 + .parameters = nfs_fs_parameters, 1416 1420 .kill_sb = nfs_kill_super, 1417 1421 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, 1418 1422 }; ··· 1424 1428 .owner = THIS_MODULE, 1425 1429 .name = "nfs4", 1426 1430 .init_fs_context = nfs_init_fs_context, 1427 - .parameters = &nfs_fs_parameters, 1431 + .parameters = nfs_fs_parameters, 1428 1432 .kill_sb = nfs_kill_super, 1429 1433 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, 1430 1434 };
+3 -7
fs/proc/root.c
··· 41 41 Opt_hidepid, 42 42 }; 43 43 44 - static const struct fs_parameter_spec proc_param_specs[] = { 44 + static const struct fs_parameter_spec proc_fs_parameters[] = { 45 45 fsparam_u32("gid", Opt_gid), 46 46 fsparam_u32("hidepid", Opt_hidepid), 47 47 {} 48 - }; 49 - 50 - static const struct fs_parameter_description proc_fs_parameters = { 51 - .specs = proc_param_specs, 52 48 }; 53 49 54 50 static int proc_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 53 57 struct fs_parse_result result; 54 58 int opt; 55 59 56 - opt = fs_parse(fc, &proc_fs_parameters, param, &result); 60 + opt = fs_parse(fc, proc_fs_parameters, param, &result); 57 61 if (opt < 0) 58 62 return opt; 59 63 ··· 202 206 static struct file_system_type proc_fs_type = { 203 207 .name = "proc", 204 208 .init_fs_context = proc_init_fs_context, 205 - .parameters = &proc_fs_parameters, 209 + .parameters = proc_fs_parameters, 206 210 .kill_sb = proc_kill_sb, 207 211 .fs_flags = FS_USERNS_MOUNT | FS_DISALLOW_NOTIFY_PERM, 208 212 };
+3 -7
fs/ramfs/inode.c
··· 181 181 Opt_mode, 182 182 }; 183 183 184 - static const struct fs_parameter_spec ramfs_param_specs[] = { 184 + const struct fs_parameter_spec ramfs_fs_parameters[] = { 185 185 fsparam_u32oct("mode", Opt_mode), 186 186 {} 187 - }; 188 - 189 - const struct fs_parameter_description ramfs_fs_parameters = { 190 - .specs = ramfs_param_specs, 191 187 }; 192 188 193 189 static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 192 196 struct ramfs_fs_info *fsi = fc->s_fs_info; 193 197 int opt; 194 198 195 - opt = fs_parse(fc, &ramfs_fs_parameters, param, &result); 199 + opt = fs_parse(fc, ramfs_fs_parameters, param, &result); 196 200 if (opt < 0) { 197 201 /* 198 202 * We might like to report bad mount options here; ··· 273 277 static struct file_system_type ramfs_fs_type = { 274 278 .name = "ramfs", 275 279 .init_fs_context = ramfs_init_fs_context, 276 - .parameters = &ramfs_fs_parameters, 280 + .parameters = ramfs_fs_parameters, 277 281 .kill_sb = ramfs_kill_sb, 278 282 .fs_flags = FS_USERNS_MOUNT, 279 283 };
+3 -7
fs/xfs/xfs_super.c
··· 62 62 Opt_discard, Opt_nodiscard, Opt_dax, 63 63 }; 64 64 65 - static const struct fs_parameter_spec xfs_param_specs[] = { 65 + static const struct fs_parameter_spec xfs_fs_parameters[] = { 66 66 fsparam_u32("logbufs", Opt_logbufs), 67 67 fsparam_string("logbsize", Opt_logbsize), 68 68 fsparam_string("logdev", Opt_logdev), ··· 104 104 fsparam_flag("nodiscard", Opt_nodiscard), 105 105 fsparam_flag("dax", Opt_dax), 106 106 {} 107 - }; 108 - 109 - static const struct fs_parameter_description xfs_fs_parameters = { 110 - .specs = xfs_param_specs, 111 107 }; 112 108 113 109 struct proc_xfs_info { ··· 1141 1145 int size = 0; 1142 1146 int opt; 1143 1147 1144 - opt = fs_parse(fc, &xfs_fs_parameters, param, &result); 1148 + opt = fs_parse(fc, xfs_fs_parameters, param, &result); 1145 1149 if (opt < 0) 1146 1150 return opt; 1147 1151 ··· 1783 1787 .owner = THIS_MODULE, 1784 1788 .name = "xfs", 1785 1789 .init_fs_context = xfs_init_fs_context, 1786 - .parameters = &xfs_fs_parameters, 1790 + .parameters = xfs_fs_parameters, 1787 1791 .kill_sb = kill_block_super, 1788 1792 .fs_flags = FS_REQUIRES_DEV, 1789 1793 };
+2 -2
include/linux/fs.h
··· 67 67 struct fsverity_info; 68 68 struct fsverity_operations; 69 69 struct fs_context; 70 - struct fs_parameter_description; 70 + struct fs_parameter_spec; 71 71 72 72 extern void __init inode_init(void); 73 73 extern void __init inode_init_early(void); ··· 2224 2224 #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ 2225 2225 #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 2226 2226 int (*init_fs_context)(struct fs_context *); 2227 - const struct fs_parameter_description *parameters; 2227 + const struct fs_parameter_spec *parameters; 2228 2228 struct dentry *(*mount) (struct file_system_type *, int, 2229 2229 const char *, void *); 2230 2230 void (*kill_sb) (struct super_block *);
+4 -8
include/linux/fs_parser.h
··· 56 56 const void *data; 57 57 }; 58 58 59 - struct fs_parameter_description { 60 - const struct fs_parameter_spec *specs; /* List of param specifications */ 61 - }; 62 - 63 59 /* 64 60 * Result of parse. 65 61 */ ··· 70 74 }; 71 75 72 76 extern int __fs_parse(struct p_log *log, 73 - const struct fs_parameter_description *desc, 77 + const struct fs_parameter_spec *desc, 74 78 struct fs_parameter *value, 75 79 struct fs_parse_result *result); 76 80 77 81 static inline int fs_parse(struct fs_context *fc, 78 - const struct fs_parameter_description *desc, 82 + const struct fs_parameter_spec *desc, 79 83 struct fs_parameter *param, 80 84 struct fs_parse_result *result) 81 85 { ··· 93 97 extern bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, 94 98 int low, int high, int special); 95 99 extern bool fs_validate_description(const char *name, 96 - const struct fs_parameter_description *desc); 100 + const struct fs_parameter_spec *desc); 97 101 #else 98 102 static inline bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, 99 103 int low, int high, int special) 100 104 { return true; } 101 105 static inline bool fs_validate_description(const char *name, 102 - const struct fs_parameter_description *desc) 106 + const struct fs_parameter_spec *desc) 103 107 { return true; } 104 108 #endif 105 109
+3 -1
include/linux/ramfs.h
··· 2 2 #ifndef _LINUX_RAMFS_H 3 3 #define _LINUX_RAMFS_H 4 4 5 + #include <linux/fs_parser.h> // bleh... 6 + 5 7 struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 6 8 umode_t mode, dev_t dev); 7 9 extern int ramfs_init_fs_context(struct fs_context *fc); ··· 18 16 extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); 19 17 #endif 20 18 21 - extern const struct fs_parameter_description ramfs_fs_parameters; 19 + extern const struct fs_parameter_spec ramfs_fs_parameters[]; 22 20 extern const struct file_operations ramfs_file_operations; 23 21 extern const struct vm_operations_struct generic_file_vm_ops; 24 22
+2 -1
include/linux/shmem_fs.h
··· 8 8 #include <linux/pagemap.h> 9 9 #include <linux/percpu_counter.h> 10 10 #include <linux/xattr.h> 11 + #include <linux/fs_parser.h> 11 12 12 13 /* inode in-kernel data */ 13 14 ··· 50 49 /* 51 50 * Functions in mm/shmem.c called directly from elsewhere: 52 51 */ 53 - extern const struct fs_parameter_description shmem_fs_parameters; 52 + extern const struct fs_parameter_spec shmem_fs_parameters[]; 54 53 extern int shmem_init(void); 55 54 extern int shmem_init_fs_context(struct fs_context *fc); 56 55 extern struct file *shmem_file_setup(const char *name,
+3 -7
kernel/bpf/inode.c
··· 587 587 OPT_MODE, 588 588 }; 589 589 590 - static const struct fs_parameter_spec bpf_param_specs[] = { 590 + static const struct fs_parameter_spec bpf_fs_parameters[] = { 591 591 fsparam_u32oct ("mode", OPT_MODE), 592 592 {} 593 - }; 594 - 595 - static const struct fs_parameter_description bpf_fs_parameters = { 596 - .specs = bpf_param_specs, 597 593 }; 598 594 599 595 struct bpf_mount_opts { ··· 602 606 struct fs_parse_result result; 603 607 int opt; 604 608 605 - opt = fs_parse(fc, &bpf_fs_parameters, param, &result); 609 + opt = fs_parse(fc, bpf_fs_parameters, param, &result); 606 610 if (opt < 0) 607 611 /* We might like to report bad mount options here, but 608 612 * traditionally we've ignored all mount options, so we'd ··· 678 682 .owner = THIS_MODULE, 679 683 .name = "bpf", 680 684 .init_fs_context = bpf_init_fs_context, 681 - .parameters = &bpf_fs_parameters, 685 + .parameters = bpf_fs_parameters, 682 686 .kill_sb = kill_litter_super, 683 687 }; 684 688
+2 -2
kernel/cgroup/cgroup-internal.h
··· 7 7 #include <linux/workqueue.h> 8 8 #include <linux/list.h> 9 9 #include <linux/refcount.h> 10 - #include <linux/fs_context.h> 10 + #include <linux/fs_parser.h> 11 11 12 12 #define TRACE_CGROUP_PATH_LEN 1024 13 13 extern spinlock_t trace_cgroup_path_lock; ··· 265 265 */ 266 266 extern struct cftype cgroup1_base_files[]; 267 267 extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; 268 - extern const struct fs_parameter_description cgroup1_fs_parameters; 268 + extern const struct fs_parameter_spec cgroup1_fs_parameters[]; 269 269 270 270 int proc_cgroupstats_show(struct seq_file *m, void *v); 271 271 bool cgroup1_ssid_disabled(int ssid);
+2 -6
kernel/cgroup/cgroup-v1.c
··· 885 885 Opt_xattr, 886 886 }; 887 887 888 - static const struct fs_parameter_spec cgroup1_param_specs[] = { 888 + const struct fs_parameter_spec cgroup1_fs_parameters[] = { 889 889 fsparam_flag ("all", Opt_all), 890 890 fsparam_flag ("clone_children", Opt_clone_children), 891 891 fsparam_flag ("cpuset_v2_mode", Opt_cpuset_v2_mode), ··· 897 897 {} 898 898 }; 899 899 900 - const struct fs_parameter_description cgroup1_fs_parameters = { 901 - .specs = cgroup1_param_specs, 902 - }; 903 - 904 900 int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) 905 901 { 906 902 struct cgroup_fs_context *ctx = cgroup_fc2context(fc); ··· 904 908 struct fs_parse_result result; 905 909 int opt, i; 906 910 907 - opt = fs_parse(fc, &cgroup1_fs_parameters, param, &result); 911 + opt = fs_parse(fc, cgroup1_fs_parameters, param, &result); 908 912 if (opt == -ENOPARAM) { 909 913 if (strcmp(param->key, "source") == 0) { 910 914 fc->source = param->string;
+4 -8
kernel/cgroup/cgroup.c
··· 1816 1816 nr__cgroup2_params 1817 1817 }; 1818 1818 1819 - static const struct fs_parameter_spec cgroup2_param_specs[] = { 1819 + static const struct fs_parameter_spec cgroup2_fs_parameters[] = { 1820 1820 fsparam_flag("nsdelegate", Opt_nsdelegate), 1821 1821 fsparam_flag("memory_localevents", Opt_memory_localevents), 1822 1822 {} 1823 - }; 1824 - 1825 - static const struct fs_parameter_description cgroup2_fs_parameters = { 1826 - .specs = cgroup2_param_specs, 1827 1823 }; 1828 1824 1829 1825 static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param) ··· 1828 1832 struct fs_parse_result result; 1829 1833 int opt; 1830 1834 1831 - opt = fs_parse(fc, &cgroup2_fs_parameters, param, &result); 1835 + opt = fs_parse(fc, cgroup2_fs_parameters, param, &result); 1832 1836 if (opt < 0) 1833 1837 return opt; 1834 1838 ··· 2151 2155 struct file_system_type cgroup_fs_type = { 2152 2156 .name = "cgroup", 2153 2157 .init_fs_context = cgroup_init_fs_context, 2154 - .parameters = &cgroup1_fs_parameters, 2158 + .parameters = cgroup1_fs_parameters, 2155 2159 .kill_sb = cgroup_kill_sb, 2156 2160 .fs_flags = FS_USERNS_MOUNT, 2157 2161 }; ··· 2159 2163 static struct file_system_type cgroup2_fs_type = { 2160 2164 .name = "cgroup2", 2161 2165 .init_fs_context = cgroup_init_fs_context, 2162 - .parameters = &cgroup2_fs_parameters, 2166 + .parameters = cgroup2_fs_parameters, 2163 2167 .kill_sb = cgroup_kill_sb, 2164 2168 .fs_flags = FS_USERNS_MOUNT, 2165 2169 };
+4 -8
mm/shmem.c
··· 3391 3391 {} 3392 3392 }; 3393 3393 3394 - static const struct fs_parameter_spec shmem_param_specs[] = { 3394 + const struct fs_parameter_spec shmem_fs_parameters[] = { 3395 3395 fsparam_u32 ("gid", Opt_gid), 3396 3396 fsparam_enum ("huge", Opt_huge, shmem_param_enums_huge), 3397 3397 fsparam_u32oct("mode", Opt_mode), ··· 3403 3403 {} 3404 3404 }; 3405 3405 3406 - const struct fs_parameter_description shmem_fs_parameters = { 3407 - .specs = shmem_param_specs, 3408 - }; 3409 - 3410 3406 static int shmem_parse_one(struct fs_context *fc, struct fs_parameter *param) 3411 3407 { 3412 3408 struct shmem_options *ctx = fc->fs_private; ··· 3411 3415 char *rest; 3412 3416 int opt; 3413 3417 3414 - opt = fs_parse(fc, &shmem_fs_parameters, param, &result); 3418 + opt = fs_parse(fc, shmem_fs_parameters, param, &result); 3415 3419 if (opt < 0) 3416 3420 return opt; 3417 3421 ··· 3885 3889 .name = "tmpfs", 3886 3890 .init_fs_context = shmem_init_fs_context, 3887 3891 #ifdef CONFIG_TMPFS 3888 - .parameters = &shmem_fs_parameters, 3892 + .parameters = shmem_fs_parameters, 3889 3893 #endif 3890 3894 .kill_sb = kill_litter_super, 3891 3895 .fs_flags = FS_USERNS_MOUNT, ··· 4031 4035 static struct file_system_type shmem_fs_type = { 4032 4036 .name = "tmpfs", 4033 4037 .init_fs_context = ramfs_init_fs_context, 4034 - .parameters = &ramfs_fs_parameters, 4038 + .parameters = ramfs_fs_parameters, 4035 4039 .kill_sb = kill_litter_super, 4036 4040 .fs_flags = FS_USERNS_MOUNT, 4037 4041 };
+2 -6
net/ceph/ceph_common.c
··· 269 269 Opt_abort_on_full, 270 270 }; 271 271 272 - static const struct fs_parameter_spec ceph_param_specs[] = { 272 + static const struct fs_parameter_spec ceph_parameters[] = { 273 273 fsparam_flag ("abort_on_full", Opt_abort_on_full), 274 274 fsparam_flag_no ("cephx_require_signatures", Opt_cephx_require_signatures), 275 275 fsparam_flag_no ("cephx_sign_messages", Opt_cephx_sign_messages), ··· 288 288 fsparam_flag_no ("share", Opt_share), 289 289 fsparam_flag_no ("tcp_nodelay", Opt_tcp_nodelay), 290 290 {} 291 - }; 292 - 293 - static const struct fs_parameter_description ceph_parameters = { 294 - .specs = ceph_param_specs, 295 291 }; 296 292 297 293 struct ceph_options *ceph_alloc_options(void) ··· 402 406 int token, err; 403 407 struct p_log log = {.prefix = "libceph", .log = l}; 404 408 405 - token = __fs_parse(&log, &ceph_parameters, param, &result); 409 + token = __fs_parse(&log, ceph_parameters, param, &result); 406 410 dout("%s fs_parse '%s' token %d\n", __func__, param->key, token); 407 411 if (token < 0) 408 412 return token;
+3 -7
security/selinux/hooks.c
··· 2808 2808 return 0; 2809 2809 } 2810 2810 2811 - static const struct fs_parameter_spec selinux_param_specs[] = { 2811 + static const struct fs_parameter_spec selinux_fs_parameters[] = { 2812 2812 fsparam_string(CONTEXT_STR, Opt_context), 2813 2813 fsparam_string(DEFCONTEXT_STR, Opt_defcontext), 2814 2814 fsparam_string(FSCONTEXT_STR, Opt_fscontext), ··· 2817 2817 {} 2818 2818 }; 2819 2819 2820 - static const struct fs_parameter_description selinux_fs_parameters = { 2821 - .specs = selinux_param_specs, 2822 - }; 2823 - 2824 2820 static int selinux_fs_context_parse_param(struct fs_context *fc, 2825 2821 struct fs_parameter *param) 2826 2822 { 2827 2823 struct fs_parse_result result; 2828 2824 int opt, rc; 2829 2825 2830 - opt = fs_parse(fc, &selinux_fs_parameters, param, &result); 2826 + opt = fs_parse(fc, selinux_fs_parameters, param, &result); 2831 2827 if (opt < 0) 2832 2828 return opt; 2833 2829 ··· 7140 7144 else 7141 7145 pr_debug("SELinux: Starting in permissive mode\n"); 7142 7146 7143 - fs_validate_description("selinux", &selinux_fs_parameters); 7147 + fs_validate_description("selinux", selinux_fs_parameters); 7144 7148 7145 7149 return 0; 7146 7150 }
+2 -6
security/smack/smack_lsm.c
··· 678 678 return 0; 679 679 } 680 680 681 - static const struct fs_parameter_spec smack_param_specs[] = { 681 + static const struct fs_parameter_spec smack_fs_parameters[] = { 682 682 fsparam_string("smackfsdef", Opt_fsdefault), 683 683 fsparam_string("smackfsdefault", Opt_fsdefault), 684 684 fsparam_string("smackfsfloor", Opt_fsfloor), ··· 686 686 fsparam_string("smackfsroot", Opt_fsroot), 687 687 fsparam_string("smackfstransmute", Opt_fstransmute), 688 688 {} 689 - }; 690 - 691 - static const struct fs_parameter_description smack_fs_parameters = { 692 - .specs = smack_param_specs, 693 689 }; 694 690 695 691 /** ··· 702 706 struct fs_parse_result result; 703 707 int opt, rc; 704 708 705 - opt = fs_parse(fc, &smack_fs_parameters, param, &result); 709 + opt = fs_parse(fc, smack_fs_parameters, param, &result); 706 710 if (opt < 0) 707 711 return opt; 708 712