[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 68/87: procfs: implement /proc/filesystems
From: |
Samuel Thibault |
Subject: |
[hurd] 68/87: procfs: implement /proc/filesystems |
Date: |
Sun, 09 Nov 2014 11:05:05 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit b288ae932a53133c986e5daace2d5bfa4cf95d2c
Author: Justus Winter <address@hidden>
Date: Thu Sep 18 19:38:04 2014 +0200
procfs: implement /proc/filesystems
* procfs/rootdir.c (rootdir_gc_filesystems): New function.
(rootdir_entries): Use the new function to implement /proc/filesystems.
---
procfs/rootdir.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/procfs/rootdir.c b/procfs/rootdir.c
index 9541059..f92e73d 100644
--- a/procfs/rootdir.c
+++ b/procfs/rootdir.c
@@ -1,5 +1,5 @@
/* Hurd /proc filesystem, permanent files of the root directory.
- Copyright (C) 2010,13 Free Software Foundation, Inc.
+ Copyright (C) 2010,13,14 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -32,6 +32,7 @@
#include <sys/stat.h>
#include <argz.h>
#include <ps.h>
+#include <glob.h>
#include "procfs.h"
#include "procfs_dir.h"
#include "main.h"
@@ -532,6 +533,57 @@ rootdir_gc_slabinfo (void *hook, char **contents, ssize_t
*contents_len)
cache_info, cache_info_count * sizeof *cache_info);
return err;
}
+
+static error_t
+rootdir_gc_filesystems (void *hook, char **contents, ssize_t *contents_len)
+{
+ error_t err = 0;
+ size_t i;
+ int glob_ret;
+ glob_t matches;
+ FILE *m;
+
+ m = open_memstream (contents, contents_len);
+ if (m == NULL)
+ return errno;
+
+ glob_ret = glob (_HURD "*fs", 0, NULL, &matches);
+ switch (glob_ret)
+ {
+ case 0:
+ for (i = 0; i < matches.gl_pathc; i++)
+ {
+ /* Get ith entry, shave off the prefix. */
+ char *name = &matches.gl_pathv[i][sizeof _HURD - 1];
+
+ /* Linux naming convention is a bit inconsistent. */
+ if (strncmp (name, "ext", 3) == 0
+ || strcmp (name, "procfs") == 0)
+ /* Drop the fs suffix. */
+ name[strlen (name) - 2] = 0;
+
+ fprintf (m, "\t%s\n", name);
+ }
+
+ globfree (&matches);
+ break;
+
+ case GLOB_NOMATCH:
+ /* Poor fellow. */
+ break;
+
+ case GLOB_NOSPACE:
+ err = ENOMEM;
+ break;
+
+ default:
+ /* This should not happen. */
+ err = EGRATUITOUS;
+ }
+
+ fclose (m);
+ return err;
+}
/* Glue logic and entries table */
@@ -632,6 +684,13 @@ static const struct procfs_dir_entry rootdir_entries[] = {
.cleanup_contents = procfs_cleanup_contents_with_free,
},
},
+ {
+ .name = "filesystems",
+ .hook = & (struct procfs_node_ops) {
+ .get_contents = rootdir_gc_filesystems,
+ .cleanup_contents = procfs_cleanup_contents_with_free,
+ },
+ },
#ifdef PROFILE
/* In order to get a usable gmon.out file, we must apparently use exit(). */
{
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 70/87: procfs: generalize the translator linkage code, (continued)
- [hurd] 70/87: procfs: generalize the translator linkage code, Samuel Thibault, 2014/11/09
- [hurd] 56/87: hurd: fix semantic of file_get_children, Samuel Thibault, 2014/11/09
- [hurd] 47/87: Make the ncursesw driver of the console client compile properly, Samuel Thibault, 2014/11/09
- [hurd] 65/87: exec: add proper argument parsing, add --device-master-port, Samuel Thibault, 2014/11/09
- [hurd] 18/87: hurd: fix type of optimal_transfer_size, Samuel Thibault, 2014/11/09
- [hurd] 50/87: sutils: add urandom device target to MAKEDEV, Samuel Thibault, 2014/11/09
- [hurd] 45/87: Revert "libpipe: fix calls to pipe_send with no data", Samuel Thibault, 2014/11/09
- [hurd] 57/87: include: detect use-after-free errors using the reference counts, Samuel Thibault, 2014/11/09
- [hurd] 73/87: libdiskfs: remove code counting cache misses, Samuel Thibault, 2014/11/09
- [hurd] 82/87: Fix dead name notification in static binaries, Samuel Thibault, 2014/11/09
- [hurd] 68/87: procfs: implement /proc/filesystems,
Samuel Thibault <=
- [hurd] 71/87: procfs: reorganize rootdir.c, Samuel Thibault, 2014/11/09
- [hurd] 78/87: Fix proc_getprocinfo calls, Samuel Thibault, 2014/11/09
- [hurd] 80/87: Fix actual procinfo_t type, Samuel Thibault, 2014/11/09
- [hurd] 83/87: Use a mere weak attribute instead of a weak alias, Samuel Thibault, 2014/11/09
- [hurd] 17/87: include: use unsigned literal in combination with binary not, Samuel Thibault, 2014/11/09
- [hurd] 79/87: Fix proc_getprocinfo calls, Samuel Thibault, 2014/11/09
- [hurd] 20/87: libdiskfs: avoid implicit integer conversion, Samuel Thibault, 2014/11/09
- [hurd] 67/87: procfs: implement /proc/N/maps, Samuel Thibault, 2014/11/09
- [hurd] 69/87: procfs: do not test whether /hurd/mtab exists, Samuel Thibault, 2014/11/09
- [hurd] 16/87: libnetfs: fix memory leak, Samuel Thibault, 2014/11/09