adfs_fs.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _ADFS_FS_H
  2. #define _ADFS_FS_H
  3. #include <linux/types.h>
  4. #include <linux/magic.h>
  5. /*
  6. * Disc Record at disc address 0xc00
  7. */
  8. struct adfs_discrecord {
  9. __u8 log2secsize;
  10. __u8 secspertrack;
  11. __u8 heads;
  12. __u8 density;
  13. __u8 idlen;
  14. __u8 log2bpmb;
  15. __u8 skew;
  16. __u8 bootoption;
  17. __u8 lowsector;
  18. __u8 nzones;
  19. __le16 zone_spare;
  20. __le32 root;
  21. __le32 disc_size;
  22. __le16 disc_id;
  23. __u8 disc_name[10];
  24. __le32 disc_type;
  25. __le32 disc_size_high;
  26. __u8 log2sharesize:4;
  27. __u8 unused40:4;
  28. __u8 big_flag:1;
  29. __u8 unused41:1;
  30. __u8 nzones_high;
  31. __le32 format_version;
  32. __le32 root_size;
  33. __u8 unused52[60 - 52];
  34. };
  35. #define ADFS_DISCRECORD (0xc00)
  36. #define ADFS_DR_OFFSET (0x1c0)
  37. #define ADFS_DR_SIZE 60
  38. #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
  39. #ifdef __KERNEL__
  40. /*
  41. * Calculate the boot block checksum on an ADFS drive. Note that this will
  42. * appear to be correct if the sector contains all zeros, so also check that
  43. * the disk size is non-zero!!!
  44. */
  45. static inline int adfs_checkbblk(unsigned char *ptr)
  46. {
  47. unsigned int result = 0;
  48. unsigned char *p = ptr + 511;
  49. do {
  50. result = (result & 0xff) + (result >> 8);
  51. result = result + *--p;
  52. } while (p != ptr);
  53. return (result & 0xff) != ptr[511];
  54. }
  55. #endif
  56. #endif