]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/open.c
[PATCH] PCI Hotplug: fix up the sysfs file in the compaq pci hotplug driver
[linux-2.6-omap-h63xx.git] / fs / open.c
index 6e8136751e9a49e1c89f47eb1957ed9f635281a7..75f3329e8a67885036e06ee76e570073cb5e106f 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -194,7 +194,8 @@ out:
        return error;
 }
 
-int do_truncate(struct dentry *dentry, loff_t length, struct file *filp)
+int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
+       struct file *filp)
 {
        int err;
        struct iattr newattrs;
@@ -204,7 +205,7 @@ int do_truncate(struct dentry *dentry, loff_t length, struct file *filp)
                return -EINVAL;
 
        newattrs.ia_size = length;
-       newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
+       newattrs.ia_valid = ATTR_SIZE | time_attrs;
        if (filp) {
                newattrs.ia_file = filp;
                newattrs.ia_valid |= ATTR_FILE;
@@ -216,7 +217,7 @@ int do_truncate(struct dentry *dentry, loff_t length, struct file *filp)
        return err;
 }
 
-static inline long do_sys_truncate(const char __user * path, loff_t length)
+static long do_sys_truncate(const char __user * path, loff_t length)
 {
        struct nameidata nd;
        struct inode * inode;
@@ -240,7 +241,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length)
        if (!S_ISREG(inode->i_mode))
                goto dput_and_out;
 
-       error = permission(inode,MAY_WRITE,&nd);
+       error = vfs_permission(&nd, MAY_WRITE);
        if (error)
                goto dput_and_out;
 
@@ -266,7 +267,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length)
        error = locks_verify_truncate(inode, NULL, length);
        if (!error) {
                DQUOT_INIT(inode);
-               error = do_truncate(nd.dentry, length, NULL);
+               error = do_truncate(nd.dentry, length, 0, NULL);
        }
        put_write_access(inode);
 
@@ -282,7 +283,7 @@ asmlinkage long sys_truncate(const char __user * path, unsigned long length)
        return do_sys_truncate(path, (long)length);
 }
 
-static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
+static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 {
        struct inode * inode;
        struct dentry *dentry;
@@ -318,7 +319,7 @@ static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 
        error = locks_verify_truncate(inode, file, length);
        if (!error)
-               error = do_truncate(dentry, length, file);
+               error = do_truncate(dentry, length, 0, file);
 out_putf:
        fput(file);
 out:
@@ -394,7 +395,7 @@ asmlinkage long sys_utime(char __user * filename, struct utimbuf __user * times)
                         goto dput_and_out;
 
                if (current->fsuid != inode->i_uid &&
-                   (error = permission(inode,MAY_WRITE,&nd)) != 0)
+                   (error = vfs_permission(&nd, MAY_WRITE)) != 0)
                        goto dput_and_out;
        }
        down(&inode->i_sem);
@@ -447,7 +448,7 @@ long do_utimes(char __user * filename, struct timeval * times)
                         goto dput_and_out;
 
                if (current->fsuid != inode->i_uid &&
-                   (error = permission(inode,MAY_WRITE,&nd)) != 0)
+                   (error = vfs_permission(&nd, MAY_WRITE)) != 0)
                        goto dput_and_out;
        }
        down(&inode->i_sem);
@@ -506,7 +507,7 @@ asmlinkage long sys_access(const char __user * filename, int mode)
 
        res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
        if (!res) {
-               res = permission(nd.dentry->d_inode, mode, &nd);
+               res = vfs_permission(&nd, mode);
                /* SuS v2 requires we report a read only fs too */
                if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
                   && !special_file(nd.dentry->d_inode->i_mode))
@@ -530,7 +531,7 @@ asmlinkage long sys_chdir(const char __user * filename)
        if (error)
                goto out;
 
-       error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
+       error = vfs_permission(&nd, MAY_EXEC);
        if (error)
                goto dput_and_out;
 
@@ -563,7 +564,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
        if (!S_ISDIR(inode->i_mode))
                goto out_putf;
 
-       error = permission(inode, MAY_EXEC, NULL);
+       error = file_permission(file, MAY_EXEC);
        if (!error)
                set_fs_pwd(current->fs, mnt, dentry);
 out_putf:
@@ -581,7 +582,7 @@ asmlinkage long sys_chroot(const char __user * filename)
        if (error)
                goto out;
 
-       error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
+       error = vfs_permission(&nd, MAY_EXEC);
        if (error)
                goto dput_and_out;
 
@@ -970,7 +971,7 @@ out:
 
 EXPORT_SYMBOL(get_unused_fd);
 
-static inline void __put_unused_fd(struct files_struct *files, unsigned int fd)
+static void __put_unused_fd(struct files_struct *files, unsigned int fd)
 {
        struct fdtable *fdt = files_fdtable(files);
        __FD_CLR(fd, fdt->open_fds);