xref: /titanic_41/usr/src/cmd/rcm_daemon/common/ttymux_rcm_impl.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_TTYMUX_RCM_IMPL_H
28 #define	_TTYMUX_RCM_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifndef lint
37 #define	_(x)    gettext(x)
38 #else
39 #define	_(x)    x
40 #endif
41 
42 #define	UNKNOWN		1	   /* flags */
43 #define	PRESENT		2	   /* flags */
44 #define	REGISTERED	4	   /* flags */
45 #define	CONNECTED	8	   /* flags */
46 #define	DISCONNECTED	0x10	   /* flags */
47 
48 /* RCM operations */
49 #define	TTYMUX_OFFLINE  1
50 #define	TTYMUX_ONLINE   2
51 #define	TTYMUX_REMOVE   3
52 #define	TTYMUX_SUSPEND  4
53 #define	TTYMUX_RESUME   5
54 
55 /*
56  * Representation of a resource.
57  * All resources are placed in a cache structured as a doubly linked list
58  * (ie the next and prev fields).
59  * The dependencies list identifies which resources this resource is
60  * depending upon.
61  */
62 typedef struct rsrc {
63 	char		*id;
64 	dev_t		dev;
65 	int		flags;
66 	struct rsrc	*next;
67 	struct rsrc	*prev;
68 	struct link	*dependencies;
69 } rsrc_t;
70 
71 /*
72  * Representation of a pair of resources participating in a
73  * dependency relationship
74  * The dependency is cast in terms of a resource that is using
75  * another resource in order to provide a service.
76  * This structure is used to represent a ttymux minor node that
77  * has another serial device multiplexed under it. In this
78  * case user resource would correspond to the ttymux minor node and the
79  * the used resource would correspond to the multiplexed serial device.
80  * The linkid field refers to the STREAM's link identifier.
81  */
82 typedef struct link {
83 	rsrc_t		*user;	/* the using resource */
84 	rsrc_t		*used;	/* the used resource */
85 	int		linkid;	/* STREAM's link identifier */
86 	uint_t		state;
87 	int		flags;
88 	int		(*connect)(struct link *);
89 	int		(*disconnect)(struct link *);
90 	struct link	*next;
91 } link_t;
92 
93 #define	MUXCTLLINK	"/devices/multiplexer@0,0:ctl"
94 #define	MUXCONLINK	"/devices/multiplexer@0,0:con"
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif /* _TTYMUX_RCM_IMPL_H */
101