1 Index: linux-2.6.10/fs/namei.c
2 ===================================================================
3 --- linux-2.6.10.orig/fs/namei.c 2005-03-31 17:43:42.417809208 +0800
4 +++ linux-2.6.10/fs/namei.c 2005-03-31 17:47:14.292599344 +0800
6 intent_init(&nd->intent.open, it.op);
7 nd->intent.open.flags = it.flags;
8 nd->intent.open.create_mode = it.create_mode;
9 + nd->intent.open.create = it.create;
10 res = link_path_walk(link, nd);
12 if (nd->depth || res || nd->last_type!=LAST_NORM)
16 nd->last_type = LAST_NORM;
17 - if (this.name[0] != '.')
20 - nd->last_type = LAST_DOT;
21 - else if (this.len == 2 && this.name[1] == '.')
22 - nd->last_type = LAST_DOTDOT;
25 + if (this.name[0] == '.') {
27 + nd->last_type = LAST_DOT;
28 + else if (this.len == 2 && this.name[1] == '.')
29 + nd->last_type = LAST_DOTDOT;
32 + if ((nd->last_type == LAST_NORM) && inode->i_op &&
33 + inode->i_op->endparentlookup) {
34 + err = inode->i_op->endparentlookup(nd);
41 * We bypassed the ordinary revalidation routines.
42 @@ -1646,9 +1653,16 @@
46 - error = path_lookup(tmp, LOOKUP_PARENT, &nd);
47 + intent_init(&nd.intent.open, IT_MKNOD);
48 + nd.intent.open.create_mode = mode;
49 + nd.intent.open.create.dev = dev;
51 + error = path_lookup_it(tmp, LOOKUP_PARENT, &nd);
54 + if (nd.intent.open.flags & IT_STATUS_RAW)
57 dentry = lookup_create(&nd, 0);
58 error = PTR_ERR(dentry);
63 up(&nd.dentry->d_inode->i_sem);
68 @@ -1717,9 +1732,13 @@
69 struct dentry *dentry;
72 - error = path_lookup(tmp, LOOKUP_PARENT, &nd);
73 + intent_init(&nd.intent.open, IT_MKDIR);
74 + nd.intent.open.create_mode = mode;
75 + error = path_lookup_it(tmp, LOOKUP_PARENT, &nd);
78 + if (nd.intent.open.flags & IT_STATUS_RAW)
80 dentry = lookup_create(&nd, 1);
81 error = PTR_ERR(dentry);
82 if (!IS_ERR(dentry)) {
86 up(&nd.dentry->d_inode->i_sem);
91 @@ -1814,9 +1834,12 @@
95 - error = path_lookup(name, LOOKUP_PARENT, &nd);
96 + intent_init(&nd.intent.open, IT_RMDIR);
97 + error = path_lookup_it(name, LOOKUP_PARENT, &nd);
100 + if (nd.intent.open.flags & IT_STATUS_RAW)
103 switch(nd.last_type) {
105 @@ -1892,9 +1915,13 @@
107 return PTR_ERR(name);
109 - error = path_lookup(name, LOOKUP_PARENT, &nd);
110 + intent_init(&nd.intent.open, IT_UNLINK);
111 + error = path_lookup_it(name, LOOKUP_PARENT, &nd);
114 + if (nd.intent.open.flags & IT_STATUS_RAW)
118 if (nd.last_type != LAST_NORM)
120 @@ -1965,9 +1992,13 @@
121 struct dentry *dentry;
124 - error = path_lookup(to, LOOKUP_PARENT, &nd);
125 + intent_init(&nd.intent.open, IT_SYMLINK);
126 + nd.intent.open.create.link = from;
127 + error = path_lookup_it(to, LOOKUP_PARENT, &nd);
130 + if (nd.intent.open.flags & IT_STATUS_RAW)
132 dentry = lookup_create(&nd, 0);
133 error = PTR_ERR(dentry);
134 if (!IS_ERR(dentry)) {
135 @@ -1975,6 +2006,7 @@
138 up(&nd.dentry->d_inode->i_sem);
143 @@ -2046,9 +2078,13 @@
144 error = __user_walk(oldname, 0, &old_nd);
147 - error = path_lookup(to, LOOKUP_PARENT, &nd);
148 + intent_init(&nd.intent.open, IT_LINK);
149 + nd.intent.open.create.source_nd = &old_nd;
150 + error = path_lookup_it(to, LOOKUP_PARENT, &nd);
153 + if (nd.intent.open.flags & IT_STATUS_RAW)
156 if (old_nd.mnt != nd.mnt)
158 @@ -2229,9 +2265,18 @@
162 - error = path_lookup(newname, LOOKUP_PARENT, &newnd);
164 + if (oldnd.last_type != LAST_NORM)
167 + intent_init(&newnd.intent.open, IT_RENAME);
168 + newnd.intent.open.create.source_nd = &oldnd;
169 + error = path_lookup_it(newname, LOOKUP_PARENT, &newnd);
172 + if (newnd.intent.open.flags & IT_STATUS_RAW) {
177 if (oldnd.mnt != newnd.mnt)
178 @@ -2239,8 +2284,6 @@
180 old_dir = oldnd.dentry;
182 - if (oldnd.last_type != LAST_NORM)
185 new_dir = newnd.dentry;
186 if (newnd.last_type != LAST_NORM)
187 Index: linux-2.6.10/include/linux/fs.h
188 ===================================================================
189 --- linux-2.6.10.orig/include/linux/fs.h 2005-03-31 17:03:37.000000000 +0800
190 +++ linux-2.6.10/include/linux/fs.h 2005-03-31 17:46:35.715463960 +0800
192 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
193 ssize_t (*listxattr) (struct dentry *, char *, size_t);
194 int (*removexattr) (struct dentry *, const char *);
195 + int (*endparentlookup) (struct nameidata *);
199 Index: linux-2.6.10/include/linux/namei.h
200 ===================================================================
201 --- linux-2.6.10.orig/include/linux/namei.h 2005-03-31 17:43:42.472800848 +0800
202 +++ linux-2.6.10/include/linux/namei.h 2005-03-31 17:50:12.533502608 +0800
204 #define IT_UNLINK (1<<5)
205 #define IT_TRUNC (1<<6)
206 #define IT_GETXATTR (1<<7)
208 +#define IT_RMDIR (1<<8)
209 +#define IT_LINK (1<<9)
210 +#define IT_RENAME (1<<10)
211 +#define IT_MKDIR (1<<11)
212 +#define IT_MKNOD (1<<12)
213 +#define IT_SYMLINK (1<<13)
214 +#define IT_CHDIR (1<<14)
216 #define INTENT_MAGIC 0x19620323
217 +#define IT_STATUS_RAW (1<<10) /* Setting this in it_flags on exit from lookup
218 + means everything was done already and return
219 + value from lookup is in fact status of
220 + already performed operation */
228 + unsigned dev; /* For mknod */
229 + char *link; /* For symlink */
230 + struct nameidata *source_nd; /* For link/rename */
233 void *fs_data; /* FS-specific intent data */