rendered paste bodyvoid pfs_read_block(uint_32 block, uint_8 disk, uint_8 partition, uint_32 toaddr){ partition_table_t pt; read_sectors_lba(disk, 0, 1, &pt); read_sectors_lba(disk, pt.partitions[partition].start_lba + 1 + (16 * (block - 1)), 16, toaddr);}void pfs_read_file(char *filename, uint_8 disk, uint_8 partition, uint_32 user, uint_32 group, uint_32 buffer_addr){ bochs_printf("pfs_read_file(\"%s\", %d, %d, %d, %d, %d)\n", filename, disk, partition, user, group, buffer_addr); pfs_dirblock_t thisdir; pfs_read_block(1, disk, partition, &thisdir); bochs_printf("read rootdir block\n"); int i; boolean found_it; for (i = 0; i < 15; i++) { bochs_printf("%d %d %s\n", i, strlen(thisdir.files[i].name), thisdir.files[i].name); if (strcmp(strsplit(filename, '/', 1), thisdir.files[i].name)) { found_it = true; break; } } i--; if (!found_it) { printf("Couldn't read %s (file not found)\n"); return; } // TODO: actually read in the next block... // TODO: permission check // TODO: support files not in / pfs_block_t *fileblock = (pfs_block_t *)buffer_addr; pfs_read_block(thisdir.files[i].first_block, disk, partition, buffer_addr);}