]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
uml: fix build when SLOB is enabled
authorJeff Dike <jdike@addtoit.com>
Mon, 12 May 2008 21:01:52 +0000 (14:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 13 May 2008 15:02:22 +0000 (08:02 -0700)
Reintroduce uml_kmalloc for the benefit of UML libc code.  The
previous tactic of declaring __kmalloc so it could be called directly
from the libc side of the house turned out to be getting too intimate
with slab, and it doesn't work with slob.

So, the uml_kmalloc wrapper is back.  It calls kmalloc or whatever
that translates into, and libc code calls it.

kfree is left alone since that still works, leaving a somewhat
inconsistent API.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 files changed:
arch/um/drivers/chan_user.c
arch/um/drivers/cow_sys.h
arch/um/drivers/daemon_user.c
arch/um/drivers/fd.c
arch/um/drivers/mcast_user.c
arch/um/drivers/net_user.c
arch/um/drivers/port_user.c
arch/um/drivers/pty.c
arch/um/drivers/slip_user.c
arch/um/drivers/tty.c
arch/um/drivers/xterm.c
arch/um/include/um_malloc.h
arch/um/kernel/mem.c
arch/um/os-Linux/drivers/ethertap_user.c
arch/um/os-Linux/helper.c
arch/um/os-Linux/main.c
arch/um/os-Linux/sigio.c

index 025764089ac8ea7b739652c827fbe88b3a400324..cfeb3f4a44afc0ef9cb6a5edf5e08d0d81ec32a1 100644 (file)
@@ -11,6 +11,7 @@
 #include <termios.h>
 #include <sys/ioctl.h>
 #include "chan_user.h"
+#include "kern_constants.h"
 #include "os.h"
 #include "um_malloc.h"
 #include "user.h"
index ca8c9e11a39b9f94361b10c6739e8712ec3a932c..f5701fd2ef90b2d8d1964c3222ebb155c2594ec1 100644 (file)
@@ -8,7 +8,7 @@
 
 static inline void *cow_malloc(int size)
 {
-       return kmalloc(size, UM_GFP_KERNEL);
+       return uml_kmalloc(size, UM_GFP_KERNEL);
 }
 
 static inline void cow_free(void *ptr)
index f23c109a055c865e9e5aac0337a2afed17c96888..f8e85e0bdace20fddc82ca805e6101bcc9c76a8d 100644 (file)
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
 {
        struct sockaddr_un *sun;
 
-       sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
+       sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
        if (sun == NULL) {
                printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
                       "failed\n");
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
                goto out_close;
        }
 
-       sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
+       sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
        if (sun == NULL) {
                printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
                       "failed\n");
index 0a2bb5b64b82e8ca5bc66c0d76e06cab0e818ed6..f5a981a16240e4d8dd92afca3fb710d9d4d84588 100644 (file)
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
                return NULL;
        }
 
-       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
+       data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if (data == NULL)
                return NULL;
 
index 5f647d7a7292946dfdd36fecf0759198802c35a7..ee19e91568a2585765127970fc9d1ba821bcc613 100644 (file)
@@ -15,6 +15,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <netinet/in.h>
+#include "kern_constants.h"
 #include "mcast.h"
 #include "net_user.h"
 #include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
 {
        struct sockaddr_in *sin;
 
-       sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
+       sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
        if (sin == NULL) {
                printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
                       "failed\n");
index abf2653f5517cbf6f65b851dd10455e7bc8e27e2..9415dd9e63ef1e98c15505733c3ba1c1eff02029 100644 (file)
@@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char *addr,
                netmask[2], netmask[3]);
 
        output_len = UM_KERN_PAGE_SIZE;
-       output = kmalloc(output_len, UM_GFP_KERNEL);
+       output = uml_kmalloc(output_len, UM_GFP_KERNEL);
        if (output == NULL)
                printk(UM_KERN_ERR "change : failed to allocate output "
                       "buffer\n");
index d269ca387f108de63595a5bf46085864668537e6..b49bf56a56aa4a7b0b94a2b3709c972a144302f4 100644 (file)
@@ -47,7 +47,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)
        if (kern_data == NULL)
                return NULL;
 
-       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
+       data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if (data == NULL)
                goto err;
 
index 49c79dda6046492fc936c4c921a04d71d7584c2b..1113911dcb2bfb70696785ac194089705c9c8693 100644 (file)
@@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
 {
        struct pty_chan *data;
 
-       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
+       data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if (data == NULL)
                return NULL;
 
index 8b80505a3fb0117ed35676de600cce0b11b2f721..a1c2d2c98a942b9798994444f00501ddd5678132 100644 (file)
@@ -96,7 +96,7 @@ static int slip_tramp(char **argv, int fd)
        pid = err;
 
        output_len = UM_KERN_PAGE_SIZE;
-       output = kmalloc(output_len, UM_GFP_KERNEL);
+       output = uml_kmalloc(output_len, UM_GFP_KERNEL);
        if (output == NULL) {
                printk(UM_KERN_ERR "slip_tramp : failed to allocate output "
                       "buffer\n");
index c930fedc517235979c72989826a1f552f6454279..495858a090e4f49e50d4a79db016173ea4b3a6df 100644 (file)
@@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
        }
        str++;
 
-       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
+       data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if (data == NULL)
                return NULL;
        *data = ((struct tty_chan) { .dev       = str,
index 8a1c18a9b2406e678e820fd7ccc6ba979da8079a..da2caa5a21efa91333ffd44c9c7743b467ec3f26 100644 (file)
@@ -30,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
 {
        struct xterm_chan *data;
 
-       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
+       data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if (data == NULL)
                return NULL;
        *data = ((struct xterm_chan) { .pid             = -1,
index 0ad17cb83d96ef6b0ace0a4ea800113a8cc05040..c554d706d1060b9a1e9502f33525a23c64aed60b 100644 (file)
@@ -8,15 +8,12 @@
 
 #include "kern_constants.h"
 
-extern void *__kmalloc(int size, int flags);
-static inline void *kmalloc(int size, int flags)
-{
-       return __kmalloc(size, flags);
-}
-
+extern void *uml_kmalloc(int size, int flags);
 extern void kfree(const void *ptr);
 
 extern void *vmalloc(unsigned long size);
 extern void vfree(void *ptr);
 
 #endif /* __UM_MALLOC_H__ */
+
+
index 2eea1ff235e6c2cac17b80fdc343f2a9394f52d4..b0ee64622ff70a91bc3a44d52965b402dfaa81c1 100644 (file)
@@ -375,3 +375,8 @@ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
        return pmd;
 }
 #endif
+
+void *uml_kmalloc(int size, int flags)
+{
+       return kmalloc(size, flags);
+}
index 6fb0b174f538df06711bf0f5b779f62ea4eb1f63..cc72cb2c1af61302ff98cc88516d0889dad40829 100644 (file)
@@ -52,7 +52,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
                return;
        }
 
-       output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
+       output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
        if (output == NULL)
                printk(UM_KERN_ERR "etap_change : Failed to allocate output "
                       "buffer\n");
@@ -165,7 +165,7 @@ static int etap_open(void *data)
        err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
                         control_fds[1], data_fds[0], data_fds[1]);
        output_len = UM_KERN_PAGE_SIZE;
-       output = kmalloc(output_len, UM_GFP_KERNEL);
+       output = uml_kmalloc(output_len, UM_GFP_KERNEL);
        read_output(control_fds[0], output, output_len);
 
        if (output == NULL)
index f25c29a12d007676d736ed8b8fcb9c9e47a0eaed..74ca7aabf4e17374e8a38026b07b40b85580af76 100644 (file)
@@ -71,8 +71,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
        data.pre_data = pre_data;
        data.argv = argv;
        data.fd = fds[1];
-       data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
-                                       kmalloc(PATH_MAX, UM_GFP_KERNEL);
+       data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
+                                       uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
        pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
        if (pid < 0) {
                ret = -errno;
index abb9b0ffd9600402e770d93fce945c9b0295b98b..eee69b9f52c92bfd355303fd72b5afbf70502d7e 100644 (file)
@@ -199,7 +199,7 @@ void *__wrap_malloc(int size)
                return __real_malloc(size);
        else if (size <= UM_KERN_PAGE_SIZE)
                /* finding contiguous pages can be hard*/
-               ret = kmalloc(size, UM_GFP_KERNEL);
+               ret = uml_kmalloc(size, UM_GFP_KERNEL);
        else ret = vmalloc(size);
 
        /*
index abf47a7c4abd795c039f4c98136163819adb92a4..0578481983c4238eb63dbbd8a9f0351cc5bb27b4 100644 (file)
@@ -109,7 +109,7 @@ static int need_poll(struct pollfds *polls, int n)
        if (n <= polls->size)
                return 0;
 
-       new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
+       new = uml_kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
        if (new == NULL) {
                printk(UM_KERN_ERR "need_poll : failed to allocate new "
                       "pollfds\n");
@@ -243,7 +243,7 @@ static struct pollfd *setup_initial_poll(int fd)
 {
        struct pollfd *p;
 
-       p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
+       p = uml_kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
        if (p == NULL) {
                printk(UM_KERN_ERR "setup_initial_poll : failed to allocate "
                       "poll\n");