cow_sys.h 692 B

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