#include #include #include #include LOG_MODULE("PROBE") #define LUNAIX_ID 0x414e554cUL // "LUNA" struct device* probe_boot_medium() { struct device* block_cat = device_getbyname(NULL, "block", 5); if (!block_cat) { return NULL; } struct iso_vol_primary* volp = valloc(ISO9660_BLKSZ); struct device *pos, *n; llist_for_each(pos, n, &block_cat->children, siblings) { int errno = pos->ops.read(pos, (void*)volp, ISO9660_READ_OFF, ISO9660_BLKSZ); if (errno < 0) { kprintf(KINFO "failed %xh:%xh, /dev/%s", pos->ident.fn_grp, pos->ident.unique, pos->name.value); pos = NULL; goto done; } if (*(u32_t*)volp->header.std_id != ISO_SIGNATURE_LO) { continue; } if (*(u32_t*)volp->sys_id == LUNAIX_ID) { kprintf(KINFO "%xh:%xh, /dev/%s, %s", pos->ident.fn_grp, pos->ident.unique, pos->name.value, (char*)volp->vol_id); break; } } done: vfree(volp); return pos; }