summaryrefslogtreecommitdiffstats
path: root/kernel/arch/um/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/arch/um/drivers')
-rw-r--r--kernel/arch/um/drivers/harddog_user.c18
-rw-r--r--kernel/arch/um/drivers/hostaudio_kern.c20
-rw-r--r--kernel/arch/um/drivers/mconsole.h2
-rw-r--r--kernel/arch/um/drivers/net_kern.c17
-rw-r--r--kernel/arch/um/drivers/net_user.c16
-rw-r--r--kernel/arch/um/drivers/slip_user.c14
-rw-r--r--kernel/arch/um/drivers/slirp_user.c16
7 files changed, 53 insertions, 50 deletions
diff --git a/kernel/arch/um/drivers/harddog_user.c b/kernel/arch/um/drivers/harddog_user.c
index f99b32a4d..3aa8b0d52 100644
--- a/kernel/arch/um/drivers/harddog_user.c
+++ b/kernel/arch/um/drivers/harddog_user.c
@@ -9,8 +9,8 @@
#include <os.h>
struct dog_data {
- int stdin;
- int stdout;
+ int stdin_fd;
+ int stdout_fd;
int close_me[2];
};
@@ -18,11 +18,11 @@ static void pre_exec(void *d)
{
struct dog_data *data = d;
- dup2(data->stdin, 0);
- dup2(data->stdout, 1);
- dup2(data->stdout, 2);
- close(data->stdin);
- close(data->stdout);
+ dup2(data->stdin_fd, 0);
+ dup2(data->stdout_fd, 1);
+ dup2(data->stdout_fd, 2);
+ close(data->stdin_fd);
+ close(data->stdout_fd);
close(data->close_me[0]);
close(data->close_me[1]);
}
@@ -49,8 +49,8 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
goto out_close_in;
}
- data.stdin = out_fds[0];
- data.stdout = in_fds[1];
+ data.stdin_fd = out_fds[0];
+ data.stdout_fd = in_fds[1];
data.close_me[0] = out_fds[1];
data.close_me[1] = in_fds[0];
diff --git a/kernel/arch/um/drivers/hostaudio_kern.c b/kernel/arch/um/drivers/hostaudio_kern.c
index 9b90fdc4b..f6b911cc3 100644
--- a/kernel/arch/um/drivers/hostaudio_kern.c
+++ b/kernel/arch/um/drivers/hostaudio_kern.c
@@ -185,9 +185,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
int ret;
#ifdef DEBUG
- kparam_block_sysfs_write(dsp);
+ kernel_param_lock(THIS_MODULE);
printk(KERN_DEBUG "hostaudio: open called (host: %s)\n", dsp);
- kparam_unblock_sysfs_write(dsp);
+ kernel_param_unlock(THIS_MODULE);
#endif
state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL);
@@ -199,11 +199,11 @@ static int hostaudio_open(struct inode *inode, struct file *file)
if (file->f_mode & FMODE_WRITE)
w = 1;
- kparam_block_sysfs_write(dsp);
+ kernel_param_lock(THIS_MODULE);
mutex_lock(&hostaudio_mutex);
ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
mutex_unlock(&hostaudio_mutex);
- kparam_unblock_sysfs_write(dsp);
+ kernel_param_unlock(THIS_MODULE);
if (ret < 0) {
kfree(state);
@@ -260,17 +260,17 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
if (file->f_mode & FMODE_WRITE)
w = 1;
- kparam_block_sysfs_write(mixer);
+ kernel_param_lock(THIS_MODULE);
mutex_lock(&hostaudio_mutex);
ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
mutex_unlock(&hostaudio_mutex);
- kparam_unblock_sysfs_write(mixer);
+ kernel_param_unlock(THIS_MODULE);
if (ret < 0) {
- kparam_block_sysfs_write(dsp);
+ kernel_param_lock(THIS_MODULE);
printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
"err = %d\n", dsp, -ret);
- kparam_unblock_sysfs_write(dsp);
+ kernel_param_unlock(THIS_MODULE);
kfree(state);
return ret;
}
@@ -326,10 +326,10 @@ MODULE_LICENSE("GPL");
static int __init hostaudio_init_module(void)
{
- __kernel_param_lock();
+ kernel_param_lock(THIS_MODULE);
printk(KERN_INFO "UML Audio Relay (host dsp = %s, host mixer = %s)\n",
dsp, mixer);
- __kernel_param_unlock();
+ kernel_param_unlock(THIS_MODULE);
module_data.dev_audio = register_sound_dsp(&hostaudio_fops, -1);
if (module_data.dev_audio < 0) {
diff --git a/kernel/arch/um/drivers/mconsole.h b/kernel/arch/um/drivers/mconsole.h
index 8b22535c6..44af7379e 100644
--- a/kernel/arch/um/drivers/mconsole.h
+++ b/kernel/arch/um/drivers/mconsole.h
@@ -7,7 +7,7 @@
#ifndef __MCONSOLE_H__
#define __MCONSOLE_H__
-#ifndef __KERNEL__
+#ifdef __UM_HOST__
#include <stdint.h>
#define u32 uint32_t
#endif
diff --git a/kernel/arch/um/drivers/net_kern.c b/kernel/arch/um/drivers/net_kern.c
index f70dd5406..9ef669d24 100644
--- a/kernel/arch/um/drivers/net_kern.c
+++ b/kernel/arch/um/drivers/net_kern.c
@@ -388,7 +388,7 @@ static const struct net_device_ops uml_netdev_ops = {
static int driver_registered;
static void eth_configure(int n, void *init, char *mac,
- struct transport *transport)
+ struct transport *transport, gfp_t gfp_mask)
{
struct uml_net *device;
struct net_device *dev;
@@ -397,7 +397,7 @@ static void eth_configure(int n, void *init, char *mac,
size = transport->private_size + sizeof(struct uml_net_private);
- device = kzalloc(sizeof(*device), GFP_KERNEL);
+ device = kzalloc(sizeof(*device), gfp_mask);
if (device == NULL) {
printk(KERN_ERR "eth_configure failed to allocate struct "
"uml_net\n");
@@ -568,7 +568,7 @@ static LIST_HEAD(transports);
static LIST_HEAD(eth_cmd_line);
static int check_transport(struct transport *transport, char *eth, int n,
- void **init_out, char **mac_out)
+ void **init_out, char **mac_out, gfp_t gfp_mask)
{
int len;
@@ -582,7 +582,7 @@ static int check_transport(struct transport *transport, char *eth, int n,
else if (*eth != '\0')
return 0;
- *init_out = kmalloc(transport->setup_size, GFP_KERNEL);
+ *init_out = kmalloc(transport->setup_size, gfp_mask);
if (*init_out == NULL)
return 1;
@@ -609,11 +609,11 @@ void register_transport(struct transport *new)
list_for_each_safe(ele, next, &eth_cmd_line) {
eth = list_entry(ele, struct eth_init, list);
match = check_transport(new, eth->init, eth->index, &init,
- &mac);
+ &mac, GFP_KERNEL);
if (!match)
continue;
else if (init != NULL) {
- eth_configure(eth->index, init, mac, new);
+ eth_configure(eth->index, init, mac, new, GFP_KERNEL);
kfree(init);
}
list_del(&eth->list);
@@ -631,10 +631,11 @@ static int eth_setup_common(char *str, int index)
spin_lock(&transports_lock);
list_for_each(ele, &transports) {
transport = list_entry(ele, struct transport, list);
- if (!check_transport(transport, str, index, &init, &mac))
+ if (!check_transport(transport, str, index, &init,
+ &mac, GFP_ATOMIC))
continue;
if (init != NULL) {
- eth_configure(index, init, mac, transport);
+ eth_configure(index, init, mac, transport, GFP_ATOMIC);
kfree(init);
}
found = 1;
diff --git a/kernel/arch/um/drivers/net_user.c b/kernel/arch/um/drivers/net_user.c
index cd14157b5..e9f844586 100644
--- a/kernel/arch/um/drivers/net_user.c
+++ b/kernel/arch/um/drivers/net_user.c
@@ -166,7 +166,7 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len)
struct change_pre_exec_data {
int close_me;
- int stdout;
+ int stdout_fd;
};
static void change_pre_exec(void *arg)
@@ -174,7 +174,7 @@ static void change_pre_exec(void *arg)
struct change_pre_exec_data *data = arg;
close(data->close_me);
- dup2(data->stdout, 1);
+ dup2(data->stdout_fd, 1);
}
static int change_tramp(char **argv, char *output, int output_len)
@@ -189,7 +189,7 @@ static int change_tramp(char **argv, char *output, int output_len)
return err;
}
pe_data.close_me = fds[0];
- pe_data.stdout = fds[1];
+ pe_data.stdout_fd = fds[1];
pid = run_helper(change_pre_exec, &pe_data, argv);
if (pid > 0) /* Avoid hang as we won't get data in failure case. */
@@ -249,21 +249,23 @@ void close_addr(unsigned char *addr, unsigned char *netmask, void *arg)
char *split_if_spec(char *str, ...)
{
- char **arg, *end;
+ char **arg, *end, *ret = NULL;
va_list ap;
va_start(ap, str);
while ((arg = va_arg(ap, char **)) != NULL) {
if (*str == '\0')
- return NULL;
+ goto out;
end = strchr(str, ',');
if (end != str)
*arg = str;
if (end == NULL)
- return NULL;
+ goto out;
*end++ = '\0';
str = end;
}
+ ret = str;
+out:
va_end(ap);
- return str;
+ return ret;
}
diff --git a/kernel/arch/um/drivers/slip_user.c b/kernel/arch/um/drivers/slip_user.c
index 55c290d92..0d6b66c64 100644
--- a/kernel/arch/um/drivers/slip_user.c
+++ b/kernel/arch/um/drivers/slip_user.c
@@ -55,8 +55,8 @@ static int set_up_tty(int fd)
}
struct slip_pre_exec_data {
- int stdin;
- int stdout;
+ int stdin_fd;
+ int stdout_fd;
int close_me;
};
@@ -64,9 +64,9 @@ static void slip_pre_exec(void *arg)
{
struct slip_pre_exec_data *data = arg;
- if (data->stdin >= 0)
- dup2(data->stdin, 0);
- dup2(data->stdout, 1);
+ if (data->stdin_fd >= 0)
+ dup2(data->stdin_fd, 0);
+ dup2(data->stdout_fd, 1);
if (data->close_me >= 0)
close(data->close_me);
}
@@ -85,8 +85,8 @@ static int slip_tramp(char **argv, int fd)
}
err = 0;
- pe_data.stdin = fd;
- pe_data.stdout = fds[1];
+ pe_data.stdin_fd = fd;
+ pe_data.stdout_fd = fds[1];
pe_data.close_me = fds[0];
err = run_helper(slip_pre_exec, &pe_data, argv);
if (err < 0)
diff --git a/kernel/arch/um/drivers/slirp_user.c b/kernel/arch/um/drivers/slirp_user.c
index c999d187a..98b6a41a2 100644
--- a/kernel/arch/um/drivers/slirp_user.c
+++ b/kernel/arch/um/drivers/slirp_user.c
@@ -20,18 +20,18 @@ static int slirp_user_init(void *data, void *dev)
}
struct slirp_pre_exec_data {
- int stdin;
- int stdout;
+ int stdin_fd;
+ int stdout_fd;
};
static void slirp_pre_exec(void *arg)
{
struct slirp_pre_exec_data *data = arg;
- if (data->stdin != -1)
- dup2(data->stdin, 0);
- if (data->stdout != -1)
- dup2(data->stdout, 1);
+ if (data->stdin_fd != -1)
+ dup2(data->stdin_fd, 0);
+ if (data->stdout_fd != -1)
+ dup2(data->stdout_fd, 1);
}
static int slirp_tramp(char **argv, int fd)
@@ -39,8 +39,8 @@ static int slirp_tramp(char **argv, int fd)
struct slirp_pre_exec_data pe_data;
int pid;
- pe_data.stdin = fd;
- pe_data.stdout = fd;
+ pe_data.stdin_fd = fd;
+ pe_data.stdout_fd = fd;
pid = run_helper(slirp_pre_exec, &pe_data, argv);
return pid;