From b7b4b455b5030fc39fea25b2eadaf629416d432d Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 9 Jun 2004 10:21:53 +0000 Subject: [PATCH] Rename struct pt_ioctl to "ptsc" and pointers to it from "pti" to "pt" --- sys/kern/tty_pty.c | 130 ++++++++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index b0693c41c49f..85511c9ed60c 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -103,7 +103,7 @@ static struct cdevsw ptc_cdevsw = { #define BUFSIZ 100 /* Chunk size iomoved to/from user */ -struct pt_ioctl { +struct ptsc { int pt_flags; struct selinfo pt_selr, pt_selw; u_char pt_send; @@ -137,7 +137,7 @@ static dev_t ptyinit(dev_t devc) { dev_t devs; - struct pt_ioctl *pt; + struct ptsc *pt; int n; n = minor(devc); @@ -165,11 +165,11 @@ ptsopen(dev_t dev, int flag, int devtype, struct thread *td) { struct tty *tp; int error; - struct pt_ioctl *pti; + struct ptsc *pt; if (!dev->si_drv1) return(ENXIO); - pti = dev->si_drv1; + pt = dev->si_drv1; tp = dev->si_tty; if ((tp->t_state & TS_ISOPEN) == 0) { ttychars(tp); /* Set up default chars */ @@ -180,7 +180,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct thread *td) tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; } else if (tp->t_state & TS_XCLUDE && suser(td)) return (EBUSY); - else if (pti->pt_prison != td->td_ucred->cr_prison) + else if (pt->pt_prison != td->td_ucred->cr_prison) return (EBUSY); if (tp->t_oproc) /* Ctrlr still around. */ (void)ttyld_modem(tp, 1); @@ -216,12 +216,12 @@ ptsread(dev_t dev, struct uio *uio, int flag) struct thread *td = curthread; struct proc *p = td->td_proc; struct tty *tp = dev->si_tty; - struct pt_ioctl *pti = dev->si_drv1; + struct ptsc *pt = dev->si_drv1; struct pgrp *pg; int error = 0; again: - if (pti->pt_flags & PF_REMOTE) { + if (pt->pt_flags & PF_REMOTE) { while (isbackground(p, tp)) { sx_slock(&proctree_lock); PROC_LOCK(p); @@ -291,13 +291,13 @@ ptswrite(dev_t dev, struct uio *uio, int flag) static void ptsstart(struct tty *tp) { - struct pt_ioctl *pti = tp->t_dev->si_drv1; + struct ptsc *pt = tp->t_dev->si_drv1; if (tp->t_state & TS_TTSTOP) return; - if (pti->pt_flags & PF_STOPPED) { - pti->pt_flags &= ~PF_STOPPED; - pti->pt_send = TIOCPKT_START; + if (pt->pt_flags & PF_STOPPED) { + pt->pt_flags &= ~PF_STOPPED; + pt->pt_send = TIOCPKT_START; } ptcwakeup(tp, FREAD); } @@ -305,14 +305,14 @@ ptsstart(struct tty *tp) static void ptcwakeup(struct tty *tp, int flag) { - struct pt_ioctl *pti = tp->t_dev->si_drv1; + struct ptsc *pt = tp->t_dev->si_drv1; if (flag & FREAD) { - selwakeuppri(&pti->pt_selr, TTIPRI); + selwakeuppri(&pt->pt_selr, TTIPRI); wakeup(TSA_PTC_READ(tp)); } if (flag & FWRITE) { - selwakeuppri(&pti->pt_selw, TTOPRI); + selwakeuppri(&pt->pt_selw, TTOPRI); wakeup(TSA_PTC_WRITE(tp)); } } @@ -321,7 +321,7 @@ static int ptcopen(dev_t dev, int flag, int devtype, struct thread *td) { struct tty *tp; - struct pt_ioctl *pti; + struct ptsc *pt; if (!dev->si_drv1) ptyinit(dev); @@ -335,11 +335,11 @@ ptcopen(dev_t dev, int flag, int devtype, struct thread *td) tp->t_stop = ptsstop; (void)ttyld_modem(tp, 1); tp->t_lflag &= ~EXTPROC; - pti = dev->si_drv1; - pti->pt_prison = td->td_ucred->cr_prison; - pti->pt_flags = 0; - pti->pt_send = 0; - pti->pt_ucntl = 0; + pt = dev->si_drv1; + pt->pt_prison = td->td_ucred->cr_prison; + pt->pt_flags = 0; + pt->pt_send = 0; + pt->pt_ucntl = 0; return (0); } @@ -373,7 +373,7 @@ static int ptcread(dev_t dev, struct uio *uio, int flag) { struct tty *tp = dev->si_tty; - struct pt_ioctl *pti = dev->si_drv1; + struct ptsc *pt = dev->si_drv1; char buf[BUFSIZ]; int error = 0, cc; @@ -385,23 +385,23 @@ ptcread(dev_t dev, struct uio *uio, int flag) */ for (;;) { if (tp->t_state&TS_ISOPEN) { - if (pti->pt_flags&PF_PKT && pti->pt_send) { - error = ureadc((int)pti->pt_send, uio); + if (pt->pt_flags&PF_PKT && pt->pt_send) { + error = ureadc((int)pt->pt_send, uio); if (error) return (error); - if (pti->pt_send & TIOCPKT_IOCTL) { + if (pt->pt_send & TIOCPKT_IOCTL) { cc = min(uio->uio_resid, sizeof(tp->t_termios)); uiomove(&tp->t_termios, cc, uio); } - pti->pt_send = 0; + pt->pt_send = 0; return (0); } - if (pti->pt_flags&PF_UCNTL && pti->pt_ucntl) { - error = ureadc((int)pti->pt_ucntl, uio); + if (pt->pt_flags&PF_UCNTL && pt->pt_ucntl) { + error = ureadc((int)pt->pt_ucntl, uio); if (error) return (error); - pti->pt_ucntl = 0; + pt->pt_ucntl = 0; return (0); } if (tp->t_outq.c_cc && (tp->t_state&TS_TTSTOP) == 0) @@ -415,7 +415,7 @@ ptcread(dev_t dev, struct uio *uio, int flag) if (error) return (error); } - if (pti->pt_flags & (PF_PKT|PF_UCNTL)) + if (pt->pt_flags & (PF_PKT|PF_UCNTL)) error = ureadc(0, uio); while (uio->uio_resid > 0 && error == 0) { cc = q_to_b(&tp->t_outq, buf, min(uio->uio_resid, BUFSIZ)); @@ -430,16 +430,16 @@ ptcread(dev_t dev, struct uio *uio, int flag) static void ptsstop(struct tty *tp, int flush) { - struct pt_ioctl *pti = tp->t_dev->si_drv1; + struct ptsc *pt = tp->t_dev->si_drv1; int flag; /* note: FLUSHREAD and FLUSHWRITE already ok */ if (flush == 0) { flush = TIOCPKT_STOP; - pti->pt_flags |= PF_STOPPED; + pt->pt_flags |= PF_STOPPED; } else - pti->pt_flags &= ~PF_STOPPED; - pti->pt_send |= flush; + pt->pt_flags &= ~PF_STOPPED; + pt->pt_send |= flush; /* change of perspective */ flag = 0; if (flush & FREAD) @@ -453,7 +453,7 @@ static int ptcpoll(dev_t dev, int events, struct thread *td) { struct tty *tp = dev->si_tty; - struct pt_ioctl *pti = dev->si_drv1; + struct ptsc *pt = dev->si_drv1; int revents = 0; int s; @@ -469,13 +469,13 @@ ptcpoll(dev_t dev, int events, struct thread *td) if (events & (POLLIN | POLLRDNORM)) if ((tp->t_state & TS_ISOPEN) && ((tp->t_outq.c_cc && (tp->t_state & TS_TTSTOP) == 0) || - ((pti->pt_flags & PF_PKT) && pti->pt_send) || - ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl))) + ((pt->pt_flags & PF_PKT) && pt->pt_send) || + ((pt->pt_flags & PF_UCNTL) && pt->pt_ucntl))) revents |= events & (POLLIN | POLLRDNORM); if (events & (POLLOUT | POLLWRNORM)) if (tp->t_state & TS_ISOPEN && - ((pti->pt_flags & PF_REMOTE) ? + ((pt->pt_flags & PF_REMOTE) ? (tp->t_canq.c_cc == 0) : ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) || (tp->t_canq.c_cc == 0 && (tp->t_lflag & ICANON))))) @@ -487,10 +487,10 @@ ptcpoll(dev_t dev, int events, struct thread *td) if (revents == 0) { if (events & (POLLIN | POLLRDNORM)) - selrecord(td, &pti->pt_selr); + selrecord(td, &pt->pt_selr); if (events & (POLLOUT | POLLWRNORM)) - selrecord(td, &pti->pt_selw); + selrecord(td, &pt->pt_selw); } splx(s); @@ -505,13 +505,13 @@ ptcwrite(dev_t dev, struct uio *uio, int flag) int cc = 0; u_char locbuf[BUFSIZ]; int cnt = 0; - struct pt_ioctl *pti = dev->si_drv1; + struct ptsc *pt = dev->si_drv1; int error = 0; again: if ((tp->t_state&TS_ISOPEN) == 0) goto block; - if (pti->pt_flags & PF_REMOTE) { + if (pt->pt_flags & PF_REMOTE) { if (tp->t_canq.c_cc) goto block; while ((uio->uio_resid > 0 || cc > 0) && @@ -609,7 +609,7 @@ static int ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct tty *tp = dev->si_tty; - struct pt_ioctl *pti = dev->si_drv1; + struct ptsc *pt = dev->si_drv1; u_char *cc = tp->t_cc; int stop, error; @@ -626,27 +626,27 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) case TIOCPKT: if (*(int *)data) { - if (pti->pt_flags & PF_UCNTL) + if (pt->pt_flags & PF_UCNTL) return (EINVAL); - pti->pt_flags |= PF_PKT; + pt->pt_flags |= PF_PKT; } else - pti->pt_flags &= ~PF_PKT; + pt->pt_flags &= ~PF_PKT; return (0); case TIOCUCNTL: if (*(int *)data) { - if (pti->pt_flags & PF_PKT) + if (pt->pt_flags & PF_PKT) return (EINVAL); - pti->pt_flags |= PF_UCNTL; + pt->pt_flags |= PF_UCNTL; } else - pti->pt_flags &= ~PF_UCNTL; + pt->pt_flags &= ~PF_UCNTL; return (0); case TIOCREMOTE: if (*(int *)data) - pti->pt_flags |= PF_REMOTE; + pt->pt_flags |= PF_REMOTE; else - pti->pt_flags &= ~PF_REMOTE; + pt->pt_flags &= ~PF_REMOTE; ttyflush(tp, FREAD|FWRITE); return (0); } @@ -699,15 +699,15 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * is turned on. */ if (*(int *)data) { - if (pti->pt_flags & PF_PKT) { - pti->pt_send |= TIOCPKT_IOCTL; + if (pt->pt_flags & PF_PKT) { + pt->pt_send |= TIOCPKT_IOCTL; ptcwakeup(tp, FREAD); } tp->t_lflag |= EXTPROC; } else { if ((tp->t_lflag & EXTPROC) && - (pti->pt_flags & PF_PKT)) { - pti->pt_send |= TIOCPKT_IOCTL; + (pt->pt_flags & PF_PKT)) { + pt->pt_send |= TIOCPKT_IOCTL; ptcwakeup(tp, FREAD); } tp->t_lflag &= ~EXTPROC; @@ -716,10 +716,10 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) } error = ttyioctl(dev, cmd, data, flag, td); if (error == ENOTTY) { - if (pti->pt_flags & PF_UCNTL && + if (pt->pt_flags & PF_UCNTL && (cmd & ~0xff) == UIOCCMD(0)) { if (cmd & 0xff) { - pti->pt_ucntl = (u_char)cmd; + pt->pt_ucntl = (u_char)cmd; ptcwakeup(tp, FREAD); } return (0); @@ -729,7 +729,7 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) /* * If external processing and packet mode send ioctl packet. */ - if ((tp->t_lflag&EXTPROC) && (pti->pt_flags & PF_PKT)) { + if ((tp->t_lflag&EXTPROC) && (pt->pt_flags & PF_PKT)) { switch(cmd) { case TIOCSETA: case TIOCSETAW: @@ -745,7 +745,7 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) case TIOCLBIC: case TIOCLSET: #endif - pti->pt_send |= TIOCPKT_IOCTL; + pt->pt_send |= TIOCPKT_IOCTL; ptcwakeup(tp, FREAD); break; default: @@ -754,18 +754,18 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) } stop = (tp->t_iflag & IXON) && CCEQ(cc[VSTOP], CTRL('s')) && CCEQ(cc[VSTART], CTRL('q')); - if (pti->pt_flags & PF_NOSTOP) { + if (pt->pt_flags & PF_NOSTOP) { if (stop) { - pti->pt_send &= ~TIOCPKT_NOSTOP; - pti->pt_send |= TIOCPKT_DOSTOP; - pti->pt_flags &= ~PF_NOSTOP; + pt->pt_send &= ~TIOCPKT_NOSTOP; + pt->pt_send |= TIOCPKT_DOSTOP; + pt->pt_flags &= ~PF_NOSTOP; ptcwakeup(tp, FREAD); } } else { if (!stop) { - pti->pt_send &= ~TIOCPKT_DOSTOP; - pti->pt_send |= TIOCPKT_NOSTOP; - pti->pt_flags |= PF_NOSTOP; + pt->pt_send &= ~TIOCPKT_DOSTOP; + pt->pt_send |= TIOCPKT_NOSTOP; + pt->pt_flags |= PF_NOSTOP; ptcwakeup(tp, FREAD); } }