Advertisement
captmicro

memfs header for exokernel

Dec 29th, 2012
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. #ifndef _MEMFS_H_
  2. #define _MEMFS_H_
  3.  
  4. #define MEMFS_DISKHDR_MAGIC "MemFS"
  5. typedef struct {
  6.     char magic[5];
  7.     unsigned int listoffset;
  8.     unsigned int dataoffset;
  9. } MEMFS_DISKHDR;
  10.  
  11. typedef struct MEMFS_FILE_S {
  12.     char name[32];
  13.     unsigned int seekpos;
  14.     unsigned int dataoffset;
  15.     unsigned int datasize;
  16.     struct MEMFS_FILE_S *next;
  17. } MEMFS_FILE;
  18.  
  19. #define MEMFS_INVALID_FILE (0xFFFFFFFF)
  20. #define MEMFS_READ_FAIL (0xFFFFFFFE)
  21. #define MEMFS_WRITE_FAIL (0xFFFFFFFD)
  22. #define MEMFS_SEEK_FAIL (0xFFFFFFFC)
  23. #define MEMFS_SEEK_START (0xFFFFFFFB)
  24. #define MEMFS_SEEK_END (0xFFFFFFFA)
  25.  
  26. MEMFS_FILE *memfs_open(MEMFS_DISKHDR *dh, char *fname);
  27. MEMFS_FILE *memfs_create(MEMFS_DISKHDR *dh, char *fname);
  28.  
  29. unsigned int memfs_seek(MEMFS_DISKHDR *dh, MEMFS_FILE *f, unsigned int pos);
  30. unsigned int memfs_read(MEMFS_DISKHDR *dh, MEMFS_FILE *f, void *data, unsigned int max);
  31. unsigned int memfs_write(MEMFS_DISKHDR *dh, MEMFS_FILE *f, void *data, unsigned int len);
  32.  
  33. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement