Commit fe500503 authored by Paolo \'Blaisorblade\' Giarrusso's avatar Paolo \'Blaisorblade\' Giarrusso Committed by Linus Torvalds

[PATCH] uml: Reduces code in *_user files, by moving it in _kern files if already possible.

Reduces code in *_user files, by moving it in _kern files if already possible.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c5588b62
......@@ -17,6 +17,7 @@
#include "irq_user.h"
#include "sigio.h"
#include "line.h"
#include "os.h"
static void *not_configged_init(char *str, int device, struct chan_opts *opts)
{
......@@ -87,6 +88,52 @@ static struct chan_ops not_configged_ops = {
.winch = 0,
};
void generic_close(int fd, void *unused)
{
os_close_file(fd);
}
int generic_read(int fd, char *c_out, void *unused)
{
int n;
n = os_read_file(fd, c_out, sizeof(*c_out));
if(n == -EAGAIN)
return(0);
else if(n == 0)
return(-EIO);
return(n);
}
int generic_write(int fd, const char *buf, int n, void *unused)
{
return(os_write_file(fd, buf, n));
}
int generic_window_size(int fd, void *unused, unsigned short *rows_out,
unsigned short *cols_out)
{
int rows, cols;
int ret;
ret = os_window_size(fd, &rows, &cols);
if(ret < 0)
return(ret);
ret = ((*rows_out != rows) || (*cols_out != cols));
*rows_out = rows;
*cols_out = cols;
return(ret);
}
void generic_free(void *data)
{
kfree(data);
}
static void tty_receive_char(struct tty_struct *tty, char ch)
{
if(tty == NULL) return;
......
......@@ -21,31 +21,6 @@
#include "choose-mode.h"
#include "mode.h"
void generic_close(int fd, void *unused)
{
os_close_file(fd);
}
int generic_read(int fd, char *c_out, void *unused)
{
int n;
n = os_read_file(fd, c_out, sizeof(*c_out));
if(n == -EAGAIN)
return(0);
else if(n == 0)
return(-EIO);
return(n);
}
/* XXX Trivial wrapper around os_write_file */
int generic_write(int fd, const char *buf, int n, void *unused)
{
return(os_write_file(fd, buf, n));
}
int generic_console_write(int fd, const char *buf, int n, void *unused)
{
struct termios save, new;
......@@ -62,29 +37,6 @@ int generic_console_write(int fd, const char *buf, int n, void *unused)
return(err);
}
int generic_window_size(int fd, void *unused, unsigned short *rows_out,
unsigned short *cols_out)
{
int rows, cols;
int ret;
ret = os_window_size(fd, &rows, &cols);
if(ret < 0)
return(ret);
ret = ((*rows_out != rows) || (*cols_out != cols));
*rows_out = rows;
*cols_out = cols;
return(ret);
}
void generic_free(void *data)
{
kfree(data);
}
static void winch_handler(int sig)
{
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment