3 --- linux-2.6.0-test1/fs/namei.c~vfs_nointent_2.6.0-test1 2003-07-22 20:18:30.000000000 +0800
4 +++ linux-2.6.0-test1-root/fs/namei.c 2003-07-22 20:27:38.000000000 +0800
5 @@ -1249,7 +1249,7 @@ int may_open(struct nameidata *nd, int a
9 - error = do_truncate(dentry, 0);
10 + error = do_truncate(dentry, 0, 1);
12 put_write_access(inode);
14 @@ -1494,6 +1494,7 @@ do_mknod(const char __user *filename, in
16 struct dentry *dentry;
18 + intent_init(&nd.intent, IT_LOOKUP);
22 @@ -1504,6 +1505,15 @@ do_mknod(const char __user *filename, in
23 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
27 + if (nd.dentry->d_inode->i_op->mknod_raw) {
28 + struct inode_operations *op = nd.dentry->d_inode->i_op;
29 + error = op->mknod_raw(&nd, mode, dev);
30 + /* the file system wants to use normal vfs path now */
31 + if (error != -EOPNOTSUPP)
35 dentry = lookup_create(&nd, 0);
36 error = PTR_ERR(dentry);
38 @@ -1526,6 +1536,7 @@ do_mknod(const char __user *filename, in
41 up(&nd.dentry->d_inode->i_sem);
46 @@ -1588,10 +1599,18 @@ asmlinkage long sys_mkdir(const char __u
48 struct dentry *dentry;
50 + intent_init(&nd.intent, IT_LOOKUP);
52 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
55 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
56 + struct inode_operations *op = nd.dentry->d_inode->i_op;
57 + error = op->mkdir_raw(&nd, mode);
58 + /* the file system wants to use normal vfs path now */
59 + if (error != -EOPNOTSUPP)
62 dentry = lookup_create(&nd, 1);
63 error = PTR_ERR(dentry);
64 if (!IS_ERR(dentry)) {
65 @@ -1601,6 +1620,7 @@ asmlinkage long sys_mkdir(const char __u
68 up(&nd.dentry->d_inode->i_sem);
73 @@ -1681,6 +1701,7 @@ asmlinkage long sys_rmdir(const char __u
75 struct dentry *dentry;
77 + intent_init(&nd.intent, IT_LOOKUP);
79 name = getname(pathname);
81 @@ -1701,6 +1722,16 @@ asmlinkage long sys_rmdir(const char __u
86 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
87 + struct inode_operations *op = nd.dentry->d_inode->i_op;
89 + error = op->rmdir_raw(&nd);
90 + /* the file system wants to use normal vfs path now */
91 + if (error != -EOPNOTSUPP)
95 down(&nd.dentry->d_inode->i_sem);
96 dentry = lookup_hash(&nd.last, nd.dentry);
97 error = PTR_ERR(dentry);
98 @@ -1759,6 +1790,7 @@ asmlinkage long sys_unlink(const char __
99 struct dentry *dentry;
101 struct inode *inode = NULL;
102 + intent_init(&nd.intent, IT_LOOKUP);
104 name = getname(pathname);
106 @@ -1770,6 +1802,13 @@ asmlinkage long sys_unlink(const char __
108 if (nd.last_type != LAST_NORM)
110 + if (nd.dentry->d_inode->i_op->unlink_raw) {
111 + struct inode_operations *op = nd.dentry->d_inode->i_op;
112 + error = op->unlink_raw(&nd);
113 + /* the file system wants to use normal vfs path now */
114 + if (error != -EOPNOTSUPP)
117 down(&nd.dentry->d_inode->i_sem);
118 dentry = lookup_hash(&nd.last, nd.dentry);
119 error = PTR_ERR(dentry);
120 @@ -1837,10 +1876,18 @@ asmlinkage long sys_symlink(const char _
122 struct dentry *dentry;
124 + intent_init(&nd.intent, IT_LOOKUP);
126 error = path_lookup(to, LOOKUP_PARENT, &nd);
129 + if (nd.dentry->d_inode->i_op->symlink_raw) {
130 + struct inode_operations *op = nd.dentry->d_inode->i_op;
131 + error = op->symlink_raw(&nd, from);
132 + /* the file system wants to use normal vfs path now */
133 + if (error != -EOPNOTSUPP)
136 dentry = lookup_create(&nd, 0);
137 error = PTR_ERR(dentry);
138 if (!IS_ERR(dentry)) {
139 @@ -1848,6 +1895,7 @@ asmlinkage long sys_symlink(const char _
142 up(&nd.dentry->d_inode->i_sem);
147 @@ -1911,6 +1959,8 @@ asmlinkage long sys_link(const char __us
148 struct nameidata nd, old_nd;
151 + intent_init(&nd.intent, IT_LOOKUP);
152 + intent_init(&old_nd.intent, IT_LOOKUP);
154 to = getname(newname);
156 @@ -1925,6 +1975,13 @@ asmlinkage long sys_link(const char __us
158 if (old_nd.mnt != nd.mnt)
160 + if (nd.dentry->d_inode->i_op->link_raw) {
161 + struct inode_operations *op = nd.dentry->d_inode->i_op;
162 + error = op->link_raw(&old_nd, &nd);
163 + /* the file system wants to use normal vfs path now */
164 + if (error != -EOPNOTSUPP)
167 new_dentry = lookup_create(&nd, 0);
168 error = PTR_ERR(new_dentry);
169 if (!IS_ERR(new_dentry)) {
170 @@ -1975,7 +2032,7 @@ exit:
173 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
174 - struct inode *new_dir, struct dentry *new_dentry)
175 + struct inode *new_dir, struct dentry *new_dentry)
178 struct inode *target;
179 @@ -2020,7 +2077,7 @@ int vfs_rename_dir(struct inode *old_dir
182 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
183 - struct inode *new_dir, struct dentry *new_dentry)
184 + struct inode *new_dir, struct dentry *new_dentry)
186 struct inode *target;
188 @@ -2097,6 +2154,8 @@ static inline int do_rename(const char *
189 struct dentry * old_dentry, *new_dentry;
190 struct dentry * trap;
191 struct nameidata oldnd, newnd;
192 + intent_init(&oldnd.intent, IT_LOOKUP);
193 + intent_init(&newnd.intent, IT_LOOKUP);
195 error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
197 @@ -2119,6 +2178,13 @@ static inline int do_rename(const char *
198 if (newnd.last_type != LAST_NORM)
201 + if (old_dir->d_inode->i_op->rename_raw) {
202 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
203 + /* the file system wants to use normal vfs path now */
204 + if (error != -EOPNOTSUPP)
208 trap = lock_rename(new_dir, old_dir);
210 old_dentry = lookup_hash(&oldnd.last, old_dir);
211 @@ -2150,8 +2216,7 @@ static inline int do_rename(const char *
212 if (new_dentry == trap)
215 - error = vfs_rename(old_dir->d_inode, old_dentry,
216 - new_dir->d_inode, new_dentry);
217 + error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
221 --- linux-2.6.0-test1/fs/open.c~vfs_nointent_2.6.0-test1 2003-07-22 20:18:30.000000000 +0800
222 +++ linux-2.6.0-test1-root/fs/open.c 2003-07-22 20:26:41.000000000 +0800
223 @@ -178,9 +178,10 @@ out:
227 -int do_truncate(struct dentry *dentry, loff_t length)
228 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
231 + struct inode_operations *op = dentry->d_inode->i_op;
232 struct iattr newattrs;
234 /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
235 @@ -190,7 +191,14 @@ int do_truncate(struct dentry *dentry, l
236 newattrs.ia_size = length;
237 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
238 down(&dentry->d_inode->i_sem);
239 - err = notify_change(dentry, &newattrs);
240 + if (called_from_open)
241 + newattrs.ia_valid |= ATTR_FROM_OPEN;
242 + if (op->setattr_raw) {
243 + newattrs.ia_valid |= ATTR_RAW;
244 + newattrs.ia_ctime = CURRENT_TIME;
245 + err = op->setattr_raw(dentry->d_inode, &newattrs);
247 + err = notify_change(dentry, &newattrs);
248 up(&dentry->d_inode->i_sem);
251 @@ -245,7 +253,7 @@ static inline long do_sys_truncate(const
252 error = locks_verify_truncate(inode, NULL, length);
255 - error = do_truncate(nd.dentry, length);
256 + error = do_truncate(nd.dentry, length, 0);
258 put_write_access(inode);
260 @@ -297,7 +305,7 @@ static inline long do_sys_ftruncate(unsi
262 error = locks_verify_truncate(inode, file, length);
264 - error = do_truncate(dentry, length);
265 + error = do_truncate(dentry, length, 0);
269 @@ -368,9 +376,19 @@ asmlinkage long sys_utime(char __user *
270 (error = permission(inode,MAY_WRITE,&nd)) != 0)
273 - down(&inode->i_sem);
274 - error = notify_change(nd.dentry, &newattrs);
276 + if (inode->i_op->setattr_raw) {
277 + struct inode_operations *op = nd.dentry->d_inode->i_op;
279 + newattrs.ia_valid |= ATTR_RAW;
280 + error = op->setattr_raw(inode, &newattrs);
281 + /* the file system wants to use normal vfs path now */
282 + if (error != -EOPNOTSUPP)
285 + down(&inode->i_sem);
286 + error = notify_change(nd.dentry, &newattrs);
292 @@ -413,9 +431,19 @@ long do_utimes(char __user * filename, s
293 (error = permission(inode,MAY_WRITE,&nd)) != 0)
296 - down(&inode->i_sem);
297 - error = notify_change(nd.dentry, &newattrs);
299 + if (inode->i_op->setattr_raw) {
300 + struct inode_operations *op = nd.dentry->d_inode->i_op;
302 + newattrs.ia_valid |= ATTR_RAW;
303 + error = op->setattr_raw(inode, &newattrs);
304 + /* the file system wants to use normal vfs path now */
305 + if (error != -EOPNOTSUPP)
308 + down(&inode->i_sem);
309 + error = notify_change(nd.dentry, &newattrs);
315 @@ -616,6 +644,18 @@ asmlinkage long sys_chmod(const char __u
316 if (IS_RDONLY(inode))
319 + if (inode->i_op->setattr_raw) {
320 + struct inode_operations *op = nd.dentry->d_inode->i_op;
322 + newattrs.ia_mode = mode;
323 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
324 + newattrs.ia_valid |= ATTR_RAW;
325 + error = op->setattr_raw(inode, &newattrs);
326 + /* the file system wants to use normal vfs path now */
327 + if (error != -EOPNOTSUPP)
332 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
334 @@ -649,6 +689,18 @@ static int chown_common(struct dentry *
335 if (IS_RDONLY(inode))
338 + if (inode->i_op->setattr_raw) {
339 + struct inode_operations *op = dentry->d_inode->i_op;
341 + newattrs.ia_uid = user;
342 + newattrs.ia_gid = group;
343 + newattrs.ia_valid = ATTR_UID | ATTR_GID;
344 + newattrs.ia_valid |= ATTR_RAW;
345 + error = op->setattr_raw(inode, &newattrs);
346 + /* the file system wants to use normal vfs path now */
347 + if (error != -EOPNOTSUPP)
350 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
352 newattrs.ia_valid = ATTR_CTIME;
353 @@ -662,6 +714,7 @@ static int chown_common(struct dentry *
355 if (!S_ISDIR(inode->i_mode))
356 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
359 error = notify_change(dentry, &newattrs);
361 --- linux-2.6.0-test1/include/linux/fs.h~vfs_nointent_2.6.0-test1 2003-07-22 20:18:30.000000000 +0800
362 +++ linux-2.6.0-test1-root/include/linux/fs.h 2003-07-22 20:26:41.000000000 +0800
363 @@ -807,13 +807,20 @@ struct inode_operations {
364 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
365 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
366 int (*link) (struct dentry *,struct inode *,struct dentry *);
367 + int (*link_raw) (struct nameidata *,struct nameidata *);
368 int (*unlink) (struct inode *,struct dentry *);
369 + int (*unlink_raw) (struct nameidata *);
370 int (*symlink) (struct inode *,struct dentry *,const char *);
371 + int (*symlink_raw) (struct nameidata *,const char *);
372 int (*mkdir) (struct inode *,struct dentry *,int);
373 + int (*mkdir_raw) (struct nameidata *,int);
374 int (*rmdir) (struct inode *,struct dentry *);
375 + int (*rmdir_raw) (struct nameidata *);
376 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
377 + int (*mknod_raw) (struct nameidata *,int,dev_t);
378 int (*rename) (struct inode *, struct dentry *,
379 struct inode *, struct dentry *);
380 + int (*rename_raw) (struct nameidata *, struct nameidata *);
381 int (*readlink) (struct dentry *, char __user *,int);
382 int (*follow_link) (struct dentry *, struct nameidata *);
383 void (*truncate) (struct inode *);
384 @@ -1098,7 +1105,7 @@ static inline int break_lease(struct ino
386 asmlinkage long sys_open(const char __user *, int, int);
387 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
388 -extern int do_truncate(struct dentry *, loff_t start);
389 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
391 extern struct file *filp_open(const char *, int, int);
392 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
393 --- linux-2.6.0-test1/fs/exec.c~vfs_nointent_2.6.0-test1 2003-07-22 20:18:30.000000000 +0800
394 +++ linux-2.6.0-test1-root/fs/exec.c 2003-07-22 20:26:41.000000000 +0800
395 @@ -1352,7 +1352,7 @@ int do_coredump(long signr, int exit_cod
397 if (!file->f_op->write)
399 - if (do_truncate(file->f_dentry, 0) != 0)
400 + if (do_truncate(file->f_dentry, 0, 0) != 0)
403 retval = binfmt->core_dump(signr, regs, file);