ttynvt_ioctl(): Cleanups around TCSET.. handling
Avoid nested switches and unnecessary block level.
This commit is contained in:
+4
-14
@@ -798,16 +798,6 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
|
|||||||
_ioctl_name(cmd), arg, in_buf,
|
_ioctl_name(cmd), arg, in_buf,
|
||||||
(unsigned int)in_bufsz, (unsigned int)out_bufsz);
|
(unsigned int)in_bufsz, (unsigned int)out_bufsz);
|
||||||
|
|
||||||
switch (cmd)
|
|
||||||
{
|
|
||||||
case TCSETSF:
|
|
||||||
case TCSETSW:
|
|
||||||
case TCSETS:
|
|
||||||
/* BEWARE of termios/termios2 buf structure difference! */
|
|
||||||
case TCSETSF2:
|
|
||||||
case TCSETSW2:
|
|
||||||
case TCSETS2:
|
|
||||||
{
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case TCSETSF:
|
case TCSETSF:
|
||||||
@@ -816,15 +806,16 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
|
|||||||
CHECK_BUF_IN(sizeof(struct termios));
|
CHECK_BUF_IN(sizeof(struct termios));
|
||||||
memcpy(tio, in_buf, in_bufsz);
|
memcpy(tio, in_buf, in_bufsz);
|
||||||
byte4 = htonl(_tio_baud(tio));
|
byte4 = htonl(_tio_baud(tio));
|
||||||
break;
|
goto do_tcset;
|
||||||
case TCSETSF2:
|
case TCSETSF2:
|
||||||
case TCSETSW2:
|
case TCSETSW2:
|
||||||
case TCSETS2:
|
case TCSETS2:
|
||||||
CHECK_BUF_IN(sizeof(struct termios2));
|
CHECK_BUF_IN(sizeof(struct termios2));
|
||||||
memcpy(tio, in_buf, in_bufsz);
|
memcpy(tio, in_buf, in_bufsz);
|
||||||
byte4 = htonl(_tio2_baud(tio));
|
byte4 = htonl(_tio2_baud(tio));
|
||||||
break;
|
goto do_tcset;
|
||||||
}
|
do_tcset:
|
||||||
|
/* BEWARE of termios/termios2 buf structure difference! */
|
||||||
telnet_rfc2217_cfg(tty->tn, TNS_SET_BAUDRATE, &byte4, 4);
|
telnet_rfc2217_cfg(tty->tn, TNS_SET_BAUDRATE, &byte4, 4);
|
||||||
|
|
||||||
byte = _tio_csize(tio);
|
byte = _tio_csize(tio);
|
||||||
@@ -872,7 +863,6 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
|
|||||||
tty->slave_suspended = 0; /* Re-enable polling of Slave */
|
tty->slave_suspended = 0; /* Re-enable polling of Slave */
|
||||||
|
|
||||||
fuse_reply_ioctl(req, 0, 0, 0);
|
fuse_reply_ioctl(req, 0, 0, 0);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case TCGETS:
|
case TCGETS:
|
||||||
CHECK_BUF_OUT(sizeof(struct termios));
|
CHECK_BUF_OUT(sizeof(struct termios));
|
||||||
|
|||||||
Reference in New Issue
Block a user