[RFC PATCH 3/4] eppic/dir_names: Introduce changes for kernel 3.14

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linux kernel commit 38129a13e6e7 ("switch mnt_hash to hlist"),
moves mnt_hash from list_head to hlist_node. Introduce these
list type changes to iterate over the mounted filesystem and
walk dentries.

These changes are not compatible with previous kernel versions,
so add new dir_names script file for kernel version >= 3.14
to kernel version <= 4.8.

Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
Cc: Atsushi Kumagai <ats-kumagai at wm.jp.nec.com>
---
 eppic_scripts/dir_names_3_14_to_4_8.c | 82 +++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 eppic_scripts/dir_names_3_14_to_4_8.c

diff --git a/eppic_scripts/dir_names_3_14_to_4_8.c b/eppic_scripts/dir_names_3_14_to_4_8.c
new file mode 100644
index 0000000..5bf08fe
--- /dev/null
+++ b/eppic_scripts/dir_names_3_14_to_4_8.c
@@ -0,0 +1,82 @@
+string
+vfs_opt()
+{
+	    return "l";
+}
+
+string
+vfs_usage()
+{
+	    return "\n";
+}
+
+static void
+vfs_showusage()
+{
+	    printf("usage : vfs %s", vfs_usage());
+}
+
+string
+vfs_help()
+{
+	    return "Help";
+}
+
+void
+rm_names(struct dentry *dir)
+{
+	struct list_head *next, *head;
+	unsigned int hash_len;
+	int i;
+
+	memset(dir->d_iname, 0, 0x20);
+	hash_len = *((unsigned int *)&dir->d_name);
+	memset(dir->d_name.name, 0, hash_len);
+
+	head = (struct list_head *)&(dir->d_subdirs);
+	next = (struct list_head *)dir->d_subdirs.next;
+
+	while (next != head)
+	{
+		struct dentry *child, *off = 0;
+
+		child = (struct dentry *)((unsigned long)next - (unsigned long)&(off->d_child));
+		rm_names(child);
+		next = child->d_child.next;
+	}
+
+	return;
+}
+
+int
+vfs()
+{
+	int i;
+	struct hlist_bl_head *tab;
+	unsigned int d_hash_size = d_hash_mask;
+
+	tab = (struct hlist_bl_head *)dentry_hashtable;
+
+	for (i = 0; i < d_hash_size; i++)
+	{
+		struct hlist_bl_head *head;
+		struct hlist_bl_node *head_node, *next;
+
+		head = (struct hlist_bl_head *) (tab + i);
+		head_node = head->first;
+		if (!head_node)
+			continue;
+
+		next = head_node;
+
+		while (next)
+		{
+			struct dentry *root, *off = 0;
+
+			root = (struct dentry *)((unsigned long)next - (unsigned long)&(off->d_hash));
+			rm_names(root);
+			next = next->next;
+		}
+	}
+	return 1;
+}
-- 
2.7.4




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux