we can reaad CDROMS
This commit is contained in:
40
kernel/drivers/iso/iso.c
Normal file
40
kernel/drivers/iso/iso.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "iso.h"
|
||||
|
||||
#include "drivers/ide/ide.h"
|
||||
|
||||
#include "lib/print.h"
|
||||
#include "lib/memory.h"
|
||||
|
||||
uint8_t sector_buf[2048];
|
||||
void read_iso(ide_device_t* dev) {
|
||||
kprintf("Reading ISO Filesystem from CDROM Disk\n");
|
||||
|
||||
ide_read_blks(dev, 16, 1, sector_buf);
|
||||
if (sector_buf[0] != 1) {
|
||||
kprintf("Couldn't find PVD\n");
|
||||
return;
|
||||
}
|
||||
|
||||
iso_pvd_t pvd = *(iso_pvd_t*)sector_buf;
|
||||
|
||||
char pvd_identifier[6];
|
||||
memcpy(pvd.header.identifier, pvd_identifier, 5);
|
||||
pvd_identifier[5] = 0;
|
||||
|
||||
if (strcmp(pvd_identifier, "CD001") > 0) {
|
||||
kprintf("Invalid PVD identifier\n");
|
||||
return;
|
||||
}
|
||||
|
||||
char system_identifier[33];
|
||||
memcpy(&pvd.sys_ident[0], system_identifier, 32);
|
||||
system_identifier[32] = 0;
|
||||
if (strlen(system_identifier) > 0) {
|
||||
kprintf("System Identifier: %s\n", system_identifier);
|
||||
}
|
||||
|
||||
char volume_identifier[33];
|
||||
memcpy(&pvd.volume_ident[0], volume_identifier, 32);
|
||||
volume_identifier[32] = 0;
|
||||
kprintf("Volume Identifier: %s\n", volume_identifier);
|
||||
}
|
||||
Reference in New Issue
Block a user