Skip to contentSkip to conversation

squashfs: add support for xattr reading

PATCH In review Phillip Lougher 1 participant 1 message May 17, 2010

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

PATCH 2/4 squashfs: add support for xattr reading

Add support for listxattr and getxattr. Also add xattr definitions.

---
 fs/squashfs/Makefile        |    2 +-
 fs/squashfs/squashfs_fs.h   |   19 +++
 fs/squashfs/squashfs_fs_i.h |    3 +
 fs/squashfs/xattr.c         |  319 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 342 insertions(+), 1 deletions(-)
 create mode 100644 fs/squashfs/xattr.c
fs/squashfs/Makefile +1 -1
index c0da4a1..56684d4 100644
@@ -5,5 +5,5 @@
 obj-$(CONFIG_SQUASHFS) += squashfs.o
 squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
 squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o
-squashfs-y += xattr_id.o
+squashfs-y += xattr.o xattr_id.o
 
fs/squashfs/squashfs_fs.h +19 -0
index c654e86..6fe940c 100644
@@ -46,6 +46,7 @@
 #define SQUASHFS_NAME_LEN		256
 
 #define SQUASHFS_INVALID_FRAG		(0xffffffffU)
+#define SQUASHFS_INVALID_XATTR		(0xffffffffU)
 #define SQUASHFS_INVALID_BLK		(-1LL)
 
 /* Filesystem flags */
@@ -96,6 +97,13 @@
 #define SQUASHFS_LFIFO_TYPE		13
 #define SQUASHFS_LSOCKET_TYPE		14
 
+/* Xattr types */
+#define SQUASHFS_XATTR_USER             0
+#define SQUASHFS_XATTR_TRUSTED          1
+#define SQUASHFS_XATTR_SECURITY         2
+#define SQUASHFS_XATTR_VALUE_OOL        256
+#define SQUASHFS_XATTR_PREFIX_MASK      0xff
+
 /* Flag whether block is compressed or uncompressed, bit is set if block is
  * uncompressed */
 #define SQUASHFS_COMPRESSED_BIT		(1 << 15)
@@ -395,6 +403,17 @@ struct squashfs_fragment_entry {
 	unsigned int		unused;
 };
 
+struct squashfs_xattr_entry {
+	__le16			type;
+	__le16			size;
+	char			data[0];
+};
+
+struct squashfs_xattr_val {
+	__le32			vsize;
+	char			value[0];
+};
+
 struct squashfs_xattr_id {
 	__le64			xattr;
 	__le32			count;
fs/squashfs/squashfs_fs_i.h +3 -0
index fbfca30..d3e3a37 100644
@@ -26,6 +26,9 @@
 struct squashfs_inode_info {
 	u64		start;
 	int		offset;
+	u64		xattr;
+	unsigned int	xattr_size;
+	int		xattr_count;
 	union {
 		struct {
 			u64		fragment_block;
fs/squashfs/xattr.c new file +319 -0

319 lines not on this page · raw message

Signature · 1 line
1.6.3.3