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] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 14 Sep 2014 14:19:37 +0400
From:	Kirill Tkhai <tkhai@...dex.ru>
To:	mmarek@...e.cz, arnd@...db.de, linux-kbuild@...r.kernel.org,
	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
	oleg@...hat.com, grant.likely@...retlab.ca, ebiederm@...ssion.com,
	akpm@...ux-foundation.org, ktkhai@...allels.com, sam@...nborg.org
Subject: [PATCH 3/3] core: create /proc/built-in file to show the list of
 built-in drivers

Signed-off-by: kirill tkhai <ktkhai@...allels.com>
---
 fs/proc/Makefile  |    1 +
 fs/proc/builtin.c |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 fs/proc/builtin.c

diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index 7151ea4..1e13361 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -10,6 +10,7 @@ proc-$(CONFIG_MMU)	:= task_mmu.o
 proc-y       += inode.o root.o base.o generic.o array.o \
 		fd.o
 proc-$(CONFIG_TTY)      += proc_tty.o
+proc-y	+= builtin.o
 proc-y	+= cmdline.o
 proc-y	+= consoles.o
 proc-y	+= cpuinfo.o
diff --git a/fs/proc/builtin.c b/fs/proc/builtin.c
new file mode 100644
index 0000000..2d49980
--- /dev/null
+++ b/fs/proc/builtin.c
@@ -0,0 +1,70 @@
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+extern char __start_builtin_drivers_list[], __stop_builtin_drivers_list[];
+
+static void *b_start(struct seq_file *m, loff_t *pos)
+{
+	unsigned long size = (unsigned long)__stop_builtin_drivers_list -
+			     (unsigned long)__start_builtin_drivers_list;
+	if (*pos) {
+		/* Skip all !'\0' symbols */
+		while (*pos <= size &&  *(__start_builtin_drivers_list + *pos))
+			++*pos;
+		/* Skip all  '\0' symbols */
+		while (*pos <= size && !*(__start_builtin_drivers_list + *pos))
+			++*pos;
+	}
+
+	if (*pos >= size)
+		return NULL;
+
+	return __start_builtin_drivers_list + *pos;
+}
+
+static void *b_next(struct seq_file *m, void *cur, loff_t *pos)
+{
+	++*pos;
+
+	return b_start(m, pos);
+}
+
+static void b_stop(struct seq_file *m, void *p)
+{
+}
+
+static int b_show(struct seq_file *m, void *p)
+{
+	seq_printf(m, "%s\n", (const char *)p);
+
+	return 0;
+}
+
+static const struct seq_operations builtin_op = {
+	.start = b_start,
+	.next = b_next,
+	.stop = b_stop,
+	.show = b_show
+};
+
+static int builtin_open(struct inode *inode, struct file *file)
+{
+	return seq_open(file, &builtin_op);
+}
+
+static const struct file_operations builtin_operations = {
+	.open = builtin_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = seq_release_private,
+};
+
+static int __init proc_builtin_init(void)
+{
+	proc_create("built-in", S_IRUGO, NULL, &builtin_operations);
+	return 0;
+}
+
+fs_initcall(proc_builtin_init);

--
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