diff options
author | ed <ed@FreeBSD.org> | 2008-08-20 08:31:58 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-08-20 08:31:58 +0000 |
commit | cc3116a9380fe32a751b584f3d8083698ccfba15 (patch) | |
tree | bd0c08a66997254385160ce71ea32029b99f99f9 /sys/dev/syscons/syscons.h | |
parent | b49301b5cd9ff43a7af0bd9054d9d1a328c0d212 (diff) | |
download | FreeBSD-src-cc3116a9380fe32a751b584f3d8083698ccfba15.zip FreeBSD-src-cc3116a9380fe32a751b584f3d8083698ccfba15.tar.gz |
Integrate the new MPSAFE TTY layer to the FreeBSD operating system.
The last half year I've been working on a replacement TTY layer for the
FreeBSD kernel. The new TTY layer was designed to improve the following:
- Improved driver model:
The old TTY layer has a driver model that is not abstract enough to
make it friendly to use. A good example is the output path, where the
device drivers directly access the output buffers. This means that an
in-kernel PPP implementation must always convert network buffers into
TTY buffers.
If a PPP implementation would be built on top of the new TTY layer
(still needs a hooks layer, though), it would allow the PPP
implementation to directly hand the data to the TTY driver.
- Improved hotplugging:
With the old TTY layer, it isn't entirely safe to destroy TTY's from
the system. This implementation has a two-step destructing design,
where the driver first abandons the TTY. After all threads have left
the TTY, the TTY layer calls a routine in the driver, which can be
used to free resources (unit numbers, etc).
The pts(4) driver also implements this feature, which means
posix_openpt() will now return PTY's that are created on the fly.
- Improved performance:
One of the major improvements is the per-TTY mutex, which is expected
to improve scalability when compared to the old Giant locking.
Another change is the unbuffered copying to userspace, which is both
used on TTY device nodes and PTY masters.
Upgrading should be quite straightforward. Unlike previous versions,
existing kernel configuration files do not need to be changed, except
when they reference device drivers that are listed in UPDATING.
Obtained from: //depot/projects/mpsafetty/...
Approved by: philip (ex-mentor)
Discussed: on the lists, at BSDCan, at the DevSummit
Sponsored by: Snow B.V., the Netherlands
dcons(4) fixed by: kan
Diffstat (limited to 'sys/dev/syscons/syscons.h')
-rw-r--r-- | sys/dev/syscons/syscons.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index f17b294..548cec6 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -102,9 +102,9 @@ */ #define SC_DRIVER_NAME "syscons" #endif -#define SC_VTY(dev) minor(dev) +#define SC_VTY(dev) (((sc_ttysoftc *)tty_softc(tp))->st_index) #define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty]) -#define SC_STAT(dev) (*((scr_stat **)&(dev)->si_drv1)) +#define SC_STAT(tp) (*((scr_stat **)&((sc_ttysoftc *)tty_softc(tp))->st_stat)) /* printable chars */ #ifndef PRINTABLE @@ -220,7 +220,7 @@ typedef struct sc_softc { int first_vty; int vtys; - struct cdev **dev; + struct tty **dev; struct scr_stat *cur_scp; struct scr_stat *new_scp; struct scr_stat *old_scp; @@ -339,6 +339,12 @@ typedef struct scr_stat { #endif } scr_stat; +/* TTY softc. */ +typedef struct sc_ttysoftc { + int st_index; + scr_stat *st_stat; +} sc_ttysoftc; + #ifndef SC_NORM_ATTR #define SC_NORM_ATTR (FG_LIGHTGREY | BG_BLACK) #endif @@ -364,7 +370,7 @@ typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); typedef int sc_term_term_t(scr_stat *scp, void **tcp); typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, - caddr_t data, int flag, struct thread *td); + caddr_t data, struct thread *td); typedef int sc_term_reset_t(scr_stat *scp, int code); #define SC_TE_HARD_RESET 0 #define SC_TE_SOFT_RESET 1 @@ -531,8 +537,8 @@ typedef struct { } while(0) /* syscons.c */ -extern int (*sc_user_ioctl)(struct cdev *dev, u_long cmd, caddr_t data, - int flag, struct thread *td); +extern int (*sc_user_ioctl)(struct tty *tp, u_long cmd, caddr_t data, + struct thread *td); int sc_probe_unit(int unit, int flags); int sc_attach_unit(int unit, int flags); @@ -574,7 +580,7 @@ void sc_hist_end(scr_stat *scp); int sc_hist_up_line(scr_stat *scp); int sc_hist_down_line(scr_stat *scp); int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, - int flag, struct thread *td); + struct thread *td); #endif /* SC_NO_HISTORY */ /* scmouse.c */ @@ -599,7 +605,7 @@ void sc_mouse_paste(scr_stat *scp); #ifndef SC_NO_SYSMOUSE void sc_mouse_move(scr_stat *scp, int x, int y); int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, - int flag, struct thread *td); + struct thread *td); #endif /* SC_NO_SYSMOUSE */ /* scvidctl.c */ @@ -609,7 +615,7 @@ int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode); int sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, int fontsize, int font_width); -int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, +int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td); int sc_render_add(sc_renderer_t *rndr); |