fs.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. typedef struct File File;
  10. typedef struct Fs Fs;
  11. #include "dosfs.h"
  12. #include "kfs.h"
  13. struct File{
  14. union{
  15. Dosfile dos;
  16. Kfsfile kfs;
  17. int walked;
  18. };
  19. Fs *fs;
  20. char *path;
  21. };
  22. struct Fs{
  23. union {
  24. Dos dos;
  25. Kfs kfs;
  26. };
  27. int dev; /* device id */
  28. long (*diskread)(Fs*, void*, long); /* disk read routine */
  29. vlong (*diskseek)(Fs*, vlong); /* disk seek routine */
  30. long (*read)(File*, void*, long);
  31. int (*walk)(File*, char*);
  32. File root;
  33. };
  34. extern int chatty;
  35. extern int dotini(Fs*);
  36. extern int fswalk(Fs*, char*, File*);
  37. extern int fsread(File*, void*, long);
  38. extern int fsboot(Fs*, char*, Boot*);
  39. #define BADPTR(x) ((uint32_t)x < (uint32_t)(KZERO+0x7c00))