Commit 43f5b3085fdd27c4edf535d938b2cb0ccead4f75
Committed by
Linus Torvalds
1 parent
484f1e2c1e
uml: fix build when SLOB is enabled
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>
Showing 17 changed files with 28 additions and 24 deletions Side-by-side Diff
- 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
arch/um/drivers/chan_user.c
arch/um/drivers/cow_sys.h
arch/um/drivers/daemon_user.c
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | { |
35 | 35 | struct sockaddr_un *sun; |
36 | 36 | |
37 | - sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); | |
37 | + sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); | |
38 | 38 | if (sun == NULL) { |
39 | 39 | printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " |
40 | 40 | "failed\n"); |
... | ... | @@ -83,7 +83,7 @@ |
83 | 83 | goto out_close; |
84 | 84 | } |
85 | 85 | |
86 | - sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); | |
86 | + sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); | |
87 | 87 | if (sun == NULL) { |
88 | 88 | printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un " |
89 | 89 | "failed\n"); |
arch/um/drivers/fd.c
arch/um/drivers/mcast_user.c
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | #include <unistd.h> |
16 | 16 | #include <errno.h> |
17 | 17 | #include <netinet/in.h> |
18 | +#include "kern_constants.h" | |
18 | 19 | #include "mcast.h" |
19 | 20 | #include "net_user.h" |
20 | 21 | #include "um_malloc.h" |
... | ... | @@ -24,7 +25,7 @@ |
24 | 25 | { |
25 | 26 | struct sockaddr_in *sin; |
26 | 27 | |
27 | - sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL); | |
28 | + sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL); | |
28 | 29 | if (sin == NULL) { |
29 | 30 | printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in " |
30 | 31 | "failed\n"); |
arch/um/drivers/net_user.c
... | ... | @@ -222,7 +222,7 @@ |
222 | 222 | netmask[2], netmask[3]); |
223 | 223 | |
224 | 224 | output_len = UM_KERN_PAGE_SIZE; |
225 | - output = kmalloc(output_len, UM_GFP_KERNEL); | |
225 | + output = uml_kmalloc(output_len, UM_GFP_KERNEL); | |
226 | 226 | if (output == NULL) |
227 | 227 | printk(UM_KERN_ERR "change : failed to allocate output " |
228 | 228 | "buffer\n"); |
arch/um/drivers/port_user.c
arch/um/drivers/pty.c
arch/um/drivers/slip_user.c
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | pid = err; |
97 | 97 | |
98 | 98 | output_len = UM_KERN_PAGE_SIZE; |
99 | - output = kmalloc(output_len, UM_GFP_KERNEL); | |
99 | + output = uml_kmalloc(output_len, UM_GFP_KERNEL); | |
100 | 100 | if (output == NULL) { |
101 | 101 | printk(UM_KERN_ERR "slip_tramp : failed to allocate output " |
102 | 102 | "buffer\n"); |
arch/um/drivers/tty.c
arch/um/drivers/xterm.c
arch/um/include/um_malloc.h
... | ... | @@ -8,12 +8,7 @@ |
8 | 8 | |
9 | 9 | #include "kern_constants.h" |
10 | 10 | |
11 | -extern void *__kmalloc(int size, int flags); | |
12 | -static inline void *kmalloc(int size, int flags) | |
13 | -{ | |
14 | - return __kmalloc(size, flags); | |
15 | -} | |
16 | - | |
11 | +extern void *uml_kmalloc(int size, int flags); | |
17 | 12 | extern void kfree(const void *ptr); |
18 | 13 | |
19 | 14 | extern void *vmalloc(unsigned long size); |
arch/um/kernel/mem.c
arch/um/os-Linux/drivers/ethertap_user.c
... | ... | @@ -52,7 +52,7 @@ |
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL); | |
55 | + output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL); | |
56 | 56 | if (output == NULL) |
57 | 57 | printk(UM_KERN_ERR "etap_change : Failed to allocate output " |
58 | 58 | "buffer\n"); |
... | ... | @@ -165,7 +165,7 @@ |
165 | 165 | err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], |
166 | 166 | control_fds[1], data_fds[0], data_fds[1]); |
167 | 167 | output_len = UM_KERN_PAGE_SIZE; |
168 | - output = kmalloc(output_len, UM_GFP_KERNEL); | |
168 | + output = uml_kmalloc(output_len, UM_GFP_KERNEL); | |
169 | 169 | read_output(control_fds[0], output, output_len); |
170 | 170 | |
171 | 171 | if (output == NULL) |
arch/um/os-Linux/helper.c
... | ... | @@ -71,8 +71,8 @@ |
71 | 71 | data.pre_data = pre_data; |
72 | 72 | data.argv = argv; |
73 | 73 | data.fd = fds[1]; |
74 | - data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) : | |
75 | - kmalloc(PATH_MAX, UM_GFP_KERNEL); | |
74 | + data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) : | |
75 | + uml_kmalloc(PATH_MAX, UM_GFP_KERNEL); | |
76 | 76 | pid = clone(helper_child, (void *) sp, CLONE_VM, &data); |
77 | 77 | if (pid < 0) { |
78 | 78 | ret = -errno; |
arch/um/os-Linux/main.c
arch/um/os-Linux/sigio.c
... | ... | @@ -109,7 +109,7 @@ |
109 | 109 | if (n <= polls->size) |
110 | 110 | return 0; |
111 | 111 | |
112 | - new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC); | |
112 | + new = uml_kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC); | |
113 | 113 | if (new == NULL) { |
114 | 114 | printk(UM_KERN_ERR "need_poll : failed to allocate new " |
115 | 115 | "pollfds\n"); |
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | { |
244 | 244 | struct pollfd *p; |
245 | 245 | |
246 | - p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL); | |
246 | + p = uml_kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL); | |
247 | 247 | if (p == NULL) { |
248 | 248 | printk(UM_KERN_ERR "setup_initial_poll : failed to allocate " |
249 | 249 | "poll\n"); |