misc/142595: Implementation of "filesystems" file in linprocfs

Fernando fernando.apesteguia at gmail.com
Sun Jan 10 21:20:02 UTC 2010


>Number:         142595
>Category:       misc
>Synopsis:       Implementation of "filesystems" file in linprocfs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 10 21:20:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Fernando
>Release:        8.0-RELEASE
>Organization:
>Environment:
FreeBSD hammer 8.0-RELEASE-p1 FreeBSD 8.0-RELEASE-p1 #11: Fri Jan  1 21:00:36 CET 2010     root at hammer:/usr/obj/usr/src/sys/APEKERNEL  amd64
>Description:
This patch implements the "filesystems" file for the linux procfs. Few programs use this file but some exceptions as "procinfo" and other system information utilities.
>How-To-Repeat:

>Fix:
The attached patch implements the mentioned file. It was tested against 8.0-RELEASE-p1.

Patch attached with submission follows:

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


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list