diff options
author | phk <phk@FreeBSD.org> | 1996-01-25 07:21:50 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1996-01-25 07:21:50 +0000 |
commit | 8891fd7f8c133e0f978a7b116aad7d0e52115b18 (patch) | |
tree | 6baa972a9bc305c5c3ee0409ec4f53e6ea8304d6 | |
parent | 395d8976253f10ed7a47c9353ea87efd21574485 (diff) | |
download | FreeBSD-src-8891fd7f8c133e0f978a7b116aad7d0e52115b18.zip FreeBSD-src-8891fd7f8c133e0f978a7b116aad7d0e52115b18.tar.gz |
Avoid local sprintfs and other printf'isms.
-rw-r--r-- | sys/dev/cy/cy.c | 38 | ||||
-rw-r--r-- | sys/dev/cy/cy_isa.c | 38 | ||||
-rw-r--r-- | sys/dev/si/si.c | 39 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 40 | ||||
-rw-r--r-- | sys/i386/isa/cy.c | 38 | ||||
-rw-r--r-- | sys/i386/isa/si.c | 39 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 40 | ||||
-rw-r--r-- | sys/isa/sio.c | 40 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 15 |
9 files changed, 147 insertions, 180 deletions
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index d1b4e66..c9e44ce 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.28 1995/12/10 20:54:29 bde Exp $ + * $Id: cy.c,v 1.29 1995/12/22 15:02:22 bde Exp $ */ #include "cy.h" @@ -420,7 +420,6 @@ static int cy_nr_cd1400s[NCY]; #undef RxFifoThreshold static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2); -static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static struct kern_devconf kdc_sio[NCY] = { { 0, 0, 0, /* filled in by dev_attach */ "cyc", 0, { MDDT_ISA, 0, "tty" }, @@ -600,24 +599,23 @@ sioattach(isdp) cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS /* path, name, devsw, minor, type, uid, gid, perm */ - sprintf(name, "ttyc%c", chardev[unit]); - com->devfs_token_ttyd = devfs_add_devsw("/", name, &sio_cdevsw, - unit, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyic%c", chardev[unit]); - com->devfs_token_ttyi = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "ttylc%c", chardev[unit]); - com->devfs_token_ttyl = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "cuac%c", chardev[unit]); - com->devfs_token_cuaa = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660); - sprintf(name, "cuaic%c", chardev[unit]); - com->devfs_token_cuai = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660); - sprintf(name, "cualc%c", chardev[unit]); - com->devfs_token_cual = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660); + com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, + unit, DV_CHR, 0, 0, 0600, "ttyc%n", unit); + com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600, + "ttyic%n", unit); + com->devfs_token_ttyl = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600, + "ttylc%n", unit); + com->devfs_token_cuaa = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660, + "cuac%n", unit); + com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660, + "cuaic%n", unit); + com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660, + "cualc%n", unit); #endif } } diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index d1b4e66..c9e44ce 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.28 1995/12/10 20:54:29 bde Exp $ + * $Id: cy.c,v 1.29 1995/12/22 15:02:22 bde Exp $ */ #include "cy.h" @@ -420,7 +420,6 @@ static int cy_nr_cd1400s[NCY]; #undef RxFifoThreshold static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2); -static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static struct kern_devconf kdc_sio[NCY] = { { 0, 0, 0, /* filled in by dev_attach */ "cyc", 0, { MDDT_ISA, 0, "tty" }, @@ -600,24 +599,23 @@ sioattach(isdp) cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS /* path, name, devsw, minor, type, uid, gid, perm */ - sprintf(name, "ttyc%c", chardev[unit]); - com->devfs_token_ttyd = devfs_add_devsw("/", name, &sio_cdevsw, - unit, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyic%c", chardev[unit]); - com->devfs_token_ttyi = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "ttylc%c", chardev[unit]); - com->devfs_token_ttyl = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "cuac%c", chardev[unit]); - com->devfs_token_cuaa = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660); - sprintf(name, "cuaic%c", chardev[unit]); - com->devfs_token_cuai = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660); - sprintf(name, "cualc%c", chardev[unit]); - com->devfs_token_cual = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660); + com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, + unit, DV_CHR, 0, 0, 0600, "ttyc%n", unit); + com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600, + "ttyic%n", unit); + com->devfs_token_ttyl = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600, + "ttylc%n", unit); + com->devfs_token_cuaa = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660, + "cuac%n", unit); + com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660, + "cuaic%n", unit); + com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660, + "cualc%n", unit); #endif } } diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index df7509a..8be544f 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.34 1996/01/09 03:01:45 peter Exp $ + * $Id: si.c,v 1.35 1996/01/16 18:13:18 phk Exp $ */ #ifndef lint @@ -88,10 +88,6 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992", enum si_mctl { GET, SET, BIS, BIC }; -static const char devchar[] = "ABCDEFGHIJK"; -static const char portchar[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - - static void si_command __P((struct si_port *, int, int)); static int si_modem __P((struct si_port *, enum si_mctl, int)); static void si_write_enable __P((struct si_port *, int)); @@ -701,22 +697,18 @@ mem_fail: /* path name devsw minor type uid gid perm*/ for ( x = 0; x < sc->sc_nport; x++ ) { y = x + 1; /* For sync with the manuals that start at 1 */ - sprintf(name,"ttyA%02d", y); - sc->devfs_token[x].ttyd = devfs_add_devsw( - "/", name, &si_cdevsw, x, - DV_CHR, 0, 0, 0600); - sprintf(name,"cuaA%02d", y); - sc->devfs_token[x].cuaa = devfs_add_devsw( - "/", name, &si_cdevsw, x + 128, - DV_CHR, 0, 0, 0600); - sprintf(name,"ttyiA%02d", y); - sc->devfs_token[x].ttyi = devfs_add_devsw( - "/", name, &si_cdevsw, x + 0x10000, - DV_CHR, 0, 0, 0600); - sprintf(name,"ttylA%02d", y); - sc->devfs_token[x].ttyl = devfs_add_devsw( - "/", name, &si_cdevsw, x + 0x20000, - DV_CHR, 0, 0, 0600); + sc->devfs_token[x].ttyd = devfs_add_devswf( + &si_cdevsw, x, + DV_CHR, 0, 0, 0600, "ttyA%02d", y); + sc->devfs_token[x].cuaa = devfs_add_devswf( + &si_cdevsw, x + 128, + DV_CHR, 0, 0, 0600, "cuaA%02d", y); + sc->devfs_token[x].ttyi = devfs_add_devswf( + &si_cdevsw, x + 0x10000, + DV_CHR, 0, 0, 0600, "ttyiA%02d", y); + sc->devfs_token[x].ttyl = devfs_add_devswf( + &si_cdevsw, x + 0x20000, + DV_CHR, 0, 0, 0600, "ttylA%02d", y); } sc->control_token = devfs_add_devsw("/", "si_control", &si_cdevsw, 0x40000, @@ -2339,14 +2331,15 @@ si_dprintf(pp, flags, fmt, va_alist) #endif { va_list ap; + if ((pp == NULL && (si_debug&flags)) || (pp != NULL && ((pp->sp_debug&flags) || (si_debug&flags)))) { - va_start(ap, fmt); if (pp != NULL) printf("%ci%d(%d): ", 's', (int)SI_CARD(pp->sp_tty->t_dev), (int)SI_PORT(pp->sp_tty->t_dev)); - printf("%r", fmt, ap); + va_start(ap, fmt); + vprintf(fmt, ap); va_end(ap); } } diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index d0797c6..b868330 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.132 1995/12/30 03:52:58 bde Exp $ + * $Id: sio.c,v 1.133 1996/01/04 21:11:37 wollman Exp $ */ #include "sio.h" @@ -279,8 +279,10 @@ void siopoll __P((void)); #define siommap nommap #define siostrategy nostrategy +#ifdef COM_ESP static int espattach __P((struct isa_device *isdp, struct com_s *com, Port_t esp_port)); +#endif static int sioattach __P((struct isa_device *dev)); static timeout_t siodtrwakeup; static void comhardclose __P((struct com_s *com)); @@ -369,7 +371,6 @@ static struct speedtab comspeedtab[] = { { -1, -1 } }; -static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static struct kern_devconf kdc_sio[NSIO] = { { 0, 0, 0, /* filled in by dev_attach */ driver_name, 0, { MDDT_ISA, 0, "tty" }, @@ -801,7 +802,6 @@ sioattach(isdp) Port_t *espp; #endif Port_t iobase; - char name[32]; int s; int unit; @@ -1050,25 +1050,21 @@ determined_type: ; dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS - /* path, name, devsw, minor, type, uid, gid, perm */ - sprintf(name, "ttyd%c", chardev[unit]); - com->devfs_token_ttyd = devfs_add_devsw("/", name, &sio_cdevsw, - unit, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyid%c", chardev[unit]); - com->devfs_token_ttyi = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyld%c", chardev[unit]); - com->devfs_token_ttyl = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "cuaa%c", chardev[unit]); - com->devfs_token_cuaa = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660); - sprintf(name, "cuaia%c", chardev[unit]); - com->devfs_token_cuai = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660); - sprintf(name, "cuala%c", chardev[unit]); - com->devfs_token_cual = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660); + /* devsw, minor, type, uid, gid, perm, fmt, ... */ + com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, + unit, DV_CHR, 0, 0, 0600, "ttyd%n", unit); + com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600, "ttyid%n", unit); + com->devfs_token_ttyl = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600, "ttyld%n", unit); + com->devfs_token_cuaa = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660, "cuaa%n", unit); + com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660, + "cuaia%n", unit); + com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660, + "cuala%n", unit); #endif return (1); } diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index d1b4e66..c9e44ce 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.28 1995/12/10 20:54:29 bde Exp $ + * $Id: cy.c,v 1.29 1995/12/22 15:02:22 bde Exp $ */ #include "cy.h" @@ -420,7 +420,6 @@ static int cy_nr_cd1400s[NCY]; #undef RxFifoThreshold static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2); -static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static struct kern_devconf kdc_sio[NCY] = { { 0, 0, 0, /* filled in by dev_attach */ "cyc", 0, { MDDT_ISA, 0, "tty" }, @@ -600,24 +599,23 @@ sioattach(isdp) cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS /* path, name, devsw, minor, type, uid, gid, perm */ - sprintf(name, "ttyc%c", chardev[unit]); - com->devfs_token_ttyd = devfs_add_devsw("/", name, &sio_cdevsw, - unit, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyic%c", chardev[unit]); - com->devfs_token_ttyi = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "ttylc%c", chardev[unit]); - com->devfs_token_ttyl = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "cuac%c", chardev[unit]); - com->devfs_token_cuaa = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660); - sprintf(name, "cuaic%c", chardev[unit]); - com->devfs_token_cuai = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660); - sprintf(name, "cualc%c", chardev[unit]); - com->devfs_token_cual = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660); + com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, + unit, DV_CHR, 0, 0, 0600, "ttyc%n", unit); + com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600, + "ttyic%n", unit); + com->devfs_token_ttyl = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600, + "ttylc%n", unit); + com->devfs_token_cuaa = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660, + "cuac%n", unit); + com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660, + "cuaic%n", unit); + com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660, + "cualc%n", unit); #endif } } diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index df7509a..8be544f 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.34 1996/01/09 03:01:45 peter Exp $ + * $Id: si.c,v 1.35 1996/01/16 18:13:18 phk Exp $ */ #ifndef lint @@ -88,10 +88,6 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992", enum si_mctl { GET, SET, BIS, BIC }; -static const char devchar[] = "ABCDEFGHIJK"; -static const char portchar[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - - static void si_command __P((struct si_port *, int, int)); static int si_modem __P((struct si_port *, enum si_mctl, int)); static void si_write_enable __P((struct si_port *, int)); @@ -701,22 +697,18 @@ mem_fail: /* path name devsw minor type uid gid perm*/ for ( x = 0; x < sc->sc_nport; x++ ) { y = x + 1; /* For sync with the manuals that start at 1 */ - sprintf(name,"ttyA%02d", y); - sc->devfs_token[x].ttyd = devfs_add_devsw( - "/", name, &si_cdevsw, x, - DV_CHR, 0, 0, 0600); - sprintf(name,"cuaA%02d", y); - sc->devfs_token[x].cuaa = devfs_add_devsw( - "/", name, &si_cdevsw, x + 128, - DV_CHR, 0, 0, 0600); - sprintf(name,"ttyiA%02d", y); - sc->devfs_token[x].ttyi = devfs_add_devsw( - "/", name, &si_cdevsw, x + 0x10000, - DV_CHR, 0, 0, 0600); - sprintf(name,"ttylA%02d", y); - sc->devfs_token[x].ttyl = devfs_add_devsw( - "/", name, &si_cdevsw, x + 0x20000, - DV_CHR, 0, 0, 0600); + sc->devfs_token[x].ttyd = devfs_add_devswf( + &si_cdevsw, x, + DV_CHR, 0, 0, 0600, "ttyA%02d", y); + sc->devfs_token[x].cuaa = devfs_add_devswf( + &si_cdevsw, x + 128, + DV_CHR, 0, 0, 0600, "cuaA%02d", y); + sc->devfs_token[x].ttyi = devfs_add_devswf( + &si_cdevsw, x + 0x10000, + DV_CHR, 0, 0, 0600, "ttyiA%02d", y); + sc->devfs_token[x].ttyl = devfs_add_devswf( + &si_cdevsw, x + 0x20000, + DV_CHR, 0, 0, 0600, "ttylA%02d", y); } sc->control_token = devfs_add_devsw("/", "si_control", &si_cdevsw, 0x40000, @@ -2339,14 +2331,15 @@ si_dprintf(pp, flags, fmt, va_alist) #endif { va_list ap; + if ((pp == NULL && (si_debug&flags)) || (pp != NULL && ((pp->sp_debug&flags) || (si_debug&flags)))) { - va_start(ap, fmt); if (pp != NULL) printf("%ci%d(%d): ", 's', (int)SI_CARD(pp->sp_tty->t_dev), (int)SI_PORT(pp->sp_tty->t_dev)); - printf("%r", fmt, ap); + va_start(ap, fmt); + vprintf(fmt, ap); va_end(ap); } } diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index d0797c6..b868330 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.132 1995/12/30 03:52:58 bde Exp $ + * $Id: sio.c,v 1.133 1996/01/04 21:11:37 wollman Exp $ */ #include "sio.h" @@ -279,8 +279,10 @@ void siopoll __P((void)); #define siommap nommap #define siostrategy nostrategy +#ifdef COM_ESP static int espattach __P((struct isa_device *isdp, struct com_s *com, Port_t esp_port)); +#endif static int sioattach __P((struct isa_device *dev)); static timeout_t siodtrwakeup; static void comhardclose __P((struct com_s *com)); @@ -369,7 +371,6 @@ static struct speedtab comspeedtab[] = { { -1, -1 } }; -static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static struct kern_devconf kdc_sio[NSIO] = { { 0, 0, 0, /* filled in by dev_attach */ driver_name, 0, { MDDT_ISA, 0, "tty" }, @@ -801,7 +802,6 @@ sioattach(isdp) Port_t *espp; #endif Port_t iobase; - char name[32]; int s; int unit; @@ -1050,25 +1050,21 @@ determined_type: ; dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS - /* path, name, devsw, minor, type, uid, gid, perm */ - sprintf(name, "ttyd%c", chardev[unit]); - com->devfs_token_ttyd = devfs_add_devsw("/", name, &sio_cdevsw, - unit, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyid%c", chardev[unit]); - com->devfs_token_ttyi = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyld%c", chardev[unit]); - com->devfs_token_ttyl = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "cuaa%c", chardev[unit]); - com->devfs_token_cuaa = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660); - sprintf(name, "cuaia%c", chardev[unit]); - com->devfs_token_cuai = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660); - sprintf(name, "cuala%c", chardev[unit]); - com->devfs_token_cual = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660); + /* devsw, minor, type, uid, gid, perm, fmt, ... */ + com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, + unit, DV_CHR, 0, 0, 0600, "ttyd%n", unit); + com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600, "ttyid%n", unit); + com->devfs_token_ttyl = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600, "ttyld%n", unit); + com->devfs_token_cuaa = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660, "cuaa%n", unit); + com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660, + "cuaia%n", unit); + com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660, + "cuala%n", unit); #endif return (1); } diff --git a/sys/isa/sio.c b/sys/isa/sio.c index d0797c6..b868330 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.132 1995/12/30 03:52:58 bde Exp $ + * $Id: sio.c,v 1.133 1996/01/04 21:11:37 wollman Exp $ */ #include "sio.h" @@ -279,8 +279,10 @@ void siopoll __P((void)); #define siommap nommap #define siostrategy nostrategy +#ifdef COM_ESP static int espattach __P((struct isa_device *isdp, struct com_s *com, Port_t esp_port)); +#endif static int sioattach __P((struct isa_device *dev)); static timeout_t siodtrwakeup; static void comhardclose __P((struct com_s *com)); @@ -369,7 +371,6 @@ static struct speedtab comspeedtab[] = { { -1, -1 } }; -static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz"; static struct kern_devconf kdc_sio[NSIO] = { { 0, 0, 0, /* filled in by dev_attach */ driver_name, 0, { MDDT_ISA, 0, "tty" }, @@ -801,7 +802,6 @@ sioattach(isdp) Port_t *espp; #endif Port_t iobase; - char name[32]; int s; int unit; @@ -1050,25 +1050,21 @@ determined_type: ; dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS - /* path, name, devsw, minor, type, uid, gid, perm */ - sprintf(name, "ttyd%c", chardev[unit]); - com->devfs_token_ttyd = devfs_add_devsw("/", name, &sio_cdevsw, - unit, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyid%c", chardev[unit]); - com->devfs_token_ttyi = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "ttyld%c", chardev[unit]); - com->devfs_token_ttyl = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600); - sprintf(name, "cuaa%c", chardev[unit]); - com->devfs_token_cuaa = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660); - sprintf(name, "cuaia%c", chardev[unit]); - com->devfs_token_cuai = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660); - sprintf(name, "cuala%c", chardev[unit]); - com->devfs_token_cual = devfs_add_devsw("/", name, &sio_cdevsw, - unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660); + /* devsw, minor, type, uid, gid, perm, fmt, ... */ + com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, + unit, DV_CHR, 0, 0, 0600, "ttyd%n", unit); + com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0600, "ttyid%n", unit); + com->devfs_token_ttyl = devfs_add_devswf(&sio_cdevsw, + unit | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0600, "ttyld%n", unit); + com->devfs_token_cuaa = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK, DV_CHR, 0, 0, 0660, "cuaa%n", unit); + com->devfs_token_cuai = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_INIT_STATE, DV_CHR, 0, 0, 0660, + "cuaia%n", unit); + com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, + unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 0, 0, 0660, + "cuala%n", unit); #endif return (1); } diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index b1534f6..d55d2b7 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tty_pty.c 8.2 (Berkeley) 9/23/93 - * $Id: tty_pty.c,v 1.33 1995/12/14 08:31:59 phk Exp $ + * $Id: tty_pty.c,v 1.34 1995/12/22 15:53:53 bde Exp $ */ /* @@ -771,7 +771,6 @@ static ptc_devsw_installed = 0; static void *devfs_token_pts[MAXUNITS]; static void *devfs_token_ptc[MAXUNITS]; static const char jnames[] = "pqrsPQRS"; -static const char knames[] = "0123456789abcdefghijklmnopqrstuv"; #endif static void @@ -800,14 +799,14 @@ ptc_drvinit(void *unused) j = i / 32; k = i % 32; - sprintf(name,"tty%c%c",jnames[j],knames[k]); devfs_token_pts[i] = - devfs_add_devsw("/",name,&pts_cdevsw,i, - DV_CHR,0,0,0666); - sprintf(name,"pty%c%c",jnames[j],knames[k]); + devfs_add_devswf(&pts_cdevsw,i, + DV_CHR,0,0,0666, + "tty%c%n",j,k); devfs_token_ptc[i] = - devfs_add_devsw("/",name,&ptc_cdevsw,i, - DV_CHR,0,0,0666); + devfs_add_devswf(&ptc_cdevsw,i, + DV_CHR,0,0,0666, + "pty%c%n",j,k); } #endif } |