96 nodev, /* reset */
97 &ncall_cb_ops,
98 (struct bus_ops *)0,
99 NULL /* power */
100 };
101
102 /*
103 * Module linkage.
104 */
105
106 extern struct mod_ops mod_driverops;
107
108 static struct modldrv modldrv = {
109 &mod_driverops,
110 "nws:Kernel Call:" ISS_VERSION_STR,
111 &ncall_ops
112 };
113
114 static struct modlinkage modlinkage = {
115 MODREV_1,
116 &modldrv,
117 0
118 };
119
120 typedef struct ncall_modinfo_s {
121 struct ncall_modinfo_s *next;
122 ncall_module_t *module;
123 } ncall_modinfo_t;
124
125 static dev_info_t *ncall_dip; /* Single DIP for driver */
126 static kmutex_t ncall_mutex;
127
128 static ncall_modinfo_t *ncall_modules;
129 static int ncall_active;
130
131 static ncall_node_t ncall_nodeinfo;
132
133 static int ncallgetnodes(intptr_t, int, int *);
134 extern void ncall_init_stub(void);
135
136 int
137 _init(void)
324 mutex_enter(&ncall_mutex);
325
326 while ((rc == 0) && ((mod = ncall_modules) != NULL)) {
327 mutex_exit(&ncall_mutex);
328
329 rc = (*mod->module->ncall_stop)();
330
331 mutex_enter(&ncall_mutex);
332 }
333
334 mutex_exit(&ncall_mutex);
335
336 return (rc);
337 }
338
339
340 /* ARGSUSED */
341 static int ncallioctl(dev_t dev, int cmd, intptr_t arg, int mode,
342 cred_t *crp, int *rvalp)
343 {
344 ncall_node_t node = { 0, };
345 int mirror;
346 int rc = 0;
347
348 *rvalp = 0;
349
350 if ((rc = drv_priv(crp)) != 0)
351 return (rc);
352
353 switch (cmd) {
354
355 case NC_IOC_START:
356 if (ncall_active) {
357 rc = EALREADY;
358 break;
359 }
360
361 if (ddi_copyin((void *)arg, &node, sizeof (node), mode) < 0)
362 return (EFAULT);
363
364 bcopy(&node, &ncall_nodeinfo, sizeof (ncall_nodeinfo));
|
96 nodev, /* reset */
97 &ncall_cb_ops,
98 (struct bus_ops *)0,
99 NULL /* power */
100 };
101
102 /*
103 * Module linkage.
104 */
105
106 extern struct mod_ops mod_driverops;
107
108 static struct modldrv modldrv = {
109 &mod_driverops,
110 "nws:Kernel Call:" ISS_VERSION_STR,
111 &ncall_ops
112 };
113
114 static struct modlinkage modlinkage = {
115 MODREV_1,
116 { &modldrv, NULL }
117 };
118
119 typedef struct ncall_modinfo_s {
120 struct ncall_modinfo_s *next;
121 ncall_module_t *module;
122 } ncall_modinfo_t;
123
124 static dev_info_t *ncall_dip; /* Single DIP for driver */
125 static kmutex_t ncall_mutex;
126
127 static ncall_modinfo_t *ncall_modules;
128 static int ncall_active;
129
130 static ncall_node_t ncall_nodeinfo;
131
132 static int ncallgetnodes(intptr_t, int, int *);
133 extern void ncall_init_stub(void);
134
135 int
136 _init(void)
323 mutex_enter(&ncall_mutex);
324
325 while ((rc == 0) && ((mod = ncall_modules) != NULL)) {
326 mutex_exit(&ncall_mutex);
327
328 rc = (*mod->module->ncall_stop)();
329
330 mutex_enter(&ncall_mutex);
331 }
332
333 mutex_exit(&ncall_mutex);
334
335 return (rc);
336 }
337
338
339 /* ARGSUSED */
340 static int ncallioctl(dev_t dev, int cmd, intptr_t arg, int mode,
341 cred_t *crp, int *rvalp)
342 {
343 ncall_node_t node = { .nc_nodeid = 0 };
344 int mirror;
345 int rc = 0;
346
347 *rvalp = 0;
348
349 if ((rc = drv_priv(crp)) != 0)
350 return (rc);
351
352 switch (cmd) {
353
354 case NC_IOC_START:
355 if (ncall_active) {
356 rc = EALREADY;
357 break;
358 }
359
360 if (ddi_copyin((void *)arg, &node, sizeof (node), mode) < 0)
361 return (EFAULT);
362
363 bcopy(&node, &ncall_nodeinfo, sizeof (ncall_nodeinfo));
|