]> git.karo-electronics.de Git - linux-beck.git/commitdiff
GFS2: Move gfs2_unlink_ok into ops_inode.c
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 22 May 2009 09:54:50 +0000 (10:54 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 22 May 2009 09:54:50 +0000 (10:54 +0100)
Another function which is only called from one ops_inode.c so
we move it and make it static.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/inode.c
fs/gfs2/inode.h
fs/gfs2/ops_inode.c

index 676e750fc84c7b753625ba63f179fa7c678146a0..2f94bd723698a24723bbe1a84153f979169816ef 100644 (file)
@@ -1046,45 +1046,6 @@ fail:
        return ERR_PTR(error);
 }
 
-
-/*
- * gfs2_unlink_ok - check to see that a inode is still in a directory
- * @dip: the directory
- * @name: the name of the file
- * @ip: the inode
- *
- * Assumes that the lock on (at least) @dip is held.
- *
- * Returns: 0 if the parent/child relationship is correct, errno if it isn't
- */
-
-int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
-                  const struct gfs2_inode *ip)
-{
-       int error;
-
-       if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
-               return -EPERM;
-
-       if ((dip->i_inode.i_mode & S_ISVTX) &&
-           dip->i_inode.i_uid != current_fsuid() &&
-           ip->i_inode.i_uid != current_fsuid() && !capable(CAP_FOWNER))
-               return -EPERM;
-
-       if (IS_APPEND(&dip->i_inode))
-               return -EPERM;
-
-       error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
-       if (error)
-               return error;
-
-       error = gfs2_dir_check(&dip->i_inode, name, ip);
-       if (error)
-               return error;
-
-       return 0;
-}
-
 static int __gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
 {
        struct buffer_head *dibh;
index fc9a08f45be70bf8a2d5871bd6b9f99a3c1590d3..c341aaf67adb24c7623e7e458b87afeaf846106e 100644 (file)
@@ -96,8 +96,6 @@ extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
 extern struct inode *gfs2_createi(struct gfs2_holder *ghs,
                                  const struct qstr *name,
                                  unsigned int mode, dev_t dev);
-extern int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
-                         const struct gfs2_inode *ip);
 extern int gfs2_permission(struct inode *inode, int mask);
 extern int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
 extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
index f607f0908cffa5f909dd1eb5b53aabf83496e5da..f8bd20baf99c4ab6d78d2141c50d3368e99228b9 100644 (file)
@@ -262,6 +262,44 @@ out_parent:
        return error;
 }
 
+/*
+ * gfs2_unlink_ok - check to see that a inode is still in a directory
+ * @dip: the directory
+ * @name: the name of the file
+ * @ip: the inode
+ *
+ * Assumes that the lock on (at least) @dip is held.
+ *
+ * Returns: 0 if the parent/child relationship is correct, errno if it isn't
+ */
+
+static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
+                         const struct gfs2_inode *ip)
+{
+       int error;
+
+       if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
+               return -EPERM;
+
+       if ((dip->i_inode.i_mode & S_ISVTX) &&
+           dip->i_inode.i_uid != current_fsuid() &&
+           ip->i_inode.i_uid != current_fsuid() && !capable(CAP_FOWNER))
+               return -EPERM;
+
+       if (IS_APPEND(&dip->i_inode))
+               return -EPERM;
+
+       error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
+       if (error)
+               return error;
+
+       error = gfs2_dir_check(&dip->i_inode, name, ip);
+       if (error)
+               return error;
+
+       return 0;
+}
+
 /**
  * gfs2_unlink - Unlink a file
  * @dir: The inode of the directory containing the file to unlink