UML - Make a bunch of driver functions static
PATCH 16/16 UML - Make a bunch of driver functions static
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.
arch/um/drivers/fd.c +4 -4
@@ -19,7 +19,7 @@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 @@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 @@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 @@ } } -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;
arch/um/drivers/null.c +5 -4
@@ -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) { }
arch/um/drivers/port_user.c +6 -5
@@ -28,7 +28,7 @@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 @@return (NULL ); } -void port_free (void *d) +static void port_free (void *d) {struct port_chan *data = d;
@@ -73,7 +73,8 @@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 @@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 @@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;
arch/um/drivers/pty.c +7 -5
@@ -22,7 +22,7 @@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 @@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 @@return (fd); } -int getmaster (char *line) +static int getmaster (char *line) {char *pty, *bank, *cp;int master, err;
@@ -92,7 +93,8 @@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 @@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;
arch/um/drivers/tty.c +4 -3
@@ -18,7 +18,7 @@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 @@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 @@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;
arch/um/drivers/xterm.c +9 -4
@@ -31,6 +31,7 @@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 @@" 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 @@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 @@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;
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel