vt and tty: code review notes
authorAlan Cox <alan@linux.intel.com>
Sat, 8 Jul 2017 13:44:43 +0000 (14:44 +0100)
committerAlan Cox <alan@linux.intel.com>
Sat, 8 Jul 2017 13:44:43 +0000 (14:44 +0100)
Kernel/tty.c
Kernel/vt.c

index 31a56e6..e603fc1 100644 (file)
@@ -85,6 +85,7 @@ int tty_read(uint8_t minor, uint8_t rawflag, uint8_t flag)
                                nread = 0;
                                break;
                        }
+                       /* FIXME: check VEOL ??  */
                        if (c == '\n')
                                break;
                }
@@ -107,7 +108,6 @@ int tty_write(uint8_t minor, uint8_t rawflag, uint8_t flag)
        uint8_t c;
 
        used(rawflag);
-       used(flag);
 
        t = &ttydata[minor];
 
@@ -138,6 +138,7 @@ int tty_write(uint8_t minor, uint8_t rawflag, uint8_t flag)
                                else if (c == '\r' && (t->termios.c_oflag & OCRNL))
                                        c = '\n';
                        }
+                       /* FIXME: this needs to learn O_NDELAY */
                        tty_putc_wait(minor, c);
                }
                ++udata.u_base;
@@ -243,7 +244,8 @@ int tty_ioctl(uint8_t minor, uarg_t request, char *data)
 {                              /* Data in User Space */
         struct tty *t;
 
-       if (minor > NUM_DEV_TTY + 1) {
+        /* FIXME: can this go away ? */
+       if (minor > NUM_DEV_TTY) {
                udata.u_error = ENODEV;
                return -1;
        }
@@ -357,11 +359,12 @@ int tty_ioctl(uint8_t minor, uarg_t request, char *data)
 int tty_inproc(uint8_t minor, unsigned char c)
 {
        unsigned char oc;
-       int canon;
+       uint8_t canon;
        uint8_t wr;
        struct tty *t = &ttydata[minor];
        struct s_queue *q = &ttyinq[minor];
 
+       /* This is safe as ICANON is in the low bits */
        canon = t->termios.c_lflag & ICANON;
 
        if (t->termios.c_iflag & ISTRIP)
@@ -384,6 +387,7 @@ int tty_inproc(uint8_t minor, unsigned char c)
                if(t->termios.c_iflag & ICRNL)
                        c = '\n';
        }
+       /* Q: should this be else .. */
        if (c == '\n' && (t->termios.c_iflag & INLCR))
                c = '\r';
 
index 534681a..90d3dca 100644 (file)
@@ -221,6 +221,8 @@ void vtoutput(unsigned char *p, unsigned int len)
        vtbusy = 1;
        irqrestore(irq);
        cursor_off();
+       /* FIXME: do we ever get called with len > 1, if not we could strip
+          this right down */
        do {
                while (len--) {
                        unsigned char c = *p++;