aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-21 14:05:55 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-21 14:05:55 -0400
commit0d25971d7c969debf76f9fab6d6b37cb62408f55 (patch)
tree89e6b432d4e8c84d59b4738e5bc1c47a2402adf2
parent615191bb1dfc6980e7c7a85225444d860d74b343 (diff)
parentca89a517fa577e6f26621463d3aa4f3c3d530b1e (diff)
Merge git://git.infradead.org/jffs2-devel-2.6
-rw-r--r--fs/Kconfig38
-rw-r--r--fs/jffs2/Makefile3
-rw-r--r--fs/jffs2/README.Locking21
-rw-r--r--fs/jffs2/acl.c485
-rw-r--r--fs/jffs2/acl.h45
-rw-r--r--fs/jffs2/build.c2
-rw-r--r--fs/jffs2/debug.h6
-rw-r--r--fs/jffs2/dir.c62
-rw-r--r--fs/jffs2/erase.c21
-rw-r--r--fs/jffs2/file.c7
-rw-r--r--fs/jffs2/fs.c11
-rw-r--r--fs/jffs2/gc.c78
-rw-r--r--fs/jffs2/jffs2_fs_i.h5
-rw-r--r--fs/jffs2/jffs2_fs_sb.h10
-rw-r--r--fs/jffs2/malloc.c67
-rw-r--r--fs/jffs2/nodelist.c147
-rw-r--r--fs/jffs2/nodelist.h90
-rw-r--r--fs/jffs2/nodemgmt.c67
-rw-r--r--fs/jffs2/os-linux.h4
-rw-r--r--fs/jffs2/scan.c392
-rw-r--r--fs/jffs2/security.c82
-rw-r--r--fs/jffs2/summary.c385
-rw-r--r--fs/jffs2/summary.h62
-rw-r--r--fs/jffs2/super.c6
-rw-r--r--fs/jffs2/symlink.c7
-rw-r--r--fs/jffs2/wbuf.c33
-rw-r--r--fs/jffs2/write.c13
-rw-r--r--fs/jffs2/xattr.c1258
-rw-r--r--fs/jffs2/xattr.h116
-rw-r--r--fs/jffs2/xattr_trusted.c52
-rw-r--r--fs/jffs2/xattr_user.c52
-rw-r--r--include/linux/jffs2.h40
32 files changed, 3306 insertions, 361 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index f9b5842c8d2d..2496ccbe2604 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1075,6 +1075,44 @@ config JFFS2_FS_DEBUG
1075 If reporting bugs, please try to have available a full dump of the 1075 If reporting bugs, please try to have available a full dump of the
1076 messages at debug level 1 while the misbehaviour was occurring. 1076 messages at debug level 1 while the misbehaviour was occurring.
1077 1077
1078config JFFS2_FS_XATTR
1079 bool "JFFS2 XATTR support"
1080 depends on JFFS2_FS
1081 default n
1082 help
1083 Extended attributes are name:value pairs associated with inodes by
1084 the kernel or by users (see the attr(5) manual page, or visit
1085 <http://acl.bestbits.at/> for details).
1086
1087 If unsure, say N.
1088
1089config JFFS2_FS_POSIX_ACL
1090 bool "JFFS2 POSIX Access Control Lists"
1091 depends on JFFS2_FS_XATTR
1092 default y
1093 select FS_POSIX_ACL
1094 help
1095 Posix Access Control Lists (ACLs) support permissions for users and
1096 groups beyond the owner/group/world scheme.
1097
1098 To learn more about Access Control Lists, visit the Posix ACLs for
1099 Linux website <http://acl.bestbits.at/>.
1100
1101 If you don't know what Access Control Lists are, say N
1102
1103config JFFS2_FS_SECURITY
1104 bool "JFFS2 Security Labels"
1105 depends on JFFS2_FS_XATTR
1106 default y
1107 help
1108 Security labels support alternative access control models
1109 implemented by security modules like SELinux. This option
1110 enables an extended attribute handler for file security
1111 labels in the jffs2 filesystem.
1112
1113 If you are not using a security module that requires using
1114 extended attributes for file security labels, say N.
1115
1078config JFFS2_FS_WRITEBUFFER 1116config JFFS2_FS_WRITEBUFFER
1079 bool "JFFS2 write-buffering support" 1117 bool "JFFS2 write-buffering support"
1080 depends on JFFS2_FS 1118 depends on JFFS2_FS
diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile
index 77dc5561a04e..7f28ee0bd132 100644
--- a/fs/jffs2/Makefile
+++ b/fs/jffs2/Makefile
@@ -12,6 +12,9 @@ jffs2-y += symlink.o build.o erase.o background.o fs.o writev.o
12jffs2-y += super.o debug.o 12jffs2-y += super.o debug.o
13 13
14jffs2-$(CONFIG_JFFS2_FS_WRITEBUFFER) += wbuf.o 14jffs2-$(CONFIG_JFFS2_FS_WRITEBUFFER) += wbuf.o
15jffs2-$(CONFIG_JFFS2_FS_XATTR) += xattr.o xattr_trusted.o xattr_user.o
16jffs2-$(CONFIG_JFFS2_FS_SECURITY) += security.o
17jffs2-$(CONFIG_JFFS2_FS_POSIX_ACL) += acl.o
15jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rubin.o 18jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rubin.o
16jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o 19jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o
17jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o 20jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o
diff --git a/fs/jffs2/README.Locking b/fs/jffs2/README.Locking
index b7943439b6ec..c8f0bd64e53e 100644
--- a/fs/jffs2/README.Locking
+++ b/fs/jffs2/README.Locking
@@ -150,3 +150,24 @@ the buffer.
150 150
151Ordering constraints: 151Ordering constraints:
152 Lock wbuf_sem last, after the alloc_sem or and f->sem. 152 Lock wbuf_sem last, after the alloc_sem or and f->sem.
153
154
155 c->xattr_sem
156 ------------
157
158This read/write semaphore protects against concurrent access to the
159xattr related objects which include stuff in superblock and ic->xref.
160In read-only path, write-semaphore is too much exclusion. It's enough
161by read-semaphore. But you must hold write-semaphore when updating,
162creating or deleting any xattr related object.
163
164Once xattr_sem released, there would be no assurance for the existence
165of those objects. Thus, a series of processes is often required to retry,
166when updating such a object is necessary under holding read semaphore.
167For example, do_jffs2_getxattr() holds read-semaphore to scan xref and
168xdatum at first. But it retries this process with holding write-semaphore
169after release read-semaphore, if it's necessary to load name/value pair
170from medium.
171
172Ordering constraints:
173 Lock xattr_sem last, after the alloc_sem.
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
new file mode 100644
index 000000000000..320dd48b834e
--- /dev/null
+++ b/fs/jffs2/acl.c
@@ -0,0 +1,485 @@
1/*
2 * JFFS2 -- Journalling Flash File System, Version 2.
3 *
4 * Copyright (C) 2006 NEC Corporation
5 *
6 * Created by KaiGai Kohei <kaigai@ak.jp.nec.com>
7 *
8 * For licensing information, see the file 'LICENCE' in this directory.
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/fs.h>
14#include <linux/time.h>
15#include <linux/crc32.h>
16#include <linux/jffs2.h>
17#include <linux/xattr.h>
18#include <linux/posix_acl_xattr.h>
19#include <linux/mtd/mtd.h>
20#include "nodelist.h"
21
22static size_t jffs2_acl_size(int count)
23{
24 if (count <= 4) {
25 return sizeof(struct jffs2_acl_header)
26 + count * sizeof(struct jffs2_acl_entry_short);
27 } else {
28 return sizeof(struct jffs2_acl_header)
29 + 4 * sizeof(struct jffs2_acl_entry_short)
30 + (count - 4) * sizeof(struct jffs2_acl_entry);
31 }
32}
33
34static int jffs2_acl_count(size_t size)
35{
36 size_t s;
37
38 size -= sizeof(struct jffs2_acl_header);
39 s = size - 4 * sizeof(struct jffs2_acl_entry_short);
40 if (s < 0) {
41 if (size % sizeof(struct jffs2_acl_entry_short))
42 return -1;
43 return size / sizeof(struct jffs2_acl_entry_short);
44 } else {
45 if (s % sizeof(struct jffs2_acl_entry))
46 return -1;
47 return s / sizeof(struct jffs2_acl_entry) + 4;
48 }
49}
50
51static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)
52{
53 void *end = value + size;
54 struct jffs2_acl_header *header = value;
55 struct jffs2_acl_entry *entry;
56 struct posix_acl *acl;
57 uint32_t ver;
58 int i, count;
59
60 if (!value)
61 return NULL;
62 if (size < sizeof(struct jffs2_acl_header))