Skip to contentSkip to conversation

XATTR support in JFFS2

PATCH New ���� 1 participant 1 message Aug 22, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XATTR support in JFFS2

Hi!

I've implemented the extended attributes for JFFS2. The implementation mechanism is simple, but it can work:). This implementation support standard extended attributes system call, such as setxattr, getxattr .... but does not support ACL.

The patch is based on Linux-2.6.10

Comments are welcome...

===========================
Best Regards

Yun Ma

fs/jffs2/file.c +9 -0
diff -uNr linux-2.6.10.mxc/fs/jffs2/file.c linux-2.6.10.jffs2/fs/jffs2/file.c
@@ -20,6 +20,9 @@
 #include <linux/highmem.h>
 #include <linux/crc32.h>
 #include <linux/jffs2.h>
+#ifdef CONFIG_JFFS2_FS_XATTR
+#include <linux/jffs2_xattr.h>
+#endif
 #include "nodelist.h"
 
 extern int generic_file_open(struct inode *, struct file *) __attribute__((weak));
@@ -55,6 +58,12 @@
 
 struct inode_operations jffs2_file_inode_operations =
 {
+#ifdef CONFIG_JFFS2_FS_XATTR
+        .setxattr = jffs2_setxattr,
+        .getxattr = jffs2_getxattr,
+        .listxattr = jffs2_listxattr,
+        .removexattr = jffs2_removexattr,
+#endif
 	.setattr =	jffs2_setattr
 };
 
fs/jffs2/Makefile +1 -0
diff -uNr linux-2.6.10.mxc/fs/jffs2/Makefile linux-2.6.10.jffs2/fs/jffs2/Makefile
@@ -11,6 +11,7 @@
 jffs2-y	+= symlink.o build.o erase.o background.o fs.o writev.o
 jffs2-y	+= super.o
 
+jffs2-$(CONFIG_JFFS2_FS_XATTR)	+= xattr.o
 jffs2-$(CONFIG_JFFS2_FS_NAND)	+= wbuf.o
 jffs2-$(CONFIG_JFFS2_FS_NOR_ECC) += wbuf.o
 jffs2-$(CONFIG_JFFS2_RUBIN)	+= compr_rubin.o
fs/jffs2/nodelist.c +2 -0
diff -uNr linux-2.6.10.mxc/fs/jffs2/nodelist.c linux-2.6.10.jffs2/fs/jffs2/nodelist.c
@@ -173,6 +173,7 @@
 				goto free_out;
 			}
 			/* sanity check */
+			#ifndef CONFIG_JFFS2_FS_XATTR
 			if (PAD((node.d.nsize + sizeof (node.d))) != PAD(je32_to_cpu (node.d.totlen))) {
 				printk(KERN_NOTICE "jffs2_get_inode_nodes(): Illegal nsize in node at 0x%08x: nsize 0x%02x, totlen %04x\n",
 				       ref_offset(ref), node.d.nsize, je32_to_cpu(node.d.totlen));
@@ -180,6 +181,7 @@
 				spin_lock(&c->erase_completion_lock);
 				continue;
 			}
+			#endif
 			if (je32_to_cpu(node.d.version) > *highest_version)
 				*highest_version = je32_to_cpu(node.d.version);
 			if (ref_obsolete(ref)) {
fs/jffs2/xattr.c +467 -0

467 lines not on this page · raw message

fs/Kconfig +6 -0
diff -uNr linux-2.6.10.mxc/fs/Kconfig linux-2.6.10.jffs2/fs/Kconfig
@@ -1201,6 +1201,12 @@
 	  Further information on the design and implementation of JFFS2 is
 	  available at <http://sources.redhat.com/jffs2/>.
 
+config JFFS2_FS_XATTR
+	bool "JFFS2 extended attributes"
+	depends on JFFS2_FS
+	help
+	 JFFS2 extended attributes
+
 config JFFS2_FS_DEBUG
 	int "JFFS2 debugging verbosity (0 = quiet, 2 = noisy)"
 	depends on JFFS2_FS
include/linux/jffs2_xattr.h +59 -0

59 lines not on this page · raw message