4 #include <linux/smp_lock.h>
5 #include <linux/backing-dev.h>
6 #include <linux/ramfs.h>
7 +#include <linux/ctype.h>
9 #include <asm/uaccess.h>
11 @@ -160,10 +161,66 @@ static const struct super_operations ram
12 .drop_inode = generic_delete_inode,
15 +static int ramfs_parse_options(char *options, int *mode)
17 + char *this_char, *value, *rest;
19 + while (options != NULL) {
20 + this_char = options;
23 + * NUL-terminate this option: unfortunately,
24 + * mount options form a comma-separated list,
25 + * but mpol's nodelist may also contain commas.
27 + options = strchr(options, ',');
28 + if (options == NULL)
31 + if (!isdigit(*options)) {
38 + if ((value = strchr(this_char,'=')) != NULL) {
42 + "ramfs: No value for mount option '%s'\n",
47 + if (!strcmp(this_char,"mode")) {
50 + *mode = simple_strtoul(value,&rest,8);
54 + printk(KERN_ERR "ramfs: Bad mount option %s\n",
62 + printk(KERN_ERR "ramfs: Bad value '%s' for mount option '%s'\n",
67 static int ramfs_fill_super(struct super_block * sb, void * data, int silent)
73 + if (ramfs_parse_options(data, &mode))
76 sb->s_maxbytes = MAX_LFS_FILESIZE;
77 sb->s_blocksize = PAGE_CACHE_SIZE;
78 @@ -171,7 +228,7 @@ static int ramfs_fill_super(struct super
79 sb->s_magic = RAMFS_MAGIC;
80 sb->s_op = &ramfs_ops;
82 - inode = ramfs_get_inode(sb, S_IFDIR | 0755, 0);
83 + inode = ramfs_get_inode(sb, S_IFDIR | mode, 0);