Removed debug dumps from the PM and FS servers. The dumps are now done by the

IS servers, which obtains a copy of the data through the getsysinfo() system
call. CTRL-F1 now is a special TTY key to shows function key mappings.
This commit is contained in:
Jorrit Herder
2005-06-07 14:43:35 +00:00
parent 4de736535c
commit c2cd510adf
20 changed files with 616 additions and 655 deletions
+1 -7
View File
@@ -13,7 +13,7 @@ CFLAGS = -I$i
LDFLAGS = -i
LIBS = -lsys -lutils
OBJ = main.o open.o read.o write.o pipe.o dmap.o dmp.o \
OBJ = main.o open.o read.o write.o pipe.o dmap.o \
device.o path.o mount.o link.o super.o inode.o \
cache.o cache2.o filedes.o stadir.o protect.o time.o \
cmostime.o lock.o misc.o utility.o select.o table.o
@@ -65,12 +65,6 @@ dmap.o: $h/com.h
dmap.o: $h/utils.h
dmap.o: dmap.h
dmp.o: $a
dmp.o: dmap.h
dmp.o: $h/callnr.h
dmp.o: $h/com.h
dmp.o: $h/keymap.h
filedes.o: $a
filedes.o: file.h
filedes.o: fproc.h
+2
View File
@@ -9,6 +9,8 @@
#define NR_SUPERS 8 /* # slots in super block table */
#define NR_LOCKS 8 /* # slots in the file locking table */
#define NR_DEVICES 16 /* # slots in the device <-> driver table */
/* The type of sizeof may be (unsigned) long. Use the following macro for
* taking the sizes of small objects so that there are no surprises like
* (small) long constants being passed to routines expecting an int.
+1 -1
View File
@@ -42,7 +42,7 @@ int flags; /* mode bits and flags */
* device number for being in range. All others can trust this check.)
*/
major = (dev >> MAJOR) & BYTE;
if (major >= max_major) major = 0;
if (major >= NR_DEVICES) major = 0;
dp = &dmap[major];
r = (*dp->dmap_opcl)(DEV_OPEN, dev, proc, flags);
if (r == SUSPEND) panic(__FILE__,"suspend on open from", dp->dmap_driver);
+6 -19
View File
@@ -28,7 +28,7 @@
Driver enabled Open/Cls I/O Driver # Flags Device File
-------------- -------- ------ ----------- ----- ------ ----
*/
struct dmap dmap[] = {
struct dmap dmap[NR_DEVICES] = {
DT(1, no_dev, 0, 0, 0) /* 0 = not used */
DT(1, gen_opcl, gen_io, MEMORY, 0) /* 1 = /dev/mem */
DT(ENABLE_FLOPPY, gen_opcl, gen_io, FLOPPY, 0) /* 2 = /dev/fd0 */
@@ -54,11 +54,6 @@ struct dmap dmap[] = {
#endif /* IBM_PC */
};
/* This is the maximum major number at compile time. This may change when
* devices are dynamically added or removed.
*/
int max_major = sizeof(dmap)/sizeof(struct dmap);
/*===========================================================================*
* map_driver *
@@ -77,19 +72,15 @@ int dev_style; /* style of the device */
struct dmap *dp;
/* Get pointer to device entry in the dmap table. */
if (major >= max_major) /* verify bounds */
return(ENODEV);
if (major >= NR_DEVICES) return(ENODEV);
dp = &dmap[major];
/* See if updating the entry is allowed. */
if (! (dp->dmap_flags & DMAP_MUTABLE))
return(EPERM);
if (dp->dmap_flags & DMAP_BUSY)
return(EBUSY);
if (! (dp->dmap_flags & DMAP_MUTABLE)) return(EPERM);
if (dp->dmap_flags & DMAP_BUSY) return(EBUSY);
/* Check process number of new driver. */
if (! isokprocnr(proc_nr))
return(EINVAL);
if (! isokprocnr(proc_nr)) return(EINVAL);
/* Try to update the entry. */
switch (dev_style) {
@@ -143,12 +134,8 @@ PUBLIC void map_controllers()
for (dp = drivertab;
dp < drivertab + sizeof(drivertab)/sizeof(drivertab[0]); dp++) {
if (strcmp(ctrlr_type, dp->wini_type) == 0) { /* found driver name */
#if DEAD_CODE
if ((s=sys_getprocnr(&proc_nr, /* lookup proc nr */
dp->proc_name, strlen(dp->proc_name)+1)) == OK) {
#endif
if ((s=findproc(dp->proc_name, &proc_nr)) == OK) {
for (i=0; i< max_major; i++) { /* find mapping */
for (i=0; i< NR_DEVICES; i++) { /* find mapping */
if (dmap[i].dmap_driver == CTRLR(c)) {
if (map_driver(i, proc_nr, STYLE_DEV) == OK) {
printf("FS: controller %s (%s) mapped to %s driver (proc. nr %d)\n",
-109
View File
@@ -1,109 +0,0 @@
/* This file contains procedures to dump to FS' data structures.
*
* The entry points into this file are
* do_fkey_pressed: a function key was pressed
* dtab_dump: display device<->driver table
* fproc_dump: display FS process table
*
* Created:
* Oct 01, 2004: by Jorrit N. Herder
*/
#include "fs.h"
#include <minix/callnr.h>
#include <minix/com.h>
#include <minix/keymap.h>
#include "dmap.h"
#include "fproc.h"
FORWARD _PROTOTYPE( void dtab_dmp, (void));
FORWARD _PROTOTYPE( void fproc_dmp, (void));
/*===========================================================================*
* do_fkey_pressed *
*===========================================================================*/
PUBLIC int do_fkey_pressed(void)
{
printf("Debug dump of FS data structure: ");
#if DEAD_CODE
switch (m_in.FKEY_CODE) {
#else
switch (m_in.NOTIFY_FLAGS) {
#endif
case SF5: fproc_dmp(); break;
case SF6: dtab_dmp(); break;
default:
#if DEAD_CODE
printf("FS: unhandled notification for Shift+F%d key.\n",
m_in.FKEY_NUM);
#else
printf("FS: unhandled notification for Shift+F%d key.\n",
m_in.NOTIFY_FLAGS);
#endif
}
}
/*===========================================================================*
* fproc_dmp *
*===========================================================================*/
PRIVATE void fproc_dmp()
{
struct fproc *fp;
int i, n=0;
static int prev_i;
printf("PROCESS TABLE (beta)\n");
printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n");
for (i=prev_i; i<NR_PROCS; i++) {
fp = &fproc[i];
if (fp->fp_pid <= 0) continue;
if (++n > 22) break;
printf("%3d %4d %2d/%d 0x%05x %2d (%d) %2d (%d) %3d %3d %3d %4d 0x%05x\n",
i, fp->fp_pid,
((fp->fp_tty>>MAJOR)&BYTE), ((fp->fp_tty>>MINOR)&BYTE),
fp->fp_umask,
fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
fp->fp_sesldr,
fp->fp_suspended, fp->fp_revived, fp->fp_task,
fp->fp_cloexec
);
}
if (i >= NR_PROCS) i = 0;
else printf("--more--\r");
prev_i = i;
}
/*===========================================================================*
* dtab_dmp *
*===========================================================================*/
PRIVATE void dtab_dmp()
{
int i;
char *file[] = {
"not used ", "/dev/mem ", "/dev/fd0 ", "/dev/c0 ", "/dev/tty0 ",
"/dev/tty ", "/dev/lp ", "/dev/ip ", "/dev/c1 ", "not used ",
"/dev/c2 ", "not used ", "/dev/c3 ", "/dev/audio", "/dev/mixer",
};
printf("DEVICE MAP\n");
printf("Dev File Open/Cls I/O Proc\n");
printf("--- ---------- -------- ------ ----\n");
for (i=0; i<max_major; i++) {
printf("%3d %s ", i, file[i] );
if (dmap[i].dmap_opcl == no_dev) printf(" no_dev");
else if (dmap[i].dmap_opcl == gen_opcl) printf("gen_opcl");
else printf("%8x", dmap[i].dmap_opcl);
if ((void *)dmap[i].dmap_io == (void *)no_dev) printf(" no_dev");
else if (dmap[i].dmap_io == gen_io) printf(" gen_io");
else printf("%8x", dmap[i].dmap_io);
printf("%6d\n", dmap[i].dmap_driver);
}
}
-1
View File
@@ -28,6 +28,5 @@ EXTERN int rdwt_err; /* status of last disk i/o request */
/* Data initialized elsewhere. */
extern _PROTOTYPE (int (*call_vec[]), (void) ); /* sys call table */
extern int max_major; /* maximum major device (+ 1) */
extern char dot1[2]; /* dot1 (&dot1[0]) and dot2 (&dot2[0]) have a special */
extern char dot2[3]; /* meaning to search_dir: no access permission check. */
+8 -4
View File
@@ -46,6 +46,14 @@ PUBLIC int do_getsysinfo()
src_addr = (vir_bytes) &proc_addr;
len = sizeof(struct fproc *);
break;
case SI_PROC_TAB:
src_addr = (vir_bytes) fproc;
len = sizeof(struct fproc) * NR_PROCS;
break;
case SI_DMAP_TAB:
src_addr = (vir_bytes) dmap;
len = sizeof(struct dmap) * NR_DEVICES;
break;
default:
return(EINVAL);
}
@@ -421,10 +429,6 @@ PUBLIC int do_svrctl()
major = (device.dev >> MAJOR) & BYTE;
r=map_driver(major, who, device.style);
return(r);
#if DEAD_CODE
if ((r=map_driver(major, who, device.style)) == OK)
fp->fp_pid = PID_SERVER;
#endif
}
default:
return(EINVAL);