[PATCH] XATTR support in JFFS2
Ma Yun
sx_yunma at hotmail.com
Wed Aug 24 07:08:38 EDT 2005
Thank joern! I am sorry for my poor kernel code experience.
I have modified the patch.
Below is the implemention mechanism :)
1. background
The implementing of EAs in jffs2 is based on Epxa embedded board.
(ARM920T core+ 64M SDRAM + 16M NOR FLASH ...)
In our project, the extended attributes name length and value length are no
more
than 256 bytes. So I defined the EA structure like this:
struct jffs2_xattr {
uint8_t namelen; /* Length of name */
uint8_t valuelen; /* Length of value */
char name[0]; /* Attribute name (include null-terminator)*/
/* Attribute Valude immediately follows name*/
}__attribute__((packed));
2. Overall design
. Extended attributes are stored in-lined in the dirent inode.
. The extended attributes list consist of a veriable (0 or more) number of
extended attribute entries.
. Each extended attribute entry is a <name, value> pair where <name>
is constructed from a null-terminated ascii string and <value> is
arbitrary
data.
. The EA name/value are not loaded until we get/set/list/remove them. Read
them
from flash directly.
Extended attribute entry format:
0 1 2 2 + namelen +
1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|Name length | Value length | Name string \0| Value ... |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Extended attribute list format:
0 JFFS2_XATTR_SIZE(ea1)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| First EA element | Second EA element | ...... |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Extended attribute list store in-lined in the dirent inode.
Just like below:
+++++++++++++++++++++++++++++++++++++++++++++++++++
| Common head |pino | ...... |node_crc|name_crc|name... |EA list...|
+++++++++++++++++++++++++++++++++++++++++++++++++++
3. Data structure
- jffs2_xattr
struct jffs2_xattr {
uint8_t namelen;
uint8_t valuelen;
char name[0];
}__attribute__((packed));
- jffs2_xattr_list
struct jffs2_xattr_list {
struct jffs2_xattr xattr[0];
}__attribute__((packed));
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jffs2-xattr.patch
Url: http://lists.infradead.org/pipermail/linux-mtd/attachments/20050824/1157f230/attachment.pl
More information about the linux-mtd
mailing list