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.1 1995/12/11 05:21:05 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>
47 static int ppp_identify __P((dev_info_t *));
48 static int ppp_attach __P((dev_info_t *, ddi_attach_cmd_t));
49 static int ppp_detach __P((dev_info_t *, ddi_detach_cmd_t));
50 static int ppp_devinfo __P((dev_info_t *, ddi_info_cmd_t, void *, void **));
52 extern struct streamtab pppinfo;
54 static dev_info_t *ppp_dip;
56 static struct cb_ops cb_ppp_ops = {
57 nulldev, nulldev, nodev, nodev, /* cb_open, ... */
58 nodev, nodev, nodev, nodev, /* cb_dump, ... */
59 nodev, nodev, nodev, nochpoll, /* cb_devmap, ... */
60 ddi_prop_op, /* cb_prop_op */
61 &pppinfo, /* cb_stream */
62 D_NEW|D_MP|D_MTQPAIR|D_MTOUTPERIM|D_MTOCEXCL /* cb_flag */
65 static struct dev_ops ppp_ops = {
66 DEVO_REV, /* devo_rev */
68 ppp_devinfo, /* devo_getinfo */
69 ppp_identify, /* devo_identify */
70 nulldev, /* devo_probe */
71 ppp_attach, /* devo_attach */
72 ppp_detach, /* devo_detach */
73 nodev, /* devo_reset */
74 &cb_ppp_ops, /* devo_cb_ops */
75 NULL /* devo_bus_ops */
79 * Module linkage information
82 static struct modldrv modldrv = {
83 &mod_driverops, /* says this is a pseudo driver */
84 "PPP-2.2 multiplexing driver",
85 &ppp_ops /* driver ops */
88 static struct modlinkage modlinkage = {
97 return mod_install(&modlinkage);
103 return mod_remove(&modlinkage);
110 return mod_info(&modlinkage, mip);
117 return strcmp(ddi_get_name(dip), "ppp") == 0? DDI_IDENTIFIED:
124 ddi_attach_cmd_t cmd;
127 if (cmd != DDI_ATTACH)
129 if (ddi_create_minor_node(dip, "ppp", S_IFCHR, 0, DDI_PSEUDO, CLONE_DEV)
131 ddi_remove_minor_node(dip, NULL);
140 ddi_detach_cmd_t cmd;
142 ddi_remove_minor_node(dip, NULL);
147 ppp_devinfo(dip, cmd, arg, result)
157 case DDI_INFO_DEVT2DEVINFO:
161 *result = (void *) ppp_dip;
163 case DDI_INFO_DEVT2INSTANCE: