Rev 2627 | Rev 2629 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2627 | Rev 2628 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include <sys/types.h> |
38 | #include <sys/types.h> |
39 | #include <bool.h> |
39 | #include <bool.h> |
40 | 40 | ||
41 | #define dprintf(...) printf(__VA_ARGS__) |
41 | #define dprintf(...) printf(__VA_ARGS__) |
42 | 42 | ||
- | 43 | typedef struct { |
|
- | 44 | uint8_t ji[3]; /**< Jump instruction. */ |
|
- | 45 | uint8_t oem_name[8]; |
|
- | 46 | /* BIOS Parameter Block */ |
|
- | 47 | uint16_t bps; /**< Bytes per sector. */ |
|
- | 48 | uint8_t spc; /**< Sectors per cluster. */ |
|
- | 49 | uint16_t rsc; /**< Reserved sector count. */ |
|
- | 50 | uint8_t fatcnt; /**< Number of FATs. */ |
|
- | 51 | uint16_t root_ent_max; /**< Maximum number of root directory |
|
- | 52 | entries. */ |
|
- | 53 | uint16_t totsec; /**< Total sectors. */ |
|
- | 54 | uint8_t mdesc; /**< Media descriptor. */ |
|
- | 55 | uint16_t sec_per_fat; /**< Sectors per FAT12/FAT16. */ |
|
- | 56 | uint16_t sec_per_track; /**< Sectors per track. */ |
|
- | 57 | uint16_t headcnt; /**< Number of heads. */ |
|
- | 58 | uint32_t hidden_sec; /**< Hidden sectors. */ |
|
- | 59 | uint32_t total_sec; /**< Total sectors. */ |
|
- | 60 | ||
- | 61 | union { |
|
- | 62 | struct { |
|
- | 63 | /* FAT12/FAT16 only: Extended BIOS Parameter Block */ |
|
- | 64 | /** Physical drive number. */ |
|
- | 65 | uint8_t pdn; |
|
- | 66 | uint8_t reserved; |
|
- | 67 | /** Extended boot signature. */ |
|
- | 68 | uint8_t ebs; |
|
- | 69 | /** Serial number. */ |
|
- | 70 | uint32_t id; |
|
- | 71 | /** Volume label. */ |
|
- | 72 | uint8_t label[11]; |
|
- | 73 | /** FAT type. */ |
|
- | 74 | uint8_t type[8]; |
|
- | 75 | /** Boot code. */ |
|
- | 76 | uint8_t boot_code[448]; |
|
- | 77 | /** Boot sector signature. */ |
|
- | 78 | uint16_t signature; |
|
- | 79 | } __attribute__ ((packed)); |
|
- | 80 | struct { |
|
- | 81 | /* FAT32 only */ |
|
- | 82 | /** Sectors per FAT. */ |
|
- | 83 | uint32_t sectors_per_fat; |
|
- | 84 | /** FAT flags. */ |
|
- | 85 | uint16_t flags; |
|
- | 86 | /** Version. */ |
|
- | 87 | uint16_t version; |
|
- | 88 | /** Cluster number of root directory. */ |
|
- | 89 | uint32_t root_cluster; |
|
- | 90 | /** Sector number of file system information sector. */ |
|
- | 91 | uint16_t fsinfo_sec; |
|
- | 92 | /** Sector number of boot sector copy. */ |
|
- | 93 | uint16_t bscopy_sec; |
|
- | 94 | uint8_t reserved1[12]; |
|
- | 95 | /** Physical drive number. */ |
|
- | 96 | uint8_t pdn; |
|
- | 97 | uint8_t reserved2; |
|
- | 98 | /** Extended boot signature. */ |
|
- | 99 | uint8_t ebs; |
|
- | 100 | /** Serial number. */ |
|
- | 101 | uint32_t id; |
|
- | 102 | /** Volume label. */ |
|
- | 103 | uint8_t label; |
|
- | 104 | /** FAT type. */ |
|
- | 105 | uint8_t type[8]; |
|
- | 106 | /** Boot code. */ |
|
- | 107 | uint8_t boot_code[420]; |
|
- | 108 | /** Signature. */ |
|
- | 109 | uint16_t signature; |
|
- | 110 | } __attribute__ ((packed)); |
|
- | 111 | }; |
|
- | 112 | } fat_bs_t __attribute__ ((packed)); |
|
- | 113 | ||
43 | extern uint8_t *plb_ro; |
114 | extern uint8_t *plb_ro; |
44 | 115 | ||
45 | extern int block_read(int, unsigned long, void *); |
116 | extern int block_read(int, unsigned long, void *); |
46 | 117 | ||
47 | extern void fat_lookup(ipc_callid_t, ipc_call_t *); |
118 | extern void fat_lookup(ipc_callid_t, ipc_call_t *); |