Date: Fri, 8 Jan 2010 18:19:29 +0100 From: =?ISO-8859-1?Q?Fernando_Apestegu=EDa?= <fernando.apesteguia@gmail.com> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: [PATCH] linprocfs dofilesystems Message-ID: <1bd550a01001080919p20ec1b20t82b3761705cd1ff3@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi all,
This patch implements the "filesystems" file in the linux proc fs.
I have used it for some time without seeing any problems. Let me
know in case this is useful.
Tested against 8.0-RELEASE-p1
Thanks
[-- Attachment #2 --]
--- sys/compat/linprocfs/linprocfs.c 2009-12-28 21:48:50.000000000 +0100
+++ /home/fernape/kernel_devel/linprocfs/linprocfs.c 2009-12-28 21:44:46.000000000 +0100
@@ -881,6 +881,33 @@
}
/*
+ * Filler function for proc/filesystems
+ */
+static int
+linprocfs_dofilesystems(PFS_FILL_ARGS)
+{
+
+ /*
+ * Traverse the mountlist to get the in-use
+ * filesystems
+ */
+
+ struct mount *iterator;
+ struct vfsconf *tmp;
+
+ mtx_lock(&mountlist_mtx);
+
+ TAILQ_FOREACH(iterator, &mountlist, mnt_list){
+ tmp = iterator->mnt_vfc;
+ sbuf_printf(sb, "\t%s\n",tmp->vfc_name);
+ }
+
+ mtx_unlock(&mountlist_mtx);
+
+ return 0;
+}
+
+/*
* Filler function for proc/pid/cmdline
*/
static int
@@ -1262,6 +1289,8 @@
NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "devices", &linprocfs_dodevices,
NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(root, "filesystems", &linprocfs_dofilesystems,
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "loadavg", &linprocfs_doloadavg,
NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "meminfo", &linprocfs_domeminfo,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1bd550a01001080919p20ec1b20t82b3761705cd1ff3>
