Serial Driver Name Question (kernels 2.4.x)
Subsystems (10)
(Please CC your answer to me, as I'm not a subscriber of this list.)
Hello,
By looking at tty_io.c:_tty_make_name(), it seems that the TTY subsystem in the Linux 2.4.x kernel series expects driver.name to be in the form "ttyX%d", even if you're not using devfs. I say that because as of now the definition in serial.c for this variable is:
#if defined(CONFIG_DEVFS_FS)
serial_driver.name = "tts/%d";
#else
serial_driver.name = "ttyS";#endif
, when it seems it should be:
#if defined(CONFIG_DEVFS_FS)
serial_driver.name = "tts/%d";
#else
serial_driver.name = "ttyS%d";#endif
to work properly with the _tty_make_name() function (otherwise, in case you're not using devfs, it'll just print "ttyS" without any reference to the port number the msg is referring to).
This was spotted by a Cyclades customer who was getting overrun msgs as:
ttyC: 1 input overrun(s)
After he changed the driver.name to be "ttyC%d", he started to get properly formatted msgs, such as:
ttyC39: 1 input overrun(s)
This problem would happen on any msg that used the function tty_name() to get the TTY name, and after the change the problem disappeared completely.
After checking the kernel code, I believe that he's found a bug that should be fixed in all drivers that define driver.name.
Please advise so that we may change the Cyclades driver to behave properly.
Regards,
Signature · 4 lines
Ivan Passos -o) Integration Manager, Cyclades - http://www.cyclades.com /\\ Project Leader, NetLinOS - http://www.netlinos.org _\_V --------------------------------------------------------------------
Quoted 16 lines · Ivan Passos
(Please CC your answer to me, as I'm not a subscriber of this list.)
Hello,
By looking at tty_io.c:_tty_make_name(), it seems that the TTY subsystem in the Linux 2.4.x kernel series expects driver.name to be in the form "ttyX%d", even if you're not using devfs. I say that because as of now the definition in
serial.cfor this variable is:#if defined(CONFIG_DEVFS_FS) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS";#endif
Quoted 8 lines
, when it seems it should be:
#if defined(CONFIG_DEVFS_FS) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS%d";#endif
I don't think so. Some quick grepping indicates that _all_ tty drivers currently use the "ttyS" equivalent if !CONFIG_DEVFS.
Instead, it appears that someone broke tty_name(). Here's the 2.2 kernel's version:
char *tty_name(struct tty_struct *tty, char *buf)
{
if (tty)
sprintf(buf, "%s%d", tty->driver.name, TTY_NUMBER(tty));
else
strcpy(buf, "NULL tty");
return buf;
}And that's much more sensible. The tty has a name associated with what it is (eg "ttyS") - correlates with major number, probably. And it has an instance number.
Which is cleaner, IMO, than embedding printf control strings in the driver name.
drivers/char/tty_io.c +1 -1
@@ -194,7 +194,7 @@ _tty_make_name(struct tty_struct *tty, cif (!tty)/* Hmm. NULL pointer. That's fun. */ strcpy (buf,"NULL tty" );else -sprintf (buf, name, +sprintf (buf,"%s%d" , name, idx + tty->driver.name_base);return buf;
Does this look (and work) OK to you?
-
Quoted 3 lines · Andrew Morton
Quoted 2 lines · Ivan Passos
(Please CC your answer to me, as I'm not a subscriber of this list.)
And when sending a message to the list about devfs, I wish people would Cc: me.
Quoted 21 lines
Quoted 13 lines
Hello,
By looking at tty_io.c:_tty_make_name(), it seems that the TTY subsystem in the Linux 2.4.x kernel series expects driver.name to be in the form "ttyX%d", even if you're not using devfs. I say that because as of now the definition in
serial.cfor this variable is:#if defined(CONFIG_DEVFS_FS) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS";#endif
Quoted 7 lines
, when it seems it should be:
#if defined(CONFIG_DEVFS_FS) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS%d";#endif
Quoted 5 lines
I don't think so. Some quick grepping indicates that _all_ tty drivers currently use the "ttyS" equivalent if !CONFIG_DEVFS.
Instead, it appears that someone broke
tty_name(). Here's the 2.2 kernel's version:
That "someone" was me, and I changed it from broken to fixed.
Quoted 9 lines
char *tty_name(struct
tty_struct*tty, char *buf){ if (tty) sprintf(buf, "%s%d", tty->driver.name, TTY_NUMBER(tty)); else strcpy(buf, "NULL tty"); return buf; }
Quoted 6 lines
And that's much more sensible. The tty has a name associated with what it is (eg "ttyS") - correlates with major number, probably. And it has an instance number.
Which is cleaner, IMO, than embedding printf control strings in the driver name.
No, originally tty_name() did it, and then I shifted it to the drivers. I don't recall the reason, but it was necessary. So I don't want this changed.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 6 lines · Richard Gooch
Quoted 3 lines
Instead, it appears that someone broke
tty_name(). Here's the 2.2 kernel's version:That "someone" was me, and I changed it from broken to fixed.
Look at serial.c:
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
serial_driver.name = "tts/%d";
#else
serial_driver.name = "ttyS";#endif
tty_name will just print "ttyS". So the transition for this case
was fixed->broken.
Quoted 4 lines
No, originally
tty_name()did it, and then I shifted it to the drivers. I don't recall the reason, but it was necessary. So I don't want this changed.
Oh dear. Why cannot devfs expand the minor part itself?
It looks like all the drivers need to be given a %d, as Ivan suggests. And we need to audit all uses to make sure nobody is doing printk(driver.name);
I think it would be better to drop the printf control construct from the names altogether.
-
Quoted 10 lines · Andrew Morton
Quoted 6 lines · Richard Gooch
Quoted 3 lines
Instead, it appears that someone broke
tty_name(). Here's the 2.2 kernel's version:That "someone" was me, and I changed it from broken to fixed.
Look at
serial.c:
Quoted 8 lines
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS";#endif
tty_namewill just print "ttyS". So the transition for this case
wasfixed->broken.
Why exactly is just "ttyS" broken?
Quoted 5 lines
Quoted 3 lines
No, originally
tty_name()did it, and then I shifted it to the drivers. I don't recall the reason, but it was necessary. So I don't want this changed.Oh dear. Why cannot devfs expand the minor part itself?
Do you mean why devfs can't do it, or do you mean why tty_name() can't do it? As I said, tty_name() used to do it, but there was some problem with that.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 5 lines
Quoted 1 line
Oh dear. Why cannot devfs expand the minor part itself?
Do you mean why devfs can't do it, or do you mean why
tty_name()can't do it? As I said,tty_name()used to do it, but there was some problem with that.
What was the problem ?
Quoted 7 lines · Alan Cox
Quoted 5 lines
Quoted 1 line
Oh dear. Why cannot devfs expand the minor part itself?
Do you mean why devfs can't do it, or do you mean why
tty_name()can't do it? As I said,tty_name()used to do it, but there was some problem with that.What was the problem ?
Dunno. Lost in the mists of time, when the world was young.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 7 lines · Richard Gooch
Since you have to change all the drivers anyway, I'd prefer if
_tty_make_name()was left unchanged, and instead you put the "%d" in each driver.name, thusly:#ifdef CONFIG_DEVFS_FS wod_driver.name = "tts/N%d"; #else wod_driver.name = "ttyN%d";
Quoted 6 lines
#endif
The reason: maximum flexibility in the kinds of names we can support. If for some reason we want a name like "tts/N%d_A" and "tts/N%d_B" (say a driver with linked ttys, like the pty driver), we don't need to make a global change.
I think that is a good idea.
However these names appear in /proc/devices too which looks rather ugly running with devfs at the moment...
# cat /proc/devices Character devices: 1 mem 2 pty/m%d 3 pty/s%d 4 ttys/%d 5 serial/%d 10 misc 108 ppp 128 ptm 136 pts/%d 162 raw
Signature · 2 lines
Nick Craig-Wood [email protected]
Quoted 18 lines · Richard Gooch
Quoted 16 lines · Andrew Morton
Quoted 6 lines · Richard Gooch
Quoted 3 lines
Instead, it appears that someone broke
tty_name(). Here's the 2.2 kernel's version:That "someone" was me, and I changed it from broken to fixed.
Look at
serial.c:#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS";#endif
Quoted 5 lines
Quoted 2 lines
tty_namewill just print "ttyS". So the transition for this case
wasfixed->broken.Why exactly is just "ttyS" broken?
umm.. Because it doesn't tell the user which serial port the message pertains to?
Here's a first cut. This is silly, and we don't want to do it this way. The "/%d" or "%d" concat, and the knowledge of devfs should be contained in one place. Please suggest something.
net/irda/ircomm/ircomm_tty.c doesn't have a "/" in the name for the devfs case. Please review that.
net/irda/ircomm/ircomm_tty.c +1 -1
@@ -103,7 +103,7 @@ int __init ircomm_tty_init(void)#ifdef CONFIG_DEVFS_FS driver.name ="ircomm%d" ;#else - driver.name ="ircomm" ; + driver.name ="ircomm%d" ;#endif driver.major =IRCOMM_TTY_MAJOR ; driver.minor_start =IRCOMM_TTY_MINOR ;
drivers/net/wan/sdla_chdlc.c +1 -1
@@ -4638,7 +4638,7 @@ int wanpipe_tty_init(sdla_t *card)memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; serial_driver.driver_name ="wanpipe_tty" ; - serial_driver.name ="ttyW" ; + serial_driver.name ="ttyW%d" ; serial_driver.major =WAN_TTY_MAJOR ; serial_driver.minor_start =WAN_TTY_MINOR ; serial_driver.num =NR_PORTS ;
drivers/char/pty.c +0 -4
@@ -452,11 +452,7 @@ int __init pty_init(void)init_waitqueue_head (&ptm_state[i][j].open_wait); pts_driver[i] = pty_slave_driver; -#ifdef CONFIG_DEVFS_FS pts_driver[i].name ="pts/%d" ; -#else - pts_driver[i].name ="pts" ; -#endif pts_driver[i].proc_entry =0 ; pts_driver[i].major =UNIX98_PTY_SLAVE_MAJOR +i; pts_driver[i].minor_start =0 ;
drivers/char/esp.c +1 -1
@@ -2547,7 +2547,7 @@ int __init espserial_init(void)memset (&esp_driver,0 ,sizeof (struct tty_driver )); esp_driver.magic =TTY_DRIVER_MAGIC ; - esp_driver.name ="ttyP" ; + esp_driver.name ="ttyP%d" ; esp_driver.major =ESP_IN_MAJOR ; esp_driver.minor_start =0 ; esp_driver.num =NR_PORTS ;
drivers/char/serial.c +1 -1
@@ -5389,7 +5389,7 @@ static int __init rs_init(void)#if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 +SERIAL_DEV_OFFSET ;
drivers/char/cyclades.c +1 -1
@@ -5496,7 +5496,7 @@ cy_init(void)memset (&cy_serial_driver,0 ,sizeof (struct tty_driver )); cy_serial_driver.magic =TTY_DRIVER_MAGIC ; cy_serial_driver.driver_name ="cyclades" ; - cy_serial_driver.name ="ttyC" ; + cy_serial_driver.name ="ttyC%d" ; cy_serial_driver.major =CYCLADES_MAJOR ; cy_serial_driver.minor_start =0 ; cy_serial_driver.num =NR_PORTS ;
drivers/char/rocket.c +1 -1
@@ -2189,7 +2189,7 @@ int __init rp_init(void)#ifdef CONFIG_DEVFS_FS rocket_driver.name ="tts/R%d" ;#else - rocket_driver.name ="ttyR" ; + rocket_driver.name ="ttyR%d" ;#endif rocket_driver.major =TTY_ROCKET_MAJOR ; rocket_driver.minor_start =0 ;
drivers/char/istallion.c +2 -2
@@ -171,9 +171,9 @@ static devfs_handle_t devfs_handle;* all the local structures required by a serial tty driver. */ static char *stli_drvtitle ="Stallion Intelligent Multiport Serial Driver" ; -static char *stli_drvname ="istallion" ; +static char *stli_drvname ="istallion%d" ;static char *stli_drvversion ="5.6.0" ; -static char *stli_serialname ="ttyE" ; +static char *stli_serialname ="ttyE%d" ;static char *stli_calloutname ="cue" ;static struct tty_driver stli_serial;
drivers/char/pcxx.c +1 -1
@@ -1229,7 +1229,7 @@ int __init pcxe_init(void)memset (&pcxe_driver,0 ,sizeof (struct tty_driver )); pcxe_driver.magic =TTY_DRIVER_MAGIC ; - pcxe_driver.name ="ttyD" ; + pcxe_driver.name ="ttyD%d" ; pcxe_driver.major =DIGI_MAJOR ; pcxe_driver.minor_start =0 ;
drivers/char/sh-sci.c +2 -2
@@ -1025,7 +1025,7 @@ static int sci_init_drivers(void)#ifdef CONFIG_DEVFS_FS sci_driver.name ="ttsc/%d" ;#else - sci_driver.name ="ttySC" ; + sci_driver.name ="ttySC%d" ;#endif sci_driver.major =SCI_MAJOR ; sci_driver.minor_start =SCI_MINOR_START ;
@@ -1064,7 +1064,7 @@ static int sci_init_drivers(void)#ifdef CONFIG_DEVFS_FS sci_callout_driver.name ="cusc/%d" ;#else - sci_callout_driver.name ="cusc" ; + sci_callout_driver.name ="cusc%d" ;#endif sci_callout_driver.major =SCI_MAJOR +1 ; sci_callout_driver.subtype =SERIAL_TYPE_CALLOUT ;
drivers/char/riscom8.c +1 -1
@@ -1755,7 +1755,7 @@ static inline int rc_init_drivers(void)memset (IRQ_to_board,0 ,sizeof (IRQ_to_board));memset (&riscom_driver,0 ,sizeof (riscom_driver)); riscom_driver.magic =TTY_DRIVER_MAGIC ; - riscom_driver.name ="ttyL" ; + riscom_driver.name ="ttyL%d" ; riscom_driver.major =RISCOM8_NORMAL_MAJOR ; riscom_driver.num =RC_NBOARD *RC_NPORT ; riscom_driver.type =TTY_DRIVER_TYPE_SERIAL ;
drivers/char/specialix.c +1 -1
@@ -2233,7 +2233,7 @@ static int sx_init_drivers(void)init_bh (SPECIALIX_BH , do_specialix_bh);memset (&specialix_driver,0 ,sizeof (specialix_driver)); specialix_driver.magic =TTY_DRIVER_MAGIC ; - specialix_driver.name ="ttyW" ; + specialix_driver.name ="ttyW%d" ; specialix_driver.major =SPECIALIX_NORMAL_MAJOR ; specialix_driver.num =SX_NBOARD *SX_NPORT ; specialix_driver.type =TTY_DRIVER_TYPE_SERIAL ;
drivers/char/epca.c +1 -1
@@ -1718,7 +1718,7 @@ int __init pc_init(void)memset (&pc_info,0 ,sizeof (struct tty_driver )); pc_driver.magic =TTY_DRIVER_MAGIC ; - pc_driver.name ="ttyD" ; + pc_driver.name ="ttyD%d" ; pc_driver.major =DIGI_MAJOR ; pc_driver.minor_start =0 ; pc_driver.num =MAX_ALLOC ;
drivers/char/sx.c +1 -1
@@ -2222,7 +2222,7 @@ static int sx_init_drivers(void)memset (&sx_driver,0 ,sizeof (sx_driver)); sx_driver.magic =TTY_DRIVER_MAGIC ; sx_driver.driver_name ="specialix_sx" ; - sx_driver.name ="ttyX" ; + sx_driver.name ="ttyX%d" ; sx_driver.major =SX_NORMAL_MAJOR ; sx_driver.num = sx_nports; sx_driver.type =TTY_DRIVER_TYPE_SERIAL ;
drivers/char/serial_amba.c +1 -1
@@ -1776,7 +1776,7 @@ int __init ambauart_init(void) ambanormal_driver.magic =TTY_DRIVER_MAGIC ; ambanormal_driver.driver_name ="serial_amba" ; - ambanormal_driver.name =SERIAL_AMBA_NAME ; + ambanormal_driver.name =SERIAL_AMBA_NAME "%d" ; ambanormal_driver.major =SERIAL_AMBA_MAJOR ; ambanormal_driver.minor_start =SERIAL_AMBA_MINOR ; ambanormal_driver.num =SERIAL_AMBA_NR ;
drivers/char/dz.c +2 -2
@@ -1338,7 +1338,7 @@ int __init dz_init(void)memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ;#if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#else serial_driver.name ="tts/%d" ;#endif
@@ -1379,7 +1379,7 @@ int __init dz_init(void)*/ callout_driver = serial_driver;#if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) - callout_driver.name ="cua" ; + callout_driver.name ="cua%d" ;#else callout_driver.name ="cua/%d" ;#endif
drivers/char/isicom.c +1 -1
@@ -1718,7 +1718,7 @@ static int register_drivers(void)/* tty driver structure initialization */ memset (&isicom_normal,0 ,sizeof (struct tty_driver )); isicom_normal.magic =TTY_DRIVER_MAGIC ; - isicom_normal.name ="ttyM" ; + isicom_normal.name ="ttyM%d" ; isicom_normal.major =ISICOM_NMAJOR ; isicom_normal.minor_start =0 ; isicom_normal.num =PORT_COUNT ;
drivers/char/synclink.c +1 -1
@@ -4587,7 +4587,7 @@ int mgsl_init_tty()memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; serial_driver.driver_name ="synclink" ; - serial_driver.name ="ttySL" ; + serial_driver.name ="ttySL%d" ; serial_driver.major = ttymajor; serial_driver.minor_start =64 ; serial_driver.num = mgsl_device_count;
drivers/char/mxser.c +1 -1
@@ -523,7 +523,7 @@ int mxser_init(void)* major number and the subtype code. */ mxvar_cdriver = mxvar_sdriver; - mxvar_cdriver.name ="cum" ; + mxvar_cdriver.name ="cum%d" ; mxvar_cdriver.major = calloutmajor; mxvar_cdriver.subtype =SERIAL_TYPE_CALLOUT ;
drivers/char/serial167.c +1 -1
@@ -2395,7 +2395,7 @@ scrn[1] = '\0';memset (&cy_serial_driver,0 ,sizeof (struct tty_driver )); cy_serial_driver.magic =TTY_DRIVER_MAGIC ; - cy_serial_driver.name ="ttyS" ; + cy_serial_driver.name ="ttyS%d" ; cy_serial_driver.major =TTY_MAJOR ; cy_serial_driver.minor_start =64 ; cy_serial_driver.num =NR_PORTS ;
drivers/char/ip2main.c +1 -1
@@ -235,7 +235,7 @@ static char *pcDriver_name = "ip2";static char *pcTty ="tts/F%d" ;static char *pcCallout ="cua/F%d" ;#else -static char *pcTty ="ttyF" ; +static char *pcTty ="ttyF%d" ;static char *pcCallout ="cuf" ;#endif static char *pcIpl ="ip2ipl" ;
drivers/char/vme_scc.c +1 -1
@@ -131,7 +131,7 @@ static int scc_init_drivers(void)memset (&scc_driver,0 ,sizeof (scc_driver)); scc_driver.magic =TTY_DRIVER_MAGIC ; scc_driver.driver_name ="scc" ; - scc_driver.name ="ttyS" ; + scc_driver.name ="ttyS%d" ; scc_driver.major =TTY_MAJOR ; scc_driver.minor_start =SCC_MINOR_BASE ; scc_driver.num =2 ;
drivers/char/stallion.c +1 -1
@@ -143,7 +143,7 @@ static char *stl_drvversion = "5.6.0";static char *stl_serialname ="tts/E%d" ;static char *stl_calloutname ="cua/E%d" ;#else -static char *stl_serialname ="ttyE" ; +static char *stl_serialname ="ttyE%d" ;static char *stl_calloutname ="cue" ;#endif
drivers/char/rio/rio_linux.c +1 -1
@@ -912,7 +912,7 @@ static int rio_init_drivers(void)memset (&rio_driver,0 ,sizeof (rio_driver)); rio_driver.magic =TTY_DRIVER_MAGIC ; rio_driver.driver_name ="specialix_rio" ; - rio_driver.name ="ttySR" ; + rio_driver.name ="ttySR%d" ; rio_driver.major =RIO_NORMAL_MAJOR0 ; rio_driver.num =256 ; rio_driver.type =TTY_DRIVER_TYPE_SERIAL ;
drivers/char/moxa.c +1 -1
@@ -344,7 +344,7 @@ int moxa_init(void)memset (&moxaDriver,0 ,sizeof (struct tty_driver ));memset (&moxaCallout,0 ,sizeof (struct tty_driver )); moxaDriver.magic =TTY_DRIVER_MAGIC ; - moxaDriver.name ="ttya" ; + moxaDriver.name ="ttya%d" ; moxaDriver.major = ttymajor; moxaDriver.minor_start =0 ; moxaDriver.num =MAX_PORTS +1 ;
drivers/char/serial_21285.c +1 -1
@@ -299,7 +299,7 @@ static int __init rs285_init(void) rs285_driver.magic =TTY_DRIVER_MAGIC ; rs285_driver.driver_name ="serial_21285" ; - rs285_driver.name =SERIAL_21285_NAME ; + rs285_driver.name =SERIAL_21285_NAME "%d" ; rs285_driver.major =SERIAL_21285_MAJOR ; rs285_driver.minor_start =SERIAL_21285_MINOR ; rs285_driver.num =1 ;
drivers/char/amiserial.c +1 -1
@@ -2129,7 +2129,7 @@ static int __init rs_init(void)memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; serial_driver.driver_name ="amiserial" ; - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ; serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ; serial_driver.num =1 ;
drivers/char/ser_a2232.c +1 -1
@@ -716,7 +716,7 @@ static int a2232_init_drivers(void)memset (&a2232_driver,0 ,sizeof (a2232_driver)); a2232_driver.magic =TTY_DRIVER_MAGIC ; a2232_driver.driver_name ="commodore_a2232" ; - a2232_driver.name ="ttyY" ; + a2232_driver.name ="ttyY%d" ; a2232_driver.major =A2232_NORMAL_MAJOR ; a2232_driver.num =NUMLINES * nr_a2232; a2232_driver.type =TTY_DRIVER_TYPE_SERIAL ;
drivers/char/serial_tx3912.c +1 -1
@@ -841,7 +841,7 @@ static int rs_init_drivers(void)memset (&rs_driver,0 ,sizeof (rs_driver)); rs_driver.magic =TTY_DRIVER_MAGIC ; rs_driver.driver_name ="serial" ; - rs_driver.name ="ttyS" ; + rs_driver.name ="ttyS%d" ; rs_driver.major =TTY_MAJOR ; rs_driver.minor_start =64 ; rs_driver.num =TX3912_UART_NPORTS ;
drivers/isdn/isdn_tty.c +1 -1
@@ -44,7 +44,7 @@ static int isdn_tty_countDLE(unsigned chstatic char *isdn_ttyname_ttyI ="isdn/ttyI%d" ;static char *isdn_ttyname_cui ="isdn/cui%d" ;#else -static char *isdn_ttyname_ttyI ="ttyI" ; +static char *isdn_ttyname_ttyI ="ttyI%d" ;static char *isdn_ttyname_cui ="cui" ;#endif
drivers/sbus/char/zs.c +1 -1
@@ -2412,7 +2412,7 @@ int __init zs_init(void)#ifdef CONFIG_DEVFS_FS serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ;
drivers/sbus/char/sab82532.c +1 -1
@@ -2240,7 +2240,7 @@ int __init sab82532_init(void)#ifdef CONFIG_DEVFS_FS serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 + su_num_ports;
drivers/sbus/char/su.c +1 -1
@@ -2491,7 +2491,7 @@ int __init su_serial_init(void)#ifdef CONFIG_DEVFS_FS serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ;
drivers/sbus/char/aurora.c +1 -1
@@ -2313,7 +2313,7 @@ static int aurora_init_drivers(void)/* memset(IRQ_to_board, 0, sizeof(IRQ_to_board));*/ memset (&aurora_driver,0 ,sizeof (aurora_driver)); aurora_driver.magic =TTY_DRIVER_MAGIC ; - aurora_driver.name ="ttyA" ; + aurora_driver.name ="ttyA%d" ; aurora_driver.major =AURORA_MAJOR ; aurora_driver.num =AURORA_TNPORTS ; aurora_driver.type =TTY_DRIVER_TYPE_SERIAL ;
drivers/macintosh/macserial.c +1 -1
@@ -2623,7 +2623,7 @@ no_dma:#ifdef CONFIG_DEVFS_FS callout_driver.name ="cua/%d" ;#else - callout_driver.name ="cua" ; + callout_driver.name ="cua%d" ;#endif /* CONFIG_DEVFS_FS */ callout_driver.major =TTYAUX_MAJOR ; callout_driver.subtype =SERIAL_TYPE_CALLOUT ;
drivers/sgi/char/sgiserial.c +1 -1
@@ -1911,7 +1911,7 @@ int rs_init(void)* major number and the subtype code. */ callout_driver = serial_driver; - callout_driver.name ="cua" ; + callout_driver.name ="cua%d" ; callout_driver.major =TTYAUX_MAJOR ; callout_driver.subtype =SERIAL_TYPE_CALLOUT ;
drivers/tc/zs.c +1 -1
@@ -1877,7 +1877,7 @@ int __init zs_init(void)#if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ;
drivers/s390/char/con3215.c +1 -1
@@ -1129,7 +1129,7 @@ void __init tty3215_init(void)memset (&tty3215_driver,0 ,sizeof (struct tty_driver )); tty3215_driver.magic =TTY_DRIVER_MAGIC ; tty3215_driver.driver_name ="tty3215" ; - tty3215_driver.name ="ttyS" ; + tty3215_driver.name ="ttyS%d" ; tty3215_driver.name_base =0 ; tty3215_driver.major =TTY_MAJOR ; tty3215_driver.minor_start =64 ;
drivers/s390/char/hwc_tty.c +1 -1
@@ -227,7 +227,7 @@ hwc_tty_init (void)memset (&hwc_tty_data,0 ,sizeof (hwc_tty_data_struct)); hwc_tty_driver.magic =TTY_DRIVER_MAGIC ; hwc_tty_driver.driver_name ="tty_hwc" ; - hwc_tty_driver.name ="ttyS" ; + hwc_tty_driver.name ="ttyS%d" ; hwc_tty_driver.name_base =0 ; hwc_tty_driver.major =TTY_MAJOR ; hwc_tty_driver.minor_start =64 ;
drivers/s390/net/ctctty.c +1 -1
@@ -111,7 +111,7 @@ static ctc_tty_driver *driver;#ifdef CONFIG_DEVFS_FS static char *ctc_ttyname ="ctc/" CTC_TTY_NAME "%d" ;#else -static char *ctc_ttyname =CTC_TTY_NAME ; +static char *ctc_ttyname =CTC_TTY_NAME "%d" ;#endif char *ctc_tty_revision ="$Revision: 1.1.2.1 $" ;
arch/mips/baget/vacserial.c +1 -1
@@ -2359,7 +2359,7 @@ int __init rs_init(void)memset (&serial_driver,0 ,sizeof (struct tty_driver )); serial_driver.magic =TTY_DRIVER_MAGIC ; serial_driver.driver_name ="serial" ; - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ; serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ; serial_driver.num =NR_PORTS ;
arch/mips/au1000/common/serial.c +1 -1
@@ -2635,7 +2635,7 @@ static int __init rs_init(void)#if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) callout_driver.name ="cua/%d" ;#else - callout_driver.name ="cua" ; + callout_driver.name ="cua%d" ;#endif callout_driver.major =TTYAUX_MAJOR ; callout_driver.subtype =SERIAL_TYPE_CALLOUT ;
arch/ppc/8xx_io/uart.c +1 -1
@@ -2532,7 +2532,7 @@ int __init rs_8xx_init(void)#ifdef CONFIG_DEVFS_FS serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ;
arch/ppc/8260_io/uart.c +1 -1
@@ -2328,7 +2328,7 @@ int __init rs_8xx_init(void)#ifdef CONFIG_DEVFS_FS serial_driver.name ="tts/%d" ;#else - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ;#endif serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ;
arch/cris/drivers/serial.c +1 -1
@@ -3461,7 +3461,7 @@ rs_init(void)#if (LINUX_VERSION_CODE >0x20100 ) serial_driver.driver_name ="serial" ;#endif - serial_driver.name ="ttyS" ; + serial_driver.name ="ttyS%d" ; serial_driver.major =TTY_MAJOR ; serial_driver.minor_start =64 ; serial_driver.num =NR_PORTS ;/* etrax100 has 4 serial ports */
Quoted 19 lines · Andrew Morton
Quoted 18 lines · Richard Gooch
Quoted 16 lines · Andrew Morton
Quoted 6 lines · Richard Gooch
Quoted 3 lines
Instead, it appears that someone broke
tty_name(). Here's the 2.2 kernel's version:That "someone" was me, and I changed it from broken to fixed.
Look at
serial.c:#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS";#endif
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
tty_namewill just print "ttyS". So the transition for this case
wasfixed->broken.Why exactly is just "ttyS" broken?
umm.. Because it doesn't tell the user which serial port the message pertains to?
Exactly where is it broken? I look at my dmesg output and things look fine.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 9 lines · Richard Gooch
Quoted 5 lines
Quoted 2 lines
Why exactly is just "ttyS" broken?
umm.. Because it doesn't tell the user which serial port the message pertains to?
Exactly where is it broken? I look at my dmesg output and things look fine.
Try disabling devfs.
Quoted 5 lines · Ivan
This was spotted by a Cyclades customer who was getting overrun msgs as:
ttyC: 1 input overrun(s)
Quoted 8 lines
After he changed the driver.name to be "ttyC%d", he started to get properly formatted msgs, such as:
ttyC39: 1 input overrun(s)
This problem would happen on any msg that used the function
tty_name()to get the TTY name, and after the change the problem disappeared completely.
-
[ tty driver name breakage ]
Richard, can we please get this wrapped up?
My preferred approach is to change the driver naming scheme so that we don't have to put printf control-strings everywhere. We can remove a number of ifdefs that way.
So for serial.c:
drivers/char/tty_io.c +7 -4
@@ -193,10 +193,13 @@ _tty_make_name(struct tty_struct *tty, cif (!tty)/* Hmm. NULL pointer. That's fun. */ strcpy (buf,"NULL tty" ); -else -sprintf (buf, name, - idx + tty->driver.name_base); - +else { +#ifdef CONFIG_DEVFS_FS +sprintf (buf,"%s/%d" , name, idx + tty->driver.name_base); +#else +sprintf (buf,"%s%d" , name, idx + tty->driver.name_base); +#endif + }return buf; }
drivers/char/serial.c +1 -1
@@ -5387,7 +5387,7 @@ static int __init rs_init(void) serial_driver.driver_name ="serial" ;#endif #if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) - serial_driver.name ="tts/%d" ; + serial_driver.name ="tts" ;#else serial_driver.name ="ttyS" ;#endif
Quoted 7 lines · Andrew Morton
[ tty driver name breakage ]
Richard, can we please get this wrapped up?
My preferred approach is to change the driver naming scheme so that we don't have to put printf control-strings everywhere. We can remove a number of ifdefs that way.
Wouldn't it be cleaner to have:
#ifdef CONFIG_DEVFS_FS serial_driver.name = "tts/"; #else serial_driver.name = "tts";
#endif
and
sprintf("buf, "%s%d", name, idx + tty->driver.name_base);respectively?!
/David
Quoted 25 lines
So for
serial.c:drivers/char/tty_io.c +7
-4@@ -193,10 +193,13 @@ _tty_make_name(struct tty_struct *tty, cif (!tty)/* Hmm. NULL pointer. That's fun. */ strcpy (buf,"NULL tty" ); -else -sprintf (buf, name, - idx + tty->driver.name_base); - +else { +#ifdef CONFIG_DEVFS_FS +sprintf (buf,"%s/%d" , name, idx + tty->driver.name_base); +#else +sprintf (buf,"%s%d" , name, idx + tty->driver.name_base); +#endif + }return buf; }
drivers/char/serial.c static int __init rs_init(void) · line 5393
Quoted 8 lines
drivers/char/serial.c +1
-1@@ -5387,7 +5387,7 @@ static int __init rs_init(void) serial_driver.driver_name ="serial" ;#endif #if (LINUX_VERSION_CODE >0x2032D && defined(CONFIG_DEVFS_FS )) - serial_driver.name ="tts/%d" ; + serial_driver.name ="tts" ;#else serial_driver.name ="ttyS" ;#endif
_ _
// David Weinehall <[email protected]> /> Northern lights wander \\
// Maintainer of the v2.0 kernel // Dance across the winter sky // \> http://www.acc.umu.se/~tao/ </ Full colour fire </
Quoted 16 lines · David Weinehall
Quoted 7 lines · Andrew Morton
[ tty driver name breakage ]
Richard, can we please get this wrapped up?
My preferred approach is to change the driver naming scheme so that we don't have to put printf control-strings everywhere. We can remove a number of ifdefs that way.
Wouldn't it be cleaner to have:
#ifdef CONFIG_DEVFS_FS serial_driver.name = "tts/"; #else serial_driver.name = "tts";
Quoted 8 lines
#endif
and
sprintf("buf, "%s%d", name, idx + tty->driver.name_base);respectively?!
Well, with the scheme I proposed most drivers won't need the ifdef. It'll just be:
serial_driver.name = "cua";
With devfs enabled that expands to cua/42. Without devfs it expands to cua42.
Seems that some drivers have had their name changed when used under devfs (tts/%d versus ttyS%d). But a lot have not.
-
Quoted 32 lines · Andrew Morton
Richard, can we please get this wrapped up?
My preferred approach is to change the driver naming scheme so that we don't have to put printf control-strings everywhere. We can remove a number of ifdefs that way.
So for
serial.c:drivers/char/tty_io.c Mon Jan 7 20:56:38 2002 renamed from drivers/char/tty_io.c Mon Jan 7 16:48:02 2002 +7
-4@@ -193,10 +193,13 @@ _tty_make_name(struct tty_struct *tty, c if (!tty) /* Hmm. NULL pointer. That's fun. */ strcpy(buf, "NULL tty"); - else - sprintf(buf, name, - idx + tty->driver.name_base); - + else { +#ifdef CONFIG_DEVFS_FS + sprintf(buf, "%s/%d", name, idx + tty->driver.name_base); +#else + sprintf(buf, "%s%d", name, idx + tty->driver.name_base); +#endif + } return buf; }
drivers/char/serial.c Mon Jan 7 20:58:09 2002 static int __init rs_init(void) · line 5393
Quoted 8 lines
drivers/char/serial.c Mon Jan 7 20:58:09 2002 renamed from drivers/char/serial.c Mon Jan 7 16:48:02 2002 +1
-1@@ -5387,7 +5387,7 @@ static int __init rs_init(void) serial_driver.driver_name = "serial"; #endif #if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) - serial_driver.name = "tts/%d"; + serial_driver.name = "tts"; #else serial_driver.name = "ttyS"; #endif
This doesn't cover all the drivers, because the definition for devfs is that the standard serial "translates" 'ttyS' to 'tts/', and other serial drivers "translate" 'ttyN' (where 'N' can be several different letters -- e.g. 'C' for Cyclades, 'R' for Comtrol, 'X' for Specialix, 'D' for Digi, etc.) to 'tts/N' (so that standard serial and other serial devices can share the same devfs directory).
So, I believe the best way to solve this would be:
drivers/char/tty_io.c:
@@ -193,10 +193,13 @@ _tty_make_name(struct tty_struct *tty, c
if (!tty) /* Hmm. NULL pointer. That's fun. */
strcpy(buf, "NULL tty");
else
- sprintf(buf, name,
- idx + tty->driver.name_base);
+ sprintf(buf, "%s%d", name, idx + tty->driver.name_base);
return buf;
}
drivers/char/serial.c:
@@ -5387,7 +5387,7 @@ static int __init rs_init(void)
serial_driver.driver_name = "serial";
#endif
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
- serial_driver.name = "tts/%d";
+ serial_driver.name = "tts/";
#else
serial_driver.name = "ttyS";#endif
And then, for instance, for the Cyclades driver, we'd use:
#ifdef CONFIG_DEVFS_FS cy_serial_driver.name = "tts/C"; #else cy_serial_driver.name = "ttyC";
#endif
, and let's not forget the callout devices (which follow a similar rule):
#ifdef CONFIG_DEVFS_FS cy_callout_driver.name = "cua/C"; #else cy_callout_driver.name = "cub";
#endif
This would apply for other drivers as well, just replacing the 'C' by the proper letter.
So, what do you think?!?!?
Later,
Signature · 4 lines
Ivan Passos -o) Integration Manager, Cyclades - http://www.cyclades.com /\\ Project Leader, NetLinOS - http://www.netlinos.org _\_V --------------------------------------------------------------------
Quoted 8 lines · Andrew Morton
Well, with the scheme I proposed most drivers won't need the ifdef. It'll just be:
serial_driver.name = "cua";With devfs enabled that expands to cua/42. Without devfs it expands to cua42.
Check my previous msg. Actually that won't work for other drivers other than serial.c, that's why we should use the scheme I suggested on that msg.
Hmmmm, I just thought about something that might be a problem with this change. I believe Richard Gooch is the right person to tell us whether this is a problem or not.
We're just talking about print msgs in tty_io.c (and the scheme I suggested -- i.e. to use 'tts/X' for devfs and 'ttyX' for non-devfs and have "%s%d" in tty_io.c's printk call -- does cover all driver in that aspect), but I'm not sure whether devfs uses the driver.name definition for something else. If that's the case, then devfs would need to be updated as well to comply with the new driver.name definition.
Richard, is this a problem or not?!?!
Later,
Signature · 4 lines
Ivan Passos -o) Integration Manager, Cyclades - http://www.cyclades.com /\\ Project Leader, NetLinOS - http://www.netlinos.org _\_V --------------------------------------------------------------------
Quoted 26 lines · Andrew Morton
Quoted 16 lines · David Weinehall
Quoted 7 lines · Andrew Morton
[ tty driver name breakage ]
Richard, can we please get this wrapped up?
My preferred approach is to change the driver naming scheme so that we don't have to put printf control-strings everywhere. We can remove a number of ifdefs that way.
Wouldn't it be cleaner to have:
#ifdef CONFIG_DEVFS_FS serial_driver.name = "tts/"; #else serial_driver.name = "tts";Quoted 8 lines
#endif
and
sprintf("buf, "%s%d", name, idx + tty->driver.name_base);respectively?!
Quoted 7 lines
Well, with the scheme I proposed most drivers won't need the ifdef. It'll just be:
serial_driver.name = "cua";With devfs enabled that expands to cua/42. Without devfs it expands to cua42.
No. We've been over this in several lists and there are more
issues here. The Computone driver is ttyF%d / tts/F%d cuf%d / cua/F%d. If I understand your convention (and maybe I do not) then the cuf driver would be what? Expanded to cuf/42 with devfs and cuf42 without? That's what it use to be and that created a problem in userland. The trouble there is the problem with conventional lock files under /var/lock which only use the base name of the device name so cua/42 and cuf/42 both have the same lock file of /var/lock/LCK..42 and would collide. Yes we could ALSO change ALL the user space applications using locks, but I just got done changing the Computone driver to conform to the non-conflicting convention that had been agreed to. This also impacts the USB ACM driver and it's devices and lock files.
Unfortunately, the basenames need to be non-conflicting in flat
name space due the the indeterminant pile of applications which are going to require non-conflicing lock files under a convention that days back to before Linux or even Taylor UUCP (HDB UUCP used a similar locking scheme). That includes pppd, slip, uucp, minicom, cu, ecu, tip, mgetty, etc, etc...
Quoted 2 lines
Seems that some drivers have had their name changed when used under devfs (tts/%d versus ttyS%d). But a lot have not.
Other drivers which are not under ttyS%d don't make to tts/%d.
As things stand right now, ttyF%d maps to tts/F%d. It use to be mapped under ttf/%d but this created a lock file conflict with the tts/%d and usb/acm/%d devices and had to be changed.
Quoted 6 lines
(quoted diff) +0
-2- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Mike
Signature · 4 lines
Michael H. Warfield | (770) 985-6132 | [email protected] /\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/ NIC whois: MHW9 | An optimist believes we live in the best of all PGP Key: 0xDF1DD471 | possible worlds. A pessimist is sure of it!
Quoted 5 lines · Michael H. Warfield
The trouble there is the problem with conventional lock files under
/var/lockwhich only use the base name of the device name so cua/42 and cuf/42 both have the same lock file of/var/lock/LCK..42and would collide.
OK, thanks. So it looks like we stick with
http://www.zip.com.au/~akpm/linux/2.4/2.4.18-pre2/tty_name.patch
Which just puts %d's at the end of all the device names in the non-devfs case.
I'll have another go at that patch, check for missed drivers, then send it out again. OK?
Quoted 10 lines · Andrew Morton
Quoted 5 lines · Michael H. Warfield
The trouble there is the problem with conventional lock files under
/var/lockwhich only use the base name of the device name so cua/42 and cuf/42 both have the same lock file of/var/lock/LCK..42and would collide.OK, thanks. So it looks like we stick with
Quoted 7 lines
http://www.zip.com.au/~akpm/linux/2.4/2.4.18-pre2/tty_name.patchWhich just puts %d's at the end of all the device names in the non-devfs case.
I'll have another go at that patch, check for missed drivers, then send it out again. OK?
OK, just two comments:
- As you'll have to patch all drivers anyway, in case Richard Gooch doesn't have a problem with this suggestion, I'd suggest you patch the kernel as follows:
(1) drivers/char/tty_io.c
---------------------
@@ -193,10 +193,13 @@ _tty_make_name(struct tty_struct *tty, c
if (!tty) /* Hmm. NULL pointer. That's fun. */
strcpy(buf, "NULL tty");
else
- sprintf(buf, name,
- idx + tty->driver.name_base);
+ sprintf(buf, "%s%d", name, idx + tty->driver.name_base);
return buf;
}
(2) drivers/char/serial.c
---------------------
@@ -5387,7 +5387,7 @@ static int __init rs_init(void)
serial_driver.driver_name = "serial"; #endif
#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
- serial_driver.name = "tts/%d";
+ serial_driver.name = "tts/";
#else
serial_driver.name = "ttyS";#endif
(3) drivers/char/whatever_other_driver.c
------------------------------------
@@ -5387,7 +5387,7 @@ static int __init wod_init(void)
wod_driver.driver_name = "whatever_other_driver"; #endif
#ifdef CONFIG_DEVFS_FS
- wod_driver.name = "tts/N%d";
+ wod_driver.name = "tts/N";
#else
wod_driver.name = "ttyN";#endif
I've already suggested this in a previous msg, but nobody gave feedback. I believe this is cleaner, as it removes the %d from the driver.name field, while fixes the problem I reported.
- Since you'll patch the Cyclades driver, could you please add the ifdef's for devfs?? The definitions are as follows:
- Callin devices: "tts/C%d" for devfs, "ttyC%d" for non-devfs.
- Callout devices: "cua/C%d" for devfs, "cub%d" for non-devfs (no, this is NOT a typo, it's really cua/C and cub).
I ask this just to avoid sending a separate patch just for that. I'd really appreciate it if you could do it along with your patch. If you don't do it, no problem either.
Anyhow, thanks to all for the attention to this issue, and especially to you, Andrew!
Later,
Signature · 4 lines
Ivan Passos -o) Integration Manager, Cyclades - http://www.cyclades.com /\\ Project Leader, NetLinOS - http://www.netlinos.org _\_V --------------------------------------------------------------------
Quoted 64 lines · Ivan Passos
Quoted 10 lines · Andrew Morton
Quoted 5 lines · Michael H. Warfield
The trouble there is the problem with conventional lock files under
/var/lockwhich only use the base name of the device name so cua/42 and cuf/42 both have the same lock file of/var/lock/LCK..42and would collide.OK, thanks. So it looks like we stick with
Quoted 7 lines
http://www.zip.com.au/~akpm/linux/2.4/2.4.18-pre2/tty_name.patchWhich just puts %d's at the end of all the device names in the non-devfs case.
I'll have another go at that patch, check for missed drivers, then send it out again. OK?
OK, just two comments:
- As you'll have to patch all drivers anyway, in case Richard Gooch doesn't have a problem with this suggestion, I'd suggest you patch the kernel as follows:(1)
drivers/char/tty_io.c---------------------(quoted diff) +2
-3@@ -193,10 +193,13 @@ _tty_make_name(struct tty_struct *tty, c if (!tty) /* Hmm. NULL pointer. That's fun. */ strcpy(buf, "NULL tty"); else - sprintf(buf, name, - idx + tty->driver.name_base); + sprintf(buf, "%s%d", name, idx + tty->driver.name_base); return buf; } (2) drivers/char/serial.c ---------------------@@ -5387,7 +5387,7 @@ static int __init rs_init(void) serial_driver.driver_name = "serial"; #endif #if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) - serial_driver.name = "tts/%d"; + serial_driver.name = "tts/"; #else serial_driver.name = "ttyS"; #endif(3)
drivers/char/whatever_other_driver.c------------------------------------(quoted diff) +1
-1@@ -5387,7 +5387,7 @@ static int __init wod_init(void) wod_driver.driver_name = "whatever_other_driver"; #endif #ifdef CONFIG_DEVFS_FS - wod_driver.name = "tts/N%d"; + wod_driver.name = "tts/N"; #else wod_driver.name = "ttyN"; #endif
Quoted 3 lines
I've already suggested this in a previous msg, but nobody gave feedback. I believe this is cleaner, as it removes the %d from the driver.name field, while fixes the problem I reported.
Since you have to change all the drivers anyway, I'd prefer if _tty_make_name() was left unchanged, and instead you put the "%d" in each driver.name, thusly:
#ifdef CONFIG_DEVFS_FS wod_driver.name = "tts/N%d"; #else wod_driver.name = "ttyN%d";
#endif
The reason: maximum flexibility in the kinds of names we can support. If for some reason we want a name like "tts/N%d_A" and "tts/N%d_B" (say a driver with linked ttys, like the pty driver), we don't need to make a global change.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 54 lines · Andrew Morton
Quoted 12 lines
By looking at tty_io.c:_tty_make_name(), it seems that the TTY subsystem in the Linux 2.4.x kernel series expects driver.name to be in the form "ttyX%d", even if you're not using devfs. I say that because as of now the definition in
serial.cfor this variable is:#if defined(CONFIG_DEVFS_FS) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS";#endif
Quoted 7 lines
, when it seems it should be:
#if defined(CONFIG_DEVFS_FS) serial_driver.name = "tts/%d"; #else serial_driver.name = "ttyS%d";#endif
I don't think so. Some quick grepping indicates that _all_ tty drivers currently use the "ttyS" equivalent if !CONFIG_DEVFS.
Instead, it appears that someone broke
tty_name(). Here's the 2.2 kernel's version:char *tty_name(struct
tty_struct*tty, char *buf){ if (tty) sprintf(buf, "%s%d", tty->driver.name, TTY_NUMBER(tty)); else strcpy(buf, "NULL tty"); return buf; }And that's much more sensible. The tty has a name associated with what it is (eg "ttyS") - correlates with major number, probably. And it has an instance number.
Which is cleaner, IMO, than embedding printf control strings in the driver name.
drivers/char/tty_io.c Wed Jan 2 20:39:53 2002 renamed from drivers/char/tty_io.c Wed Dec 26 11:47:40 2001 +1
-1@@ -194,7 +194,7 @@ _tty_make_name(struct tty_struct *tty, c if (!tty) /* Hmm. NULL pointer. That's fun. */ strcpy(buf, "NULL tty"); else - sprintf(buf, name, + sprintf(buf, "%s%d", name, idx + tty->driver.name_base); return buf;
Quoted 1 line
Does this look (and work) OK to you?
No, because with this implementation you'll break the devfs printk.
We have two options, I guess:
1) Change the drivers to have "ttx/%d" (devfs) and "ttyX%d" (non-devfs), and leave _tty_make_name() untouched (my original suggestion).
2) Change the drivers to have "ttx/" (devfs) and "ttyX" (non-devfs) and change _tty_make_name() as suggested above by Andrew. I don't know how this would affect devfs though ...
I really don't care which solution is used (although I do prefer option 2, if possible), but I'm sure that it can't stay as it is now, because right now it's broken.
So ... Which one is more appropriate?? Any other suggestions??
Later,
Signature · 4 lines
Ivan Passos -o) Integration Manager, Cyclades - http://www.cyclades.com /\\ Project Leader, NetLinOS - http://www.netlinos.org _\_V --------------------------------------------------------------------