/
vmblock-7.1.5-3.12.patch
182 lines (169 loc) · 6.4 KB
/
vmblock-7.1.5-3.12.patch
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
diff -uN -r vmblock-only-orig/linux/control.c vmblock-only/linux/control.c
--- vmblock-only-orig/linux/control.c 2011-09-24 09:57:00.000000000 +1000
+++ vmblock-only/linux/control.c 2013-12-27 00:59:22.179150779 +1100
@@ -208,17 +208,18 @@
VMBlockSetProcEntryOwner(controlProcMountpoint);
/* Create /proc/fs/vmblock/dev */
- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
+ /*controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
VMBLOCK_CONTROL_MODE,
- controlProcDirEntry);
- if (!controlProcEntry) {
+ controlProcDirEntry);*/
+ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps);
+ if (controlProcEntry == NULL) {
Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
return -EINVAL;
}
- controlProcEntry->proc_fops = &ControlFileOps;
+ /* controlProcEntry->proc_fops = &ControlFileOps; */
return 0;
}
diff -uN -r vmblock-only-orig/linux/file.c vmblock-only/linux/file.c
--- vmblock-only-orig/linux/file.c 2011-09-24 09:57:00.000000000 +1000
+++ vmblock-only/linux/file.c 2013-12-27 01:10:24.916423669 +1100
@@ -32,31 +32,13 @@
#include "vmblockInt.h"
#include "filesystem.h"
-/* Specifically for our filldir_t callback */
-typedef struct FilldirInfo {
- filldir_t filldir;
- void *dirent;
-} FilldirInfo;
-
/* File operations */
static int FileOpOpen(struct inode *inode, struct file *file);
-static int FileOpReaddir(struct file *file, void *dirent, filldir_t filldir);
+static int FileOpReaddir(struct file *file, struct dir_context *ctx);
static int FileOpRelease(struct inode *inode, struct file *file);
-/* Local functions */
-#if defined(VMW_FILLDIR_2618)
-static int Filldir(void *buf, const char *name, int namelen,
- loff_t offset, u64 ino, unsigned int d_type);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9)
-static int Filldir(void *buf, const char *name, int namelen,
- loff_t offset, ino_t ino, unsigned int d_type);
-#else
-static int Filldir(void *buf, const char *name, int namelen,
- off_t offset, ino_t ino, unsigned int d_type);
-#endif
-
struct file_operations RootFileOps = {
- .readdir = FileOpReaddir,
+ .iterate = FileOpReaddir,
.open = FileOpOpen,
.release = FileOpRelease,
};
@@ -150,11 +132,9 @@
static int
FileOpReaddir(struct file *file, // IN
- void *dirent, // IN
- filldir_t filldir) // IN
+ struct dir_context *ctx) // IN
{
int ret;
- FilldirInfo info;
struct file *actualFile;
if (!file) {
@@ -168,12 +148,10 @@
return -EINVAL;
}
- info.filldir = filldir;
- info.dirent = dirent;
-
- actualFile->f_pos = file->f_pos;
- ret = vfs_readdir(actualFile, Filldir, &info);
- file->f_pos = actualFile->f_pos;
+ /* Ricky Wong Yung Fei:
+ * Manipulation of pos is now handled internally by iterate_dir().
+ */
+ ret = iterate_dir(actualFile, ctx);
return ret;
}
@@ -218,58 +196,3 @@
return ret;
}
-
-
-/* Local functions */
-
-/*
- *----------------------------------------------------------------------------
- *
- * Filldir --
- *
- * Callback function for readdir that we use in place of the one provided.
- * This allows us to specify that each dentry is a symlink, but pass through
- * everything else to the original filldir function.
- *
- * Results:
- * Original filldir's return value.
- *
- * Side effects:
- * Directory information gets copied to user's buffer.
- *
- *----------------------------------------------------------------------------
- */
-
-#if defined(VMW_FILLDIR_2618)
-static int
-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
- const char *name, // IN: Dirent name
- int namelen, // IN: len of dirent's name
- loff_t offset, // IN: Offset
- u64 ino, // IN: Inode number of dirent
- unsigned int d_type) // IN: Type of file
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9)
-static int
-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
- const char *name, // IN: Dirent name
- int namelen, // IN: len of dirent's name
- loff_t offset, // IN: Offset
- ino_t ino, // IN: Inode number of dirent
- unsigned int d_type) // IN: Type of file
-#else
-static int
-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
- const char *name, // IN: Dirent name
- int namelen, // IN: len of dirent's name
- off_t offset, // IN: Offset
- ino_t ino, // IN: Inode number of dirent
- unsigned int d_type) // IN: Type of file
-#endif
-{
- FilldirInfo *info = (FilldirInfo *)buf;
-
- /* Specify DT_LNK regardless */
- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
-}
-
-
diff -uN -r vmblock-only-orig/linux/inode.c vmblock-only/linux/inode.c
--- vmblock-only-orig/linux/inode.c 2011-09-24 09:57:00.000000000 +1000
+++ vmblock-only/linux/inode.c 2013-12-27 01:20:33.457040125 +1100
@@ -36,7 +36,7 @@
/* Inode operations */
static struct dentry *InodeOpLookup(struct inode *dir,
- struct dentry *dentry, struct nameidata *nd);
+ struct dentry *dentry, unsigned int flags);
static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
@@ -75,7 +75,7 @@
static struct dentry *
InodeOpLookup(struct inode *dir, // IN: parent directory's inode
struct dentry *dentry, // IN: dentry to lookup
- struct nameidata *nd) // IN: lookup intent and information
+ unsigned int flags) // IN: lookup intent and information
{
char *filename;
struct inode *inode;
@@ -221,7 +221,7 @@
goto out;
}
- ret = vfs_follow_link(nd, iinfo->name);
+ nd_set_link(nd, iinfo->name);
out:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)