From: Jeff Dike Noticed by Frank Sorenson - the methods in arch/um/drivers/tty.c should be static. It turns out that all the channels have the same problem, so these are all fixed. These files export only a structure of function pointers, so that structure should be the only externally visible symbol. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton --- 25-akpm/arch/um/drivers/fd.c | 8 ++++---- 25-akpm/arch/um/drivers/null.c | 9 +++++---- 25-akpm/arch/um/drivers/port_user.c | 11 ++++++----- 25-akpm/arch/um/drivers/pty.c | 12 +++++++----- 25-akpm/arch/um/drivers/tty.c | 7 ++++--- 25-akpm/arch/um/drivers/xterm.c | 13 +++++++++---- 6 files changed, 35 insertions(+), 25 deletions(-) diff -puN arch/um/drivers/fd.c~uml-make-a-bunch-of-driver-functions-static arch/um/drivers/fd.c --- 25/arch/um/drivers/fd.c~uml-make-a-bunch-of-driver-functions-static 2005-03-07 22:16:25.000000000 -0800 +++ 25-akpm/arch/um/drivers/fd.c 2005-03-07 22:16:25.000000000 -0800 @@ -19,7 +19,7 @@ struct fd_chan { char str[sizeof("1234567890\0")]; }; -void *fd_init(char *str, int device, struct chan_opts *opts) +static void *fd_init(char *str, int device, struct chan_opts *opts) { struct fd_chan *data; char *end; @@ -43,7 +43,7 @@ void *fd_init(char *str, int device, str return(data); } -int fd_open(int input, int output, int primary, void *d, char **dev_out) +static int fd_open(int input, int output, int primary, void *d, char **dev_out) { struct fd_chan *data = d; int err; @@ -62,7 +62,7 @@ int fd_open(int input, int output, int p return(data->fd); } -void fd_close(int fd, void *d) +static void fd_close(int fd, void *d) { struct fd_chan *data = d; int err; @@ -76,7 +76,7 @@ void fd_close(int fd, void *d) } } -int fd_console_write(int fd, const char *buf, int n, void *d) +static int fd_console_write(int fd, const char *buf, int n, void *d) { struct fd_chan *data = d; diff -puN arch/um/drivers/null.c~uml-make-a-bunch-of-driver-functions-static arch/um/drivers/null.c --- 25/arch/um/drivers/null.c~uml-make-a-bunch-of-driver-functions-static 2005-03-07 22:16:25.000000000 -0800 +++ 25-akpm/arch/um/drivers/null.c 2005-03-07 22:16:25.000000000 -0800 @@ -10,23 +10,24 @@ static int null_chan; -void *null_init(char *str, int device, struct chan_opts *opts) +static void *null_init(char *str, int device, struct chan_opts *opts) { return(&null_chan); } -int null_open(int input, int output, int primary, void *d, char **dev_out) +static int null_open(int input, int output, int primary, void *d, + char **dev_out) { *dev_out = NULL; return(os_open_file(DEV_NULL, of_rdwr(OPENFLAGS()), 0)); } -int null_read(int fd, char *c_out, void *unused) +static int null_read(int fd, char *c_out, void *unused) { return(-ENODEV); } -void null_free(void *data) +static void null_free(void *data) { } diff -puN arch/um/drivers/port_user.c~uml-make-a-bunch-of-driver-functions-static arch/um/drivers/port_user.c --- 25/arch/um/drivers/port_user.c~uml-make-a-bunch-of-driver-functions-static 2005-03-07 22:16:25.000000000 -0800 +++ 25-akpm/arch/um/drivers/port_user.c 2005-03-07 22:16:25.000000000 -0800 @@ -28,7 +28,7 @@ struct port_chan { char dev[sizeof("32768\0")]; }; -void *port_init(char *str, int device, struct chan_opts *opts) +static void *port_init(char *str, int device, struct chan_opts *opts) { struct port_chan *data; void *kern_data; @@ -65,7 +65,7 @@ void *port_init(char *str, int device, s return(NULL); } -void port_free(void *d) +static void port_free(void *d) { struct port_chan *data = d; @@ -73,7 +73,8 @@ void port_free(void *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; @@ -92,7 +93,7 @@ int port_open(int input, int output, int return(fd); } -void port_close(int fd, void *d) +static void port_close(int fd, void *d) { struct port_chan *data = d; @@ -100,7 +101,7 @@ void port_close(int fd, void *d) os_close_file(fd); } -int port_console_write(int fd, const char *buf, int n, void *d) +static int port_console_write(int fd, const char *buf, int n, void *d) { struct port_chan *data = d; diff -puN arch/um/drivers/pty.c~uml-make-a-bunch-of-driver-functions-static arch/um/drivers/pty.c --- 25/arch/um/drivers/pty.c~uml-make-a-bunch-of-driver-functions-static 2005-03-07 22:16:25.000000000 -0800 +++ 25-akpm/arch/um/drivers/pty.c 2005-03-07 22:16:25.000000000 -0800 @@ -22,7 +22,7 @@ struct pty_chan { char dev_name[sizeof("/dev/pts/0123456\0")]; }; -void *pty_chan_init(char *str, int device, struct chan_opts *opts) +static void *pty_chan_init(char *str, int device, struct chan_opts *opts) { struct pty_chan *data; @@ -34,7 +34,8 @@ void *pty_chan_init(char *str, int devic return(data); } -int pts_open(int input, int output, int primary, void *d, char **dev_out) +static int pts_open(int input, int output, int primary, void *d, + char **dev_out) { struct pty_chan *data = d; char *dev; @@ -63,7 +64,7 @@ int pts_open(int input, int output, int return(fd); } -int getmaster(char *line) +static int getmaster(char *line) { char *pty, *bank, *cp; int master, err; @@ -92,7 +93,8 @@ int getmaster(char *line) return(-1); } -int pty_open(int input, int output, int primary, void *d, char **dev_out) +static int pty_open(int input, int output, int primary, void *d, + char **dev_out) { struct pty_chan *data = d; int fd, err; @@ -115,7 +117,7 @@ int pty_open(int input, int output, int return(fd); } -int pty_console_write(int fd, const char *buf, int n, void *d) +static int pty_console_write(int fd, const char *buf, int n, void *d) { struct pty_chan *data = d; diff -puN arch/um/drivers/tty.c~uml-make-a-bunch-of-driver-functions-static arch/um/drivers/tty.c --- 25/arch/um/drivers/tty.c~uml-make-a-bunch-of-driver-functions-static 2005-03-07 22:16:25.000000000 -0800 +++ 25-akpm/arch/um/drivers/tty.c 2005-03-07 22:16:25.000000000 -0800 @@ -18,7 +18,7 @@ struct tty_chan { struct termios tt; }; -void *tty_chan_init(char *str, int device, struct chan_opts *opts) +static void *tty_chan_init(char *str, int device, struct chan_opts *opts) { struct tty_chan *data; @@ -38,7 +38,8 @@ void *tty_chan_init(char *str, int devic return(data); } -int tty_open(int input, int output, int primary, void *d, char **dev_out) +static int tty_open(int input, int output, int primary, void *d, + char **dev_out) { struct tty_chan *data = d; int fd, err; @@ -59,7 +60,7 @@ int tty_open(int input, int output, int return(fd); } -int tty_console_write(int fd, const char *buf, int n, void *d) +static int tty_console_write(int fd, const char *buf, int n, void *d) { struct tty_chan *data = d; diff -puN arch/um/drivers/xterm.c~uml-make-a-bunch-of-driver-functions-static arch/um/drivers/xterm.c --- 25/arch/um/drivers/xterm.c~uml-make-a-bunch-of-driver-functions-static 2005-03-07 22:16:25.000000000 -0800 +++ 25-akpm/arch/um/drivers/xterm.c 2005-03-07 22:16:25.000000000 -0800 @@ -31,6 +31,7 @@ struct xterm_chan { int direct_rcv; }; +/* Not static because it's called directly by the tt mode gdb code */ void *xterm_init(char *str, int device, struct chan_opts *opts) { struct xterm_chan *data; @@ -83,8 +84,11 @@ __uml_setup("xterm=", xterm_setup, " are 'xterm=gnome-terminal,-t,-x'.\n\n" ); -/* XXX This badly needs some cleaning up in the error paths */ -int xterm_open(int input, int output, int primary, void *d, char **dev_out) +/* XXX This badly needs some cleaning up in the error paths + * Not static because it's called directly by the tt mode gdb code + */ +int xterm_open(int input, int output, int primary, void *d, + char **dev_out) { struct xterm_chan *data = d; unsigned long stack; @@ -170,6 +174,7 @@ int xterm_open(int input, int output, in return(new); } +/* Not static because it's called directly by the tt mode gdb code */ void xterm_close(int fd, void *d) { struct xterm_chan *data = d; @@ -183,12 +188,12 @@ void xterm_close(int fd, void *d) os_close_file(fd); } -void xterm_free(void *d) +static void xterm_free(void *d) { free(d); } -int xterm_console_write(int fd, const char *buf, int n, void *d) +static int xterm_console_write(int fd, const char *buf, int n, void *d) { struct xterm_chan *data = d; _