shmem.c (5f00110f7273f9ff04ac69a5f85bb535a4fd0987) | shmem.c (49cd0a5c290f99deca3463d16c3c1c7240107889) |
---|---|
1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 2371 unchanged lines hidden (view full) --- 2380 .encode_fh = shmem_encode_fh, 2381 .fh_to_dentry = shmem_fh_to_dentry, 2382}; 2383 2384static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, 2385 bool remount) 2386{ 2387 char *this_char, *value, *rest; | 1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 2371 unchanged lines hidden (view full) --- 2380 .encode_fh = shmem_encode_fh, 2381 .fh_to_dentry = shmem_fh_to_dentry, 2382}; 2383 2384static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, 2385 bool remount) 2386{ 2387 char *this_char, *value, *rest; |
2388 struct mempolicy *mpol = NULL; |
|
2388 uid_t uid; 2389 gid_t gid; 2390 2391 while (options != NULL) { 2392 this_char = options; 2393 for (;;) { 2394 /* 2395 * NUL-terminate this option: unfortunately, --- 12 unchanged lines hidden (view full) --- 2408 if (!*this_char) 2409 continue; 2410 if ((value = strchr(this_char,'=')) != NULL) { 2411 *value++ = 0; 2412 } else { 2413 printk(KERN_ERR 2414 "tmpfs: No value for mount option '%s'\n", 2415 this_char); | 2389 uid_t uid; 2390 gid_t gid; 2391 2392 while (options != NULL) { 2393 this_char = options; 2394 for (;;) { 2395 /* 2396 * NUL-terminate this option: unfortunately, --- 12 unchanged lines hidden (view full) --- 2409 if (!*this_char) 2410 continue; 2411 if ((value = strchr(this_char,'=')) != NULL) { 2412 *value++ = 0; 2413 } else { 2414 printk(KERN_ERR 2415 "tmpfs: No value for mount option '%s'\n", 2416 this_char); |
2416 return 1; | 2417 goto error; |
2417 } 2418 2419 if (!strcmp(this_char,"size")) { 2420 unsigned long long size; 2421 size = memparse(value,&rest); 2422 if (*rest == '%') { 2423 size <<= PAGE_SHIFT; 2424 size *= totalram_pages; --- 32 unchanged lines hidden (view full) --- 2457 continue; 2458 gid = simple_strtoul(value, &rest, 0); 2459 if (*rest) 2460 goto bad_val; 2461 sbinfo->gid = make_kgid(current_user_ns(), gid); 2462 if (!gid_valid(sbinfo->gid)) 2463 goto bad_val; 2464 } else if (!strcmp(this_char,"mpol")) { | 2418 } 2419 2420 if (!strcmp(this_char,"size")) { 2421 unsigned long long size; 2422 size = memparse(value,&rest); 2423 if (*rest == '%') { 2424 size <<= PAGE_SHIFT; 2425 size *= totalram_pages; --- 32 unchanged lines hidden (view full) --- 2458 continue; 2459 gid = simple_strtoul(value, &rest, 0); 2460 if (*rest) 2461 goto bad_val; 2462 sbinfo->gid = make_kgid(current_user_ns(), gid); 2463 if (!gid_valid(sbinfo->gid)) 2464 goto bad_val; 2465 } else if (!strcmp(this_char,"mpol")) { |
2465 if (mpol_parse_str(value, &sbinfo->mpol)) | 2466 mpol_put(mpol); 2467 mpol = NULL; 2468 if (mpol_parse_str(value, &mpol)) |
2466 goto bad_val; 2467 } else { 2468 printk(KERN_ERR "tmpfs: Bad mount option %s\n", 2469 this_char); | 2469 goto bad_val; 2470 } else { 2471 printk(KERN_ERR "tmpfs: Bad mount option %s\n", 2472 this_char); |
2470 return 1; | 2473 goto error; |
2471 } 2472 } | 2474 } 2475 } |
2476 sbinfo->mpol = mpol; |
|
2473 return 0; 2474 2475bad_val: 2476 printk(KERN_ERR "tmpfs: Bad value '%s' for mount option '%s'\n", 2477 value, this_char); | 2477 return 0; 2478 2479bad_val: 2480 printk(KERN_ERR "tmpfs: Bad value '%s' for mount option '%s'\n", 2481 value, this_char); |
2482error: 2483 mpol_put(mpol); |
|
2478 return 1; 2479 2480} 2481 2482static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) 2483{ 2484 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 2485 struct shmem_sb_info config = *sbinfo; --- 59 unchanged lines hidden (view full) --- 2545} 2546#endif /* CONFIG_TMPFS */ 2547 2548static void shmem_put_super(struct super_block *sb) 2549{ 2550 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 2551 2552 percpu_counter_destroy(&sbinfo->used_blocks); | 2484 return 1; 2485 2486} 2487 2488static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) 2489{ 2490 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 2491 struct shmem_sb_info config = *sbinfo; --- 59 unchanged lines hidden (view full) --- 2551} 2552#endif /* CONFIG_TMPFS */ 2553 2554static void shmem_put_super(struct super_block *sb) 2555{ 2556 struct shmem_sb_info *sbinfo = SHMEM_SB(sb); 2557 2558 percpu_counter_destroy(&sbinfo->used_blocks); |
2559 mpol_put(sbinfo->mpol); |
|
2553 kfree(sbinfo); 2554 sb->s_fs_info = NULL; 2555} 2556 2557int shmem_fill_super(struct super_block *sb, void *data, int silent) 2558{ 2559 struct inode *inode; 2560 struct shmem_sb_info *sbinfo; --- 434 unchanged lines hidden --- | 2560 kfree(sbinfo); 2561 sb->s_fs_info = NULL; 2562} 2563 2564int shmem_fill_super(struct super_block *sb, void *data, int silent) 2565{ 2566 struct inode *inode; 2567 struct shmem_sb_info *sbinfo; --- 434 unchanged lines hidden --- |