From 35cf8beb336549e77c8c9e3b4af92e98aa408efa Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Sun, 11 Dec 2011 15:24:28 +0100 Subject: [PATCH] procfs: add /proc/dmap --- servers/procfs/inc.h | 2 ++ servers/procfs/root.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/servers/procfs/inc.h b/servers/procfs/inc.h index 4240e076a..f1c0b8851 100644 --- a/servers/procfs/inc.h +++ b/servers/procfs/inc.h @@ -53,9 +53,11 @@ #if defined(_USEAVFS) # include "avfs/const.h" # include "avfs/fproc.h" +# include "avfs/dmap.h" #else # include "vfs/const.h" # include "vfs/fproc.h" +# include "vfs/dmap.h" #endif #include diff --git a/servers/procfs/root.c b/servers/procfs/root.c index 9b07437a1..a402fb384 100644 --- a/servers/procfs/root.c +++ b/servers/procfs/root.c @@ -2,6 +2,7 @@ #include "inc.h" #include +#include #include "cpuinfo.h" FORWARD _PROTOTYPE( void root_hz, (void) ); @@ -10,6 +11,7 @@ FORWARD _PROTOTYPE( void root_loadavg, (void) ); FORWARD _PROTOTYPE( void root_kinfo, (void) ); FORWARD _PROTOTYPE( void root_meminfo, (void) ); FORWARD _PROTOTYPE( void root_pci, (void) ); +FORWARD _PROTOTYPE( void root_dmap, (void) ); struct file root_files[] = { { "hz", REG_ALL_MODE, (data_t) root_hz }, @@ -18,6 +20,7 @@ struct file root_files[] = { { "kinfo", REG_ALL_MODE, (data_t) root_kinfo }, { "meminfo", REG_ALL_MODE, (data_t) root_meminfo }, { "pci", REG_ALL_MODE, (data_t) root_pci }, + { "dmap", REG_ALL_MODE, (data_t) root_dmap }, { "cpuinfo", REG_ALL_MODE, (data_t) root_cpuinfo }, { NULL, 0, NULL } }; @@ -140,3 +143,23 @@ PRIVATE void root_pci(void) r = pci_next_dev(&devind, &vid, &did); } } + +/*===========================================================================* + * root_dmap * + *===========================================================================*/ +PRIVATE void root_dmap(void) +{ + struct dmap dmap[NR_DEVICES]; + int i; + + if (getsysinfo(VFS_PROC_NR, SI_DMAP_TAB, dmap, sizeof(dmap)) != OK) + return; + + for (i = 0; i < NR_DEVICES; i++) { + if (dmap[i].dmap_driver == NONE) + continue; + + buf_printf("%u %s %u\n", i, dmap[i].dmap_label, + dmap[i].dmap_driver); + } +} -- 2.44.0