This patch removes the strdup implementation in the UML architecture (uml_strdup), and updates it to use the kstrdup library function.
Signed-off-by: Paulo Marques <[EMAIL PROTECTED]> -- Paulo Marques - www.grupopie.com All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke (1729 - 1797)
diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/drivers/cow_sys.h linux-2.6.11-rc2-bk9/arch/um/drivers/cow_sys.h --- vanilla-2.6.11-rc2-bk9/arch/um/drivers/cow_sys.h 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/drivers/cow_sys.h 2005-01-31 20:40:01.713782823 +0000 @@ -18,11 +18,6 @@ static inline void cow_free(void *ptr) #define cow_printf printk -static inline char *cow_strdup(char *str) -{ - return(uml_strdup(str)); -} - static inline int cow_seek_file(int fd, unsigned long long offset) { return(os_seek_file(fd, offset)); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/drivers/cow_user.c linux-2.6.11-rc2-bk9/arch/um/drivers/cow_user.c --- vanilla-2.6.11-rc2-bk9/arch/um/drivers/cow_user.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/drivers/cow_user.c 2005-01-31 20:39:08.587154730 +0000 @@ -7,6 +7,7 @@ #include <sys/param.h> #include <sys/user.h> #include <netinet/in.h> +#include <linux/string.h> #include "os.h" @@ -313,7 +314,7 @@ int read_cow_header(int (*reader)(__u64, goto out; } err = -ENOMEM; - *backing_file_out = cow_strdup(file); + *backing_file_out = kstrdup(file, GFP_KERNEL); if(*backing_file_out == NULL){ cow_printf("read_cow_header - failed to allocate backing " "file\n"); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/drivers/line.c linux-2.6.11-rc2-bk9/arch/um/drivers/line.c --- vanilla-2.6.11-rc2-bk9/arch/um/drivers/line.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/drivers/line.c 2005-01-31 20:39:08.587154730 +0000 @@ -9,6 +9,7 @@ #include "linux/kd.h" #include "linux/interrupt.h" #include "linux/devfs_fs_kernel.h" +#include "linux/string.h" #include "asm/uaccess.h" #include "chan_kern.h" #include "irq_user.h" @@ -445,10 +446,10 @@ int line_setup(struct line *lines, int n int line_config(struct line *lines, int num, char *str) { - char *new = uml_strdup(str); + char *new = kstrdup(str, GFP_KERNEL); if(new == NULL){ - printk("line_config - uml_strdup failed\n"); + printk("line_config - kstrdup failed\n"); return(-ENOMEM); } return(!line_setup(lines, num, new, 0)); @@ -555,9 +556,9 @@ void lines_init(struct line *lines, int INIT_LIST_HEAD(&line->chan_list); sema_init(&line->sem, 1); if(line->init_str != NULL){ - line->init_str = uml_strdup(line->init_str); + line->init_str = kstrdup(line->init_str, GFP_KERNEL); if(line->init_str == NULL) - printk("lines_init - uml_strdup returned " + printk("lines_init - kstrdup returned " "NULL\n"); } } diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/drivers/mconsole_kern.c linux-2.6.11-rc2-bk9/arch/um/drivers/mconsole_kern.c --- vanilla-2.6.11-rc2-bk9/arch/um/drivers/mconsole_kern.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/drivers/mconsole_kern.c 2005-01-31 20:39:08.588154554 +0000 @@ -20,6 +20,7 @@ #include "linux/namei.h" #include "linux/proc_fs.h" #include "linux/syscalls.h" +#include "linux/string.h" #include "asm/irq.h" #include "asm/uaccess.h" #include "user_util.h" @@ -483,7 +484,7 @@ int mconsole_init(void) } if(notify_socket != NULL){ - notify_socket = uml_strdup(notify_socket); + notify_socket = kstrdup(notify_socket, GFP_KERNEL); if(notify_socket != NULL) mconsole_notify(notify_socket, MCONSOLE_SOCKET, mconsole_socket_name, diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/drivers/net_kern.c linux-2.6.11-rc2-bk9/arch/um/drivers/net_kern.c --- vanilla-2.6.11-rc2-bk9/arch/um/drivers/net_kern.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/drivers/net_kern.c 2005-01-31 20:39:08.589154377 +0000 @@ -20,6 +20,7 @@ #include "linux/ctype.h" #include "linux/bootmem.h" #include "linux/ethtool.h" +#include "linux/string.h" #include "asm/uaccess.h" #include "user_util.h" #include "kern_util.h" @@ -602,7 +603,7 @@ static int net_config(char *str) err = eth_parse(str, &n, &str); if(err) return(err); - str = uml_strdup(str); + str = kstrdup(str, GFP_KERNEL); if(str == NULL){ printk(KERN_ERR "net_config failed to strdup string\n"); return(-1); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/drivers/ubd_kern.c linux-2.6.11-rc2-bk9/arch/um/drivers/ubd_kern.c --- vanilla-2.6.11-rc2-bk9/arch/um/drivers/ubd_kern.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/drivers/ubd_kern.c 2005-01-31 20:39:08.589154377 +0000 @@ -35,6 +35,7 @@ #include "linux/blkpg.h" #include "linux/genhd.h" #include "linux/spinlock.h" +#include "linux/string.h" #include "asm/segment.h" #include "asm/uaccess.h" #include "asm/irq.h" @@ -722,7 +723,7 @@ static int ubd_config(char *str) { int n, err; - str = uml_strdup(str); + str = kstrdup(str, GFP_KERNEL); if(str == NULL){ printk(KERN_ERR "ubd_config failed to strdup string\n"); return(1); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/include/kern_util.h linux-2.6.11-rc2-bk9/arch/um/include/kern_util.h --- vanilla-2.6.11-rc2-bk9/arch/um/include/kern_util.h 2004-12-24 21:34:31.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/include/kern_util.h 2005-01-31 20:40:37.752426461 +0000 @@ -85,7 +85,6 @@ extern int attach_debugger(int idle_pid, extern void bad_segv(unsigned long address, unsigned long ip, int is_write); extern int config_gdb(char *str); extern int remove_gdb(void); -extern char *uml_strdup(char *string); extern void unprotect_kernel_mem(void); extern void protect_kernel_mem(void); extern void uml_cleanup(void); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/kernel/ksyms.c linux-2.6.11-rc2-bk9/arch/um/kernel/ksyms.c --- vanilla-2.6.11-rc2-bk9/arch/um/kernel/ksyms.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/kernel/ksyms.c 2005-01-31 20:39:08.590154201 +0000 @@ -61,7 +61,6 @@ EXPORT_SYMBOL(strncpy_from_user_skas); EXPORT_SYMBOL(copy_to_user_skas); EXPORT_SYMBOL(copy_from_user_skas); #endif -EXPORT_SYMBOL(uml_strdup); EXPORT_SYMBOL(os_stat_fd); EXPORT_SYMBOL(os_stat_file); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/kernel/process_kern.c linux-2.6.11-rc2-bk9/arch/um/kernel/process_kern.c --- vanilla-2.6.11-rc2-bk9/arch/um/kernel/process_kern.c 2005-01-31 20:05:17.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/kernel/process_kern.c 2005-01-31 20:39:08.590154201 +0000 @@ -353,16 +353,6 @@ void do_uml_exitcalls(void) (*call)(); } -char *uml_strdup(char *string) -{ - char *new; - - new = kmalloc(strlen(string) + 1, GFP_KERNEL); - if(new == NULL) return(NULL); - strcpy(new, string); - return(new); -} - void *get_init_task(void) { return(&init_thread_union.thread_info.task); diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/kernel/tempfile.c linux-2.6.11-rc2-bk9/arch/um/kernel/tempfile.c --- vanilla-2.6.11-rc2-bk9/arch/um/kernel/tempfile.c 2004-12-24 21:34:58.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/kernel/tempfile.c 2005-01-31 20:39:08.590154201 +0000 @@ -9,6 +9,7 @@ #include <string.h> #include <errno.h> #include <sys/param.h> +#include <linux/string.h> #include "init.h" /* Modified from create_mem_file and start_debugger */ diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/kernel/tt/gdb.c linux-2.6.11-rc2-bk9/arch/um/kernel/tt/gdb.c --- vanilla-2.6.11-rc2-bk9/arch/um/kernel/tt/gdb.c 2005-01-31 20:05:18.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/kernel/tt/gdb.c 2005-01-31 20:39:08.591154025 +0000 @@ -10,6 +10,7 @@ #include <signal.h> #include <sys/ptrace.h> #include <sys/types.h> +#include <linux/string.h> #include "uml-config.h" #include "kern_constants.h" #include "chan_user.h" @@ -200,7 +201,7 @@ int attach_debugger(int idle_pid, int pi #ifdef notdef /* Put this back in when it does something useful */ static int __init uml_gdb_init_setup(char *line, int *add) { - gdb_init = uml_strdup(line); + gdb_init = kstrdup(line, GFP_KERNEL); return 0; } diff -buprN -X dontdiff vanilla-2.6.11-rc2-bk9/arch/um/os-Linux/drivers/tuntap_user.c linux-2.6.11-rc2-bk9/arch/um/os-Linux/drivers/tuntap_user.c --- vanilla-2.6.11-rc2-bk9/arch/um/os-Linux/drivers/tuntap_user.c 2004-12-24 21:35:40.000000000 +0000 +++ linux-2.6.11-rc2-bk9/arch/um/os-Linux/drivers/tuntap_user.c 2005-01-31 20:39:08.591154025 +0000 @@ -15,6 +15,7 @@ #include <sys/ioctl.h> #include <net/if.h> #include <linux/if_tun.h> +#include <linux/string.h> #include "net_user.h" #include "tuntap.h" #include "kern_util.h" @@ -175,7 +176,7 @@ static int tuntap_open(void *data) return(err); } - pri->dev_name = uml_strdup(buffer); + pri->dev_name = kstrdup(buffer); output += IFNAMSIZ; printk("%s", output); free_output_buffer(buffer);