Commit b49d1849 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman
Browse files

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: default avatar"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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 18977909
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+4 −5
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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;

+5 −4
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;

Loading