lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1273484765-29055-25-git-send-email-benh@kernel.crashing.org>
Date:	Mon, 10 May 2010 19:46:05 +1000
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	linux-mm@...ck.org
Cc:	linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...e.hu,
	davem@...emloft.net, lethal@...ux-sh.org,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: [PATCH 25/25] lmb: Add debugfs files to dump the arrays content

Signed-off-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>
---
 lib/lmb.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index 6c38c87..1e11891 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -16,6 +16,8 @@
 #include <linux/bitops.h>
 #include <linux/poison.h>
 #include <linux/pfn.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
 #include <linux/lmb.h>
 
 struct lmb lmb;
@@ -696,3 +698,52 @@ static int __init early_lmb(char *p)
 }
 early_param("lmb", early_lmb);
 
+#ifdef CONFIG_DEBUG_FS
+
+static int lmb_debug_show(struct seq_file *m, void *private)
+{
+	struct lmb_type *type = m->private;
+	struct lmb_region *reg;
+	int i;
+
+	for (i = 0; i < type->cnt; i++) {
+		reg = &type->regions[i];
+		seq_printf(m, "%4d: ", i);
+		if (sizeof(phys_addr_t) == 4)
+			seq_printf(m, "0x%08lx..0x%08lx\n",
+				   (unsigned long)reg->base,
+				   (unsigned long)(reg->base + reg->size - 1));
+		else
+			seq_printf(m, "0x%016llx..0x%016llx\n",
+				   (unsigned long long)reg->base,
+				   (unsigned long long)(reg->base + reg->size - 1));
+
+	}
+	return 0;
+}
+
+static int lmb_debug_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, lmb_debug_show, inode->i_private);
+}
+
+static const struct file_operations lmb_debug_fops = {
+	.open = lmb_debug_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int __init lmb_init_debugfs(void)
+{
+	struct dentry *root = debugfs_create_dir("lmb", NULL);
+	if (!root)
+		return -ENXIO;
+	debugfs_create_file("memory", S_IRUGO, root, &lmb.memory, &lmb_debug_fops);
+	debugfs_create_file("reserved", S_IRUGO, root, &lmb.reserved, &lmb_debug_fops);
+	
+	return 0;
+}
+__initcall(lmb_init_debugfs);
+
+#endif /* CONFIG_DEBUG_FS */
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ