Fix whitespace inconsistencies in the TTY layer and its drivers owned by me.
This commit is contained in:
parent
aaa232d41d
commit
7c9669276e
@ -79,7 +79,7 @@ ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp)
|
||||
/* Raise a warning when a legacy PTY has been allocated. */
|
||||
if (pty_warningcnt > 0) {
|
||||
pty_warningcnt--;
|
||||
log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n",
|
||||
log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n",
|
||||
td->td_proc->p_pid, td->td_name,
|
||||
pty_warningcnt ? "" : " - not logging anymore");
|
||||
}
|
||||
@ -139,8 +139,8 @@ static int
|
||||
pty_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
|
||||
switch(type) {
|
||||
case MOD_LOAD:
|
||||
switch(type) {
|
||||
case MOD_LOAD:
|
||||
EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000);
|
||||
make_dev_credf(MAKEDEV_ETERNAL_KLD, &ptmx_cdevsw, 0, NULL,
|
||||
UID_ROOT, GID_WHEEL, 0666, "ptmx");
|
||||
|
@ -158,7 +158,7 @@ snp_read(struct cdev *dev, struct uio *uio, int flag)
|
||||
error = devfs_get_cdevpriv((void **)&ss);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
|
||||
tp = ss->snp_tty;
|
||||
if (tp == NULL || tty_gone(tp))
|
||||
return (EIO);
|
||||
@ -198,7 +198,7 @@ snp_write(struct cdev *dev, struct uio *uio, int flag)
|
||||
error = devfs_get_cdevpriv((void **)&ss);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
|
||||
tp = ss->snp_tty;
|
||||
if (tp == NULL || tty_gone(tp))
|
||||
return (EIO);
|
||||
|
@ -643,7 +643,7 @@ scteken_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p)
|
||||
|
||||
while (src < end) {
|
||||
sc_vtb_move(&scp->vtb, src, dst, width);
|
||||
|
||||
|
||||
src += scp->xsize;
|
||||
dst += scp->xsize;
|
||||
}
|
||||
@ -658,7 +658,7 @@ scteken_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p)
|
||||
|
||||
while (src >= end) {
|
||||
sc_vtb_move(&scp->vtb, src, dst, width);
|
||||
|
||||
|
||||
src -= scp->xsize;
|
||||
dst -= scp->xsize;
|
||||
}
|
||||
|
@ -470,10 +470,10 @@ ttydev_write(struct cdev *dev, struct uio *uio, int ioflag)
|
||||
if (error)
|
||||
goto done;
|
||||
}
|
||||
|
||||
tp->t_flags |= TF_BUSY_OUT;
|
||||
|
||||
tp->t_flags |= TF_BUSY_OUT;
|
||||
error = ttydisc_write(tp, uio, ioflag);
|
||||
tp->t_flags &= ~TF_BUSY_OUT;
|
||||
tp->t_flags &= ~TF_BUSY_OUT;
|
||||
cv_signal(&tp->t_outserwait);
|
||||
}
|
||||
|
||||
@ -1054,7 +1054,7 @@ tty_rel_pgrp(struct tty *tp, struct pgrp *pg)
|
||||
|
||||
if (tp->t_pgrp == pg)
|
||||
tp->t_pgrp = NULL;
|
||||
|
||||
|
||||
tty_unlock(tp);
|
||||
}
|
||||
|
||||
@ -1241,7 +1241,7 @@ tty_signal_sessleader(struct tty *tp, int sig)
|
||||
|
||||
/* Make signals start output again. */
|
||||
tp->t_flags &= ~TF_STOPPED;
|
||||
|
||||
|
||||
if (tp->t_session != NULL && tp->t_session->s_leader != NULL) {
|
||||
p = tp->t_session->s_leader;
|
||||
PROC_LOCK(p);
|
||||
@ -1305,7 +1305,7 @@ tty_wait(struct tty *tp, struct cv *cv)
|
||||
/* Restart the system call when we may have been revoked. */
|
||||
if (tp->t_revokecnt != revokecnt)
|
||||
return (ERESTART);
|
||||
|
||||
|
||||
/* Bail out when the device slipped away. */
|
||||
if (tty_gone(tp))
|
||||
return (ENXIO);
|
||||
@ -1327,7 +1327,7 @@ tty_timedwait(struct tty *tp, struct cv *cv, int hz)
|
||||
/* Restart the system call when we may have been revoked. */
|
||||
if (tp->t_revokecnt != revokecnt)
|
||||
return (ERESTART);
|
||||
|
||||
|
||||
/* Bail out when the device slipped away. */
|
||||
if (tty_gone(tp))
|
||||
return (ENXIO);
|
||||
@ -1469,7 +1469,7 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
|
||||
return (error);
|
||||
|
||||
/* XXX: CLOCAL? */
|
||||
|
||||
|
||||
tp->t_termios.c_cflag = t->c_cflag & ~CIGNORE;
|
||||
tp->t_termios.c_ispeed = t->c_ispeed;
|
||||
tp->t_termios.c_ospeed = t->c_ospeed;
|
||||
@ -1708,7 +1708,7 @@ tty_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, struct thread *td)
|
||||
|
||||
if (tty_gone(tp))
|
||||
return (ENXIO);
|
||||
|
||||
|
||||
error = ttydevsw_ioctl(tp, cmd, data, td);
|
||||
if (error == ENOIOCTL)
|
||||
error = tty_generic_ioctl(tp, cmd, data, fflag, td);
|
||||
@ -1786,7 +1786,7 @@ ttyhook_defrint(struct tty *tp, char c, int flags)
|
||||
|
||||
if (ttyhook_rint_bypass(tp, &c, 1) != 1)
|
||||
return (-1);
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1812,7 +1812,7 @@ ttyhook_register(struct tty **rtp, struct proc *p, int fd,
|
||||
error = EBADF;
|
||||
goto done1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Make sure the vnode is bound to a character device.
|
||||
* Unlocked check for the vnode type is ok there, because we
|
||||
@ -1910,7 +1910,7 @@ ttyconsdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
|
||||
/* System console has no TTY associated. */
|
||||
if (dev_console->si_drv1 == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
|
||||
return (ttydev_open(dev, oflags, devtype, td));
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ void
|
||||
ttyinq_free(struct ttyinq *ti)
|
||||
{
|
||||
struct ttyinq_block *tib;
|
||||
|
||||
|
||||
ttyinq_flush(ti);
|
||||
ti->ti_quota = 0;
|
||||
|
||||
@ -276,7 +276,7 @@ ttyinq_write(struct ttyinq *ti, const void *buf, size_t nbytes, int quote)
|
||||
struct ttyinq_block *tib;
|
||||
unsigned int boff;
|
||||
size_t l;
|
||||
|
||||
|
||||
while (nbytes > 0) {
|
||||
boff = ti->ti_end % TTYINQ_DATASIZE;
|
||||
|
||||
@ -313,7 +313,7 @@ ttyinq_write(struct ttyinq *ti, const void *buf, size_t nbytes, int quote)
|
||||
nbytes -= l;
|
||||
ti->ti_end += l;
|
||||
}
|
||||
|
||||
|
||||
return (cbuf - (const char *)buf);
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ ttyinq_peekchar(struct ttyinq *ti, char *c, int *quote)
|
||||
|
||||
*c = tib->tib_data[boff];
|
||||
*quote = GETBIT(tib, boff);
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ void
|
||||
ttyoutq_free(struct ttyoutq *to)
|
||||
{
|
||||
struct ttyoutq_block *tob;
|
||||
|
||||
|
||||
ttyoutq_flush(to);
|
||||
to->to_quota = 0;
|
||||
|
||||
|
@ -295,7 +295,7 @@ ptsdev_ioctl(struct file *fp, u_long cmd, void *data,
|
||||
return (EINVAL);
|
||||
return copyout(p, fgn->buf, i);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We need to implement TIOCGPGRP and TIOCGSID here again. When
|
||||
* called on the pseudo-terminal master, it should not check if
|
||||
@ -563,7 +563,7 @@ ptsdev_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
|
||||
sb->st_uid = dev->si_uid;
|
||||
sb->st_gid = dev->si_gid;
|
||||
sb->st_mode = dev->si_mode | S_IFCHR;
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -823,7 +823,7 @@ posix_openpt(struct thread *td, struct posix_openpt_args *uap)
|
||||
*/
|
||||
if (uap->flags & ~(O_RDWR|O_NOCTTY))
|
||||
return (EINVAL);
|
||||
|
||||
|
||||
error = falloc(td, &fp, &fd, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -270,13 +270,13 @@ ttydisc_read_raw_interbyte_timer(struct tty *tp, struct uio *uio, int ioflag)
|
||||
|
||||
MPASS(tp->t_termios.c_cc[VMIN] != 0);
|
||||
MPASS(tp->t_termios.c_cc[VTIME] != 0);
|
||||
|
||||
|
||||
/*
|
||||
* When using the interbyte timer, the timer should be started
|
||||
* after the first byte has been received. We just call into the
|
||||
* generic read timer code after we've received the first byte.
|
||||
*/
|
||||
|
||||
|
||||
for (;;) {
|
||||
error = ttyinq_read_uio(&tp->t_inq, tp, uio,
|
||||
uio->uio_resid, 0);
|
||||
@ -331,7 +331,7 @@ ttydisc_read(struct tty *tp, struct uio *uio, int ioflag)
|
||||
/* Unset the input watermark when we've got enough space. */
|
||||
tty_hiwat_in_unblock(tp);
|
||||
}
|
||||
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ ttydisc_write(struct tty *tp, struct uio *uio, int ioflag)
|
||||
error = EWOULDBLOCK;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The driver may write back the data
|
||||
* synchronously. Be sure to check the high
|
||||
@ -567,7 +567,7 @@ ttydisc_optimize(struct tty *tp)
|
||||
} else if (!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) &&
|
||||
(!CMP_FLAG(i, BRKINT) || CMP_FLAG(i, IGNBRK)) &&
|
||||
(!CMP_FLAG(i, PARMRK) ||
|
||||
CMP_FLAG(i, IGNPAR|IGNBRK) == (IGNPAR|IGNBRK)) &&
|
||||
CMP_FLAG(i, IGNPAR|IGNBRK) == (IGNPAR|IGNBRK)) &&
|
||||
!CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) {
|
||||
tp->t_flags |= TF_BYPASS;
|
||||
} else {
|
||||
@ -583,7 +583,7 @@ ttydisc_modem(struct tty *tp, int open)
|
||||
|
||||
if (open)
|
||||
cv_broadcast(&tp->t_dcdwait);
|
||||
|
||||
|
||||
/*
|
||||
* Ignore modem status lines when CLOCAL is turned on, but don't
|
||||
* enter the zombie state when the TTY isn't opened, because
|
||||
@ -834,7 +834,7 @@ ttydisc_rint(struct tty *tp, char c, int flags)
|
||||
|
||||
if (ttyhook_hashook(tp, rint))
|
||||
return ttyhook_rint(tp, c, flags);
|
||||
|
||||
|
||||
if (tp->t_flags & TF_BYPASS)
|
||||
goto processed;
|
||||
|
||||
@ -1072,7 +1072,7 @@ ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len)
|
||||
size_t ret;
|
||||
|
||||
tty_lock_assert(tp, MA_OWNED);
|
||||
|
||||
|
||||
MPASS(tp->t_flags & TF_BYPASS);
|
||||
|
||||
atomic_add_long(&tty_nin, len);
|
||||
@ -1122,7 +1122,7 @@ ttydisc_rint_poll(struct tty *tp)
|
||||
l = ttyinq_bytesleft(&tp->t_inq);
|
||||
if (l == 0 && (tp->t_flags & TF_HIWAT_IN) == 0)
|
||||
return (1);
|
||||
|
||||
|
||||
return (l);
|
||||
}
|
||||
|
||||
@ -1201,7 +1201,7 @@ ttydisc_getc_uio(struct tty *tp, struct uio *uio)
|
||||
tty_unlock(tp);
|
||||
error = uiomove(buf, len, uio);
|
||||
tty_lock(tp);
|
||||
|
||||
|
||||
if (error != 0)
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user