source: trunk/athena/bin/mon/readnames.c @ 2

Revision 2, 2.0 KB checked in by dgg, 37 years ago (diff)
Initial revision
Line 
1/*
2 *      $Source: /afs/dev.mit.edu/source/repository/athena/bin/mon/readnames.c,v $
3 *      $Author: dgg $
4 *      $Locker:  $
5 *      $Header: /afs/dev.mit.edu/source/repository/athena/bin/mon/readnames.c,v 1.1 1984-12-13 12:01:24 dgg Exp $
6 */
7
8#ifndef lint
9static char *rcsid_readnames_c = "$Header: /afs/dev.mit.edu/source/repository/athena/bin/mon/readnames.c,v 1.1 1984-12-13 12:01:24 dgg Exp $";
10#endif  lint
11
12/*
13 *      R E A D N A M E S
14 *
15 * purpose: Reads the names of the disks from kernel space
16 *
17 */
18#include "mon.h"
19#include <sys/buf.h>            /* needed by following two includes */
20#include <vaxuba/ubavar.h>      /* unibus adapters */
21#include <vaxmba/mbavar.h>      /* massbus adapters */
22
23#define steal(where, var) lseek(kmem, where, 0); read(kmem, &var, sizeof var);
24
25read_names()
26{
27        struct mba_device mdev;
28        register struct mba_device *mp;
29        struct mba_driver mdrv;
30        short two_char;
31        char *cp = (char *) &two_char;
32        struct uba_device udev, *up;
33        struct uba_driver udrv;
34
35        mp = (struct mba_device *) namelist[X_MBDINIT].n_value;
36        up = (struct uba_device *) namelist[X_UBDINIT].n_value;
37        if (mp) for (;;) {
38                steal(mp++, mdev);
39                if (mdev.mi_driver == 0)
40                        break;
41                if (mdev.mi_dk < 0 || mdev.mi_alive == 0)
42                        continue;
43                steal(mdev.mi_driver, mdrv);
44                steal(mdrv.md_dname, two_char);
45                sprintf(dr_name[mdev.mi_dk], "%c%c%d", cp[0], cp[1], mdev.mi_unit);
46                dr_unit[mdev.mi_dk] = mdev.mi_unit;
47        }
48        if (up) for (;;) {
49                steal(up++, udev);
50                if (udev.ui_driver == 0)
51                        break;
52                if (udev.ui_dk < 0 || udev.ui_alive == 0)
53                        continue;
54                steal(udev.ui_driver, udrv);
55                steal(udrv.ud_dname, two_char);
56                sprintf(dr_name[udev.ui_dk], "%c%c%d", cp[0], cp[1], udev.ui_unit);
57                dr_unit[udev.ui_dk] = udev.ui_unit;
58        }
59}
Note: See TracBrowser for help on using the repository browser.