]> Zhao Yanbai Git Server - minix.git/commitdiff
procfs: add /proc/dmap
authorDavid van Moolenbroek <david@minix3.org>
Sun, 11 Dec 2011 14:24:28 +0000 (15:24 +0100)
committerDavid van Moolenbroek <david@minix3.org>
Sun, 11 Dec 2011 21:35:33 +0000 (22:35 +0100)
servers/procfs/inc.h
servers/procfs/root.c

index 4240e076a71fcb2d99c60caedfea789e463e8707..f1c0b88510f1628f7fe30c764590476a95d1a31b 100644 (file)
 #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 <minix/vtreefs.h>
index 9b07437a186e8a4490b1140df8e925509b1cbadc..a402fb384c359344e7566821e7653d07a47cf832 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "inc.h"
 #include <machine/pci.h>
+#include <minix/dmap.h>
 #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);
+       }
+}