VM: make mapping types explicit
[minix.git] / servers / is / dmp_fs.c
blobee486c99d60e34f191a1993517be3f6071b39369
1 /* This file contains procedures to dump to FS' data structures.
3 * The entry points into this file are
4 * dtab_dump: display device <-> driver mappings
5 * fproc_dump: display FS process table
7 * Created:
8 * Oct 01, 2004: by Jorrit N. Herder
9 */
11 #include "inc.h"
12 #include "../mfs/const.h"
13 #include "../vfs/const.h"
14 #include "../vfs/fproc.h"
15 #include "../vfs/dmap.h"
16 #include <minix/dmap.h>
18 struct fproc fproc[NR_PROCS];
19 struct dmap dmap[NR_DEVICES];
21 /*===========================================================================*
22 * fproc_dmp *
23 *===========================================================================*/
24 void fproc_dmp()
26 struct fproc *fp;
27 int i, n=0;
28 static int prev_i;
30 if (getsysinfo(VFS_PROC_NR, SI_PROC_TAB, fproc, sizeof(fproc)) != OK) {
31 printf("Error obtaining table from VFS. Perhaps recompile IS?\n");
32 return;
35 printf("File System (FS) process table dump\n");
36 printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc-\n");
37 for (i=prev_i; i<NR_PROCS; i++) {
38 fp = &fproc[i];
39 if (fp->fp_pid <= 0) continue;
40 if (++n > 22) break;
41 printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d ",
42 i, fp->fp_pid,
43 major(fp->fp_tty), minor(fp->fp_tty),
44 fp->fp_umask,
45 fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
46 !!(fp->fp_flags & FP_SESLDR),
47 fp->fp_blocked_on, !!(fp->fp_flags & FP_REVIVED)
49 if (fp->fp_blocked_on == FP_BLOCKED_ON_OTHER)
50 printf("%4d\n", fp->fp_task);
51 else
52 printf(" nil\n");
54 if (i >= NR_PROCS) i = 0;
55 else printf("--more--\r");
56 prev_i = i;
59 /*===========================================================================*
60 * dmap_flags *
61 *===========================================================================*/
62 static char * dmap_flags(int flags)
64 static char fl[10];
65 strlcpy(fl, "-----", sizeof(fl));
66 if(flags & DRV_FORCED) fl[0] = 'F';
67 return fl;
70 /*===========================================================================*
71 * dmap_style *
72 *===========================================================================*/
73 static char * dmap_style(int dev_style)
75 switch(dev_style) {
76 case STYLE_DEV: return "STYLE_DEV";
77 case STYLE_DEVA: return "STYLE_DEVA";
78 case STYLE_TTY: return "STYLE_TTY";
79 case STYLE_CTTY: return "STYLE_CTTY";
80 case STYLE_CLONE: return "STYLE_CLONE";
81 case STYLE_CLONE_A: return "STYLE_CLONE_A";
82 default: return "UNKNOWN";
86 /*===========================================================================*
87 * dtab_dmp *
88 *===========================================================================*/
89 void dtab_dmp()
91 int i;
93 if (getsysinfo(VFS_PROC_NR, SI_DMAP_TAB, dmap, sizeof(dmap)) != OK) {
94 printf("Error obtaining table from VFS. Perhaps recompile IS?\n");
95 return;
98 printf("File System (FS) device <-> driver mappings\n");
99 printf(" Label Major Driver ept Flags Style \n");
100 printf("------------- ----- ---------- ----- -------------\n");
101 for (i=0; i<NR_DEVICES; i++) {
102 if (dmap[i].dmap_driver == NONE) continue;
103 printf("%13s %5d %10d %s %-13s\n",
104 dmap[i].dmap_label, i, dmap[i].dmap_driver,
105 dmap_flags(dmap[i].dmap_flags), dmap_style(dmap[i].dmap_style));