blob: 7f2ed0b8824a53ea085be063f860c8a3844b55a1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __COW_SYS_H__
2#define __COW_SYS_H__
3
4#include "kern_util.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include "os.h"
Paolo 'Blaisorblade' Giarrussoc13e5692006-10-19 23:28:20 -07006#include "um_malloc.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8static inline void *cow_malloc(int size)
9{
Jeff Dike43f5b302008-05-12 14:01:52 -070010 return uml_kmalloc(size, UM_GFP_KERNEL);
Linus Torvalds1da177e2005-04-16 15:20:36 -070011}
12
13static inline void cow_free(void *ptr)
14{
15 kfree(ptr);
16}
17
18#define cow_printf printk
19
20static inline char *cow_strdup(char *str)
21{
Jeff Dikedc764e52007-05-06 14:51:41 -070022 return uml_strdup(str);
Linus Torvalds1da177e2005-04-16 15:20:36 -070023}
24
Paolo 'Blaisorblade' Giarrussofe1db502006-02-24 13:03:58 -080025static inline int cow_seek_file(int fd, __u64 offset)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026{
Jeff Dikedc764e52007-05-06 14:51:41 -070027 return os_seek_file(fd, offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -070028}
29
Paolo 'Blaisorblade' Giarrusso52c73782006-04-10 22:53:41 -070030static inline int cow_file_size(char *file, unsigned long long *size_out)
Linus Torvalds1da177e2005-04-16 15:20:36 -070031{
Jeff Dikedc764e52007-05-06 14:51:41 -070032 return os_file_size(file, size_out);
Linus Torvalds1da177e2005-04-16 15:20:36 -070033}
34
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -080035static inline int cow_write_file(int fd, void *buf, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070036{
Jeff Dikea6ea4cc2007-05-06 14:51:43 -070037 return os_write_file(fd, buf, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
40#endif