patch-2.1.85 linux/fs/dcache.c

Next file: linux/fs/proc/root.c
Previous file: linux/fs/autofs/dirhash.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.84/linux/fs/dcache.c linux/fs/dcache.c
@@ -758,6 +758,30 @@
 }
 
 /*
+ * Test whether new_dentry is a subdirectory of old_dentry.
+ *
+ * Trivially implemented using the dcache structure
+ */
+int is_subdir(struct dentry * new_dentry, struct dentry * old_dentry)
+{
+	int result;
+
+	result = 0;
+	for (;;) {
+		if (new_dentry != old_dentry) {
+			struct dentry * parent = new_dentry->d_parent;
+			if (parent == new_dentry)
+				break;
+			new_dentry = parent;
+			continue;
+		}
+		result = 1;
+		break;
+	}
+	return result;
+}
+
+/*
  * Check whether a dentry already exists for the given name,
  * and return the inode number if it has an inode.
  *

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov