aboutsummaryrefslogtreecommitdiff
path: root/arch/um/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/mconsole_user.c7
-rw-r--r--arch/um/drivers/net_user.c80
-rw-r--r--arch/um/drivers/tty.c31
-rw-r--r--arch/um/drivers/ubd_kern.c1
4 files changed, 54 insertions, 65 deletions
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index 4b109fe7fff..9bfd405c3bd 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -18,7 +18,12 @@
#include "umid.h"
static struct mconsole_command commands[] = {
- { "version", mconsole_version, MCONSOLE_INTR },
+ /* With uts namespaces, uts information becomes process-specific, so
+ * we need a process context. If we try handling this in interrupt
+ * context, we may hit an exiting process without a valid uts
+ * namespace.
+ */
+ { "version", mconsole_version, MCONSOLE_PROC },
{ "halt", mconsole_halt, MCONSOLE_PROC },
{ "reboot", mconsole_reboot, MCONSOLE_PROC },
{ "config", mconsole_config, MCONSOLE_PROC },
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index 0a7786e00cf..107c5e43fa0 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)
{
int tap_addr[4];
- if(gate_addr == NULL) return(0);
+ if(gate_addr == NULL)
+ return 0;
if(sscanf(gate_addr, "%d.%d.%d.%d", &tap_addr[0],
&tap_addr[1], &tap_addr[2], &tap_addr[3]) != 4){
printk("Invalid tap IP address - '%s'\n", gate_addr);
- return(-EINVAL);
+ return -EINVAL;
}
- return(0);
+ return 0;
}
void tap_check_ips(char *gate_addr, unsigned char *eth_addr)
@@ -94,25 +95,25 @@ int net_read(int fd, void *buf, int len)
n = os_read_file(fd, buf, len);
if(n == -EAGAIN)
- return(0);
+ return 0;
else if(n == 0)
- return(-ENOTCONN);
- return(n);
+ return -ENOTCONN;
+ return n;
}
int net_recvfrom(int fd, void *buf, int len)
{
int n;
- while(((n = recvfrom(fd, buf, len, 0, NULL, NULL)) < 0) &&
- (errno == EINTR)) ;
-
+ CATCH_EINTR(n = recvfrom(fd, buf, len, 0, NULL, NULL));
if(n < 0){
- if(errno == EAGAIN) return(0);
- return(-errno);
+ if(errno == EAGAIN)
+ return 0;
+ return -errno;
}
- else if(n == 0) return(-ENOTCONN);
- return(n);
+ else if(n == 0)
+ return -ENOTCONN;
+ return n;
}
int net_write(int fd, void *buf, int len)
@@ -122,37 +123,41 @@ int net_write(int fd, void *buf, int len)
n = os_write_file(fd, buf, len);
if(n == -EAGAIN)
- return(0);
+ return 0;
else if(n == 0)
- return(-ENOTCONN);
- return(n);
+ return -ENOTCONN;
+ return n;
}
int net_send(int fd, void *buf, int len)
{
int n;
- while(((n = send(fd, buf, len, 0)) < 0) && (errno == EINTR)) ;
+ CATCH_EINTR(n = send(fd, buf, len, 0));
if(n < 0){
- if(errno == EAGAIN) return(0);
- return(-errno);
+ if(errno == EAGAIN)
+ return 0;
+ return -errno;
}
- else if(n == 0) return(-ENOTCONN);
- return(n);
+ else if(n == 0)
+ return -ENOTCONN;
+ return n;
}
int net_sendto(int fd, void *buf, int len, void *to, int sock_len)
{
int n;
- while(((n = sendto(fd, buf, len, 0, (struct sockaddr *) to,
- sock_len)) < 0) && (errno == EINTR)) ;
+ CATCH_EINTR(n = sendto(fd, buf, len, 0, (struct sockaddr *) to,
+ sock_len));
if(n < 0){
- if(errno == EAGAIN) return(0);
- return(-errno);
+ if(errno == EAGAIN)
+ return 0;
+ return -errno;
}
- else if(n == 0) return(-ENOTCONN);
- return(n);
+ else if(n == 0)
+ return -ENOTCONN;
+ return n;
}
struct change_pre_exec_data {
@@ -176,7 +181,7 @@ static int change_tramp(char **argv, char *output, int output_len)
err = os_pipe(fds, 1, 0);
if(err < 0){
printk("change_tramp - pipe failed, err = %d\n", -err);
- return(err);
+ return err;
}
pe_data.close_me = fds[0];
pe_data.stdout = fds[1];
@@ -190,7 +195,7 @@ static int change_tramp(char **argv, char *output, int output_len)
if (pid > 0)
CATCH_EINTR(err = waitpid(pid, NULL, 0));
- return(pid);
+ return pid;
}
static void change(char *dev, char *what, unsigned char *addr,
@@ -241,26 +246,15 @@ char *split_if_spec(char *str, ...)
va_start(ap, str);
while((arg = va_arg(ap, char **)) != NULL){
if(*str == '\0')
- return(NULL);
+ return NULL;
end = strchr(str, ',');
if(end != str)
*arg = str;
if(end == NULL)
- return(NULL);
+ return NULL;
*end++ = '\0';
str = end;
}
va_end(ap);
- return(str);
+ return str;
}
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only. This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index 94c9265a4f2..9f70edf5d8e 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
@@ -25,17 +25,17 @@ static void *tty_chan_init(char *str, int device, struct chan_opts *opts)
if(*str != ':'){
printk("tty_init : channel type 'tty' must specify "
"a device\n");
- return(NULL);
+ return NULL;
}
str++;
data = um_kmalloc(sizeof(*data));
if(data == NULL)
- return(NULL);
+ return NULL;
*data = ((struct tty_chan) { .dev = str,
.raw = opts->raw });
-
- return(data);
+
+ return data;
}
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,
int fd, err;
fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0);
- if(fd < 0) return(fd);
+ if(fd < 0)
+ return fd;
+
if(data->raw){
CATCH_EINTR(err = tcgetattr(fd, &data->tt));
if(err)
- return(err);
+ return err;
err = raw(fd);
if(err)
- return(err);
+ return err;
}
*dev_out = data->dev;
- return(fd);
+ return fd;
}
struct chan_ops tty_ops = {
@@ -72,14 +74,3 @@ struct chan_ops tty_ops = {
.free = generic_free,
.winch = 0,
};
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only. This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 602d7286b9e..34085315aa5 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -627,7 +627,6 @@ static int ubd_new_disk(int major, u64 size, int unit,
{
struct gendisk *disk;
- int err;
disk = alloc_disk(1 << UBD_SHIFT);
if(disk == NULL)