MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / l_getbb

Function l_getbb

dep/hfsutils/libhfs/low.c:216–262  ·  view source on GitHub ↗

* NAME: low->getbb() * DESCRIPTION: read a volume's boot blocks */

Source from the content-addressed store, hash-verified

214 * DESCRIPTION: read a volume's boot blocks
215 */
216int l_getbb(hfsvol *vol, BootBlkHdr *bb, byte *bootcode)
217{
218 block b;
219 const byte *ptr = b;
220
221 if (b_readlb(vol, 0, &b) == -1)
222 goto fail;
223
224 d_fetchsw(&ptr, &bb->bbID);
225 d_fetchsl(&ptr, &bb->bbEntry);
226 d_fetchsw(&ptr, &bb->bbVersion);
227 d_fetchsw(&ptr, &bb->bbPageFlags);
228
229 d_fetchstr(&ptr, bb->bbSysName, sizeof(bb->bbSysName));
230 d_fetchstr(&ptr, bb->bbShellName, sizeof(bb->bbShellName));
231 d_fetchstr(&ptr, bb->bbDbg1Name, sizeof(bb->bbDbg1Name));
232 d_fetchstr(&ptr, bb->bbDbg2Name, sizeof(bb->bbDbg2Name));
233 d_fetchstr(&ptr, bb->bbScreenName, sizeof(bb->bbScreenName));
234 d_fetchstr(&ptr, bb->bbHelloName, sizeof(bb->bbHelloName));
235 d_fetchstr(&ptr, bb->bbScrapName, sizeof(bb->bbScrapName));
236
237 d_fetchsw(&ptr, &bb->bbCntFCBs);
238 d_fetchsw(&ptr, &bb->bbCntEvts);
239 d_fetchsl(&ptr, &bb->bb128KSHeap);
240 d_fetchsl(&ptr, &bb->bb256KSHeap);
241 d_fetchsl(&ptr, &bb->bbSysHeapSize);
242 d_fetchsw(&ptr, &bb->filler);
243 d_fetchsl(&ptr, &bb->bbSysHeapExtra);
244 d_fetchsl(&ptr, &bb->bbSysHeapFract);
245
246 ASSERT(ptr - b == 148);
247
248 if (bootcode)
249 {
250 memcpy(bootcode, ptr, HFS_BOOTCODE1LEN);
251
252 if (b_readlb(vol, 1, &b) == -1)
253 goto fail;
254
255 memcpy(bootcode + HFS_BOOTCODE1LEN, b, HFS_BOOTCODE2LEN);
256 }
257
258 return 0;
259
260fail:
261 return -1;
262}
263
264/*
265 * NAME: low->putbb()

Callers

nothing calls this directly

Calls 4

b_readlbFunction · 0.85
d_fetchswFunction · 0.85
d_fetchslFunction · 0.85
d_fetchstrFunction · 0.85

Tested by

no test coverage detected