mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-25 10:59:05 +00:00
43f5b3085f
Reintroduce uml_kmalloc for the benefit of UML libc code. The previous tactic of declaring __kmalloc so it could be called directly from the libc side of the house turned out to be getting too intimate with slab, and it doesn't work with slob. So, the uml_kmalloc wrapper is back. It calls kmalloc or whatever that translates into, and libc code calls it. kfree is left alone since that still works, leaving a somewhat inconsistent API. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
42 lines
692 B
C
42 lines
692 B
C
#ifndef __COW_SYS_H__
|
|
#define __COW_SYS_H__
|
|
|
|
#include "kern_util.h"
|
|
#include "os.h"
|
|
#include "user.h"
|
|
#include "um_malloc.h"
|
|
|
|
static inline void *cow_malloc(int size)
|
|
{
|
|
return uml_kmalloc(size, UM_GFP_KERNEL);
|
|
}
|
|
|
|
static inline void cow_free(void *ptr)
|
|
{
|
|
kfree(ptr);
|
|
}
|
|
|
|
#define cow_printf printk
|
|
|
|
static inline char *cow_strdup(char *str)
|
|
{
|
|
return uml_strdup(str);
|
|
}
|
|
|
|
static inline int cow_seek_file(int fd, __u64 offset)
|
|
{
|
|
return os_seek_file(fd, offset);
|
|
}
|
|
|
|
static inline int cow_file_size(char *file, unsigned long long *size_out)
|
|
{
|
|
return os_file_size(file, size_out);
|
|
}
|
|
|
|
static inline int cow_write_file(int fd, void *buf, int size)
|
|
{
|
|
return os_write_file(fd, buf, size);
|
|
}
|
|
|
|
#endif
|