]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef __COW_SYS_H__ |
3 | #define __COW_SYS_H__ | |
4 | ||
37185b33 AV |
5 | #include <kern_util.h> |
6 | #include <os.h> | |
7 | #include <um_malloc.h> | |
1da177e4 LT |
8 | |
9 | static inline void *cow_malloc(int size) | |
10 | { | |
43f5b308 | 11 | return uml_kmalloc(size, UM_GFP_KERNEL); |
1da177e4 LT |
12 | } |
13 | ||
14 | static inline void cow_free(void *ptr) | |
15 | { | |
16 | kfree(ptr); | |
17 | } | |
18 | ||
19 | #define cow_printf printk | |
20 | ||
21 | static inline char *cow_strdup(char *str) | |
22 | { | |
dc764e50 | 23 | return uml_strdup(str); |
1da177e4 LT |
24 | } |
25 | ||
fe1db50c | 26 | static inline int cow_seek_file(int fd, __u64 offset) |
1da177e4 | 27 | { |
dc764e50 | 28 | return os_seek_file(fd, offset); |
1da177e4 LT |
29 | } |
30 | ||
52c73782 | 31 | static inline int cow_file_size(char *file, unsigned long long *size_out) |
1da177e4 | 32 | { |
dc764e50 | 33 | return os_file_size(file, size_out); |
1da177e4 LT |
34 | } |
35 | ||
31bc5a33 | 36 | static inline int cow_write_file(int fd, void *buf, int size) |
1da177e4 | 37 | { |
a6ea4cce | 38 | return os_write_file(fd, buf, size); |
1da177e4 LT |
39 | } |
40 | ||
41 | #endif |