X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;ds=sidebyside;f=init%2Finitramfs.c;h=8eeeccb328c9f984812941592258ebd72e5d96e6;hb=a7be37ac8e1565e00880531f4e2aff421a21c803;hp=00eff7a110854d5706ff51205f5ef06a7a267d27;hpb=0a7b35cb18c52d651f6ed9cd59edc979200ab880;p=safe%2Fjmp%2Flinux-2.6 diff --git a/init/initramfs.c b/init/initramfs.c index 00eff7a..8eeeccb 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -57,7 +57,7 @@ static char __init *find_link(int major, int minor, int ino, continue; return (*p)->name; } - q = (struct hash *)malloc(sizeof(struct hash)); + q = kmalloc(sizeof(struct hash), GFP_KERNEL); if (!q) panic("can't allocate link hash entry"); q->major = major; @@ -77,7 +77,7 @@ static void __init free_hash(void) while (*p) { q = *p; *p = q->next; - free(q); + kfree(q); } } } @@ -133,7 +133,7 @@ static __initdata loff_t this_header, next_header; static __initdata int dry_run; -static inline void eat(unsigned n) +static inline void __init eat(unsigned n) { victim += n; this_header += n; @@ -445,10 +445,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) { int written; dry_run = check_only; - header_buf = malloc(110); - symlink_buf = malloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1); - name_buf = malloc(N_ALIGN(PATH_MAX)); - window = malloc(WSIZE); + header_buf = kmalloc(110, GFP_KERNEL); + symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL); + name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL); + window = kmalloc(WSIZE, GFP_KERNEL); if (!window || !header_buf || !symlink_buf || !name_buf) panic("can't allocate buffers"); state = Start; @@ -484,10 +484,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) buf += inptr; len -= inptr; } - free(window); - free(name_buf); - free(symlink_buf); - free(header_buf); + kfree(window); + kfree(name_buf); + kfree(symlink_buf); + kfree(header_buf); return message; } @@ -503,7 +503,6 @@ static int __init retain_initrd_param(char *str) __setup("retain_initrd", retain_initrd_param); extern char __initramfs_start[], __initramfs_end[]; -#ifdef CONFIG_BLK_DEV_INITRD #include #include @@ -539,15 +538,12 @@ skip: initrd_end = 0; } -#endif - static int __init populate_rootfs(void) { char *err = unpack_to_rootfs(__initramfs_start, __initramfs_end - __initramfs_start, 0); if (err) panic(err); -#ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { #ifdef CONFIG_BLK_DEV_RAM int fd; @@ -579,7 +575,6 @@ static int __init populate_rootfs(void) free_initrd(); #endif } -#endif return 0; } rootfs_initcall(populate_rootfs);