[PATCH 4/4] squashfs: add xattr support configure option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Signed-off-by: Phillip Lougher <phillip@xxxxxxxxxxxxxxxxxxx>
---
 fs/squashfs/Kconfig    |   11 +++++++++++
 fs/squashfs/Makefile   |    2 +-
 fs/squashfs/inode.c    |    1 +
 fs/squashfs/namei.c    |    1 +
 fs/squashfs/squashfs.h |    6 ------
 fs/squashfs/super.c    |    4 +++-
 fs/squashfs/symlink.c  |    1 +
 fs/squashfs/xattr.h    |   45 +++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 63 insertions(+), 8 deletions(-)
 create mode 100644 fs/squashfs/xattr.h

diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 25a00d1..cc6ce8a 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -26,6 +26,17 @@ config SQUASHFS

 	  If unsure, say N.

+config SQUASHFS_XATTRS
+	bool "Squashfs XATTR support"
+	depends on SQUASHFS
+	default n
+	help
+	  Saying Y here includes support for extended attributes (xattrs).
+	  Xattrs are name:value pairs associated with inodes by
+	  the kernel or by users (see the attr(5) manual page).
+
+	  If unsure, say N.
+
 config SQUASHFS_EMBEDDED

 	bool "Additional option for memory-constrained systems"
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 56684d4..2cee3e9 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -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.o xattr_id.o
+squashfs-$(CONFIG_SQUASHFS_XATTRS) += xattr.o xattr_id.o

diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index 2507011..62e63ad 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -46,6 +46,7 @@
 #include "squashfs_fs_sb.h"
 #include "squashfs_fs_i.h"
 #include "squashfs.h"
+#include "xattr.h"

 /*
  * Initialise VFS inode with the base inode information common to all
diff --git a/fs/squashfs/namei.c b/fs/squashfs/namei.c
index 32f5b54..7a9464d 100644
--- a/fs/squashfs/namei.c
+++ b/fs/squashfs/namei.c
@@ -63,6 +63,7 @@
 #include "squashfs_fs_sb.h"
 #include "squashfs_fs_i.h"
 #include "squashfs.h"
+#include "xattr.h"

 /*
  * Lookup name in the directory index, returning the location of the metadata
diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
index 7d23810..305ce15 100644
--- a/fs/squashfs/squashfs.h
+++ b/fs/squashfs/squashfs.h
@@ -76,12 +76,6 @@ extern int squashfs_read_inode(struct inode *, long long);
 /* xattr.c */
 extern ssize_t squashfs_listxattr(struct dentry *, char *, size_t);

-/* xattr_id.c */
-extern int squashfs_xattr_lookup(struct super_block *, unsigned int, int *,
-				int *, long long *);
-extern __le64 *squashfs_read_xattr_id_table(struct super_block *, u64,
-				u64 *, int *);
-
 /*
  * Inodes, files,  decompressor and xattr operations
  */
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index b6425ac..88b4f86 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -43,6 +43,7 @@
 #include "squashfs_fs_i.h"
 #include "squashfs.h"
 #include "decompressor.h"
+#include "xattr.h"

 static struct file_system_type squashfs_fs_type;
 static const struct super_operations squashfs_super_ops;
@@ -272,7 +273,8 @@ allocate_xattr_table:
 	if (IS_ERR(msblk->xattr_id_table)) {
 		err = PTR_ERR(msblk->xattr_id_table);
 		msblk->xattr_id_table = NULL;
-		goto failed_mount;
+		if (err != -ENOTSUPP)
+			goto failed_mount;
 	}
 allocate_root:
 	root = new_inode(sb);
diff --git a/fs/squashfs/symlink.c b/fs/squashfs/symlink.c
index a7ee68a..ec86434 100644
--- a/fs/squashfs/symlink.c
+++ b/fs/squashfs/symlink.c
@@ -41,6 +41,7 @@
 #include "squashfs_fs_sb.h"
 #include "squashfs_fs_i.h"
 #include "squashfs.h"
+#include "xattr.h"

 static int squashfs_symlink_readpage(struct file *file, struct page *page)
 {
diff --git a/fs/squashfs/xattr.h b/fs/squashfs/xattr.h
new file mode 100644
index 0000000..4a96366
--- /dev/null
+++ b/fs/squashfs/xattr.h
@@ -0,0 +1,45 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2010
+ * Phillip Lougher <phillip@xxxxxxxxxxxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * xattr.h
+ */
+
+#ifdef CONFIG_SQUASHFS_XATTRS
+extern __le64 *squashfs_read_xattr_id_table(struct super_block *, u64,
+		u64 *, int *);
+extern int squashfs_xattr_lookup(struct super_block *, unsigned int, int *,
+		int *, long long *);
+#else
+static inline __le64 *squashfs_read_xattr_id_table(struct super_block *sb,
+		u64 start, u64 *xattr_table_start, int *xattr_ids)
+{
+	ERROR("Xattrs in filesystem, these will be ignored\n");
+	return ERR_PTR(-ENOTSUPP);
+}
+
+static inline int squashfs_xattr_lookup(struct super_block *sb,
+		unsigned int index, int *count, int *size, long long *xattr)
+{
+	return 0;
+}
+#define squashfs_listxattr NULL
+#define generic_getxattr NULL
+#define squashfs_xattr_handlers NULL
+#endif
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux