source: trunk/third/xntp/kernel/clkinit.c @ 10832

Revision 10832, 1.3 KB checked in by brlewis, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10831, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2**      dynamically loadable clk driver
3**
4**      /src/NTP/REPOSITORY/v3/kernel/clkinit.c,v 1.1.1.1 1994/07/11 07:56:25 kardel Exp
5**
6**      william robertson <rob@agate.berkeley.edu> 
7*/
8
9#include <sys/types.h>
10#include <sys/conf.h>
11#include <sys/errno.h>
12#include <sys/stream.h>
13#include <sys/syslog.h>
14
15#include <sun/openprom.h>
16#include <sun/vddrv.h>
17
18extern int findmod();           /* os/str_io.c */
19
20extern struct streamtab clkinfo;
21
22struct vdldrv vd = {
23     VDMAGIC_USER,
24     "clk"
25  };
26
27
28int
29xxxinit(function_code, vdp, vdi, vds)
30unsigned int function_code;
31struct vddrv *vdp;
32addr_t vdi;
33struct vdstat *vds;
34{
35     register int i = 0;
36     register int j;
37
38     switch (function_code) {
39        case VDLOAD:
40
41          if (findmod("clk") >= 0) {
42               log(LOG_ERR, "clk stream module already loaded\n");
43               return (EADDRINUSE);
44          }
45 
46          i = findmod("\0");
47
48          if (i == -1 || fmodsw[i].f_name[0] != '\0')
49            return(-1);
50
51          for (j = 0; vd.Drv_name[j] != '\0'; j++)      /* XXX check bounds */
52            fmodsw[i].f_name[j] = vd.Drv_name[j];
53
54          fmodsw[i].f_name[j] = '\0';
55          fmodsw[i].f_str = &clkinfo;
56
57          vdp->vdd_vdtab = (struct vdlinkage *)  &vd;
58
59          return(0);
60
61        case VDUNLOAD:
62          if ((i = findmod(vd.Drv_name)) == -1)
63            return(-1);
64
65          fmodsw[i].f_name[0] = '\0';
66          fmodsw[i].f_str = 0;
67
68          return(0);
69     
70        case VDSTAT:
71          return(0);
72
73        default:
74          return(EIO);
75     }
76}
Note: See TracBrowser for help on using the repository browser.