tty: um: convert to u8/__u8 and size_t
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Wed, 6 Dec 2023 07:37:11 +0000 (08:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Dec 2023 11:02:38 +0000 (12:02 +0100)
Switch character types to u8 and sizes to size_t. To conform to
characters/sizes in the rest of the tty layer.

Note we use __u8 in the userspace files.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-um@lists.infradead.org
Link: https://lore.kernel.org/r/20231206073712.17776-27-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/um/drivers/chan.h
arch/um/drivers/chan_kern.c
arch/um/drivers/chan_user.c
arch/um/drivers/chan_user.h
arch/um/drivers/line.c
arch/um/drivers/line.h
arch/um/drivers/null.c

index 3fec3b8406e98a2bad48c19630ce0cd801f738b4..e14b9cdf7a33df26367e766099405d350510fdde 100644 (file)
@@ -30,7 +30,7 @@ struct chan {
 extern void chan_interrupt(struct line *line, int irq);
 extern int parse_chan_pair(char *str, struct line *line, int device,
                           const struct chan_opts *opts, char **error_out);
-extern int write_chan(struct chan *chan, const char *buf, int len,
+extern int write_chan(struct chan *chan, const u8 *buf, size_t len,
                             int write_irq);
 extern int console_write_chan(struct chan *chan, const char *buf, 
                              int len);
index 26a702a06515492a8797e8f4fa7bd59282435060..37538b4168da6af584d0b5b2ccc035516edb9b0f 100644 (file)
@@ -33,14 +33,14 @@ static void not_configged_close(int fd, void *data)
               "UML\n");
 }
 
-static int not_configged_read(int fd, char *c_out, void *data)
+static int not_configged_read(int fd, u8 *c_out, void *data)
 {
        printk(KERN_ERR "Using a channel type which is configured out of "
               "UML\n");
        return -EIO;
 }
 
-static int not_configged_write(int fd, const char *buf, int len, void *data)
+static int not_configged_write(int fd, const u8 *buf, size_t len, void *data)
 {
        printk(KERN_ERR "Using a channel type which is configured out of "
               "UML\n");
@@ -247,8 +247,7 @@ void deactivate_chan(struct chan *chan, int irq)
                deactivate_fd(chan->fd, irq);
 }
 
-int write_chan(struct chan *chan, const char *buf, int len,
-              int write_irq)
+int write_chan(struct chan *chan, const u8 *buf, size_t len, int write_irq)
 {
        int n, ret = 0;
 
@@ -540,7 +539,7 @@ void chan_interrupt(struct line *line, int irq)
        struct tty_port *port = &line->port;
        struct chan *chan = line->chan_in;
        int err;
-       char c;
+       u8 c;
 
        if (!chan || !chan->ops->read)
                goto out;
index 25727ed648b7273bf960aa4259aa1374123c493d..40d98dd23c8a817960a7efcc240fd6b7c5da1907 100644 (file)
@@ -19,7 +19,7 @@ void generic_close(int fd, void *unused)
        close(fd);
 }
 
-int generic_read(int fd, char *c_out, void *unused)
+int generic_read(int fd, __u8 *c_out, void *unused)
 {
        int n;
 
@@ -35,7 +35,7 @@ int generic_read(int fd, char *c_out, void *unused)
 
 /* XXX Trivial wrapper around write */
 
-int generic_write(int fd, const char *buf, int n, void *unused)
+int generic_write(int fd, const __u8 *buf, size_t n, void *unused)
 {
        int err;
 
index 4e51b85e2a23a524066333353585de857403e5ae..e158e16fb3cc9852af0cd496034ce8cd20e03eb2 100644 (file)
@@ -7,6 +7,7 @@
 #define __CHAN_USER_H__
 
 #include <init.h>
+#include <linux/types.h>
 
 struct chan_opts {
        void (*const announce)(char *dev_name, int dev);
@@ -19,8 +20,8 @@ struct chan_ops {
        void *(*init)(char *, int, const struct chan_opts *);
        int (*open)(int, int, int, void *, char **);
        void (*close)(int, void *);
-       int (*read)(int, char *, void *);
-       int (*write)(int, const char *, int, void *);
+       int (*read)(int, __u8 *, void *);
+       int (*write)(int, const __u8 *, size_t, void *);
        int (*console_write)(int, const char *, int);
        int (*window_size)(int, void *, unsigned short *, unsigned short *);
        void (*free)(void *);
@@ -31,8 +32,8 @@ extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
        tty_ops, xterm_ops;
 
 extern void generic_close(int fd, void *unused);
-extern int generic_read(int fd, char *c_out, void *unused);
-extern int generic_write(int fd, const char *buf, int n, void *unused);
+extern int generic_read(int fd, __u8 *c_out, void *unused);
+extern int generic_write(int fd, const __u8 *buf, size_t n, void *unused);
 extern int generic_console_write(int fd, const char *buf, int n);
 extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
                               unsigned short *cols_out);
index b98545f3edb5033260dad9590d812f3ddc522360..c9403629cc56ca01152e60d7824151e0c7a8c11c 100644 (file)
@@ -83,7 +83,7 @@ unsigned int line_chars_in_buffer(struct tty_struct *tty)
  *
  * Must be called while holding line->lock!
  */
-static int buffer_data(struct line *line, const char *buf, int len)
+static int buffer_data(struct line *line, const u8 *buf, size_t len)
 {
        int end, room;
 
index e84fb9b4165e86f498031b004184772dd33471f9..e8bd6f3dfb507771e1d7f9e89252904e14240199 100644 (file)
@@ -47,9 +47,9 @@ struct line {
         *
         * buffer points to a buffer allocated on demand, of length
         * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
-       char *buffer;
-       char *head;
-       char *tail;
+       u8 *buffer;
+       u8 *head;
+       u8 *tail;
 
        int sigio;
        struct delayed_work task;
index 87087763a417f946e15fb33992ccb269db218d3e..30d59b8481b40711e018f81c5826acc02d3bc42b 100644 (file)
@@ -28,7 +28,7 @@ static int null_open(int input, int output, int primary, void *d,
        return (fd < 0) ? -errno : fd;
 }
 
-static int null_read(int fd, char *c_out, void *unused)
+static int null_read(int fd, __u8 *c_out, void *unused)
 {
        return -ENODEV;
 }