wok-next view squashfs/stuff/squashfs-patch-2.6.25 @ rev 1251

Minor fix
author Dominique Corbex <domcox@users.sourceforge.net>
date Tue Aug 12 20:05:51 2008 +0200 (2008-08-12)
parents
children
line source
1 diff -x .gitignore -Nurp linux-2.6.25-rc7.orig/fs/squashfs/inode.c linux-2.6.25-rc7.new/fs/squashfs/inode.c
2 --- linux-2.6.25-rc7.orig/fs/squashfs/inode.c 2008-04-05 00:19:09.000000000 +0100
3 +++ linux-2.6.25-rc7.new/fs/squashfs/inode.c 2008-04-05 00:22:44.000000000 +0100
4 @@ -1,7 +1,7 @@
5 /*
6 * Squashfs - a compressed read only filesystem for Linux
7 *
8 - * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
9 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
10 * Phillip Lougher <phillip@lougher.demon.co.uk>
11 *
12 * This program is free software; you can redistribute it and/or
13 @@ -37,7 +37,10 @@
15 int squashfs_cached_blks;
17 -static void vfs_read_inode(struct inode *i);
18 +static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
19 + struct fid *fid, int fh_len, int fh_type);
20 +static struct dentry *squashfs_fh_to_parent(struct super_block *s,
21 + struct fid *fid, int fh_len, int fh_type);
22 static struct dentry *squashfs_get_parent(struct dentry *child);
23 static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
24 static int squashfs_statfs(struct dentry *, struct kstatfs *);
25 @@ -78,15 +81,9 @@ static struct super_operations squashfs_
26 .remount_fs = squashfs_remount
27 };
29 -static struct super_operations squashfs_export_super_ops = {
30 - .alloc_inode = squashfs_alloc_inode,
31 - .destroy_inode = squashfs_destroy_inode,
32 - .statfs = squashfs_statfs,
33 - .put_super = squashfs_put_super,
34 - .read_inode = vfs_read_inode
35 -};
36 -
37 static struct export_operations squashfs_export_ops = {
38 + .fh_to_dentry = squashfs_fh_to_dentry,
39 + .fh_to_parent = squashfs_fh_to_parent,
40 .get_parent = squashfs_get_parent
41 };
43 @@ -630,42 +627,72 @@ static squashfs_inode_t squashfs_inode_l
44 out:
45 return SQUASHFS_INVALID_BLK;
46 }
47 -
49 -static void vfs_read_inode(struct inode *i)
50 +
51 +
52 +static struct dentry *squashfs_export_iget(struct super_block *s,
53 + unsigned int inode_number)
54 {
55 - struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
56 - squashfs_inode_t inode = squashfs_inode_lookup(i->i_sb, i->i_ino);
57 + squashfs_inode_t inode;
58 + struct inode *i;
59 + struct dentry *dentry;
61 - TRACE("Entered vfs_read_inode\n");
62 + TRACE("Entered squashfs_export_iget\n");
64 - if(inode != SQUASHFS_INVALID_BLK)
65 - (msblk->read_inode)(i, inode);
66 + inode = squashfs_inode_lookup(s, inode_number);
67 + if(inode == SQUASHFS_INVALID_BLK) {
68 + dentry = ERR_PTR(-ENOENT);
69 + goto failure;
70 + }
71 +
72 + i = squashfs_iget(s, inode, inode_number);
73 + if(i == NULL) {
74 + dentry = ERR_PTR(-EACCES);
75 + goto failure;
76 + }
77 +
78 + dentry = d_alloc_anon(i);
79 + if (dentry == NULL) {
80 + iput(i);
81 + dentry = ERR_PTR(-ENOMEM);
82 + }
83 +
84 +failure:
85 + return dentry;
86 +}
87 +
88 +
89 +static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
90 + struct fid *fid, int fh_len, int fh_type)
91 +{
92 + if((fh_type != FILEID_INO32_GEN && fh_type != FILEID_INO32_GEN_PARENT) ||
93 + fh_len < 2)
94 + return NULL;
95 +
96 + return squashfs_export_iget(s, fid->i32.ino);
97 +}
98 +
99 +
100 +static struct dentry *squashfs_fh_to_parent(struct super_block *s,
101 + struct fid *fid, int fh_len, int fh_type)
102 +{
103 + if(fh_type != FILEID_INO32_GEN_PARENT || fh_len < 4)
104 + return NULL;
105 +
106 + return squashfs_export_iget(s, fid->i32.parent_ino);
107 }
110 static struct dentry *squashfs_get_parent(struct dentry *child)
111 {
112 struct inode *i = child->d_inode;
113 - struct inode *parent = iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
114 - struct dentry *rv;
116 TRACE("Entered squashfs_get_parent\n");
118 - if(parent == NULL) {
119 - rv = ERR_PTR(-EACCES);
120 - goto out;
121 - }
122 -
123 - rv = d_alloc_anon(parent);
124 - if(rv == NULL)
125 - rv = ERR_PTR(-ENOMEM);
126 -
127 -out:
128 - return rv;
129 + return squashfs_export_iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
130 }
132 -
133 +
134 SQSH_EXTERN struct inode *squashfs_iget(struct super_block *s,
135 squashfs_inode_t inode, unsigned int inode_number)
136 {
137 @@ -1257,7 +1284,6 @@ static int squashfs_fill_super(struct su
138 if (read_inode_lookup_table(s) == 0)
139 goto failed_mount;
141 - s->s_op = &squashfs_export_super_ops;
142 s->s_export_op = &squashfs_export_ops;
144 allocate_root:
145 @@ -2124,7 +2150,7 @@ static int __init init_squashfs_fs(void)
146 if (err)
147 goto out;
149 - printk(KERN_INFO "squashfs: version 3.3 (2007/10/31) "
150 + printk(KERN_INFO "squashfs: version 3.3-CVS (2008/04/04) "
151 "Phillip Lougher\n");
153 err = register_filesystem(&squashfs_fs_type);
154 @@ -2187,6 +2213,6 @@ static void destroy_inodecache(void)
156 module_init(init_squashfs_fs);
157 module_exit(exit_squashfs_fs);
158 -MODULE_DESCRIPTION("squashfs 3.2-r2-CVS, a compressed read-only filesystem");
159 +MODULE_DESCRIPTION("squashfs 3.3, a compressed read-only filesystem");
160 MODULE_AUTHOR("Phillip Lougher <phillip@lougher.demon.co.uk>");
161 MODULE_LICENSE("GPL");