kfile.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // kfile.h :
  2. //
  3. #if !defined(AGD_KFILE_H__A71FB716_AC33_40F3_95C0_3E47923E77B4__INCLUDED_)
  4. #define AGD_KFILE_H__A71FB716_AC33_40F3_95C0_3E47923E77B4__INCLUDED_
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif // __cplusplus
  8. /////////////////////////////////////////////////////////////////////////////
  9. //
  10. // https://stackoverflow.com/questions/1184274/read-write-files-within-a-linux-kernel-module
  11. //
  12. /////////////////////////////////////////////////////////////////////////////
  13. // kofile.h - Declarations:
  14. struct file* kf_open(const char *path, int flags, int rights);
  15. struct file* kf_open_locked(const char *path, int flags, int rights);
  16. void kf_close(struct file *pf);
  17. int kf_read(struct file *pf, unsigned long long offset, unsigned char *data, unsigned int size);
  18. int kf_write(struct file *pf, unsigned long long offset, unsigned char *data, unsigned int size);
  19. long kf_ioctl(struct file *pf, unsigned int cmd, unsigned long arg);
  20. int kf_sync(struct file *pf);
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifdef __cplusplus
  23. }
  24. #endif // __cplusplus
  25. #endif // !defined(AGD_KFILE_H__A71FB716_AC33_40F3_95C0_3E47923E77B4__INCLUDED_)