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