X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/8b8f49b713d64065775fe538232f8639083601bd..47c4e0c19ae8526b14ce4e0d7b243f7a4dc6fafd:/lunaix-os/kernel/fs/probe_boot.c diff --git a/lunaix-os/kernel/fs/probe_boot.c b/lunaix-os/kernel/fs/probe_boot.c index 2ddc9b1..fe384f7 100644 --- a/lunaix-os/kernel/fs/probe_boot.c +++ b/lunaix-os/kernel/fs/probe_boot.c @@ -1,8 +1,9 @@ -#include #include #include #include +#include "iso9660/iso9660.h" + LOG_MODULE("PROBE") #define LUNAIX_ID 0x414e554cUL // "LUNA" @@ -10,24 +11,30 @@ LOG_MODULE("PROBE") struct device* probe_boot_medium() { - struct device* block_cat = device_getbyname(NULL, "block", 5); + struct device_meta* block_cat = device_getbyname(NULL, "block", 5); if (!block_cat) { return NULL; } struct iso_vol_primary* volp = valloc(ISO9660_BLKSZ); - struct device *pos, *n; + struct device* dev = NULL; + struct device_meta *pos, *n; llist_for_each(pos, n, &block_cat->children, siblings) { + dev = resolve_device(pos); + if (!dev) { + continue; + } + int errno = - pos->ops.read(pos, (void*)volp, ISO9660_READ_OFF, ISO9660_BLKSZ); + dev->ops.read(dev, (void*)volp, ISO9660_READ_OFF, ISO9660_BLKSZ); if (errno < 0) { - kprintf(KINFO "failed %xh:%xh, /dev/%s\n", - pos->ident.fn_grp, - pos->ident.unique, - pos->name.value); - pos = NULL; + kprintf(KINFO "failed %xh:%xh, /dev/%s", + dev->ident.fn_grp, + dev->ident.unique, + dev->name.value); + dev = NULL; goto done; } @@ -36,16 +43,18 @@ probe_boot_medium() } if (*(u32_t*)volp->sys_id == LUNAIX_ID) { - kprintf(KINFO "%xh:%xh, /dev/%s, %s\n", - pos->ident.fn_grp, - pos->ident.unique, - pos->name.value, + kprintf(KINFO "%xh:%xh, /dev/%s, %s", + dev->ident.fn_grp, + dev->ident.unique, + dev->name.value, (char*)volp->vol_id); - break; + goto done; } } + return NULL; + done: vfree(volp); - return pos; + return dev; } \ No newline at end of file