From: Kirill Tkhai <tkhai@yandex.ru>
To: mmarek@suse.cz, arnd@arndb.de, linux-kbuild@vger.kernel.org,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
oleg@redhat.com, grant.likely@secretlab.ca,
ebiederm@xmission.com, akpm@linux-foundation.org,
ktkhai@parallels.com, sam@ravnborg.org
Subject: [PATCH 3/3] core: create /proc/built-in file to show the list of built-in drivers
Date: Sun, 14 Sep 2014 14:19:37 +0400 [thread overview]
Message-ID: <20140914101933.3745.29648.stgit@localhost> (raw)
In-Reply-To: <20140914100545.3745.23394.stgit@localhost>
Signed-off-by: kirill tkhai <ktkhai@parallels.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);
next prev parent reply other threads:[~2014-09-14 10:24 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-14 10:18 [PATCH 0/3] Implement /proc/built-in file similar to /proc/modules Kirill Tkhai
2014-09-14 10:18 ` [PATCH 1/3] kbuild: Make targets names tree-wide unique on x86 Kirill Tkhai
2014-09-14 15:57 ` Peter Foley
2014-09-14 18:09 ` Kirill Tkhai
2014-09-14 10:18 ` [PATCH 2/3] core: Save list of built-in drivers names Kirill Tkhai
2014-09-14 10:19 ` Kirill Tkhai [this message]
2014-09-14 15:38 ` [PATCH 0/3] Implement /proc/built-in file similar to /proc/modules Greg KH
2014-09-14 17:27 ` Oleg Nesterov
2014-09-14 17:57 ` Kirill Tkhai
2014-09-14 18:12 ` Richard Weinberger
2014-09-14 18:58 ` Kirill Tkhai
2014-09-14 20:00 ` Oleg Nesterov
2014-09-14 17:31 ` Kirill Tkhai
2014-09-14 17:39 ` Greg KH
2014-09-14 18:05 ` Kirill Tkhai
2014-09-14 18:13 ` Greg KH
2014-09-14 18:35 ` Kirill Tkhai
2014-09-14 18:56 ` Greg KH
2014-09-15 11:50 ` Kirill Tkhai
2014-09-16 15:40 ` Lucas De Marchi
2014-09-15 9:17 ` Michal Marek
2014-09-15 9:12 ` Michal Marek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140914101933.3745.29648.stgit@localhost \
--to=tkhai@yandex.ru \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=ebiederm@xmission.com \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=ktkhai@parallels.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=oleg@redhat.com \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.