summaryrefslogtreecommitdiffstats
path: root/package/shfs/patches/101-shfs_0.35_2.6.18_dentry.patch
blob: e7754b037d5b322b517ef156e40e82b53663dc75 (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
Index: shfs-0.35/shfs/Linux-2.6/inode.c
===================================================================
--- shfs-0.35.orig/shfs/Linux-2.6/inode.c	2007-06-04 13:22:58.091024104 +0200
+++ shfs-0.35/shfs/Linux-2.6/inode.c	2007-06-04 13:22:58.397977440 +0200
@@ -337,12 +337,21 @@
 	return -EINVAL;
 }
 
+#ifdef NEW_VFS_DENTRY_API
+static int
+shfs_get_sb(struct file_system_type *fs_type,
+	    int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+{
+	return get_sb_nodev(fs_type, flags, data, shfs_read_super, mnt);
+}
+#else
 static struct super_block *
 shfs_get_sb(struct file_system_type *fs_type,
 	    int flags, const char *dev_name, void *data)
 {
 	return get_sb_nodev(fs_type, flags, data, shfs_read_super);
 }
+#endif
 
 static struct file_system_type sh_fs_type = {
 	.owner		= THIS_MODULE,
Index: shfs-0.35/shfs/Linux-2.6/file.c
===================================================================
--- shfs-0.35.orig/shfs/Linux-2.6/file.c	2007-06-04 13:22:58.096023344 +0200
+++ shfs-0.35/shfs/Linux-2.6/file.c	2007-06-04 13:22:58.397977440 +0200
@@ -199,7 +199,7 @@
 }
 
 static int
-shfs_file_flush(struct file *f)
+do_file_flush(struct file *f)
 {
 	struct dentry *dentry = f->f_dentry;
 	struct shfs_sb_info *info = info_from_dentry(dentry);
@@ -222,6 +222,16 @@
 }
 
 static int
+#ifdef FLUSH_HAS_LOCK_OWNER
+shfs_file_flush(struct file *f, fl_owner_t id)
+#else
+shfs_file_flush(struct file *f)
+#endif
+{
+	return do_file_flush(f);
+}
+
+static int
 shfs_file_release(struct inode *inode, struct file *f)
 {
 	struct dentry *dentry = f->f_dentry;
@@ -311,7 +321,7 @@
 	DEBUG("\n");
 	written = generic_file_write(f, buf, count, offset);
 	if (written > 0) {
-		result = shfs_file_flush(f);
+		result = do_file_flush(f);
 		written = result < 0 ? result: written;
 	}
 	
Index: shfs-0.35/shfs/Linux-2.6/proc.c
===================================================================
--- shfs-0.35.orig/shfs/Linux-2.6/proc.c	2007-06-04 13:22:58.102022432 +0200
+++ shfs-0.35/shfs/Linux-2.6/proc.c	2007-06-04 13:22:58.398977288 +0200
@@ -570,6 +570,16 @@
 	return result;
 }
 
+#ifdef NEW_VFS_DENTRY_API
+int
+shfs_statfs(struct dentry *dentry, struct kstatfs *attr)
+{
+	struct shfs_sb_info *info = info_from_sb(dentry->d_sb);
+
+	DEBUG("\n");
+	return info->fops.statfs(info, attr);
+}
+#else
 int
 shfs_statfs(struct super_block *sb, struct kstatfs *attr)
 {
@@ -578,4 +588,5 @@
 	DEBUG("\n");
 	return info->fops.statfs(info, attr);
 }
+#endif
 
Index: shfs-0.35/shfs/Linux-2.6/shfs_fs.h
===================================================================
--- shfs-0.35.orig/shfs/Linux-2.6/shfs_fs.h	2007-06-04 13:22:58.107021672 +0200
+++ shfs-0.35/shfs/Linux-2.6/shfs_fs.h	2007-06-04 13:22:58.398977288 +0200
@@ -9,6 +9,12 @@
 
 #include <linux/ioctl.h>
 #include <linux/pagemap.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)
+#define NEW_VFS_DENTRY_API
+#define FLUSH_HAS_LOCK_OWNER
+#endif
 
 #define SHFS_MAX_AGE(info)	(((info)->ttl * HZ) / 1000)
 #define SOCKBUF_SIZE		(SHFS_PATH_MAX * 10)
@@ -101,7 +107,12 @@
 void set_garbage(struct shfs_sb_info *info, int write, int count);
 int get_name(struct dentry *d, char *name);
 int shfs_notify_change(struct dentry *dentry, struct iattr *attr);
+
+#ifdef NEW_VFS_DENTRY_API
+int shfs_statfs(struct dentry *dentry, struct kstatfs *attr);
+#else
 int shfs_statfs(struct super_block *sb, struct kstatfs *attr);
+#endif
 	
 /* shfs/inode.c */
 void shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr);
Index: shfs-0.35/shfs/Linux-2.6/symlink.c
===================================================================
--- shfs-0.35.orig/shfs/Linux-2.6/symlink.c	2007-06-04 13:22:58.113020760 +0200
+++ shfs-0.35/shfs/Linux-2.6/symlink.c	2007-06-04 13:22:58.398977288 +0200
@@ -41,7 +41,7 @@
 	return result;
 }
 
-static int
+static void *
 shfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
 	struct shfs_sb_info *info = info_from_dentry(dentry);
@@ -61,7 +61,7 @@
 	DEBUG("%s\n", real_name);
 	result = vfs_follow_link(nd, real_name);
 error:
-	return result;
+	return NULL;
 }
 
 struct inode_operations shfs_symlink_inode_operations = {
Index: shfs-0.35/shfs/Linux-2.6/dcache.c
===================================================================
--- shfs-0.35.orig/shfs/Linux-2.6/dcache.c	2007-06-04 13:22:58.121019544 +0200
+++ shfs-0.35/shfs/Linux-2.6/dcache.c	2007-06-04 13:22:58.398977288 +0200
@@ -68,7 +68,7 @@
 	spin_lock(&dcache_lock);
 	next = parent->d_subdirs.next;
 	while (next != &parent->d_subdirs) {
-		dentry = list_entry(next, struct dentry, d_child);
+		dentry = list_entry(next, struct dentry, d_u.d_child);
 		dentry->d_fsdata = NULL;
 		shfs_age_dentry(info, dentry);
 		next = next->next;
@@ -101,7 +101,7 @@
 	spin_lock(&dcache_lock);
 	next = parent->d_subdirs.next;
 	while (next != &parent->d_subdirs) {
-		dent = list_entry(next, struct dentry, d_child);
+		dent = list_entry(next, struct dentry, d_u.d_child);
 		if ((unsigned long)dent->d_fsdata == fpos) {
 			if (dent->d_inode)
 				dget_locked(dent);