Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43f5b308 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

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: default avatarJeff Dike <jdike@linux.intel.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 484f1e2c
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
#include <termios.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include "chan_user.h"
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "os.h"
#include "um_malloc.h"
#include "um_malloc.h"
#include "user.h"
#include "user.h"
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,7 @@


static inline void *cow_malloc(int size)
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)
static inline void cow_free(void *ptr)
+2 −2
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
{
{
	struct sockaddr_un *sun;
	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) {
	if (sun == NULL) {
		printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
		printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
		       "failed\n");
		       "failed\n");
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
		goto out_close;
		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) {
	if (sun == NULL) {
		printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
		printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
		       "failed\n");
		       "failed\n");
+1 −1
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
		return NULL;
		return NULL;
	}
	}


	data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
	data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
	if (data == NULL)
	if (data == NULL)
		return NULL;
		return NULL;


+2 −1
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
#include <unistd.h>
#include <unistd.h>
#include <errno.h>
#include <errno.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include "kern_constants.h"
#include "mcast.h"
#include "mcast.h"
#include "net_user.h"
#include "net_user.h"
#include "um_malloc.h"
#include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
{
{
	struct sockaddr_in *sin;
	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) {
	if (sin == NULL) {
		printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
		printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
		       "failed\n");
		       "failed\n");
Loading