qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/3] linux-user: Add missing termbits types and values def


From: Laurent Vivier
Subject: Re: [PATCH v2 2/3] linux-user: Add missing termbits types and values definitions
Date: Mon, 24 Aug 2020 22:39:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Le 23/07/2020 à 23:02, Filip Bozuta a écrit :
> This patch introduces missing target types ('target_flag_t', 'target_cc_t',
> 'target_speed_t') in a few 'termibts.h' header files. Also, two missing
> values ('TARGET_IUTF8' and 'TARGET_EXTPROC') were also added. These values
> were also added in file 'syscall.c' in bitmask tables 'iflag_tbl[]' and
> 'lflag_tbl[]' which are used to convert values of 'struct termios' between
> target and host.
> 
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
>  linux-user/alpha/termbits.h   |  1 +
>  linux-user/cris/termbits.h    | 18 ++++++++----
>  linux-user/hppa/termbits.h    | 17 +++++++----
>  linux-user/mips/termbits.h    | 17 +++++++----
>  linux-user/ppc/termbits.h     | 21 ++++++++------
>  linux-user/sh4/termbits.h     | 19 +++++++++----
>  linux-user/sparc/termbits.h   | 18 ++++++++----
>  linux-user/sparc64/termbits.h | 18 ++++++++----
>  linux-user/syscall.c          | 34 +++++++++++-----------
>  linux-user/xtensa/termbits.h  | 53 ++++++++++++++++++-----------------
>  10 files changed, 130 insertions(+), 86 deletions(-)
> 
> diff --git a/linux-user/alpha/termbits.h b/linux-user/alpha/termbits.h
> index a71425174a..4a4b1e96f2 100644
> --- a/linux-user/alpha/termbits.h
> +++ b/linux-user/alpha/termbits.h
> @@ -159,6 +159,7 @@ struct target_termios {
>  #define TARGET_FLUSHO        0x00800000
>  #define TARGET_PENDIN        0x20000000
>  #define TARGET_IEXTEN        0x00000400
> +#define TARGET_EXTPROC  0x10000000
>  
>  #define TARGET_FIOCLEX               TARGET_IO('f', 1)
>  #define TARGET_FIONCLEX      TARGET_IO('f', 2)
> diff --git a/linux-user/cris/termbits.h b/linux-user/cris/termbits.h
> index 475ee70fed..0c8d8fc051 100644
> --- a/linux-user/cris/termbits.h
> +++ b/linux-user/cris/termbits.h
> @@ -5,13 +5,17 @@
>  
>  #define TARGET_NCCS 19
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -    unsigned int c_iflag;               /* input mode flags */
> -    unsigned int c_oflag;               /* output mode flags */
> -    unsigned int c_cflag;               /* control mode flags */
> -    unsigned int c_lflag;               /* local mode flags */
> -    unsigned char c_line;                    /* line discipline */
> -    unsigned char c_cc[TARGET_NCCS];                /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
>  /* c_iflag bits */
> @@ -29,6 +33,7 @@ struct target_termios {
>  #define TARGET_IXANY   0004000
>  #define TARGET_IXOFF   0010000
>  #define TARGET_IMAXBEL 0020000
> +#define TARGET_IUTF8   0040000
>  
>  /* c_oflag bits */
>  #define TARGET_OPOST   0000001
> @@ -118,6 +123,7 @@ struct target_termios {
>  #define TARGET_FLUSHO  0010000
>  #define TARGET_PENDIN  0040000
>  #define TARGET_IEXTEN  0100000
> +#define TARGET_EXTPROC 0200000
>  
>  /* c_cc character offsets */
>  #define TARGET_VINTR 0
> diff --git a/linux-user/hppa/termbits.h b/linux-user/hppa/termbits.h
> index 8fba839dd4..11fd4eed62 100644
> --- a/linux-user/hppa/termbits.h
> +++ b/linux-user/hppa/termbits.h
> @@ -5,13 +5,17 @@
>  
>  #define TARGET_NCCS 19
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -    unsigned int c_iflag;               /* input mode flags */
> -    unsigned int c_oflag;               /* output mode flags */
> -    unsigned int c_cflag;               /* control mode flags */
> -    unsigned int c_lflag;               /* local mode flags */
> -    unsigned char c_line;                    /* line discipline */
> -    unsigned char c_cc[TARGET_NCCS];                /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
>  /* c_iflag bits */
> @@ -120,6 +124,7 @@ struct target_termios {
>  #define TARGET_FLUSHO  0010000
>  #define TARGET_PENDIN  0040000
>  #define TARGET_IEXTEN  0100000
> +#define TARGET_EXTPROC 0200000
>  
>  /* c_cc character offsets */
>  #define TARGET_VINTR    0
> diff --git a/linux-user/mips/termbits.h b/linux-user/mips/termbits.h
> index 3287cf6df8..e8b4b58d87 100644
> --- a/linux-user/mips/termbits.h
> +++ b/linux-user/mips/termbits.h
> @@ -5,13 +5,17 @@
>  
>  #define TARGET_NCCS 23
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -    unsigned int c_iflag;               /* input mode flags */
> -    unsigned int c_oflag;               /* output mode flags */
> -    unsigned int c_cflag;               /* control mode flags */
> -    unsigned int c_lflag;               /* local mode flags */
> -    unsigned char c_line;                    /* line discipline */
> -    unsigned char c_cc[TARGET_NCCS];                /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
>  /* c_iflag bits */
> @@ -133,6 +137,7 @@ struct target_termios {
>  #define TARGET_PENDIN  0040000
>  #define TARGET_TOSTOP  0100000
>  #define TARGET_ITOSTOP TARGET_TOSTOP
> +#define TARGET_EXTPROC 0200000
>  
>  /* c_cc character offsets */
>  #define TARGET_VINTR 0
> diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
> index 19e4c6eda8..7066d1e552 100644
> --- a/linux-user/ppc/termbits.h
> +++ b/linux-user/ppc/termbits.h
> @@ -5,15 +5,19 @@
>  
>  #define TARGET_NCCS 19
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -    unsigned int c_iflag;               /* input mode flags */
> -    unsigned int c_oflag;               /* output mode flags */
> -    unsigned int c_cflag;               /* control mode flags */
> -    unsigned int c_lflag;               /* local mode flags */
> -    unsigned char c_cc[TARGET_NCCS];                /* control characters */
> -    unsigned char c_line;                    /* line discipline */
> -    unsigned int c_ispeed;           /* input speed */
> -    unsigned int c_ospeed;           /* output speed */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
> +    target_speed_t c_ispeed;               /* input speed */
> +    target_speed_t c_ospeed;               /* output speed */
>  };
>  
>  /* c_cc character offsets */
> @@ -158,6 +162,7 @@ struct target_termios {
>  #define TARGET_FLUSHO        0x00800000
>  #define TARGET_PENDIN        0x20000000
>  #define TARGET_IEXTEN        0x00000400
> +#define TARGET_EXTPROC  0x10000000
>  
>  /* ioctls */
>  
> diff --git a/linux-user/sh4/termbits.h b/linux-user/sh4/termbits.h
> index dd125b6a2b..f91b5c51cf 100644
> --- a/linux-user/sh4/termbits.h
> +++ b/linux-user/sh4/termbits.h
> @@ -5,15 +5,20 @@
>  
>  #define TARGET_NCCS 19
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -     unsigned int c_iflag;                   /* input mode flags */
> -     unsigned int c_oflag;                   /* output mode flags */
> -     unsigned int c_cflag;                   /* control mode flags */
> -     unsigned int c_lflag;                   /* local mode flags */
> -     unsigned char c_line;                   /* line discipline */
> -     unsigned char c_cc[TARGET_NCCS];        /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
> +
>  /* c_cc characters */
>  #define TARGET_VINTR 0
>  #define TARGET_VQUIT 1
> @@ -150,6 +155,8 @@ struct target_termios {
>  #define TARGET_FLUSHO        0010000
>  #define TARGET_PENDIN        0040000
>  #define TARGET_IEXTEN        0100000
> +#define TARGET_EXTPROC  0200000
> +
>  
>  /* tcflow() and TCXONC use these */
>  #define TARGET_TCOOFF                0
> diff --git a/linux-user/sparc/termbits.h b/linux-user/sparc/termbits.h
> index f85219ed71..704bee1c42 100644
> --- a/linux-user/sparc/termbits.h
> +++ b/linux-user/sparc/termbits.h
> @@ -5,15 +5,20 @@
>  
>  #define TARGET_NCCS 19
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -    unsigned int c_iflag;               /* input mode flags */
> -    unsigned int c_oflag;               /* output mode flags */
> -    unsigned int c_cflag;               /* control mode flags */
> -    unsigned int c_lflag;               /* local mode flags */
> -    unsigned char c_line;                    /* line discipline */
> -    unsigned char c_cc[TARGET_NCCS];                /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
> +
>  /* c_cc characters */
>  #define TARGET_VINTR    0
>  #define TARGET_VQUIT    1
> @@ -170,6 +175,7 @@ struct target_termios {
>  #define TARGET_FLUSHO        0x00002000
>  #define TARGET_PENDIN        0x00004000
>  #define TARGET_IEXTEN        0x00008000
> +#define TARGET_EXTPROC  0x00010000
>  
>  /* ioctls */
>  
> diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h
> index 11b5abcf84..1ab1e80db5 100644
> --- a/linux-user/sparc64/termbits.h
> +++ b/linux-user/sparc64/termbits.h
> @@ -5,15 +5,20 @@
>  
>  #define TARGET_NCCS 19
>  
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
> +
>  struct target_termios {
> -    unsigned int c_iflag;               /* input mode flags */
> -    unsigned int c_oflag;               /* output mode flags */
> -    unsigned int c_cflag;               /* control mode flags */
> -    unsigned int c_lflag;               /* local mode flags */
> -    unsigned char c_line;                    /* line discipline */
> -    unsigned char c_cc[TARGET_NCCS];                /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
> +
>  /* c_cc characters */
>  #define TARGET_VINTR    0
>  #define TARGET_VQUIT    1
> @@ -170,6 +175,7 @@ struct target_termios {
>  #define TARGET_FLUSHO        0x00002000
>  #define TARGET_PENDIN        0x00004000
>  #define TARGET_IEXTEN        0x00008000
> +#define TARGET_EXTPROC  0x00010000
>  
>  /* ioctls */
>  
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 24d915f0ff..e815f14bac 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -5508,6 +5508,7 @@ static const bitmask_transtbl iflag_tbl[] = {
>          { TARGET_IXANY, TARGET_IXANY, IXANY, IXANY },
>          { TARGET_IXOFF, TARGET_IXOFF, IXOFF, IXOFF },
>          { TARGET_IMAXBEL, TARGET_IMAXBEL, IMAXBEL, IMAXBEL },
> +        { TARGET_IUTF8, TARGET_IUTF8, IUTF8, IUTF8},
>          { 0, 0, 0, 0 }
>  };
>  
> @@ -5575,22 +5576,23 @@ static const bitmask_transtbl cflag_tbl[] = {
>  };
>  
>  static const bitmask_transtbl lflag_tbl[] = {
> -     { TARGET_ISIG, TARGET_ISIG, ISIG, ISIG },
> -     { TARGET_ICANON, TARGET_ICANON, ICANON, ICANON },
> -     { TARGET_XCASE, TARGET_XCASE, XCASE, XCASE },
> -     { TARGET_ECHO, TARGET_ECHO, ECHO, ECHO },
> -     { TARGET_ECHOE, TARGET_ECHOE, ECHOE, ECHOE },
> -     { TARGET_ECHOK, TARGET_ECHOK, ECHOK, ECHOK },
> -     { TARGET_ECHONL, TARGET_ECHONL, ECHONL, ECHONL },
> -     { TARGET_NOFLSH, TARGET_NOFLSH, NOFLSH, NOFLSH },
> -     { TARGET_TOSTOP, TARGET_TOSTOP, TOSTOP, TOSTOP },
> -     { TARGET_ECHOCTL, TARGET_ECHOCTL, ECHOCTL, ECHOCTL },
> -     { TARGET_ECHOPRT, TARGET_ECHOPRT, ECHOPRT, ECHOPRT },
> -     { TARGET_ECHOKE, TARGET_ECHOKE, ECHOKE, ECHOKE },
> -     { TARGET_FLUSHO, TARGET_FLUSHO, FLUSHO, FLUSHO },
> -     { TARGET_PENDIN, TARGET_PENDIN, PENDIN, PENDIN },
> -     { TARGET_IEXTEN, TARGET_IEXTEN, IEXTEN, IEXTEN },
> -     { 0, 0, 0, 0 }
> +  { TARGET_ISIG, TARGET_ISIG, ISIG, ISIG },
> +  { TARGET_ICANON, TARGET_ICANON, ICANON, ICANON },
> +  { TARGET_XCASE, TARGET_XCASE, XCASE, XCASE },
> +  { TARGET_ECHO, TARGET_ECHO, ECHO, ECHO },
> +  { TARGET_ECHOE, TARGET_ECHOE, ECHOE, ECHOE },
> +  { TARGET_ECHOK, TARGET_ECHOK, ECHOK, ECHOK },
> +  { TARGET_ECHONL, TARGET_ECHONL, ECHONL, ECHONL },
> +  { TARGET_NOFLSH, TARGET_NOFLSH, NOFLSH, NOFLSH },
> +  { TARGET_TOSTOP, TARGET_TOSTOP, TOSTOP, TOSTOP },
> +  { TARGET_ECHOCTL, TARGET_ECHOCTL, ECHOCTL, ECHOCTL },
> +  { TARGET_ECHOPRT, TARGET_ECHOPRT, ECHOPRT, ECHOPRT },
> +  { TARGET_ECHOKE, TARGET_ECHOKE, ECHOKE, ECHOKE },
> +  { TARGET_FLUSHO, TARGET_FLUSHO, FLUSHO, FLUSHO },
> +  { TARGET_PENDIN, TARGET_PENDIN, PENDIN, PENDIN },
> +  { TARGET_IEXTEN, TARGET_IEXTEN, IEXTEN, IEXTEN },
> +  { TARGET_EXTPROC, TARGET_EXTPROC, EXTPROC, EXTPROC},
> +  { 0, 0, 0, 0 }
>  };
>  
>  static void target_to_host_termios (void *dst, const void *src)
> diff --git a/linux-user/xtensa/termbits.h b/linux-user/xtensa/termbits.h
> index d1e09e61a6..2a603ecae6 100644
> --- a/linux-user/xtensa/termbits.h
> +++ b/linux-user/xtensa/termbits.h
> @@ -15,40 +15,40 @@
>  
>  #include <linux/posix_types.h>
>  
> -typedef unsigned char   cc_t;
> -typedef unsigned int    speed_t;
> -typedef unsigned int    tcflag_t;
> +typedef unsigned char   target_cc_t;        /* cc_t */
> +typedef unsigned int    target_speed_t;     /* speed_t */
> +typedef unsigned int    target_tcflag_t;    /* tcflag_t */
>  
> -#define TARGET_NCCS 19
>  struct target_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[TARGET_NCCS]; /* control characters */
> +    target_tcflag_t c_iflag;               /* input mode flags */
> +    target_tcflag_t c_oflag;               /* output mode flags */
> +    target_tcflag_t c_cflag;               /* control mode flags */
> +    target_tcflag_t c_lflag;               /* local mode flags */
> +    target_cc_t c_line;                    /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS];         /* control characters */
>  };
>  
> +
>  struct target_termios2 {
> -    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[TARGET_NCCS]; /* control characters */
> -    speed_t c_ispeed;       /* input speed */
> -    speed_t c_ospeed;       /* output speed */
> +    target_tcflag_t c_iflag;       /* input mode flags */
> +    target_tcflag_t c_oflag;       /* output mode flags */
> +    target_tcflag_t c_cflag;       /* control mode flags */
> +    target_tcflag_t c_lflag;       /* local mode flags */
> +    target_cc_t c_line;            /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS]; /* control characters */
> +    target_speed_t c_ispeed;       /* input speed */
> +    target_speed_t c_ospeed;       /* output speed */
>  };
>  
>  struct target_ktermios {
> -    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[TARGET_NCCS]; /* control characters */
> -    speed_t c_ispeed;       /* input speed */
> -    speed_t c_ospeed;       /* output speed */
> +    target_tcflag_t c_iflag;       /* input mode flags */
> +    target_tcflag_t c_oflag;       /* output mode flags */
> +    target_tcflag_t c_cflag;       /* control mode flags */
> +    target_tcflag_t c_lflag;       /* local mode flags */
> +    target_cc_t c_line;            /* line discipline */
> +    target_cc_t c_cc[TARGET_NCCS]; /* control characters */
> +    target_speed_t c_ispeed;       /* input speed */
> +    target_speed_t c_ospeed;       /* output speed */
>  };
>  
>  /* c_cc characters */
> @@ -195,6 +195,7 @@ struct target_ktermios {
>  #define TARGET_FLUSHO   0010000
>  #define TARGET_PENDIN   0040000
>  #define TARGET_IEXTEN   0100000
> +#define TARGET_EXTPROC  0200000
>  
>  /* tcflow() and TCXONC use these */
>  
>
Applied to my linux-user-for-5.2 branch.

Thanks,
Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]