make includes fix from trunk
[minix.git] / servers / is / dmp_fs.c
blob630af6709ae1ae70b68a9890be917e6bfdd3cc9a
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 PUBLIC struct fproc fproc[NR_PROCS];
19 PUBLIC struct dmap dmap[NR_DEVICES];
21 /*===========================================================================*
22 * fproc_dmp *
23 *===========================================================================*/
24 PUBLIC void fproc_dmp()
26 struct fproc *fp;
27 int i, n=0;
28 static int prev_i;
30 getsysinfo(FS_PROC_NR, SI_PROC_TAB, fproc);
32 printf("File System (FS) process table dump\n");
33 printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc-\n");
34 for (i=prev_i; i<NR_PROCS; i++) {
35 fp = &fproc[i];
36 if (fp->fp_pid <= 0) continue;
37 if (++n > 22) break;
38 printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d ",
39 i, fp->fp_pid,
40 ((fp->fp_tty>>MAJOR)&BYTE), ((fp->fp_tty>>MINOR)&BYTE),
41 fp->fp_umask,
42 fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
43 fp->fp_sesldr,
44 fp->fp_blocked_on, !!fp->fp_revived
46 if (fp->fp_blocked_on == FP_BLOCKED_ON_OTHER)
47 printf("%4d\n", fp->fp_task);
48 else
49 printf(" nil\n");
51 if (i >= NR_PROCS) i = 0;
52 else printf("--more--\r");
53 prev_i = i;
56 /*===========================================================================*
57 * dmap_flags *
58 *===========================================================================*/
59 PRIVATE char * dmap_flags(int flags)
61 static char fl[10];
62 strcpy(fl, "-----");
63 if(flags & DRV_FORCED) fl[0] = 'F';
64 return fl;
67 /*===========================================================================*
68 * dmap_style *
69 *===========================================================================*/
70 PRIVATE char * dmap_style(int dev_style)
72 static char str[16];
73 switch(dev_style) {
74 case STYLE_DEV: strcpy(str, "STYLE_DEV"); break;
75 case STYLE_DEVA: strcpy(str, "STYLE_DEVA"); break;
76 case STYLE_TTY: strcpy(str, "STYLE_TTY"); break;
77 case STYLE_CTTY: strcpy(str, "STYLE_CTTY"); break;
78 case STYLE_CLONE: strcpy(str, "STYLE_CLONE"); break;
79 default: strcpy(str, "UNKNOWN"); break;
82 return str;
85 /*===========================================================================*
86 * dtab_dmp *
87 *===========================================================================*/
88 PUBLIC void dtab_dmp()
90 int i;
92 getsysinfo(FS_PROC_NR, SI_DMAP_TAB, dmap);
94 printf("File System (FS) device <-> driver mappings\n");
95 printf(" Label Major Driver ept Flags Style \n");
96 printf("------------- ----- ---------- ----- -------------\n");
97 for (i=0; i<NR_DEVICES; i++) {
98 if (dmap[i].dmap_driver == NONE) continue;
99 printf("%13s %5d %10d %s %-13s\n",
100 dmap[i].dmap_label, i, dmap[i].dmap_driver,
101 dmap_flags(dmap[i].dmap_flags), dmap_style(dmap[i].dmap_style));