aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-07-16 02:38:56 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:38 -0400
commite4c4bf9968cb4f0fceb1b8fb54790ccae73caf4e (patch)
treefe9892123214821c37a7b615fe52db7f6d46e148 /arch/um/os-Linux
parentc43990162fc7f9d2f15a12797fdc6f9c0905f704 (diff)
uml: Eliminate kernel allocator wrappers
UML had two wrapper procedures for kmalloc, um_kmalloc and um_kmalloc_atomic because the flag constants weren't available in userspace code. kern_constants.h had made kernel constants available for a long time, so there is no need for these wrappers any more. Rather, userspace code calls kmalloc directly with the userspace versions of the gfp flags. kmalloc isn't a real procedure, so I had to essentially copy the inline wrapper around __kmalloc. vmalloc also had its own wrapper for no good reason. This is now gone. Signed-off-by: Jeff Dike <jdike@linux.intel.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/os-Linux')
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c4
-rw-r--r--arch/um/os-Linux/helper.c4
-rw-r--r--arch/um/os-Linux/main.c4
-rw-r--r--arch/um/os-Linux/sigio.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index cac01b31ea95..61d3953c7ac9 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -54,7 +54,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
54 return; 54 return;
55 } 55 }
56 56
57 output = um_kmalloc(UM_KERN_PAGE_SIZE); 57 output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
58 if(output == NULL) 58 if(output == NULL)
59 printk("etap_change : Failed to allocate output buffer\n"); 59 printk("etap_change : Failed to allocate output buffer\n");
60 read_output(fd, output, UM_KERN_PAGE_SIZE); 60 read_output(fd, output, UM_KERN_PAGE_SIZE);
@@ -166,7 +166,7 @@ static int etap_open(void *data)
166 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], 166 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
167 control_fds[1], data_fds[0], data_fds[1]); 167 control_fds[1], data_fds[0], data_fds[1]);
168 output_len = UM_KERN_PAGE_SIZE; 168 output_len = UM_KERN_PAGE_SIZE;
169 output = um_kmalloc(output_len); 169 output = kmalloc(output_len, UM_GFP_KERNEL);
170 read_output(control_fds[0], output, output_len); 170 read_output(control_fds[0], output, output_len);
171 171
172 if(output == NULL) 172 if(output == NULL)
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 9cf48d0577cc..d81af7b8587a 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -72,8 +72,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
72 data.pre_data = pre_data; 72 data.pre_data = pre_data;
73 data.argv = argv; 73 data.argv = argv;
74 data.fd = fds[1]; 74 data.fd = fds[1];
75 data.buf = __cant_sleep() ? um_kmalloc_atomic(PATH_MAX) : 75 data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
76 um_kmalloc(PATH_MAX); 76 kmalloc(PATH_MAX, UM_GFP_KERNEL);
77 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); 77 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data);
78 if (pid < 0) { 78 if (pid < 0) {
79 ret = -errno; 79 ret = -errno;
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index fb510d40480c..e85f4995a011 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -235,8 +235,8 @@ void *__wrap_malloc(int size)
235 return __real_malloc(size); 235 return __real_malloc(size);
236 else if(size <= UM_KERN_PAGE_SIZE) 236 else if(size <= UM_KERN_PAGE_SIZE)
237 /* finding contiguous pages can be hard*/ 237 /* finding contiguous pages can be hard*/
238 ret = um_kmalloc(size); 238 ret = kmalloc(size, UM_GFP_KERNEL);
239 else ret = um_vmalloc(size); 239 else ret = vmalloc(size);
240 240
241 /* glibc people insist that if malloc fails, errno should be 241 /* glibc people insist that if malloc fails, errno should be
242 * set by malloc as well. So we do. 242 * set by malloc as well. So we do.
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 2c23cb261188..dc03e9cccb63 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -105,7 +105,7 @@ static int need_poll(struct pollfds *polls, int n)
105 if(n <= polls->size) 105 if(n <= polls->size)
106 return 0; 106 return 0;
107 107
108 new = um_kmalloc_atomic(n * sizeof(struct pollfd)); 108 new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
109 if(new == NULL){ 109 if(new == NULL){
110 printk("need_poll : failed to allocate new pollfds\n"); 110 printk("need_poll : failed to allocate new pollfds\n");
111 return -ENOMEM; 111 return -ENOMEM;
@@ -233,7 +233,7 @@ static struct pollfd *setup_initial_poll(int fd)
233{ 233{
234 struct pollfd *p; 234 struct pollfd *p;
235 235
236 p = um_kmalloc(sizeof(struct pollfd)); 236 p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
237 if (p == NULL) { 237 if (p == NULL) {
238 printk("setup_initial_poll : failed to allocate poll\n"); 238 printk("setup_initial_poll : failed to allocate poll\n");
239 return NULL; 239 return NULL;