Home | History | Annotate | Download | only in fsck_msdos

Lines Matching refs:fsinfo

56 	u_char fsinfo[2 * DOSBOOTBLOCKSIZE];
106 boot->FSInfo = block[48] + (block[49] << 8);
109 if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
110 != boot->FSInfo * boot->BytesPerSec
111 || read(dosfs, fsinfo, sizeof fsinfo)
112 != sizeof fsinfo) {
113 perror("could not read fsinfo block");
116 if (memcmp(fsinfo, "RRaA", 4)
117 || memcmp(fsinfo + 0x1e4, "rrAa", 4)
118 || fsinfo[0x1fc]
119 || fsinfo[0x1fd]
120 || fsinfo[0x1fe] != 0x55
121 || fsinfo[0x1ff] != 0xaa
122 || fsinfo[0x3fc]
123 || fsinfo[0x3fd]
124 || fsinfo[0x3fe] != 0x55
125 || fsinfo[0x3ff] != 0xaa) {
126 pwarn("Invalid signature in fsinfo block\n");
128 memcpy(fsinfo, "RRaA", 4);
129 memcpy(fsinfo + 0x1e4, "rrAa", 4);
130 fsinfo[0x1fc] = fsinfo[0x1fd] = 0;
131 fsinfo[0x1fe] = 0x55;
132 fsinfo[0x1ff] = 0xaa;
133 fsinfo[0x3fc] = fsinfo[0x3fd] = 0;
134 fsinfo[0x3fe] = 0x55;
135 fsinfo[0x3ff] = 0xaa;
136 if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
137 != boot->FSInfo * boot->BytesPerSec
138 || write(dosfs, fsinfo, sizeof fsinfo)
139 != sizeof fsinfo) {
140 perror("Unable to write FSInfo");
145 boot->FSInfo = 0;
147 if (boot->FSInfo) {
148 boot->FSFree = fsinfo[0x1e8] + (fsinfo[0x1e9] << 8)
149 + (fsinfo[0x1ea] << 16)
150 + (fsinfo[0x1eb] << 24);
151 boot->FSNext = fsinfo[0x1ec] + (fsinfo[0x1ed] << 8)
152 + (fsinfo[0x1ee] << 16)
153 + (fsinfo[0x1ef] << 24);
193 /* Check backup FSInfo? XXX */
268 u_char fsinfo[2 * DOSBOOTBLOCKSIZE];
270 if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
271 != boot->FSInfo * boot->BytesPerSec
272 || read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) {
273 perror("could not read fsinfo block");
276 fsinfo[0x1e8] = (u_char)boot->FSFree;
277 fsinfo[0x1e9] = (u_char)(boot->FSFree >> 8);
278 fsinfo[0x1ea] = (u_char)(boot->FSFree >> 16);
279 fsinfo[0x1eb] = (u_char)(boot->FSFree >> 24);
280 fsinfo[0x1ec] = (u_char)boot->FSNext;
281 fsinfo[0x1ed] = (u_char)(boot->FSNext >> 8);
282 fsinfo[0x1ee] = (u_char)(boot->FSNext >> 16);
283 fsinfo[0x1ef] = (u_char)(boot->FSNext >> 24);
284 if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
285 != boot->FSInfo * boot->BytesPerSec
286 || write(dosfs, fsinfo, sizeof fsinfo)
287 != sizeof fsinfo) {
288 perror("Unable to write FSInfo");
295 * support for FAT32) doesn't maintain the FSINFO block
298 * Therefor, we handle the FSINFO block only informally,