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

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

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: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c4399016
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@

static inline void *cow_malloc(int size)
{
	return um_kmalloc(size);
	return kmalloc(size, UM_GFP_KERNEL);
}

static inline void cow_free(void *ptr)
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
{
	struct sockaddr_un *sun;

	sun = um_kmalloc(sizeof(struct sockaddr_un));
	sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
	if(sun == NULL){
		printk("new_addr: allocation of sockaddr_un failed\n");
		return NULL;
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
		goto out_close;
	}

	sun = um_kmalloc(sizeof(struct sockaddr_un));
	sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
	if(sun == NULL){
		printk("new_addr: allocation of sockaddr_un failed\n");
		err = -ENOMEM;
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
		printk("fd_init : couldn't parse file descriptor '%s'\n", str);
		return(NULL);
	}
	data = um_kmalloc(sizeof(*data));
	data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
	if(data == NULL) return(NULL);
	*data = ((struct fd_chan) { .fd  	= n,
				    .raw  	= opts->raw });
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
{
	struct sockaddr_in *sin;

	sin = um_kmalloc(sizeof(struct sockaddr_in));
	sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
	if(sin == NULL){
		printk("new_addr: allocation of sockaddr_in failed\n");
		return NULL;
+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ static void change(char *dev, char *what, unsigned char *addr,
		netmask[2], netmask[3]);

	output_len = UM_KERN_PAGE_SIZE;
	output = um_kmalloc(output_len);
	output = kmalloc(output_len, UM_GFP_KERNEL);
	if(output == NULL)
		printk("change : failed to allocate output buffer\n");

Loading