[brcm63xx] also supports pcmcia
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 034-ramfs-mode-support.patch
1 --- a/fs/ramfs/inode.c
2 +++ b/fs/ramfs/inode.c
3 @@ -33,6 +33,7 @@
4 #include <linux/smp_lock.h>
5 #include <linux/backing-dev.h>
6 #include <linux/ramfs.h>
7 +#include <linux/ctype.h>
8
9 #include <asm/uaccess.h>
10 #include "internal.h"
11 @@ -160,10 +161,66 @@ static const struct super_operations ram
12 .drop_inode = generic_delete_inode,
13 };
14
15 +static int ramfs_parse_options(char *options, int *mode)
16 +{
17 + char *this_char, *value, *rest;
18 +
19 + while (options != NULL) {
20 + this_char = options;
21 + for (;;) {
22 + /*
23 + * NUL-terminate this option: unfortunately,
24 + * mount options form a comma-separated list,
25 + * but mpol's nodelist may also contain commas.
26 + */
27 + options = strchr(options, ',');
28 + if (options == NULL)
29 + break;
30 + options++;
31 + if (!isdigit(*options)) {
32 + options[-1] = '\0';
33 + break;
34 + }
35 + }
36 + if (!*this_char)
37 + continue;
38 + if ((value = strchr(this_char,'=')) != NULL) {
39 + *value++ = 0;
40 + } else {
41 + printk(KERN_ERR
42 + "ramfs: No value for mount option '%s'\n",
43 + this_char);
44 + return 1;
45 + }
46 +
47 + if (!strcmp(this_char,"mode")) {
48 + if (!mode)
49 + continue;
50 + *mode = simple_strtoul(value,&rest,8);
51 + if (*rest)
52 + goto bad_val;
53 + } else {
54 + printk(KERN_ERR "ramfs: Bad mount option %s\n",
55 + this_char);
56 + return 1;
57 + }
58 + }
59 + return 0;
60 +
61 +bad_val:
62 + printk(KERN_ERR "ramfs: Bad value '%s' for mount option '%s'\n",
63 + value, this_char);
64 + return 1;
65 +}
66 +
67 static int ramfs_fill_super(struct super_block * sb, void * data, int silent)
68 {
69 struct inode * inode;
70 struct dentry * root;
71 + int mode = 0755;
72 +
73 + if (ramfs_parse_options(data, &mode))
74 + return -EINVAL;
75
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;
81 sb->s_time_gran = 1;
82 - inode = ramfs_get_inode(sb, S_IFDIR | 0755, 0);
83 + inode = ramfs_get_inode(sb, S_IFDIR | mode, 0);
84 if (!inode)
85 return -ENOMEM;
86
This page took 0.043881 seconds and 5 git commands to generate.