typedef struct { int8_t int8_t uint16_t uint8_t uint16_t uint8_t uint16_t uint16_t jump_to_bootstrap [3]; oem_id [8]; bytes_per_sector; sectors_per_cluster; reserved sectors; fat_copies; root_dir_entries; total_sectors; media_descriptor_type; sectors_per_fat; uint8_t uint16_t uint16_t sectors_per_track; uint16_t heads; uint32_t hidden_sectors; uint32_t total_sectors2; uint8_t drive_index; uint8_t _stuff; uint8_t signature; uint32_t id; int8_t label [11]; int8_t type [8]; uint8_t _more_stuff [448]; uint16_t sig; } __attribute _ ((packed)) boot_t; typedef struct int8_t int8_t int8_t int8_t uint16_t uint16_t uint16_t uint32_t filename [8]; extension [3]; attributes; _reserved [10]; update_time; update_date; starting_cluster; file_size; } _ attribute _ ((packed)) dir_entry_t; Write a program to take the name of a file in the root directory and extract its contents to your local disk. Hint: • • • Sector number to byte offset Sector number to next sector number (using the FAT) readCluster(clusterNumber) -> bytes array readSector(sectorNumber) -> bytes array readFromSector(sectorNumber, bytes) -> bytes array readMBR -> boot_t getRootDirEntries() -> dir_entry_t[] find RootDirEntry(string filename, dir_entry_t entries[]) -> dir_entry_t // This has to do a search with a loop

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

please help, i use mac terminal so pls also include how to compile and run

typedef struct
{
int8_t
int8_t
uint16_t
uint8_t
uint16_t
uint8_t
uint16_t
uint16_t
jump_to_bootstrap [3];
oem_id [8];
bytes_per_sector;
sectors_per_cluster;
reserved sectors;
fat_copies;
root_dir_entries;
total_sectors;
media_descriptor_type;
sectors_per_fat;
uint8_t
uint16_t
uint16_t
sectors_per_track;
uint16_t
heads;
uint32_t
hidden_sectors;
uint32_t
total_sectors2;
uint8_t
drive_index;
uint8_t
_stuff;
uint8_t
signature;
uint32_t
id;
int8_t
label [11];
int8_t
type [8];
uint8_t
_more_stuff [448];
uint16_t
sig;
} __attribute _ ((packed)) boot_t;
typedef struct
int8_t
int8_t
int8_t
int8_t
uint16_t
uint16_t
uint16_t
uint32_t
filename [8];
extension [3];
attributes;
_reserved [10];
update_time;
update_date;
starting_cluster;
file_size;
} _ attribute _ ((packed)) dir_entry_t;
Transcribed Image Text:typedef struct { int8_t int8_t uint16_t uint8_t uint16_t uint8_t uint16_t uint16_t jump_to_bootstrap [3]; oem_id [8]; bytes_per_sector; sectors_per_cluster; reserved sectors; fat_copies; root_dir_entries; total_sectors; media_descriptor_type; sectors_per_fat; uint8_t uint16_t uint16_t sectors_per_track; uint16_t heads; uint32_t hidden_sectors; uint32_t total_sectors2; uint8_t drive_index; uint8_t _stuff; uint8_t signature; uint32_t id; int8_t label [11]; int8_t type [8]; uint8_t _more_stuff [448]; uint16_t sig; } __attribute _ ((packed)) boot_t; typedef struct int8_t int8_t int8_t int8_t uint16_t uint16_t uint16_t uint32_t filename [8]; extension [3]; attributes; _reserved [10]; update_time; update_date; starting_cluster; file_size; } _ attribute _ ((packed)) dir_entry_t;
Write a program to take the name of a file in the root directory and extract its contents to your
local disk.
Hint:
•
•
•
Sector number to byte offset
Sector number to next sector number (using the FAT)
readCluster(clusterNumber) -> bytes array
readSector(sectorNumber) -> bytes array
readFromSector(sectorNumber, bytes) -> bytes array
readMBR -> boot_t
getRootDirEntries() -> dir_entry_t[]
find RootDirEntry(string filename, dir_entry_t entries[]) -> dir_entry_t // This has to do a
search with a loop
Transcribed Image Text:Write a program to take the name of a file in the root directory and extract its contents to your local disk. Hint: • • • Sector number to byte offset Sector number to next sector number (using the FAT) readCluster(clusterNumber) -> bytes array readSector(sectorNumber) -> bytes array readFromSector(sectorNumber, bytes) -> bytes array readMBR -> boot_t getRootDirEntries() -> dir_entry_t[] find RootDirEntry(string filename, dir_entry_t entries[]) -> dir_entry_t // This has to do a search with a loop
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education