|
From: Helge B. <hel...@se...> - 2010-04-19 16:49:07
|
Hi, Am Saturday 17 April 2010 05:04:29 schrieb Stephen Hemminger: > Vyatta uses squashfs both for livecd and installed image mode, and in order > to support SELinux properly we need xattr supported on squashfs. > > I know the current version of squashfs doesn't support xattr, and there > are hints of future support. But we need it sooner, does anybody have a > "back of the envelope" description of how they expect it to work > (data formats etc), I am perfectly willing to fill in the missing code. I have similar requirements and have a (tentative) squashfs xattr implementation. I will clean up the code and publish it for review tomorrow, so you are welcome to try it out and comment on it. xattr sets are stored within the xattr table in the following way: - 32-bit size specifier for the whole attribute set - zero or more attributes, each encoded in the following way - 32-bit size specifier for the attribute name - 32-bit size specifier for the attribute value - attribute name (lacking trailing '\0') - attribute value All xattrs are stored in the xattr table, in consecutive compressed metadata blocks. The attributes are then referenced by inodes using the "xattr" field already defined for the LREG/LDIR types (other file types extended in obvious ways) in the following way: The 32-bit xattr field is split into a 19-bit block specifier and a 13-bit offset specifier. The block specifier encodes the offset of a (typically compressed) block of 8192 bytes, addressed relative to the xattr_table_start specified in the super block, while the offset addresses a specific byte in this block. xattrs may span an arbitrary number of consecutive such blocks. This allows up to 500Kb of (compressed) xattr data per filesystem, and a conceptually unlimited size of individual attributes and attribute sets. Since files will rarely have more than a single extended attribute, I think that this relatively simple scheme will suffice for all practical purposes. Best regards Helge -- Dr.-Ing. Helge Bahmann Berater Geschäftsbereich Hochsicherheit secunet Security Networks AG Ammonstraße 74 01067 Dresden, Germany Fon: +49 201 54 54-3586 Fax: +49 201 54 54-1323 Email: hel...@se... Sitz: Kronprinzenstraße 30, 45128 Essen Amtsgericht Essen HRB 13615 Vorstand: Dr. Rainer Baumgart, Thomas Koelzer, Thomas Pleines Aufsichtsratsvorsitzender: Dr. Karsten Ottenberg |