blob: f5701fd2ef90b2d8d1964c3222ebb155c2594ec1 [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"
6#include "user.h"
Paolo 'Blaisorblade' Giarrussoc13e5692006-10-19 23:28:20 -07007#include "um_malloc.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9static inline void *cow_malloc(int size)
10{
Jeff Dike43f5b302008-05-12 14:01:52 -070011 return uml_kmalloc(size, UM_GFP_KERNEL);
Linus Torvalds1da177e2005-04-16 15:20:36 -070012}
13
14static inline void cow_free(void *ptr)
15{
16 kfree(ptr);
17}
18
19#define cow_printf printk
20
21static inline char *cow_strdup(char *str)
22{
Jeff Dikedc764e52007-05-06 14:51:41 -070023 return uml_strdup(str);
Linus Torvalds1da177e2005-04-16 15:20:36 -070024}
25
Paolo 'Blaisorblade' Giarrussofe1db502006-02-24 13:03:58 -080026static inline int cow_seek_file(int fd, __u64 offset)
Linus Torvalds1da177e2005-04-16 15:20:36 -070027{
Jeff Dikedc764e52007-05-06 14:51:41 -070028 return os_seek_file(fd, offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -070029}
30
Paolo 'Blaisorblade' Giarrusso52c73782006-04-10 22:53:41 -070031static inline int cow_file_size(char *file, unsigned long long *size_out)
Linus Torvalds1da177e2005-04-16 15:20:36 -070032{
Jeff Dikedc764e52007-05-06 14:51:41 -070033 return os_file_size(file, size_out);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034}
35
Paolo 'Blaisorblade' Giarrusso31bc5a32006-02-24 13:03:53 -080036static inline int cow_write_file(int fd, void *buf, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037{
Jeff Dikea6ea4cc2007-05-06 14:51:43 -070038 return os_write_file(fd, buf, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039}
40
41#endif