Deleted Added
full compact
kern_cons.c (5) kern_cons.c (301)
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.

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

51#include "sys/proc.h"
52#include "sys/user.h"
53#include "sys/systm.h"
54#include "sys/buf.h"
55#include "sys/ioctl.h"
56#include "sys/tty.h"
57#include "sys/file.h"
58#include "sys/conf.h"
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.

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

51#include "sys/proc.h"
52#include "sys/user.h"
53#include "sys/systm.h"
54#include "sys/buf.h"
55#include "sys/ioctl.h"
56#include "sys/tty.h"
57#include "sys/file.h"
58#include "sys/conf.h"
59#include "sys/vnode.h"
59
60#include "cons.h"
61
62/* XXX - all this could be autoconfig()ed */
63int pccnprobe(), pccninit(), pccngetc(), pccnputc();
64#include "com.h"
65#if NCOM > 0
66int comcnprobe(), comcninit(), comcngetc(), comcnputc();

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

100 return;
101 /*
102 * Turn on console
103 */
104 cn_tty = cp->cn_tp;
105 (*cp->cn_init)(cp);
106}
107
60
61#include "cons.h"
62
63/* XXX - all this could be autoconfig()ed */
64int pccnprobe(), pccninit(), pccngetc(), pccnputc();
65#include "com.h"
66#if NCOM > 0
67int comcnprobe(), comcninit(), comcngetc(), comcnputc();

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

101 return;
102 /*
103 * Turn on console
104 */
105 cn_tty = cp->cn_tp;
106 (*cp->cn_init)(cp);
107}
108
109static struct vnode *cnopenvp = NULLVP;
110
111
108cnopen(dev, flag, mode, p)
109 dev_t dev;
110 int flag, mode;
111 struct proc *p;
112{
112cnopen(dev, flag, mode, p)
113 dev_t dev;
114 int flag, mode;
115 struct proc *p;
116{
117 int error;
118
119
113 if (cn_tab == NULL)
114 return (0);
115 dev = cn_tab->cn_dev;
120 if (cn_tab == NULL)
121 return (0);
122 dev = cn_tab->cn_dev;
123 if (cnopenvp == NULLVP)
124 if ((error = getdevvp(dev, &cnopenvp, VCHR))) {
125 printf("cnopen: getdevvp returned %d !\n", error);
126 return(error);
127 }
116 return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
117}
118
119cnclose(dev, flag, mode, p)
120 dev_t dev;
121 int flag, mode;
122 struct proc *p;
123{
128 return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
129}
130
131cnclose(dev, flag, mode, p)
132 dev_t dev;
133 int flag, mode;
134 struct proc *p;
135{
136 int error;
137
138
124 if (cn_tab == NULL)
125 return (0);
126 dev = cn_tab->cn_dev;
139 if (cn_tab == NULL)
140 return (0);
141 dev = cn_tab->cn_dev;
127 return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p));
142 if (vcount(cnopenvp) <= 1)
143 error = (*cdevsw[major(dev)].d_close)(dev, flag, mode, p);
144 else
145 error = 0;
146 if (error == 0) {
147 vrele(cnopenvp);
148 cnopenvp = NULLVP;
149 return(error);
150 }
128}
129
130cnread(dev, uio, flag)
131 dev_t dev;
132 struct uio *uio;
133{
134 if (cn_tab == NULL)
135 return (0);

--- 78 unchanged lines hidden ---
151}
152
153cnread(dev, uio, flag)
154 dev_t dev;
155 struct uio *uio;
156{
157 if (cn_tab == NULL)
158 return (0);

--- 78 unchanged lines hidden ---