2 fs/namei.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++----
3 fs/open.c | 73 ++++++++++++++++++++++++++++++++++++++++++++-------
4 include/linux/fs.h | 9 +++++-
5 4 files changed, 142 insertions(+), 17 deletions(-)
7 --- uml-2.5/fs/namei.c~vfs_nointent_2.5.69_rev1 2003-06-20 00:04:07.000000000 -0600
8 +++ uml-2.5-braam/fs/namei.c 2003-06-20 06:22:37.000000000 -0600
9 @@ -1279,7 +1279,7 @@ int may_open(struct nameidata *nd, int a
13 - error = do_truncate(dentry, 0);
14 + error = do_truncate(dentry, 0, 1);
16 put_write_access(inode);
18 @@ -1517,6 +1517,7 @@ asmlinkage long sys_mknod(const char __u
20 struct dentry * dentry;
22 + intent_init(&nd.it, IT_LOOKUP, 0);
26 @@ -1527,6 +1528,15 @@ asmlinkage long sys_mknod(const char __u
27 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
31 + if (nd.dentry->d_inode->i_op->mknod_raw) {
32 + struct inode_operations *op = nd.dentry->d_inode->i_op;
33 + error = op->mknod_raw(&nd, mode, dev);
34 + /* the file system wants to use normal vfs path now */
35 + if (error != -EOPNOTSUPP)
39 dentry = lookup_create(&nd, 0);
40 error = PTR_ERR(dentry);
42 @@ -1549,6 +1559,7 @@ asmlinkage long sys_mknod(const char __u
45 up(&nd.dentry->d_inode->i_sem);
50 @@ -1590,10 +1601,18 @@ asmlinkage long sys_mkdir(const char __u
52 struct dentry *dentry;
54 + intent_init(&nd.it, IT_LOOKUP, 0);
56 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
59 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
60 + struct inode_operations *op = nd.dentry->d_inode->i_op;
61 + error = op->mkdir_raw(&nd, mode);
62 + /* the file system wants to use normal vfs path now */
63 + if (error != -EOPNOTSUPP)
66 dentry = lookup_create(&nd, 1);
67 error = PTR_ERR(dentry);
68 if (!IS_ERR(dentry)) {
69 @@ -1603,6 +1622,7 @@ asmlinkage long sys_mkdir(const char __u
72 up(&nd.dentry->d_inode->i_sem);
77 @@ -1683,6 +1703,7 @@ asmlinkage long sys_rmdir(const char __u
79 struct dentry *dentry;
81 + intent_init(&nd.it, IT_LOOKUP, 0);
83 name = getname(pathname);
85 @@ -1703,6 +1724,16 @@ asmlinkage long sys_rmdir(const char __u
90 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
91 + struct inode_operations *op = nd.dentry->d_inode->i_op;
93 + error = op->rmdir_raw(&nd);
94 + /* the file system wants to use normal vfs path now */
95 + if (error != -EOPNOTSUPP)
99 down(&nd.dentry->d_inode->i_sem);
100 dentry = lookup_hash(&nd.last, nd.dentry, &nd);
101 error = PTR_ERR(dentry);
102 @@ -1759,6 +1790,7 @@ asmlinkage long sys_unlink(const char __
103 struct dentry *dentry;
105 struct inode *inode = NULL;
106 + intent_init(&nd.it, IT_LOOKUP, 0);
108 name = getname(pathname);
110 @@ -1770,6 +1802,13 @@ asmlinkage long sys_unlink(const char __
112 if (nd.last_type != LAST_NORM)
114 + if (nd.dentry->d_inode->i_op->unlink_raw) {
115 + struct inode_operations *op = nd.dentry->d_inode->i_op;
116 + error = op->unlink_raw(&nd);
117 + /* the file system wants to use normal vfs path now */
118 + if (error != -EOPNOTSUPP)
121 down(&nd.dentry->d_inode->i_sem);
122 dentry = lookup_hash(&nd.last, nd.dentry, &nd);
123 error = PTR_ERR(dentry);
124 @@ -1837,10 +1876,18 @@ asmlinkage long sys_symlink(const char _
126 struct dentry *dentry;
128 + intent_init(&nd.it, IT_LOOKUP, 0);
130 error = path_lookup(to, LOOKUP_PARENT, &nd);
133 + if (nd.dentry->d_inode->i_op->symlink_raw) {
134 + struct inode_operations *op = nd.dentry->d_inode->i_op;
135 + error = op->symlink_raw(&nd, from);
136 + /* the file system wants to use normal vfs path now */
137 + if (error != -EOPNOTSUPP)
140 dentry = lookup_create(&nd, 0);
141 error = PTR_ERR(dentry);
142 if (!IS_ERR(dentry)) {
143 @@ -1848,6 +1895,7 @@ asmlinkage long sys_symlink(const char _
146 up(&nd.dentry->d_inode->i_sem);
151 @@ -1911,6 +1959,8 @@ asmlinkage long sys_link(const char __us
152 struct nameidata nd, old_nd;
155 + intent_init(&nd.it, IT_LOOKUP, 0);
156 + intent_init(&old_nd.it, IT_LOOKUP, 0);
158 to = getname(newname);
160 @@ -1925,6 +1975,13 @@ asmlinkage long sys_link(const char __us
162 if (old_nd.mnt != nd.mnt)
164 + if (nd.dentry->d_inode->i_op->link_raw) {
165 + struct inode_operations *op = nd.dentry->d_inode->i_op;
166 + error = op->link_raw(&old_nd, &nd);
167 + /* the file system wants to use normal vfs path now */
168 + if (error != -EOPNOTSUPP)
171 new_dentry = lookup_create(&nd, 0);
172 error = PTR_ERR(new_dentry);
173 if (!IS_ERR(new_dentry)) {
174 @@ -1975,7 +2032,7 @@ exit:
177 int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
178 - struct inode *new_dir, struct dentry *new_dentry)
179 + struct inode *new_dir, struct dentry *new_dentry)
182 struct inode *target;
183 @@ -2020,7 +2077,7 @@ int vfs_rename_dir(struct inode *old_dir
186 int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
187 - struct inode *new_dir, struct dentry *new_dentry)
188 + struct inode *new_dir, struct dentry *new_dentry)
190 struct inode *target;
192 @@ -2097,6 +2154,8 @@ static inline int do_rename(const char *
193 struct dentry * old_dentry, *new_dentry;
194 struct dentry * trap;
195 struct nameidata oldnd, newnd;
196 + intent_init(&oldnd.it, IT_LOOKUP, 0);
197 + intent_init(&newnd.it, IT_LOOKUP, 0);
199 error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
201 @@ -2119,6 +2178,13 @@ static inline int do_rename(const char *
202 if (newnd.last_type != LAST_NORM)
205 + if (old_dir->d_inode->i_op->rename_raw) {
206 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
207 + /* the file system wants to use normal vfs path now */
208 + if (error != -EOPNOTSUPP)
212 trap = lock_rename(new_dir, old_dir);
214 old_dentry = lookup_hash(&oldnd.last, old_dir, &oldnd);
215 @@ -2150,8 +2216,7 @@ static inline int do_rename(const char *
216 if (new_dentry == trap)
219 - error = vfs_rename(old_dir->d_inode, old_dentry,
220 - new_dir->d_inode, new_dentry);
221 + error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
225 --- uml-2.5/fs/open.c~vfs_nointent_2.5.69_rev1 2003-06-18 21:42:57.000000000 -0600
226 +++ uml-2.5-braam/fs/open.c 2003-06-20 06:22:37.000000000 -0600
227 @@ -75,9 +75,10 @@ out:
231 -int do_truncate(struct dentry *dentry, loff_t length)
232 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
235 + struct inode_operations *op = dentry->d_inode->i_op;
236 struct iattr newattrs;
238 /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
239 @@ -87,7 +88,14 @@ int do_truncate(struct dentry *dentry, l
240 newattrs.ia_size = length;
241 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
242 down(&dentry->d_inode->i_sem);
243 - err = notify_change(dentry, &newattrs);
244 + if (called_from_open)
245 + newattrs.ia_valid |= ATTR_FROM_OPEN;
246 + if (op->setattr_raw) {
247 + newattrs.ia_valid |= ATTR_RAW;
248 + newattrs.ia_ctime = CURRENT_TIME;
249 + err = op->setattr_raw(dentry->d_inode, &newattrs);
251 + err = notify_change(dentry, &newattrs);
252 up(&dentry->d_inode->i_sem);
255 @@ -142,7 +150,7 @@ static inline long do_sys_truncate(const
256 error = locks_verify_truncate(inode, NULL, length);
259 - error = do_truncate(nd.dentry, length);
260 + error = do_truncate(nd.dentry, length, 0);
262 put_write_access(inode);
264 @@ -194,7 +202,7 @@ static inline long do_sys_ftruncate(unsi
266 error = locks_verify_truncate(inode, file, length);
268 - error = do_truncate(dentry, length);
269 + error = do_truncate(dentry, length, 0);
273 @@ -265,9 +273,19 @@ asmlinkage long sys_utime(char __user *
274 (error = permission(inode,MAY_WRITE)) != 0)
277 - down(&inode->i_sem);
278 - error = notify_change(nd.dentry, &newattrs);
280 + if (inode->i_op->setattr_raw) {
281 + struct inode_operations *op = nd.dentry->d_inode->i_op;
283 + newattrs.ia_valid |= ATTR_RAW;
284 + error = op->setattr_raw(inode, &newattrs);
285 + /* the file system wants to use normal vfs path now */
286 + if (error != -EOPNOTSUPP)
289 + down(&inode->i_sem);
290 + error = notify_change(nd.dentry, &newattrs);
296 @@ -310,9 +328,19 @@ long do_utimes(char __user * filename, s
297 (error = permission(inode,MAY_WRITE)) != 0)
300 - down(&inode->i_sem);
301 - error = notify_change(nd.dentry, &newattrs);
303 + if (inode->i_op->setattr_raw) {
304 + struct inode_operations *op = nd.dentry->d_inode->i_op;
306 + newattrs.ia_valid |= ATTR_RAW;
307 + error = op->setattr_raw(inode, &newattrs);
308 + /* the file system wants to use normal vfs path now */
309 + if (error != -EOPNOTSUPP)
312 + down(&inode->i_sem);
313 + error = notify_change(nd.dentry, &newattrs);
319 @@ -513,6 +541,18 @@ asmlinkage long sys_chmod(const char __u
320 if (IS_RDONLY(inode))
323 + if (inode->i_op->setattr_raw) {
324 + struct inode_operations *op = nd.dentry->d_inode->i_op;
326 + newattrs.ia_mode = mode;
327 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
328 + newattrs.ia_valid |= ATTR_RAW;
329 + error = op->setattr_raw(inode, &newattrs);
330 + /* the file system wants to use normal vfs path now */
331 + if (error != -EOPNOTSUPP)
336 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
338 @@ -546,6 +586,18 @@ static int chown_common(struct dentry *
339 if (IS_RDONLY(inode))
342 + if (inode->i_op->setattr_raw) {
343 + struct inode_operations *op = dentry->d_inode->i_op;
345 + newattrs.ia_uid = user;
346 + newattrs.ia_gid = group;
347 + newattrs.ia_valid = ATTR_UID | ATTR_GID;
348 + newattrs.ia_valid |= ATTR_RAW;
349 + error = op->setattr_raw(inode, &newattrs);
350 + /* the file system wants to use normal vfs path now */
351 + if (error != -EOPNOTSUPP)
354 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
356 newattrs.ia_valid = ATTR_CTIME;
357 @@ -559,6 +611,7 @@ static int chown_common(struct dentry *
359 if (!S_ISDIR(inode->i_mode))
360 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
363 error = notify_change(dentry, &newattrs);
365 --- uml-2.5/include/linux/fs.h~vfs_nointent_2.5.69_rev1 2003-06-18 21:40:58.000000000 -0600
366 +++ uml-2.5-braam/include/linux/fs.h 2003-06-20 06:22:37.000000000 -0600
367 @@ -738,13 +738,20 @@ struct inode_operations {
368 struct dentry * (*lookup_it) (struct inode *,struct dentry *,
370 int (*link) (struct dentry *,struct inode *,struct dentry *);
371 + int (*link_raw) (struct nameidata *,struct nameidata *);
372 int (*unlink) (struct inode *,struct dentry *);
373 + int (*unlink_raw) (struct nameidata *);
374 int (*symlink) (struct inode *,struct dentry *,const char *);
375 + int (*symlink_raw) (struct nameidata *,const char *);
376 int (*mkdir) (struct inode *,struct dentry *,int);
377 + int (*mkdir_raw) (struct nameidata *,int);
378 int (*rmdir) (struct inode *,struct dentry *);
379 + int (*rmdir_raw) (struct nameidata *);
380 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
381 + int (*mknod_raw) (struct nameidata *,int,dev_t);
382 int (*rename) (struct inode *, struct dentry *,
383 struct inode *, struct dentry *);
384 + int (*rename_raw) (struct nameidata *, struct nameidata *);
385 int (*readlink) (struct dentry *, char __user *,int);
386 int (*follow_link) (struct dentry *, struct nameidata *);
387 void (*truncate) (struct inode *);
388 @@ -1029,7 +1036,7 @@ static inline int break_lease(struct ino
390 asmlinkage long sys_open(const char *, int, int);
391 asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
392 -extern int do_truncate(struct dentry *, loff_t start);
393 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
395 extern struct file *filp_open(const char *, int, int);
396 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
397 --- uml-2.5/fs/exec.c~vfs_nointent_2.5.69_rev1 2003-06-04 21:29:14.000000000 -0600
398 +++ uml-2.5-braam/fs/exec.c 2003-06-20 06:22:37.000000000 -0600
399 @@ -1358,7 +1358,7 @@ int do_coredump(long signr, int exit_cod
401 if (!file->f_op->write)
403 - if (do_truncate(file->f_dentry, 0) != 0)
404 + if (do_truncate(file->f_dentry, 0, 0) != 0)
407 retval = binfmt->core_dump(signr, regs, file);