2 * ppp_mod.c - modload support for PPP pseudo-device driver.
4 * Copyright (c) 1994 The Australian National University.
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation is hereby granted, provided that the above copyright
9 * notice appears in all copies. This software is provided without any
10 * warranty, express or implied. The Australian National University
11 * makes no representations about the suitability of this software for
14 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
20 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
27 * $Id: ppp_mod.c,v 1.3 1999/02/26 10:53:28 paulus Exp $
31 * This file is used under Solaris 2.
34 #include <sys/types.h>
35 #include <sys/param.h>
38 #include <sys/modctl.h>
39 #include <sys/sunddi.h>
40 #include <sys/ksynch.h>
48 static int ppp_identify __P((dev_info_t *));
49 static int ppp_attach __P((dev_info_t *, ddi_attach_cmd_t));
50 static int ppp_detach __P((dev_info_t *, ddi_detach_cmd_t));
51 static int ppp_devinfo __P((dev_info_t *, ddi_info_cmd_t, void *, void **));
53 extern struct streamtab pppinfo;
54 extern krwlock_t ppp_lower_lock;
56 static dev_info_t *ppp_dip;
58 static struct cb_ops cb_ppp_ops = {
59 nulldev, nulldev, nodev, nodev, /* cb_open, ... */
60 nodev, nodev, nodev, nodev, /* cb_dump, ... */
61 nodev, nodev, nodev, nochpoll, /* cb_devmap, ... */
62 ddi_prop_op, /* cb_prop_op */
63 &pppinfo, /* cb_stream */
64 D_NEW|D_MP|D_MTQPAIR|D_MTOUTPERIM|D_MTOCEXCL /* cb_flag */
67 static struct dev_ops ppp_ops = {
68 DEVO_REV, /* devo_rev */
70 ppp_devinfo, /* devo_getinfo */
71 ppp_identify, /* devo_identify */
72 nulldev, /* devo_probe */
73 ppp_attach, /* devo_attach */
74 ppp_detach, /* devo_detach */
75 nodev, /* devo_reset */
76 &cb_ppp_ops, /* devo_cb_ops */
77 NULL /* devo_bus_ops */
81 * Module linkage information
84 static struct modldrv modldrv = {
85 &mod_driverops, /* says this is a pseudo driver */
86 "PPP-2.3 multiplexing driver",
87 &ppp_ops /* driver ops */
90 static struct modlinkage modlinkage = {
99 return mod_install(&modlinkage);
105 return mod_remove(&modlinkage);
112 return mod_info(&modlinkage, mip);
119 return strcmp(ddi_get_name(dip), "ppp") == 0? DDI_IDENTIFIED:
126 ddi_attach_cmd_t cmd;
129 if (cmd != DDI_ATTACH)
131 if (ddi_create_minor_node(dip, "ppp", S_IFCHR, 0, DDI_PSEUDO, CLONE_DEV)
133 ddi_remove_minor_node(dip, NULL);
136 rw_init(&ppp_lower_lock, NULL, RW_DRIVER, NULL);
143 ddi_detach_cmd_t cmd;
145 rw_destroy(&ppp_lower_lock);
146 ddi_remove_minor_node(dip, NULL);
151 ppp_devinfo(dip, cmd, arg, result)
161 case DDI_INFO_DEVT2DEVINFO:
165 *result = (void *) ppp_dip;
167 case DDI_INFO_DEVT2INSTANCE: