From: David van Moolenbroek Date: Sun, 11 Dec 2011 14:24:28 +0000 (+0100) Subject: procfs: add /proc/dmap X-Git-Tag: v3.2.0~183 X-Git-Url: http://zhaoyanbai.com/repos/icons/debian/static/datamaps.china.min.js?a=commitdiff_plain;h=35cf8beb336549e77c8c9e3b4af92e98aa408efa;p=minix.git procfs: add /proc/dmap --- 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); + } +}