cow_sys.h 674 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef __COW_SYS_H__
  2. #define __COW_SYS_H__
  3. #include <kern_util.h>
  4. #include <os.h>
  5. #include <um_malloc.h>
  6. static inline void *cow_malloc(int size)
  7. {
  8. return uml_kmalloc(size, UM_GFP_KERNEL);
  9. }
  10. static inline void cow_free(void *ptr)
  11. {
  12. kfree(ptr);
  13. }
  14. #define cow_printf printk
  15. static inline char *cow_strdup(char *str)
  16. {
  17. return uml_strdup(str);
  18. }
  19. static inline int cow_seek_file(int fd, __u64 offset)
  20. {
  21. return os_seek_file(fd, offset);
  22. }
  23. static inline int cow_file_size(char *file, unsigned long long *size_out)
  24. {
  25. return os_file_size(file, size_out);
  26. }
  27. static inline int cow_write_file(int fd, void *buf, int size)
  28. {
  29. return os_write_file(fd, buf, size);
  30. }
  31. #endif