iso.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * This code is based on the ISO filesystem support in MILO (by
  3. * Dave Rusling).
  4. *
  5. * This is a set of functions that provides minimal filesystem
  6. * functionality to the Linux bootstrapper. All we can do is
  7. * open and read files... but that's all we need 8-)
  8. */
  9. #include <stddef.h>
  10. #include <cons.h>
  11. #include <bootfs.h>
  12. #include <isolib.h>
  13. #ifdef DEBUG_ISO
  14. #include <utils.h>
  15. #endif
  16. extern const struct bootfs isofs;
  17. static long cd_device = -1;
  18. long
  19. iso_dev_read (void * buf, long offset, long size)
  20. {
  21. return cons_read(cd_device, buf, size, offset);
  22. }
  23. static int
  24. iso_mount (long cons_dev, long p_offset, long quiet)
  25. {
  26. #ifdef DEBUG_ISO
  27. printf("iso_mount() called\n");
  28. #endif
  29. cd_device = cons_dev;
  30. /*
  31. * Read the super block (this determines the file system type
  32. * and other important information)
  33. */
  34. return iso_read_super(NULL, quiet);
  35. }
  36. static const char *
  37. iso_readdir(int fd, int rewind)
  38. {
  39. return iso_readdir_i(fd,rewind);
  40. }
  41. const struct bootfs iso = {
  42. -1, /* isofs is not partitioned */
  43. 1024, /* block size */
  44. iso_mount,
  45. iso_open,
  46. iso_bread,
  47. iso_close,
  48. iso_readdir,
  49. iso_fstat
  50. };