New serial speed handling: First implementation
Enclosed is a draft patch for the serial update which implements arbitary speeds in the core and fixes up some drivers.
What needs doing:
Architecture Maintainer
-----------------------
Define struct termios_v1 to be the existing "old style" termios
structure
Create a struct termios which adds speed_t type fields for c_ispeed andc_ospeed. You may wish to follow the glibc struct termios for simplicity.
Find an unused speed value and define it for other (BOTHER). For most
platforms CBAUDEX|0 is unused.
Add ioctl values for TCGETS2/TCSETS2/TCSETSW2/TCSETSF2 to match the
existing TCGETS/SETS ioctls but with struct termios (the new version)
Add user_termios_to_kernel_termios_1 and the reverse for copying old
style termios structures
Driver Author
-------------
From the point this change goes into the base kernel the baud rate is
always in tty->termios.c_ispeed (input rate) and tty->termios.c_ospeed (output rate). tty_get_baud_rate() will continue to give the correct answer but does not allow for differing input/output rates if your hardware can do it. Please move to using ispeed/ospeed directly.
In your speed changing routine set the baud rates to the one you set if
it differs from the requested speed. If you need to change it then - set the c_cflags CBAUD bits either to the Bxxx version of the speed or BOTHER and set c_ispeed/c_ospeed appropriately. If a lot of people need this I will add a helper.
In your init_termios ensure that you set valid c_ispeed/c_ospeed values
to match the termios structure Bxxx value you are currently specifiying.
Compatibility
-------------
tty_get_baud_rate() remains doing the right thing Peeking at CBAUD bits works for "old" speeds still
All the application functionality will continue with the
cfget/set*speed functions in glibc
For the moment the code handles anything except a pty (all ptys are
sorted) which forgets to set c_ispeed/c_ospeed on its init_termios. That will become a warning in time.
Thanks to Roland for reviewing ideas and pointing out CBAUDEX|0.
drivers/char/epca.c +4 -0
@@ -1240,6 +1240,8 @@ pc_driver->init_termios.c_oflag =0 ; pc_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |CLOCAL |HUPCL ; pc_driver->init_termios.c_lflag =0 ; + pc_driver->init_termios.c_ispeed =9600 ; + pc_driver->init_termios.c_ospeed =9600 ; pc_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (pc_driver, &pc_ops);
@@ -1254,6 +1256,8 @@ pc_info->init_termios.c_oflag =0 ; pc_info->init_termios.c_lflag =0 ; pc_info->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL ; + pc_info->init_termios.c_ispeed =9600 ; + pc_info->init_termios.c_ospeed =9600 ; pc_info->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (pc_info, &info_ops);
drivers/char/generic_serial.c +1 -10
@@ -746,11 +746,9 @@gs_dprintk (GS_DEBUG_TERMIOS ,"termios structure (%p):\n" , tiosp); } -#if 0 /* This is an optimization that is only allowed for dumb cards */ /* Smart cards require knowledge of iflags and oflags too: that might change hardware cooking mode.... */ -#endif if (old_termios) {if ( (tiosp->c_iflag == old_termios->c_iflag) && (tiosp->c_oflag == old_termios->c_oflag)
@@ -774,14 +772,7 @@if (!memcmp (tiosp->c_cc, old_termios->c_cc,NCC ))printk ("c_cc changed\n" ); } - baudrate = tiosp->c_cflag &CBAUD ; -if (baudrate &CBAUDEX ) { - baudrate &= ~CBAUDEX ; -if ((baudrate <1 ) || (baudrate >4 )) - tiosp->c_cflag &= ~CBAUDEX ; -else - baudrate +=15 ; - } + baudrate =tty_get_baud_rate (tty); baudrate = gs_baudrates[baudrate];if ((tiosp->c_cflag &CBAUD ) ==B38400 ) {
drivers/char/hvcs.c +3 -1
@@ -196,7 +196,9 @@ .c_iflag = IGNBRK | IGNPAR, .c_oflag = OPOST, .c_cflag = B38400 | CS8 | CREAD | HUPCL, - .c_cc = INIT_C_CC + .c_cc = INIT_C_CC, + .c_ispeed = 38400, + .c_ospeed = 38400 };/*
drivers/char/hvsi.c +2 -0
@@ -1159,6 +1159,8 @@ hvsi_driver->type =TTY_DRIVER_TYPE_SYSTEM ; hvsi_driver->init_termios = tty_std_termios; hvsi_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL ; + hvsi_driver->init_termios.c_ispeed =9600 ; + hvsi_driver->init_termios.c_ospeed =9600 ; hvsi_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (hvsi_driver, &hvsi_ops);
drivers/char/istallion.c +3 -19
@@ -197,6 +197,8 @@static struct termios stli_deftermios = { .c_cflag = (B9600 |CS8 |CREAD |HUPCL |CLOCAL ), .c_cc =INIT_C_CC , + .c_ispeed =9600 , + .c_ospeed =9600 , };/*
@@ -612,16 +614,6 @@#define MINOR2BRD (min) (((min) & 0xc0) >> 6)#define MINOR2PORT (min) ((min) & 0x3f) -/* -* Define a baud rate table that converts termios baud rate selector -* into the actual baud rate value. All baud rate calculations are based -* on the actual baud rate required. -*/ -static unsigned int stli_baudrates[] = { -0 ,50 ,75 ,110 ,134 ,150 ,200 ,300 ,600 ,1200 ,1800 ,2400 ,4800 , -9600 ,19200 ,38400 ,57600 ,115200 ,230400 ,460800 ,921600 -}; -/*****************************************************************************/ /*
@@ -2747,15 +2739,7 @@/* * Start of by setting the baud, char size, parity and stop bit info. */ - pp->baudout = tiosp->c_cflag &CBAUD ; -if (pp->baudout &CBAUDEX ) { - pp->baudout &= ~CBAUDEX ; -if ((pp->baudout <1 ) || (pp->baudout >4 )) - tiosp->c_cflag &= ~CBAUDEX ; -else - pp->baudout +=15 ; - } - pp->baudout = stli_baudrates[pp->baudout]; + pp->baudout =tty_get_baud_rate (portp->tty);if ((tiosp->c_cflag &CBAUD ) ==B38400 ) {if ((portp->flags &ASYNC_SPD_MASK ) ==ASYNC_SPD_HI ) pp->baudout =57600 ;
drivers/char/moxa.c +9 -75
127 lines not on this page · raw message
drivers/char/mxser.c +3 -65
80 lines not on this page · raw message
drivers/char/pty.c +8 -0
@@ -272,6 +272,8 @@ pty_driver->init_termios.c_oflag =0 ; pty_driver->init_termios.c_cflag =B38400 |CS8 |CREAD ; pty_driver->init_termios.c_lflag =0 ; + pty_driver->init_termios.c_ispeed =38400 ; + pty_driver->init_termios.c_ospeed =38400 ; pty_driver->flags =TTY_DRIVER_RESET_TERMIOS |TTY_DRIVER_REAL_RAW ; pty_driver->other = pty_slave_driver;tty_set_operations (pty_driver, &pty_ops);
@@ -286,6 +288,8 @@ pty_slave_driver->subtype =PTY_TYPE_SLAVE ; pty_slave_driver->init_termios = tty_std_termios; pty_slave_driver->init_termios.c_cflag =B38400 |CS8 |CREAD ; + pty_slave_driver->init_termios.c_ispeed =38400 ; + pty_slave_driver->init_termios.c_ospeed =38400 ; pty_slave_driver->flags =TTY_DRIVER_RESET_TERMIOS |TTY_DRIVER_REAL_RAW ; pty_slave_driver->other = pty_driver;
@@ -366,6 +370,8 @@ ptm_driver->init_termios.c_oflag =0 ; ptm_driver->init_termios.c_cflag =B38400 |CS8 |CREAD ; ptm_driver->init_termios.c_lflag =0 ; + ptm_driver->init_termios.c_ispeed =38400 ; + ptm_driver->init_termios.c_ospeed =38400 ; ptm_driver->flags =TTY_DRIVER_RESET_TERMIOS |TTY_DRIVER_REAL_RAW |TTY_DRIVER_DYNAMIC_DEV |TTY_DRIVER_DEVPTS_MEM ; ptm_driver->other = pts_driver;
@@ -381,6 +387,8 @@ pts_driver->subtype =PTY_TYPE_SLAVE ; pts_driver->init_termios = tty_std_termios; pts_driver->init_termios.c_cflag =B38400 |CS8 |CREAD ; + pts_driver->init_termios.c_ispeed =38400 ; + pts_driver->init_termios.c_ospeed =38400 ; pts_driver->flags =TTY_DRIVER_RESET_TERMIOS |TTY_DRIVER_REAL_RAW |TTY_DRIVER_DYNAMIC_DEV |TTY_DRIVER_DEVPTS_MEM ; pts_driver->other = ptm_driver;
drivers/char/riscom8.c +6 -18
@@ -675,26 +675,12 @@ port->COR2 =0 ; port->MSVR =MSVR_RTS ; - baud =C_BAUD (tty); - -if (baud &CBAUDEX ) { - baud &= ~CBAUDEX ; -if (baud <1 || baud >2 ) - port->tty->termios->c_cflag &= ~CBAUDEX ; -else - baud +=15 ; - } -if (baud ==15 ) { -if ((port->flags &ASYNC_SPD_MASK ) ==ASYNC_SPD_HI ) - baud ++; -if ((port->flags &ASYNC_SPD_MASK ) ==ASYNC_SPD_VHI ) - baud +=2 ; - } + baud =tty_get_baud_rate (tty);/* Select port on the board */ rc_out (bp,CD180_CAR ,port_No (port)); -if (!baud_table[baud]) { +if (!baud) {/* Drop DTR & exit */ bp->DTR |= (1u <<port_No (port));rc_out (bp,RC_DTR , bp->DTR);
@@ -710,7 +696,7 @@*/ /* Set baud rate for port */ - tmp = (((RC_OSCFREQ + baud_table[baud]/2 ) / baud_table[baud] + + tmp = (((RC_OSCFREQ + baud/2 ) / baud +CD180_TPC /2 ) /CD180_TPC );rc_out (bp,CD180_RBPRH , (tmp >>8 ) &0xff );
@@ -718,7 +704,7 @@rc_out (bp,CD180_RBPRL , tmp &0xff );rc_out (bp,CD180_TBPRL , tmp &0xff ); - baud = (baud_table[baud] +5 ) /10 ;/* Estimated CPS */ + baud = (baud +5 ) /10 ;/* Estimated CPS */ /* Two timer ticks seems enough to wakeup something like SLIP driver */ tmp = ((baud +HZ /2 ) /HZ ) *2 -CD180_NFIFO ;
@@ -1640,6 +1626,8 @@ riscom_driver->init_termios = tty_std_termios; riscom_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + riscom_driver->init_termios.c_ispeed =9600 ; + riscom_driver->init_termios.c_ospeed =9600 ; riscom_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (riscom_driver, &riscom_ops);if ((error =tty_register_driver (riscom_driver))) {
drivers/char/rocket.c +2 -0
@@ -2436,6 +2436,8 @@ rocket_driver->init_termios = tty_std_termios; rocket_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + rocket_driver->init_termios.c_ispeed =9600 ; + rocket_driver->init_termios.c_ospeed =9600 ;#ifdef ROCKET_SOFT_FLOW rocket_driver->flags |=TTY_DRIVER_REAL_RAW |TTY_DRIVER_DYNAMIC_DEV ;#endif
drivers/char/ser_a2232.c +2 -0
@@ -695,6 +695,8 @@ a2232_driver->init_termios = tty_std_termios; a2232_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + a2232_driver->init_termios.c_ispeed =9600 ; + a2232_driver->init_termios.c_ospeed =9600 ; a2232_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (a2232_driver, &a2232_ops);if ((error =tty_register_driver (a2232_driver))) {
drivers/char/specialix.c +6 -12
@@ -1087,24 +1087,16 @@ port->MSVR = (sx_in (bp, CD186x_MSVR) &MSVR_RTS );spin_unlock_irqrestore (&bp->lock, flags);dprintk (SX_DEBUG_TERMIOS ,"sx: got MSVR=%02x.\n" , port->MSVR); - baud =C_BAUD (tty); + baud =tty_get_baud_rate (tty); -if (baud &CBAUDEX ) { - baud &= ~CBAUDEX ; -if (baud <1 || baud >2 ) - port->tty->termios->c_cflag &= ~CBAUDEX ; -else - baud +=15 ; - } -if (baud ==15 ) { +if (baud ==38400 ) {if ((port->flags &ASYNC_SPD_MASK ) ==ASYNC_SPD_HI ) baud ++;if ((port->flags &ASYNC_SPD_MASK ) ==ASYNC_SPD_VHI ) baud +=2 ; } - -if (!baud_table[baud]) { +if (!baud) {/* Drop DTR & exit */ dprintk (SX_DEBUG_TERMIOS ,"Dropping DTR... Hmm....\n" );if (!SX_CRTSCTS (tty)) {
@@ -1134,7 +1126,7 @@"This is an untested option, please be carefull.\n" , port_No (port), tmp); else - tmp = (((SX_OSCFREQ + baud_table[baud]/2 ) / baud_table[baud] + + tmp = (((SX_OSCFREQ + baud/2 ) / baud + CD186x_TPC/2 ) / CD186x_TPC);if ((tmp <0x10 ) &&time_before (again, jiffies)) {
@@ -2420,6 +2412,8 @@ specialix_driver->init_termios = tty_std_termios; specialix_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + specialix_driver->init_termios.c_ispeed =9600 ; + specialix_driver->init_termios.c_ospeed =9600 ; specialix_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (specialix_driver, &sx_ops);
drivers/char/stallion.c +2 -0
@@ -146,6 +146,8 @@static struct termios stl_deftermios = { .c_cflag = (B9600 |CS8 |CREAD |HUPCL |CLOCAL ), .c_cc =INIT_C_CC , + .c_ispeed =9600 , + .c_ospeed =9600 , };/*
drivers/char/sx.c +2 -0
@@ -2263,6 +2263,8 @@ sx_driver->init_termios = tty_std_termios; sx_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + sx_driver->init_termios.c_ispeed =9600 ; + sx_driver->init_termios.c_ospeed =9600 ; sx_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (sx_driver, &sx_ops);
drivers/char/synclink.c +2 -0
@@ -4404,6 +4404,8 @@ serial_driver->init_termios = tty_std_termios; serial_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + serial_driver->init_termios.c_ispeed =9600 ; + serial_driver->init_termios.c_ospeed =9600 ; serial_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (serial_driver, &mgsl_ops);if ((rc =tty_register_driver (serial_driver)) <0 ) {
drivers/char/synclink_gt.c +2 -0
@@ -3537,6 +3537,8 @@ serial_driver->init_termios = tty_std_termios; serial_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + serial_driver->init_termios.c_ispeed =9600 ; + serial_driver->init_termios.c_ospeed =9600 ; serial_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (serial_driver, &ops);if ((rc =tty_register_driver (serial_driver)) <0 ) {
drivers/char/synclinkmp.c +2 -0
@@ -4033,6 +4033,8 @@ serial_driver->init_termios = tty_std_termios; serial_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + serial_driver->init_termios.c_ispeed =9600 ; + serial_driver->init_termios.c_ospeed =9600 ; serial_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (serial_driver, &ops);if ((rc =tty_register_driver (serial_driver)) <0 ) {
drivers/char/tty_io.c +18 -82
124 lines not on this page · raw message
drivers/char/tty_ioctl.c +127 -12
218 lines not on this page · raw message
drivers/char/vme_scc.c +2 -0
@@ -153,6 +153,8 @@ scc_driver->init_termios = tty_std_termios; scc_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + scc_driver->init_termios.c_ispeed =9600 ; + scc_driver->init_termios.c_ospeed =9600 ; scc_driver->flags =TTY_DRIVER_REAL_RAW ;tty_set_operations (scc_driver, &scc_ops);
drivers/serial/crisv10.c +2 -0
@@ -4877,6 +4877,8 @@ driver->init_termios = tty_std_termios; driver->init_termios.c_cflag =B115200 |CS8 |CREAD |HUPCL |CLOCAL ;/* is normally B9600 default... */ + driver->init_termios.c_ispeed =115200 ; + driver->init_termios.c_ospeed =115200 ; driver->flags =TTY_DRIVER_REAL_RAW |TTY_DRIVER_DYNAMIC_DEV ; driver->termios = serial_termios; driver->termios_locked = serial_termios_locked;
drivers/serial/serial_core.c +1 -0
@@ -2170,6 +2170,7 @@ normal->subtype =SERIAL_TYPE_NORMAL ; normal->init_termios = tty_std_termios; normal->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; + normal->init_termios.c_ispeed = normal->init_termios.c_ospeed =9600 ; normal->flags =TTY_DRIVER_REAL_RAW |TTY_DRIVER_DYNAMIC_DEV ; normal->driver_state = drv;tty_set_operations (normal, &uart_ops);
include/asm-i386/ioctls.h +6 -0
@@ -47,6 +47,12 @@#define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */ + +#define TCGETS2 0x542A +#define TCSETS2 0x542B +#define TCSETSW2 0x542C +#define TCSETSF2 0x542D +#define TIOCGPTN _IOR('T',0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T',0x31, int)/* Lock/unlock Pty */
include/asm-i386/termbits.h +13 -0
@@ -8,6 +8,16 @@typedef unsigned int tcflag_t ;#define NCCS 19 + +struct termios_v1 {/* Deprecated termios */ +tcflag_t c_iflag;/* input mode flags */ +tcflag_t c_oflag;/* output mode flags */ +tcflag_t c_cflag;/* control mode flags */ +tcflag_t c_lflag;/* local mode flags */ +cc_t c_line;/* line discipline */ +cc_t c_cc[NCCS ];/* control characters */ +}; +struct termios {tcflag_t c_iflag;/* input mode flags */ tcflag_t c_oflag;/* output mode flags */
@@ -15,6 +25,8 @@tcflag_t c_lflag;/* local mode flags */ cc_t c_line;/* line discipline */ cc_t c_cc[NCCS ];/* control characters */ +speed_t c_ispeed;/* input speed */ +speed_t c_ospeed;/* output speed */ };/* c_cc characters */
@@ -118,6 +130,7 @@#define HUPCL 0002000#define CLOCAL 0004000#define CBAUDEX 0010000 +#define BOTHER 0010000/* non standard rate */ #define B57600 0010001#define B115200 0010002#define B230400 0010003
include/asm-i386/termios.h +2 -0
@@ -99,6 +99,8 @@copy_to_user ((termio)->c_cc, (termios)->c_cc,NCC ); \ }) +#define user_termios_to_kernel_termios_1 (k, u) copy_from_user(k, u, sizeof(struct termios_1)) +#define kernel_termios_to_user_termios_1 (u, k) copy_to_user(u, k, sizeof(struct termios_1))#define user_termios_to_kernel_termios (k, u) copy_from_user(k, u, sizeof(struct termios))#define kernel_termios_to_user_termios (u, k) copy_to_user(u, k, sizeof(struct termios))
include/asm-x86_64/ioctls.h +6 -0
@@ -46,6 +46,12 @@#define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */ + +#define TCGETS2 0x542A +#define TCSETS2 0x542B +#define TCSETSW2 0x542C +#define TCSETSF2 0x542D +#define TIOCGPTN _IOR('T',0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T',0x31, int)/* Lock/unlock Pty */
include/asm-x86_64/termbits.h +13 -0
@@ -8,6 +8,15 @@typedef unsigned int tcflag_t ;#define NCCS 19 +struct termios_v1 { +tcflag_t c_iflag;/* input mode flags */ +tcflag_t c_oflag;/* output mode flags */ +tcflag_t c_cflag;/* control mode flags */ +tcflag_t c_lflag;/* local mode flags */ +cc_t c_line;/* line discipline */ +cc_t c_cc[NCCS ];/* control characters */ +}; +struct termios {tcflag_t c_iflag;/* input mode flags */ tcflag_t c_oflag;/* output mode flags */
@@ -15,8 +24,11 @@tcflag_t c_lflag;/* local mode flags */ cc_t c_line;/* line discipline */ cc_t c_cc[NCCS ];/* control characters */ +speed_t c_ispeed;/* input speed */ +speed_t c_ospeed;/* output speed */ }; +/* c_cc characters */ #define VINTR 0#define VQUIT 1
@@ -118,6 +130,7 @@#define HUPCL 0002000#define CLOCAL 0004000#define CBAUDEX 0010000 +#define BOTHER 0010000/* non standard rate */ #define B57600 0010001#define B115200 0010002#define B230400 0010003
include/asm-x86_64/termios.h +2 -0
@@ -98,6 +98,8 @@copy_to_user ((termio)->c_cc, (termios)->c_cc,NCC ); \ }) +#define user_termios_to_kernel_termios_1 (k, u) copy_from_user(k, u, sizeof(struct termios_v1)) +#define kernel_termios_to_user_termios_1 (u, k) copy_to_user(u, k, sizeof(struct termios_v1))#define user_termios_to_kernel_termios (k, u) copy_from_user(k, u, sizeof(struct termios))#define kernel_termios_to_user_termios (u, k) copy_to_user(u, k, sizeof(struct termios))
include/linux/tty.h +2 -2
@@ -294,8 +294,8 @@extern void do_SAK (struct tty_struct *tty);extern void disassociate_ctty (int priv);extern void tty_flip_buffer_push (struct tty_struct *tty); -extern int tty_get_baud_rate (struct tty_struct *tty); -extern int tty_termios_baud_rate (struct termios *termios); +extern speed_t tty_get_baud_rate (struct tty_struct *tty); +extern speed_t tty_termios_baud_rate (struct termios *termios);extern struct tty_ldisc *tty_ldisc_ref (struct tty_struct *);extern void tty_ldisc_deref (struct tty_ldisc *);
include/asm-i386/ioctls.h line 55
Quoted 13 lines · Alan Cox
diff -u --new-file --recursive --exclude-from
/usr/src/excludelinux.vanilla-2.6.18-rc4-mm2/include/asm-i386/ioctls.hlinux-2.6.18-rc4-mm2/include/asm-i386/ioctls.hinclude/asm-i386/ioctls.h +6
-0@@ -47,6 +47,12 @@#define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */ + +#define TCGETS2 0x542A +#define TCSETS2 0x542B +#define TCSETSW2 0x542C +#define TCSETSF2 0x542D +
Wouldn't it be better to use the _IO* macros to define these new ioctls? Ditto for other architectures.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Ar Gwe, 2006-08-25 am 18:41 +0100, ysgrifennodd Russell King:
Quoted 9 lines · Alan Cox
Quoted 8 lines
diff -u --new-file --recursive --exclude-from
/usr/src/excludelinux.vanilla-2.6.18-rc4-mm2/include/asm-i386/ioctls.hlinux-2.6.18-rc4-mm2/include/asm-i386/ioctls.hinclude/asm-i386/ioctls.h +1
-0@@ -47,6 +47,12 @@#define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */ +
Quoted 8 lines
include/asm-i386/ioctls.h line 55
Quoted 5 lines
include/asm-i386/ioctls.h +5
-0+#define TCGETS2 0x542A +#define TCSETS2 0x542B +#define TCSETSW2 0x542C +#define TCSETSF2 0x542D +Wouldn't it be better to use the _IO* macros to define these new ioctls? Ditto for other architectures.
That really is up to you. For x86/x86-64 it would break the internal consistency.
Quoted 19 lines · Alan Cox
Ar Gwe, 2006-08-25 am 18:41 +0100, ysgrifennodd Russell King:
Quoted 9 lines · Alan Cox
Quoted 8 lines
diff -u --new-file --recursive --exclude-from
/usr/src/excludelinux.vanilla-2.6.18-rc4-mm2/include/asm-i386/ioctls.hlinux-2.6.18-rc4-mm2/include/asm-i386/ioctls.hinclude/asm-i386/ioctls.h +1
-0@@ -47,6 +47,12 @@#define TIOCSBRK 0x5427/* BSD compatibility */ #define TIOCCBRK 0x5428/* BSD compatibility */ #define TIOCGSID 0x5429/* Return the session ID of FD */ +Quoted 8 lines
include/asm-i386/ioctls.h line 55
Quoted 5 lines
include/asm-i386/ioctls.h +5
-0+#define TCGETS2 0x542A +#define TCSETS2 0x542B +#define TCSETSW2 0x542C +#define TCSETSF2 0x542D +Wouldn't it be better to use the _IO* macros to define these new ioctls? Ditto for other architectures.
Quoted 2 lines
That really is up to you. For x86/x86-64 it would break the internal consistency.
Depends how you look at it - there are already ioctls in x86 which are defined using this format:
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
rather than the legacy way, so maybe someone's already taken the decision that new ioctls should be using the new format, and this "internal consistency" has already been broken.
Moreover, these two end up being 0x80045430 and 0x80045431 respectively. If you break them down into the component parts, they are actually in the same namespace as all the others in that file, but with the direction and size properly encoded.
It also means that you will have less chance that the ioctls clash with something else, like the sound subsystem, eg:
#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core