kern_cons.c (12701) | kern_cons.c (12813) |
---|---|
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 * $Id: cons.c,v 1.38 1995/12/08 23:20:00 phk Exp $ | 39 * $Id: cons.c,v 1.39 1995/12/09 20:39:45 phk Exp $ |
40 */ 41 42#include <sys/param.h> 43#ifdef DEVFS 44#include <sys/devfsext.h> 45#endif /*DEVFS*/ 46#include <sys/systm.h> 47#include <sys/conf.h> --- 97 unchanged lines hidden (view full) --- 145 struct cdevsw *cdp; 146 147 if (cn_tab == NULL) 148 return; 149 150 /* 151 * Hook the open and close functions. 152 */ | 40 */ 41 42#include <sys/param.h> 43#ifdef DEVFS 44#include <sys/devfsext.h> 45#endif /*DEVFS*/ 46#include <sys/systm.h> 47#include <sys/conf.h> --- 97 unchanged lines hidden (view full) --- 145 struct cdevsw *cdp; 146 147 if (cn_tab == NULL) 148 return; 149 150 /* 151 * Hook the open and close functions. 152 */ |
153 cdp = &cdevsw[major(cn_tab->cn_dev)]; | 153 cdp = cdevsw[major(cn_tab->cn_dev)]; |
154 cn_phys_close = cdp->d_close; 155 cdp->d_close = cnclose; 156 cn_phys_open = cdp->d_open; 157 cdp->d_open = cnopen; 158 cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev); 159 cn_dev_t = cn_tp->t_dev; 160} 161 --- 57 unchanged lines hidden (view full) --- 219cnread(dev, uio, flag) 220 dev_t dev; 221 struct uio *uio; 222 int flag; 223{ 224 if (cn_tab == NULL) 225 return (0); 226 dev = cn_tab->cn_dev; | 154 cn_phys_close = cdp->d_close; 155 cdp->d_close = cnclose; 156 cn_phys_open = cdp->d_open; 157 cdp->d_open = cnopen; 158 cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev); 159 cn_dev_t = cn_tp->t_dev; 160} 161 --- 57 unchanged lines hidden (view full) --- 219cnread(dev, uio, flag) 220 dev_t dev; 221 struct uio *uio; 222 int flag; 223{ 224 if (cn_tab == NULL) 225 return (0); 226 dev = cn_tab->cn_dev; |
227 return ((*cdevsw[major(dev)].d_read)(dev, uio, flag)); | 227 return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag)); |
228} 229 230static int 231cnwrite(dev, uio, flag) 232 dev_t dev; 233 struct uio *uio; 234 int flag; 235{ 236 if (cn_tab == NULL) 237 return (0); 238 if (constty) 239 dev = constty->t_dev; 240 else 241 dev = cn_tab->cn_dev; | 228} 229 230static int 231cnwrite(dev, uio, flag) 232 dev_t dev; 233 struct uio *uio; 234 int flag; 235{ 236 if (cn_tab == NULL) 237 return (0); 238 if (constty) 239 dev = constty->t_dev; 240 else 241 dev = cn_tab->cn_dev; |
242 return ((*cdevsw[major(dev)].d_write)(dev, uio, flag)); | 242 return ((*cdevsw[major(dev)]->d_write)(dev, uio, flag)); |
243} 244 245static int 246cnioctl(dev, cmd, data, flag, p) 247 dev_t dev; 248 int cmd; 249 caddr_t data; 250 int flag; --- 10 unchanged lines hidden (view full) --- 261 if (cmd == TIOCCONS && constty) { 262 error = suser(p->p_ucred, (u_short *) NULL); 263 if (error) 264 return (error); 265 constty = NULL; 266 return (0); 267 } 268 dev = cn_tab->cn_dev; | 243} 244 245static int 246cnioctl(dev, cmd, data, flag, p) 247 dev_t dev; 248 int cmd; 249 caddr_t data; 250 int flag; --- 10 unchanged lines hidden (view full) --- 261 if (cmd == TIOCCONS && constty) { 262 error = suser(p->p_ucred, (u_short *) NULL); 263 if (error) 264 return (error); 265 constty = NULL; 266 return (0); 267 } 268 dev = cn_tab->cn_dev; |
269 return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p)); | 269 return ((*cdevsw[major(dev)]->d_ioctl)(dev, cmd, data, flag, p)); |
270} 271 272static int 273cnselect(dev, rw, p) 274 dev_t dev; 275 int rw; 276 struct proc *p; 277{ 278 if (cn_tab == NULL) 279 return (1); 280 281 dev = cn_tab->cn_dev; 282 | 270} 271 272static int 273cnselect(dev, rw, p) 274 dev_t dev; 275 int rw; 276 struct proc *p; 277{ 278 if (cn_tab == NULL) 279 return (1); 280 281 dev = cn_tab->cn_dev; 282 |
283 return ((*cdevsw[major(dev)].d_select)(dev, rw, p)); | 283 return ((*cdevsw[major(dev)]->d_select)(dev, rw, p)); |
284} 285 286int 287cngetc() 288{ 289 int c; 290 if (cn_tab == NULL) 291 return (0); --- 62 unchanged lines hidden --- | 284} 285 286int 287cngetc() 288{ 289 int c; 290 if (cn_tab == NULL) 291 return (0); --- 62 unchanged lines hidden --- |