This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
2007-09-17 04:08:06 +00:00
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/bootmem.h>
|
2007-10-02 03:37:53 +00:00
|
|
|
#include <linux/string.h>
|
2007-09-17 04:08:06 +00:00
|
|
|
|
|
|
|
#include <asm/system.h>
|
|
|
|
|
|
|
|
void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
|
|
|
|
{
|
|
|
|
if (mem_init_done)
|
|
|
|
return kmalloc(size, mask);
|
|
|
|
else
|
|
|
|
return alloc_bootmem(size);
|
|
|
|
}
|
2007-10-02 03:37:53 +00:00
|
|
|
|
|
|
|
void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
|
|
|
|
{
|
|
|
|
void *p;
|
|
|
|
|
|
|
|
if (mem_init_done)
|
|
|
|
p = kzalloc(size, mask);
|
|
|
|
else {
|
|
|
|
p = alloc_bootmem(size);
|
|
|
|
if (p)
|
|
|
|
memset(p, 0, size);
|
|
|
|
}
|
|
|
|
return p;
|
|
|
|
}
|