Deleted Added
full compact
kern_cons.c (50477) kern_cons.c (51654)
1/*
2 * Copyright (c) 1988 University of Utah.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the Systems Programming Group of the University of Utah Computer
8 * Science Department.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * from: @(#)cons.c 7.2 (Berkeley) 5/9/91
1/*
2 * Copyright (c) 1988 University of Utah.
3 * Copyright (c) 1991 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the Systems Programming Group of the University of Utah Computer
8 * Science Department.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * from: @(#)cons.c 7.2 (Berkeley) 5/9/91
39 * $FreeBSD: head/sys/kern/tty_cons.c 50477 1999-08-28 01:08:13Z peter $
39 * $FreeBSD: head/sys/kern/tty_cons.c 51654 1999-09-25 16:21:39Z phk $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/conf.h>
45#include <sys/kernel.h>
46#include <sys/reboot.h>
47#include <sys/sysctl.h>

--- 47 unchanged lines hidden (view full) ---

95 */
96
97static u_char cn_is_open; /* nonzero if logical console is open */
98static int openmode, openflag; /* how /dev/console was openned */
99static u_char cn_phys_is_open; /* nonzero if physical device is open */
100static d_close_t *cn_phys_close; /* physical device close function */
101static d_open_t *cn_phys_open; /* physical device open function */
102struct consdev *cn_tab; /* physical console device info */
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/conf.h>
45#include <sys/kernel.h>
46#include <sys/reboot.h>
47#include <sys/sysctl.h>

--- 47 unchanged lines hidden (view full) ---

95 */
96
97static u_char cn_is_open; /* nonzero if logical console is open */
98static int openmode, openflag; /* how /dev/console was openned */
99static u_char cn_phys_is_open; /* nonzero if physical device is open */
100static d_close_t *cn_phys_close; /* physical device close function */
101static d_open_t *cn_phys_open; /* physical device open function */
102struct consdev *cn_tab; /* physical console device info */
103static struct tty *cn_tp; /* physical console tty struct */
104static dev_t condev_t; /* represents the device private info */
105
106CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL);
107
108void
109cninit()
110{
111 struct consdev **list, *best_cp, *cp;

--- 58 unchanged lines hidden (view full) ---

170 /*
171 * Hook the open and close functions.
172 */
173 cdp = devsw(cn_tab->cn_dev);
174 cn_phys_close = cdp->d_close;
175 cdp->d_close = cnclose;
176 cn_phys_open = cdp->d_open;
177 cdp->d_open = cnopen;
103static dev_t condev_t; /* represents the device private info */
104
105CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL);
106
107void
108cninit()
109{
110 struct consdev **list, *best_cp, *cp;

--- 58 unchanged lines hidden (view full) ---

169 /*
170 * Hook the open and close functions.
171 */
172 cdp = devsw(cn_tab->cn_dev);
173 cn_phys_close = cdp->d_close;
174 cdp->d_close = cnclose;
175 cn_phys_open = cdp->d_open;
176 cdp->d_open = cnopen;
178 cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev);
179 cn_dev_t = cn_tab->cn_dev;
180 cn_udev_t = dev2udev(cn_dev_t);
181}
182
183static void
184cnuninit(void)
185{
186 struct cdevsw *cdp;

--- 4 unchanged lines hidden (view full) ---

191 /*
192 * Unhook the open and close functions.
193 */
194 cdp = devsw(cn_tab->cn_dev);
195 cdp->d_close = cn_phys_close;
196 cn_phys_close = NULL;
197 cdp->d_open = cn_phys_open;
198 cn_phys_open = NULL;
177 cn_dev_t = cn_tab->cn_dev;
178 cn_udev_t = dev2udev(cn_dev_t);
179}
180
181static void
182cnuninit(void)
183{
184 struct cdevsw *cdp;

--- 4 unchanged lines hidden (view full) ---

189 /*
190 * Unhook the open and close functions.
191 */
192 cdp = devsw(cn_tab->cn_dev);
193 cdp->d_close = cn_phys_close;
194 cn_phys_close = NULL;
195 cdp->d_open = cn_phys_open;
196 cn_phys_open = NULL;
199 cn_tp = NULL;
200 cn_dev_t = NODEV;
201 cn_udev_t = NOUDEV;
202}
203
204/*
205 * User has changed the state of the console muting.
206 * This may require us to open or close the device in question.
207 */

--- 68 unchanged lines hidden (view full) ---

276 */
277 if (dev == cndev)
278 cn_phys_is_open = 1;
279 else if (physdev == cndev) {
280 openmode = mode;
281 openflag = flag;
282 cn_is_open = 1;
283 }
197 cn_dev_t = NODEV;
198 cn_udev_t = NOUDEV;
199}
200
201/*
202 * User has changed the state of the console muting.
203 * This may require us to open or close the device in question.
204 */

--- 68 unchanged lines hidden (view full) ---

273 */
274 if (dev == cndev)
275 cn_phys_is_open = 1;
276 else if (physdev == cndev) {
277 openmode = mode;
278 openflag = flag;
279 cn_is_open = 1;
280 }
281 dev->si_tty = physdev->si_tty;
284 }
285 return (retval);
286}
287
288static int
289cnclose(dev, flag, mode, p)
290 dev_t dev;
291 int flag, mode;
292 struct proc *p;
293{
294 dev_t cndev;
282 }
283 return (retval);
284}
285
286static int
287cnclose(dev, flag, mode, p)
288 dev_t dev;
289 int flag, mode;
290 struct proc *p;
291{
292 dev_t cndev;
293 struct tty *cn_tp;
295
296 if (cn_tab == NULL)
297 return (0);
298 cndev = cn_tab->cn_dev;
294
295 if (cn_tab == NULL)
296 return (0);
297 cndev = cn_tab->cn_dev;
298 cn_tp = cndev->si_tty;
299 /*
300 * act appropriatly depending on whether it's /dev/console
301 * or the pysical device (e.g. /dev/sio) that's being closed.
302 * in either case, don't actually close the device unless
303 * both are closed.
304 */
305 if (dev == cndev) {
306 /* the physical device is about to be closed */

--- 136 unchanged lines hidden ---
299 /*
300 * act appropriatly depending on whether it's /dev/console
301 * or the pysical device (e.g. /dev/sio) that's being closed.
302 * in either case, don't actually close the device unless
303 * both are closed.
304 */
305 if (dev == cndev) {
306 /* the physical device is about to be closed */

--- 136 unchanged lines hidden ---