|
From: Helge B. <hel...@se...> - 2010-04-20 08:22:45
|
Hello everyone, as promised my work on adding xattr support to squashfs so far. The included patch (against 2.6.31.12 currently) implements the kernel bits for squashfs xattr support, following the format described therein and for convenience also repeated below. I have prepared a small "test" squashfs image with a file including extended attributes available at: http://www.chaoticmind.net/~hcb/projects/squashfs-xattr/squashfs-xattr-test.img Support for creating squashfs images including extended attributes has been added to my squashfs library available at: http://gitorious.org/libsqfs (note: only in the "xattr" branch, not in "master" yet), also contains a small sample program to demonstrate how to create images including xattrs. I have not yet begun patching mksquashfs, but this will follow as well. Current limitations: - xattrs available only for directories and regular files; to support other file types, L*-versions of on-disk-structures need to be defined (this is straight-forward, but not done this yet) - kernel fs driver passes xattrs through in raw form (i.e. does not perform any permission or sanity checking to enforce the prefix structure expected for xattr names) 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 consecutive compressed metadata blocks. The attributes are 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 is very similar to how directories are addressed in squashfs, but using 19/13 bits instead of 32/16 to fit within the existing format specification. This scheme allows for 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. Comments? -- 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 |