diff options
author | ed <ed@FreeBSD.org> | 2009-08-23 08:04:40 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-08-23 08:04:40 +0000 |
commit | 503bd5d6c51e4b39865925d17eb7f6d7708b93c6 (patch) | |
tree | 832ce47945c34ffc3c6cc8881a39f32c034bfb8a /sys/kern/tty_pts.c | |
parent | 659df31c6cd55ed551bd24d090e55b1df6e9f152 (diff) | |
download | FreeBSD-src-503bd5d6c51e4b39865925d17eb7f6d7708b93c6.zip FreeBSD-src-503bd5d6c51e4b39865925d17eb7f6d7708b93c6.tar.gz |
Add ttydisc_rint_simple().
I noticed several drivers in our tree don't actually care about parity
and framing, such as pts(4), snp(4) (and my partially finished console
driver). Instead of duplicating a lot of code, I think we'd better add a
utility function for those drivers to quickly process a buffer of input.
Also change pts(4) and snp(4) to use this function.
Diffstat (limited to 'sys/kern/tty_pts.c')
-rw-r--r-- | sys/kern/tty_pts.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index d5045c1..c77cf2a 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -215,25 +215,12 @@ ptsdev_write(struct file *fp, struct uio *uio, struct ucred *active_cred, */ MPASS(iblen > 0); do { - if (ttydisc_can_bypass(tp)) { - /* Store data at once. */ - rintlen = ttydisc_rint_bypass(tp, - ibstart, iblen); - ibstart += rintlen; - iblen -= rintlen; - - if (iblen == 0) { - /* All data written. */ - break; - } - } else { - error = ttydisc_rint(tp, *ibstart, 0); - if (error == 0) { - /* Character stored successfully. */ - ibstart++; - iblen--; - continue; - } + rintlen = ttydisc_rint_simple(tp, ibstart, iblen); + ibstart += rintlen; + iblen -= rintlen; + if (iblen == 0) { + /* All data written. */ + break; } /* Maybe the device isn't used anyway. */ |