]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
squashfs: add xattr support configure option
authorPhillip Lougher <phillip@lougher.demon.co.uk>
Mon, 17 May 2010 18:39:02 +0000 (19:39 +0100)
committerPhillip Lougher <phillip@lougher.demon.co.uk>
Mon, 17 May 2010 18:54:07 +0000 (19:54 +0100)
Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
fs/squashfs/Kconfig
fs/squashfs/Makefile
fs/squashfs/inode.c
fs/squashfs/namei.c
fs/squashfs/squashfs.h
fs/squashfs/super.c
fs/squashfs/symlink.c
fs/squashfs/xattr.h [new file with mode: 0644]

index 25a00d19d68681687d0f9990a661ab8a7321fb75..cc6ce8a84c217d50fb82aef341d26fd56da6e991 100644 (file)
@@ -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" 
index 56684d46410529741b89652e954842bc8939f8c2..2cee3e9fa452b81219a04145f77c1ba827723a6e 100644 (file)
@@ -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
 
index 250701180a3bbbf78546eb872bb8126727d62d93..62e63ad250755ed6d51fd56aa75f2c91f82e74e7 100644 (file)
@@ -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
index 32f5b54d1cec812dd7bb57de1a1b85270049a593..7a9464d08cf632bef2395baea734c9eae9d8d6a7 100644 (file)
@@ -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
index 7d23810705815f61b0a03a8f670a39786d1f1c3b..305ce15d2d2d8deeee73231fde7bfe03c548bbdb 100644 (file)
@@ -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
  */
index b6425ac1c2ae4a8d7255abf0dbd5bf5ba68488e6..88b4f8606652b8e675621a2f545aff357ea176ae 100644 (file)
@@ -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);
index a7ee68a8621b7593e2f4af40ebafb1dce9e8f624..ec86434921e18c6a5bd180246439f84b56a5d00b 100644 (file)
@@ -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 (file)
index 0000000..4a96366
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2010
+ * Phillip Lougher <phillip@lougher.demon.co.uk>
+ *
+ * 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