Print this page
8368 remove warlock leftovers from usr/src/uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/vcons_conf.c
+++ new/usr/src/uts/common/io/vcons_conf.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #include <sys/types.h>
26 26 #include <sys/param.h>
27 27 #include <sys/termios.h>
28 28 #include <sys/stream.h>
29 29 #include <sys/stropts.h>
30 30 #include <sys/kmem.h>
31 31 #include <sys/stat.h>
32 32 #include <sys/sunddi.h>
33 33 #include <sys/ddi.h>
34 34 #include <sys/bitmap.h>
35 35 #include <sys/sysmacros.h>
36 36 #include <sys/ddi_impldefs.h>
37 37 #include <sys/zone.h>
38 38 #include <sys/thread.h>
39 39 #ifdef DEBUG
40 40 #include <sys/strlog.h>
41 41 #endif
42 42
43 43 #include <sys/consdev.h>
44 44 #include <sys/console.h>
45 45 #include <sys/wscons.h>
46 46 #include <sys/vt_impl.h>
47 47 #include <sys/note.h>
48 48 #include <sys/avl.h>
49 49
50 50 /* set if console driver is attached */
51 51 dev_info_t *wc_dip = NULL;
52 52 /* active virtual console minor number */
53 53 minor_t vc_active_console = VT_MINOR_INVALID;
54 54 /*
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
55 55 * console_user symbol link minor number.
56 56 * VT_MINOR_INVALID : /dev/console
57 57 * N : /dev/vt/N
58 58 */
59 59 minor_t vc_cons_user = VT_MINOR_INVALID;
60 60 /* vc_state_t AVL tree */
61 61 avl_tree_t vc_avl_root;
62 62 /* virtual console global lock */
63 63 kmutex_t vc_lock;
64 64
65 -_NOTE(MUTEX_PROTECTS_DATA(vc_lock, wc_dip vc_avl_root vc_active_console
66 -vc_cons_user))
67 -
68 65 /*
69 66 * Called from vt devname part. Checks if dip is attached. If it is,
70 67 * return its major number.
71 68 */
72 69 major_t
73 70 vt_wc_attached(void)
74 71 {
75 72 major_t maj = (major_t)-1;
76 73
77 74 mutex_enter(&vc_lock);
78 75
79 76 if (wc_dip)
80 77 maj = ddi_driver_major(wc_dip);
81 78
82 79 mutex_exit(&vc_lock);
83 80
84 81 return (maj);
85 82 }
86 83
87 84 void
88 85 vt_getactive(char *buf, int buflen)
89 86 {
90 87 ASSERT(buf);
91 88 ASSERT(buflen != 0);
92 89
93 90 mutex_enter(&vc_lock);
94 91
95 92 if (vc_active_console == 0 || vc_active_console == VT_MINOR_INVALID)
96 93 (void) snprintf(buf, buflen, "/dev/console");
97 94 else
98 95 (void) snprintf(buf, buflen, "%u", vc_active_console);
99 96
100 97 mutex_exit(&vc_lock);
101 98 }
102 99
103 100 void
104 101 vt_getconsuser(char *buf, int buflen)
105 102 {
106 103 ASSERT(buf);
107 104 ASSERT(buflen != 0);
108 105
109 106 mutex_enter(&vc_lock);
110 107
111 108 if (vc_cons_user == VT_MINOR_INVALID) {
112 109 (void) snprintf(buf, buflen, "/dev/console");
113 110 mutex_exit(&vc_lock);
114 111 return;
115 112 }
116 113
117 114 (void) snprintf(buf, buflen, "%u", vc_cons_user);
118 115 mutex_exit(&vc_lock);
119 116 }
120 117
121 118 boolean_t
122 119 vt_minor_valid(minor_t minor)
123 120 {
124 121 if (consmode == CONS_FW) {
125 122 if (minor == 0)
126 123 return (B_TRUE);
127 124
128 125 return (B_FALSE);
129 126 }
130 127
131 128 mutex_enter(&vc_lock);
132 129 if (minor < VC_INSTANCES_COUNT) {
133 130 mutex_exit(&vc_lock);
134 131 return (B_TRUE);
135 132 }
136 133
137 134 mutex_exit(&vc_lock);
138 135 return (B_FALSE);
139 136
140 137 }
↓ open down ↓ |
63 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX