Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: um: convert to u8/__u8 and size_t

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>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
b49d1849 18977909

+17 -17
+1 -1
arch/um/drivers/chan.h
··· 30 30 extern void chan_interrupt(struct line *line, int irq); 31 31 extern int parse_chan_pair(char *str, struct line *line, int device, 32 32 const struct chan_opts *opts, char **error_out); 33 - extern int write_chan(struct chan *chan, const char *buf, int len, 33 + extern int write_chan(struct chan *chan, const u8 *buf, size_t len, 34 34 int write_irq); 35 35 extern int console_write_chan(struct chan *chan, const char *buf, 36 36 int len);
+4 -5
arch/um/drivers/chan_kern.c
··· 33 33 "UML\n"); 34 34 } 35 35 36 - static int not_configged_read(int fd, char *c_out, void *data) 36 + static int not_configged_read(int fd, u8 *c_out, void *data) 37 37 { 38 38 printk(KERN_ERR "Using a channel type which is configured out of " 39 39 "UML\n"); 40 40 return -EIO; 41 41 } 42 42 43 - static int not_configged_write(int fd, const char *buf, int len, void *data) 43 + static int not_configged_write(int fd, const u8 *buf, size_t len, void *data) 44 44 { 45 45 printk(KERN_ERR "Using a channel type which is configured out of " 46 46 "UML\n"); ··· 247 247 deactivate_fd(chan->fd, irq); 248 248 } 249 249 250 - int write_chan(struct chan *chan, const char *buf, int len, 251 - int write_irq) 250 + int write_chan(struct chan *chan, const u8 *buf, size_t len, int write_irq) 252 251 { 253 252 int n, ret = 0; 254 253 ··· 539 540 struct tty_port *port = &line->port; 540 541 struct chan *chan = line->chan_in; 541 542 int err; 542 - char c; 543 + u8 c; 543 544 544 545 if (!chan || !chan->ops->read) 545 546 goto out;
+2 -2
arch/um/drivers/chan_user.c
··· 19 19 close(fd); 20 20 } 21 21 22 - int generic_read(int fd, char *c_out, void *unused) 22 + int generic_read(int fd, __u8 *c_out, void *unused) 23 23 { 24 24 int n; 25 25 ··· 35 35 36 36 /* XXX Trivial wrapper around write */ 37 37 38 - int generic_write(int fd, const char *buf, int n, void *unused) 38 + int generic_write(int fd, const __u8 *buf, size_t n, void *unused) 39 39 { 40 40 int err; 41 41
+5 -4
arch/um/drivers/chan_user.h
··· 7 7 #define __CHAN_USER_H__ 8 8 9 9 #include <init.h> 10 + #include <linux/types.h> 10 11 11 12 struct chan_opts { 12 13 void (*const announce)(char *dev_name, int dev); ··· 20 19 void *(*init)(char *, int, const struct chan_opts *); 21 20 int (*open)(int, int, int, void *, char **); 22 21 void (*close)(int, void *); 23 - int (*read)(int, char *, void *); 24 - int (*write)(int, const char *, int, void *); 22 + int (*read)(int, __u8 *, void *); 23 + int (*write)(int, const __u8 *, size_t, void *); 25 24 int (*console_write)(int, const char *, int); 26 25 int (*window_size)(int, void *, unsigned short *, unsigned short *); 27 26 void (*free)(void *); ··· 32 31 tty_ops, xterm_ops; 33 32 34 33 extern void generic_close(int fd, void *unused); 35 - extern int generic_read(int fd, char *c_out, void *unused); 36 - extern int generic_write(int fd, const char *buf, int n, void *unused); 34 + extern int generic_read(int fd, __u8 *c_out, void *unused); 35 + extern int generic_write(int fd, const __u8 *buf, size_t n, void *unused); 37 36 extern int generic_console_write(int fd, const char *buf, int n); 38 37 extern int generic_window_size(int fd, void *unused, unsigned short *rows_out, 39 38 unsigned short *cols_out);
+1 -1
arch/um/drivers/line.c
··· 83 83 * 84 84 * Must be called while holding line->lock! 85 85 */ 86 - static int buffer_data(struct line *line, const char *buf, int len) 86 + static int buffer_data(struct line *line, const u8 *buf, size_t len) 87 87 { 88 88 int end, room; 89 89
+3 -3
arch/um/drivers/line.h
··· 47 47 * 48 48 * buffer points to a buffer allocated on demand, of length 49 49 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/ 50 - char *buffer; 51 - char *head; 52 - char *tail; 50 + u8 *buffer; 51 + u8 *head; 52 + u8 *tail; 53 53 54 54 int sigio; 55 55 struct delayed_work task;
+1 -1
arch/um/drivers/null.c
··· 28 28 return (fd < 0) ? -errno : fd; 29 29 } 30 30 31 - static int null_read(int fd, char *c_out, void *unused) 31 + static int null_read(int fd, __u8 *c_out, void *unused) 32 32 { 33 33 return -ENODEV; 34 34 }