diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-02-10 04:44:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:21 -0500 |
commit | 67608e0c809ceca1b44755ee818199af7478ca77 (patch) | |
tree | a407374a1accc3d11494e9b770dd9e936691890c /arch/um/drivers/port_user.c | |
parent | d832fc60d533d52da7170cf5f95271c331259bca (diff) |
[PATCH] uml: port driver formatting
Whitespace and style fixes.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers/port_user.c')
-rw-r--r-- | arch/um/drivers/port_user.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index bc6afaf74c1..80508023054 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -38,18 +38,18 @@ static void *port_init(char *str, int device, const struct chan_opts *opts) | |||
38 | if(*str != ':'){ | 38 | if(*str != ':'){ |
39 | printk("port_init : channel type 'port' must specify a " | 39 | printk("port_init : channel type 'port' must specify a " |
40 | "port number\n"); | 40 | "port number\n"); |
41 | return(NULL); | 41 | return NULL; |
42 | } | 42 | } |
43 | str++; | 43 | str++; |
44 | port = strtoul(str, &end, 0); | 44 | port = strtoul(str, &end, 0); |
45 | if((*end != '\0') || (end == str)){ | 45 | if((*end != '\0') || (end == str)){ |
46 | printk("port_init : couldn't parse port '%s'\n", str); | 46 | printk("port_init : couldn't parse port '%s'\n", str); |
47 | return(NULL); | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
50 | kern_data = port_data(port); | 50 | kern_data = port_data(port); |
51 | if(kern_data == NULL) | 51 | if(kern_data == NULL) |
52 | return(NULL); | 52 | return NULL; |
53 | 53 | ||
54 | data = um_kmalloc(sizeof(*data)); | 54 | data = um_kmalloc(sizeof(*data)); |
55 | if(data == NULL) | 55 | if(data == NULL) |
@@ -59,10 +59,10 @@ static void *port_init(char *str, int device, const struct chan_opts *opts) | |||
59 | .kernel_data = kern_data }); | 59 | .kernel_data = kern_data }); |
60 | sprintf(data->dev, "%d", port); | 60 | sprintf(data->dev, "%d", port); |
61 | 61 | ||
62 | return(data); | 62 | return data; |
63 | err: | 63 | err: |
64 | port_kern_free(kern_data); | 64 | port_kern_free(kern_data); |
65 | return(NULL); | 65 | return NULL; |
66 | } | 66 | } |
67 | 67 | ||
68 | static void port_free(void *d) | 68 | static void port_free(void *d) |
@@ -83,14 +83,14 @@ static int port_open(int input, int output, int primary, void *d, | |||
83 | if((fd >= 0) && data->raw){ | 83 | if((fd >= 0) && data->raw){ |
84 | CATCH_EINTR(err = tcgetattr(fd, &data->tt)); | 84 | CATCH_EINTR(err = tcgetattr(fd, &data->tt)); |
85 | if(err) | 85 | if(err) |
86 | return(err); | 86 | return err; |
87 | 87 | ||
88 | err = raw(fd); | 88 | err = raw(fd); |
89 | if(err) | 89 | if(err) |
90 | return(err); | 90 | return err; |
91 | } | 91 | } |
92 | *dev_out = data->dev; | 92 | *dev_out = data->dev; |
93 | return(fd); | 93 | return fd; |
94 | } | 94 | } |
95 | 95 | ||
96 | static void port_close(int fd, void *d) | 96 | static void port_close(int fd, void *d) |
@@ -120,8 +120,8 @@ int port_listen_fd(int port) | |||
120 | int fd, err, arg; | 120 | int fd, err, arg; |
121 | 121 | ||
122 | fd = socket(PF_INET, SOCK_STREAM, 0); | 122 | fd = socket(PF_INET, SOCK_STREAM, 0); |
123 | if(fd == -1) | 123 | if(fd == -1) |
124 | return(-errno); | 124 | return -errno; |
125 | 125 | ||
126 | arg = 1; | 126 | arg = 1; |
127 | if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0){ | 127 | if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0){ |
@@ -136,7 +136,7 @@ int port_listen_fd(int port) | |||
136 | err = -errno; | 136 | err = -errno; |
137 | goto out; | 137 | goto out; |
138 | } | 138 | } |
139 | 139 | ||
140 | if(listen(fd, 1) < 0){ | 140 | if(listen(fd, 1) < 0){ |
141 | err = -errno; | 141 | err = -errno; |
142 | goto out; | 142 | goto out; |
@@ -146,10 +146,10 @@ int port_listen_fd(int port) | |||
146 | if(err < 0) | 146 | if(err < 0) |
147 | goto out; | 147 | goto out; |
148 | 148 | ||
149 | return(fd); | 149 | return fd; |
150 | out: | 150 | out: |
151 | os_close_file(fd); | 151 | os_close_file(fd); |
152 | return(err); | 152 | return err; |
153 | } | 153 | } |
154 | 154 | ||
155 | struct port_pre_exec_data { | 155 | struct port_pre_exec_data { |
@@ -173,13 +173,13 @@ void port_pre_exec(void *arg) | |||
173 | int port_connection(int fd, int *socket, int *pid_out) | 173 | int port_connection(int fd, int *socket, int *pid_out) |
174 | { | 174 | { |
175 | int new, err; | 175 | int new, err; |
176 | char *argv[] = { "/usr/sbin/in.telnetd", "-L", | 176 | char *argv[] = { "/usr/sbin/in.telnetd", "-L", |
177 | "/usr/lib/uml/port-helper", NULL }; | 177 | "/usr/lib/uml/port-helper", NULL }; |
178 | struct port_pre_exec_data data; | 178 | struct port_pre_exec_data data; |
179 | 179 | ||
180 | new = os_accept_connection(fd); | 180 | new = os_accept_connection(fd); |
181 | if(new < 0) | 181 | if(new < 0) |
182 | return(new); | 182 | return new; |
183 | 183 | ||
184 | err = os_pipe(socket, 0, 0); | 184 | err = os_pipe(socket, 0, 0); |
185 | if(err < 0) | 185 | if(err < 0) |
@@ -190,29 +190,18 @@ int port_connection(int fd, int *socket, int *pid_out) | |||
190 | .pipe_fd = socket[1] }); | 190 | .pipe_fd = socket[1] }); |
191 | 191 | ||
192 | err = run_helper(port_pre_exec, &data, argv, NULL); | 192 | err = run_helper(port_pre_exec, &data, argv, NULL); |
193 | if(err < 0) | 193 | if(err < 0) |
194 | goto out_shutdown; | 194 | goto out_shutdown; |
195 | 195 | ||
196 | *pid_out = err; | 196 | *pid_out = err; |
197 | return(new); | 197 | return new; |
198 | 198 | ||
199 | out_shutdown: | 199 | out_shutdown: |
200 | os_shutdown_socket(socket[0], 1, 1); | 200 | os_shutdown_socket(socket[0], 1, 1); |
201 | os_close_file(socket[0]); | 201 | os_close_file(socket[0]); |
202 | os_shutdown_socket(socket[1], 1, 1); | 202 | os_shutdown_socket(socket[1], 1, 1); |
203 | os_close_file(socket[1]); | 203 | os_close_file(socket[1]); |
204 | out_close: | 204 | out_close: |
205 | os_close_file(new); | 205 | os_close_file(new); |
206 | return(err); | 206 | return err; |
207 | } | 207 | } |
208 | |||
209 | /* | ||
210 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
211 | * Emacs will notice this stuff at the end of the file and automatically | ||
212 | * adjust the settings for this buffer only. This must remain at the end | ||
213 | * of the file. | ||
214 | * --------------------------------------------------------------------------- | ||
215 | * Local variables: | ||
216 | * c-file-style: "linux" | ||
217 | * End: | ||
218 | */ | ||