aboutsummaryrefslogtreecommitdiff
path: root/kernel/linux-2.6.24.patch
blob: 3877c6827699075c5f5a67f834e834c80ac471f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
diff -Naurp linux-post-2.6.24/fs/squashfs/inode.c linux-pre-2.6.25/fs/squashfs/inode.c
--- linux-post-2.6.24/fs/squashfs/inode.c	2008-06-13 00:45:31.000000000 +0100
+++ linux-pre-2.6.25/fs/squashfs/inode.c	2008-06-13 00:46:27.000000000 +0100
@@ -32,14 +32,10 @@
 #include <linux/vmalloc.h>
 #include <linux/spinlock.h>
 #include <linux/smp_lock.h>
 
 #include "squashfs.h"
 
-static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
-		struct fid *fid, int fh_len, int fh_type);
-static struct dentry *squashfs_fh_to_parent(struct super_block *s,
-		struct fid *fid, int fh_len, int fh_type);
+static void vfs_read_inode(struct inode *i);
 static struct dentry *squashfs_get_parent(struct dentry *child);
 static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
 static int squashfs_statfs(struct dentry *, struct kstatfs *);
@@ -80,9 +76,15 @@ static struct super_operations squashfs_
 	.remount_fs = squashfs_remount
 };
 
+static struct super_operations squashfs_export_super_ops = {
+	.alloc_inode = squashfs_alloc_inode,
+	.destroy_inode = squashfs_destroy_inode,
+	.statfs = squashfs_statfs,
+	.put_super = squashfs_put_super,
+	.read_inode = vfs_read_inode
+};
+
 static struct export_operations squashfs_export_ops = {
-	.fh_to_dentry = squashfs_fh_to_dentry,
-	.fh_to_parent = squashfs_fh_to_parent,
 	.get_parent = squashfs_get_parent
 };
 
@@ -631,72 +633,42 @@ static squashfs_inode_t squashfs_inode_l
 out:
 	return SQUASHFS_INVALID_BLK;
 }
+	
 
-
-
-static struct dentry *squashfs_export_iget(struct super_block *s,
-	unsigned int inode_number)
-{
-	squashfs_inode_t inode;
-	struct inode *i;
-	struct dentry *dentry;
-
-	TRACE("Entered squashfs_export_iget\n");
-
-	inode = squashfs_inode_lookup(s, inode_number);
-	if(inode == SQUASHFS_INVALID_BLK) {
-		dentry = ERR_PTR(-ENOENT);
-		goto failure;
-	}
-
-	i = squashfs_iget(s, inode, inode_number);
-	if(i == NULL) {
-		dentry = ERR_PTR(-EACCES);
-		goto failure;
-	}
-
-	dentry = d_alloc_anon(i);
-	if (dentry == NULL) {
-		iput(i);
-		dentry = ERR_PTR(-ENOMEM);
-	}
-
-failure:
-	return dentry;
-}
-
-
-static struct dentry *squashfs_fh_to_dentry(struct super_block *s,
-		struct fid *fid, int fh_len, int fh_type)
+static void vfs_read_inode(struct inode *i)
 {
-	if((fh_type != FILEID_INO32_GEN && fh_type != FILEID_INO32_GEN_PARENT) ||
-			fh_len < 2)
-		return NULL;
-
-	return squashfs_export_iget(s, fid->i32.ino);
-}
+	struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
+	squashfs_inode_t inode = squashfs_inode_lookup(i->i_sb, i->i_ino);
 
+	TRACE("Entered vfs_read_inode\n");
 
-static struct dentry *squashfs_fh_to_parent(struct super_block *s,
-		struct fid *fid, int fh_len, int fh_type)
-{
-	if(fh_type != FILEID_INO32_GEN_PARENT || fh_len < 4)
-		return NULL;
-
-	return squashfs_export_iget(s, fid->i32.parent_ino);
+	if(inode != SQUASHFS_INVALID_BLK)
+		(msblk->read_inode)(i, inode);
 }
 
 
 static struct dentry *squashfs_get_parent(struct dentry *child)
 {
 	struct inode *i = child->d_inode;
+	struct inode *parent = iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
+	struct dentry *rv;
 
 	TRACE("Entered squashfs_get_parent\n");
 
-	return squashfs_export_iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode);
-}
+	if(parent == NULL) {
+		rv = ERR_PTR(-EACCES);
+		goto out;
+	}
 
+	rv = d_alloc_anon(parent);
+	if(rv == NULL)
+		rv = ERR_PTR(-ENOMEM);
 
+out:
+	return rv;
+}
+
+	
 SQSH_EXTERN struct inode *squashfs_iget(struct super_block *s,
 				squashfs_inode_t inode, unsigned int inode_number)
 {
@@ -1247,6 +1219,7 @@ static int squashfs_fill_super(struct su
 	if (read_inode_lookup_table(s) == 0)
 		goto failed_mount;
 
+	s->s_op = &squashfs_export_super_ops;
 	s->s_export_op = &squashfs_export_ops;
 
 allocate_root: