#include "user.h"
#include "chan_user.h"
#include "port.h"
-#include "helper.h"
#include "os.h"
+#include "um_malloc.h"
struct port_chan {
int raw;
char dev[sizeof("32768\0")];
};
-void *port_init(char *str, int device, struct chan_opts *opts)
+static void *port_init(char *str, int device, const struct chan_opts *opts)
{
struct port_chan *data;
void *kern_data;
return(NULL);
}
-void port_free(void *d)
+static void port_free(void *d)
{
struct port_chan *data = d;
kfree(data);
}
-int port_open(int input, int output, int primary, void *d, char **dev_out)
+static int port_open(int input, int output, int primary, void *d,
+ char **dev_out)
{
struct port_chan *data = d;
int fd, err;
return(fd);
}
-void port_close(int fd, void *d)
+static void port_close(int fd, void *d)
{
struct port_chan *data = d;
os_close_file(fd);
}
-int port_console_write(int fd, const char *buf, int n, void *d)
-{
- struct port_chan *data = d;
-
- return(generic_console_write(fd, buf, n, &data->tt));
-}
-
-struct chan_ops port_ops = {
+const struct chan_ops port_ops = {
.type = "port",
.init = port_init,
.open = port_open,
.close = port_close,
.read = generic_read,
.write = generic_write,
- .console_write = port_console_write,
+ .console_write = generic_console_write,
.window_size = generic_window_size,
.free = port_free,
.winch = 1,