aboutsummaryrefslogtreecommitdiffstats
path: root/fs/squashfs/super.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2010-05-14 15:48:47 -0400
committerPhillip Lougher <phillip@lougher.demon.co.uk>2010-05-17 14:54:05 -0400
commit4b5397dc24ab12afaac85be3d0863b7f6eb8b0f0 (patch)
treebd385be428cfefcdf520f19c532196df1202d687 /fs/squashfs/super.c
parentb57f95a38233a2e73b679bea4a5453a1cc2a1cc9 (diff)
squashfs: add xattr id support
This patch adds support for mapping xattr ids (stored in inodes) into the on-disk location of the xattrs themselves. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Diffstat (limited to 'fs/squashfs/super.c')
-rw-r--r--fs/squashfs/super.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 48b6f4a385a6..c4dfc393fa52 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -36,6 +36,7 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/magic.h> 38#include <linux/magic.h>
39#include <linux/xattr.h>
39 40
40#include "squashfs_fs.h" 41#include "squashfs_fs.h"
41#include "squashfs_fs_sb.h" 42#include "squashfs_fs_sb.h"
@@ -82,7 +83,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
82 long long root_inode; 83 long long root_inode;
83 unsigned short flags; 84 unsigned short flags;
84 unsigned int fragments; 85 unsigned int fragments;
85 u64 lookup_table_start; 86 u64 lookup_table_start, xattr_id_table_start;
86 int err; 87 int err;
87 88
88 TRACE("Entered squashfs_fill_superblock\n"); 89 TRACE("Entered squashfs_fill_superblock\n");
@@ -143,7 +144,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
143 * Check if there's xattrs in the filesystem. These are not 144 * Check if there's xattrs in the filesystem. These are not
144 * supported in this version, so warn that they will be ignored. 145 * supported in this version, so warn that they will be ignored.
145 */ 146 */
146 if (le64_to_cpu(sblk->xattr_table_start) != SQUASHFS_INVALID_BLK) 147 if (le64_to_cpu(sblk->xattr_id_table_start) != SQUASHFS_INVALID_BLK)
147 ERROR("Xattrs in filesystem, these will be ignored\n"); 148 ERROR("Xattrs in filesystem, these will be ignored\n");
148 149
149 /* Check the filesystem does not extend beyond the end of the 150 /* Check the filesystem does not extend beyond the end of the
@@ -253,7 +254,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
253allocate_lookup_table: 254allocate_lookup_table:
254 lookup_table_start = le64_to_cpu(sblk->lookup_table_start); 255 lookup_table_start = le64_to_cpu(sblk->lookup_table_start);
255 if (lookup_table_start == SQUASHFS_INVALID_BLK) 256 if (lookup_table_start == SQUASHFS_INVALID_BLK)
256 goto allocate_root; 257 goto allocate_xattr_table;
257 258
258 /* Allocate and read inode lookup table */ 259 /* Allocate and read inode lookup table */
259 msblk->inode_lookup_table = squashfs_read_inode_lookup_table(sb, 260 msblk->inode_lookup_table = squashfs_read_inode_lookup_table(sb,
@@ -266,6 +267,19 @@ allocate_lookup_table:
266 267
267 sb->s_export_op = &squashfs_export_ops; 268 sb->s_export_op = &squashfs_export_ops;
268 269
270allocate_xattr_table:
271 xattr_id_table_start = le64_to_cpu(sblk->xattr_id_table_start);
272 if (xattr_id_table_start == SQUASHFS_INVALID_BLK)
273 goto allocate_root;
274
275 /* Allocate and read xattr id lookup table */
276 msblk->xattr_id_table = squashfs_read_xattr_id_table(sb,
277 xattr_id_table_start, &msblk->xattr_table, &msblk->xattr_ids);
278 if (IS_ERR(msblk->xattr_id_table)) {
279 err = PTR_ERR(msblk->xattr_id_table);
280 msblk->xattr_id_table = NULL;
281 goto failed_mount;
282 }
269allocate_root: 283allocate_root:
270 root = new_inode(sb); 284 root = new_inode(sb);
271 if (!root) { 285 if (!root) {
@@ -301,6 +315,7 @@ failed_mount:
301 kfree(msblk->inode_lookup_table); 315 kfree(msblk->inode_lookup_table);
302 kfree(msblk->fragment_index); 316 kfree(msblk->fragment_index);
303 kfree(msblk->id_table); 317 kfree(msblk->id_table);
318 kfree(msblk->xattr_id_table);
304 kfree(sb->s_fs_info); 319 kfree(sb->s_fs_info);
305 sb->s_fs_info = NULL; 320 sb->s_fs_info = NULL;
306 kfree(sblk); 321 kfree(sblk);
@@ -355,6 +370,7 @@ static void squashfs_put_super(struct super_block *sb)
355 kfree(sbi->fragment_index); 370 kfree(sbi->fragment_index);
356 kfree(sbi->meta_index); 371 kfree(sbi->meta_index);
357 kfree(sbi->inode_lookup_table); 372 kfree(sbi->inode_lookup_table);
373 kfree(sbi->xattr_id_table);
358 kfree(sb->s_fs_info); 374 kfree(sb->s_fs_info);
359 sb->s_fs_info = NULL; 375 sb->s_fs_info = NULL;
360 } 376 }