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