From e4c4bf9968cb4f0fceb1b8fb54790ccae73caf4e Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Sun, 15 Jul 2007 23:38:56 -0700 Subject: 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 Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/cow_sys.h | 2 +- arch/um/drivers/daemon_user.c | 4 ++-- arch/um/drivers/fd.c | 2 +- arch/um/drivers/mcast_user.c | 2 +- arch/um/drivers/net_user.c | 2 +- arch/um/drivers/port_user.c | 2 +- arch/um/drivers/pty.c | 2 +- arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/tty.c | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h index 15453845d2b..ca8c9e11a39 100644 --- a/arch/um/drivers/cow_sys.h +++ b/arch/um/drivers/cow_sys.h @@ -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) diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index b869e389968..8d2008f0668 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c @@ -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; diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c index 7f083ec47a4..39c01ffd45c 100644 --- a/arch/um/drivers/fd.c +++ b/arch/um/drivers/fd.c @@ -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 }); diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c index d319db16d4e..236a3dfc297 100644 --- a/arch/um/drivers/mcast_user.c +++ b/arch/um/drivers/mcast_user.c @@ -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; diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 6fa948ba969..da946e3e1bf 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c @@ -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"); diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index 29250beba42..c799b00012c 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c @@ -50,7 +50,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts) if(kern_data == NULL) return NULL; - data = um_kmalloc(sizeof(*data)); + data = kmalloc(sizeof(*data), UM_GFP_KERNEL); if(data == NULL) goto err; diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index 640bcdaad9f..1e3fd619a83 100644 --- a/arch/um/drivers/pty.c +++ b/arch/um/drivers/pty.c @@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts) { struct pty_chan *data; - data = um_kmalloc(sizeof(*data)); + data = kmalloc(sizeof(*data), UM_GFP_KERNEL); if (data == NULL) return NULL; diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c index edc2de3ee2f..c0b73c28cff 100644 --- a/arch/um/drivers/slip_user.c +++ b/arch/um/drivers/slip_user.c @@ -91,7 +91,7 @@ static int slip_tramp(char **argv, int fd) pid = err; output_len = UM_KERN_PAGE_SIZE; - output = um_kmalloc(output_len); + output = kmalloc(output_len, UM_GFP_KERNEL); if(output == NULL){ printk("slip_tramp : failed to allocate output buffer\n"); os_kill_process(pid, 1); diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c index c07d0d56278..a9f87e19c5b 100644 --- a/arch/um/drivers/tty.c +++ b/arch/um/drivers/tty.c @@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts) } str++; - data = um_kmalloc(sizeof(*data)); + data = kmalloc(sizeof(*data), UM_GFP_KERNEL); if(data == NULL) return NULL; *data = ((struct tty_chan) { .dev = str, -- cgit v1.2.3