diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-07-10 07:45:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:24 -0400 |
commit | 108ffa8cbfa323d462a2f4b49f38da3205d36e5a (patch) | |
tree | a9474c48ff4da341ce296b9b26da70dd5bba0fd2 /arch/um/drivers | |
parent | 1d3468a6643a6a5905e2ac9ae1fa1aefc06d882a (diff) |
[PATCH] uml: formatting fixes
Fix a bunch of formatting problems.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/net_user.c | 70 | ||||
-rw-r--r-- | arch/um/drivers/tty.c | 31 |
2 files changed, 44 insertions, 57 deletions
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 0a7786e00cfb..8cd851be0e4d 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c | |||
@@ -22,13 +22,14 @@ int tap_open_common(void *dev, char *gate_addr) | |||
22 | { | 22 | { |
23 | int tap_addr[4]; | 23 | int tap_addr[4]; |
24 | 24 | ||
25 | if(gate_addr == NULL) return(0); | 25 | if(gate_addr == NULL) |
26 | return 0; | ||
26 | if(sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0], | 27 | if(sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0], |
27 | &tap_addr[1], &tap_addr[2], &tap_addr[3]) != 4){ | 28 | &tap_addr[1], &tap_addr[2], &tap_addr[3]) != 4){ |
28 | printk("Invalid tap IP address - '%s'\n", gate_addr); | 29 | printk("Invalid tap IP address - '%s'\n", gate_addr); |
29 | return(-EINVAL); | 30 | return -EINVAL; |
30 | } | 31 | } |
31 | return(0); | 32 | return 0; |
32 | } | 33 | } |
33 | 34 | ||
34 | void tap_check_ips(char *gate_addr, unsigned char *eth_addr) | 35 | void tap_check_ips(char *gate_addr, unsigned char *eth_addr) |
@@ -94,10 +95,10 @@ int net_read(int fd, void *buf, int len) | |||
94 | n = os_read_file(fd, buf, len); | 95 | n = os_read_file(fd, buf, len); |
95 | 96 | ||
96 | if(n == -EAGAIN) | 97 | if(n == -EAGAIN) |
97 | return(0); | 98 | return 0; |
98 | else if(n == 0) | 99 | else if(n == 0) |
99 | return(-ENOTCONN); | 100 | return -ENOTCONN; |
100 | return(n); | 101 | return n; |
101 | } | 102 | } |
102 | 103 | ||
103 | int net_recvfrom(int fd, void *buf, int len) | 104 | int net_recvfrom(int fd, void *buf, int len) |
@@ -108,11 +109,13 @@ int net_recvfrom(int fd, void *buf, int len) | |||
108 | (errno == EINTR)) ; | 109 | (errno == EINTR)) ; |
109 | 110 | ||
110 | if(n < 0){ | 111 | if(n < 0){ |
111 | if(errno == EAGAIN) return(0); | 112 | if(errno == EAGAIN) |
112 | return(-errno); | 113 | return 0; |
114 | return -errno; | ||
113 | } | 115 | } |
114 | else if(n == 0) return(-ENOTCONN); | 116 | else if(n == 0) |
115 | return(n); | 117 | return -ENOTCONN; |
118 | return n; | ||
116 | } | 119 | } |
117 | 120 | ||
118 | int net_write(int fd, void *buf, int len) | 121 | int net_write(int fd, void *buf, int len) |
@@ -122,10 +125,10 @@ int net_write(int fd, void *buf, int len) | |||
122 | n = os_write_file(fd, buf, len); | 125 | n = os_write_file(fd, buf, len); |
123 | 126 | ||
124 | if(n == -EAGAIN) | 127 | if(n == -EAGAIN) |
125 | return(0); | 128 | return 0; |
126 | else if(n == 0) | 129 | else if(n == 0) |
127 | return(-ENOTCONN); | 130 | return -ENOTCONN; |
128 | return(n); | 131 | return n; |
129 | } | 132 | } |
130 | 133 | ||
131 | int net_send(int fd, void *buf, int len) | 134 | int net_send(int fd, void *buf, int len) |
@@ -134,11 +137,13 @@ int net_send(int fd, void *buf, int len) | |||
134 | 137 | ||
135 | while(((n = send(fd, buf, len, 0)) < 0) && (errno == EINTR)) ; | 138 | while(((n = send(fd, buf, len, 0)) < 0) && (errno == EINTR)) ; |
136 | if(n < 0){ | 139 | if(n < 0){ |
137 | if(errno == EAGAIN) return(0); | 140 | if(errno == EAGAIN) |
138 | return(-errno); | 141 | return 0; |
142 | return -errno; | ||
139 | } | 143 | } |
140 | else if(n == 0) return(-ENOTCONN); | 144 | else if(n == 0) |
141 | return(n); | 145 | return -ENOTCONN; |
146 | return n; | ||
142 | } | 147 | } |
143 | 148 | ||
144 | int net_sendto(int fd, void *buf, int len, void *to, int sock_len) | 149 | int net_sendto(int fd, void *buf, int len, void *to, int sock_len) |
@@ -148,11 +153,13 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len) | |||
148 | while(((n = sendto(fd, buf, len, 0, (struct sockaddr *) to, | 153 | while(((n = sendto(fd, buf, len, 0, (struct sockaddr *) to, |
149 | sock_len)) < 0) && (errno == EINTR)) ; | 154 | sock_len)) < 0) && (errno == EINTR)) ; |
150 | if(n < 0){ | 155 | if(n < 0){ |
151 | if(errno == EAGAIN) return(0); | 156 | if(errno == EAGAIN) |
152 | return(-errno); | 157 | return 0; |
158 | return -errno; | ||
153 | } | 159 | } |
154 | else if(n == 0) return(-ENOTCONN); | 160 | else if(n == 0) |
155 | return(n); | 161 | return -ENOTCONN; |
162 | return n; | ||
156 | } | 163 | } |
157 | 164 | ||
158 | struct change_pre_exec_data { | 165 | struct change_pre_exec_data { |
@@ -176,7 +183,7 @@ static int change_tramp(char **argv, char *output, int output_len) | |||
176 | err = os_pipe(fds, 1, 0); | 183 | err = os_pipe(fds, 1, 0); |
177 | if(err < 0){ | 184 | if(err < 0){ |
178 | printk("change_tramp - pipe failed, err = %d\n", -err); | 185 | printk("change_tramp - pipe failed, err = %d\n", -err); |
179 | return(err); | 186 | return err; |
180 | } | 187 | } |
181 | pe_data.close_me = fds[0]; | 188 | pe_data.close_me = fds[0]; |
182 | pe_data.stdout = fds[1]; | 189 | pe_data.stdout = fds[1]; |
@@ -190,7 +197,7 @@ static int change_tramp(char **argv, char *output, int output_len) | |||
190 | 197 | ||
191 | if (pid > 0) | 198 | if (pid > 0) |
192 | CATCH_EINTR(err = waitpid(pid, NULL, 0)); | 199 | CATCH_EINTR(err = waitpid(pid, NULL, 0)); |
193 | return(pid); | 200 | return pid; |
194 | } | 201 | } |
195 | 202 | ||
196 | static void change(char *dev, char *what, unsigned char *addr, | 203 | static void change(char *dev, char *what, unsigned char *addr, |
@@ -241,26 +248,15 @@ char *split_if_spec(char *str, ...) | |||
241 | va_start(ap, str); | 248 | va_start(ap, str); |
242 | while((arg = va_arg(ap, char **)) != NULL){ | 249 | while((arg = va_arg(ap, char **)) != NULL){ |
243 | if(*str == '\0') | 250 | if(*str == '\0') |
244 | return(NULL); | 251 | return NULL; |
245 | end = strchr(str, ','); | 252 | end = strchr(str, ','); |
246 | if(end != str) | 253 | if(end != str) |
247 | *arg = str; | 254 | *arg = str; |
248 | if(end == NULL) | 255 | if(end == NULL) |
249 | return(NULL); | 256 | return NULL; |
250 | *end++ = '\0'; | 257 | *end++ = '\0'; |
251 | str = end; | 258 | str = end; |
252 | } | 259 | } |
253 | va_end(ap); | 260 | va_end(ap); |
254 | return(str); | 261 | return str; |
255 | } | 262 | } |
256 | |||
257 | /* | ||
258 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
259 | * Emacs will notice this stuff at the end of the file and automatically | ||
260 | * adjust the settings for this buffer only. This must remain at the end | ||
261 | * of the file. | ||
262 | * --------------------------------------------------------------------------- | ||
263 | * Local variables: | ||
264 | * c-file-style: "linux" | ||
265 | * End: | ||
266 | */ | ||
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c index 94c9265a4f2c..9f70edf5d8ef 100644 --- a/arch/um/drivers/tty.c +++ b/arch/um/drivers/tty.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 | */ |
@@ -25,17 +25,17 @@ static void *tty_chan_init(char *str, int device, struct chan_opts *opts) | |||
25 | if(*str != ':'){ | 25 | if(*str != ':'){ |
26 | printk("tty_init : channel type 'tty' must specify " | 26 | printk("tty_init : channel type 'tty' must specify " |
27 | "a device\n"); | 27 | "a device\n"); |
28 | return(NULL); | 28 | return NULL; |
29 | } | 29 | } |
30 | str++; | 30 | str++; |
31 | 31 | ||
32 | data = um_kmalloc(sizeof(*data)); | 32 | data = um_kmalloc(sizeof(*data)); |
33 | if(data == NULL) | 33 | if(data == NULL) |
34 | return(NULL); | 34 | return NULL; |
35 | *data = ((struct tty_chan) { .dev = str, | 35 | *data = ((struct tty_chan) { .dev = str, |
36 | .raw = opts->raw }); | 36 | .raw = opts->raw }); |
37 | 37 | ||
38 | return(data); | 38 | return data; |
39 | } | 39 | } |
40 | 40 | ||
41 | static int tty_open(int input, int output, int primary, void *d, | 41 | static int tty_open(int input, int output, int primary, void *d, |
@@ -45,19 +45,21 @@ static int tty_open(int input, int output, int primary, void *d, | |||
45 | int fd, err; | 45 | int fd, err; |
46 | 46 | ||
47 | fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0); | 47 | fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0); |
48 | if(fd < 0) return(fd); | 48 | if(fd < 0) |
49 | return fd; | ||
50 | |||
49 | if(data->raw){ | 51 | if(data->raw){ |
50 | CATCH_EINTR(err = tcgetattr(fd, &data->tt)); | 52 | CATCH_EINTR(err = tcgetattr(fd, &data->tt)); |
51 | if(err) | 53 | if(err) |
52 | return(err); | 54 | return err; |
53 | 55 | ||
54 | err = raw(fd); | 56 | err = raw(fd); |
55 | if(err) | 57 | if(err) |
56 | return(err); | 58 | return err; |
57 | } | 59 | } |
58 | 60 | ||
59 | *dev_out = data->dev; | 61 | *dev_out = data->dev; |
60 | return(fd); | 62 | return fd; |
61 | } | 63 | } |
62 | 64 | ||
63 | struct chan_ops tty_ops = { | 65 | struct chan_ops tty_ops = { |
@@ -72,14 +74,3 @@ struct chan_ops tty_ops = { | |||
72 | .free = generic_free, | 74 | .free = generic_free, |
73 | .winch = 0, | 75 | .winch = 0, |
74 | }; | 76 | }; |
75 | |||
76 | /* | ||
77 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
78 | * Emacs will notice this stuff at the end of the file and automatically | ||
79 | * adjust the settings for this buffer only. This must remain at the end | ||
80 | * of the file. | ||
81 | * --------------------------------------------------------------------------- | ||
82 | * Local variables: | ||
83 | * c-file-style: "linux" | ||
84 | * End: | ||
85 | */ | ||