File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,21 +139,6 @@ typedef struct {
139139
140140extern ahci_disk_info_t ahci_disks [32 ];
141141
142- typedef struct {
143- int disk ;
144- uint32_t lba_start ;
145- uint32_t sectors ;
146- uint8_t type ;
147- } block_part_t ;
148-
149- // For block devics
150- typedef struct {
151- int port ;
152- uint64_t sectors ;
153-
154- block_part_t partitions [4 ];
155- } block_disk_t ;
156-
157142/**
158143 * @brief Global AHCI controller pointer.
159144 */
Original file line number Diff line number Diff line change 1111#ifndef MBR_H
1212#define MBR_H
1313#include <basics.h>
14- #include <ahci.h>
1514
1615#define MBR_PART_BOOTABLE 0x80
1716
18- extern block_disk_t mbr_disks [10 ];
19- extern int mbr_disks_count ;
20-
2117typedef struct {
2218 uint8_t boot_flag ;
2319 uint8_t chs_start [3 ];
@@ -27,6 +23,25 @@ typedef struct {
2723 uint32_t num_sectors ;
2824} __attribute__((packed )) mbr_partition_t ;
2925
26+ // Simplified and cleaned up mbr
27+ typedef struct {
28+ int disk ;
29+ uint32_t lba_start ;
30+ uint32_t sectors ;
31+ uint8_t type ;
32+ } mbr_part_t ;
33+
34+ // For block devics
35+ typedef struct {
36+ int port ;
37+ uint64_t sectors ;
38+
39+ mbr_part_t partitions [4 ];
40+ } mbr_disk_t ;
41+
42+ extern mbr_disk_t mbr_disks [10 ];
43+ extern int mbr_disks_count ;
44+
3045int check_mbr (int portno );
3146void parse_mbr_partitions (int8 * mbr , int portno );
3247
Original file line number Diff line number Diff line change 1313#include <ahci.h>
1414#include <filesystems/fat16.h>
1515
16- block_disk_t mbr_disks [10 ];
16+ mbr_disk_t mbr_disks [10 ];
1717int mbr_disks_count = 0 ;
1818
1919int check_mbr (int portno ){
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ static void print_part_tree(
5151 printfnoln ("disk%dp%d " , disk_id , p + 1 );
5252
5353 if (!is_gpt ) {
54- block_part_t * part = & ((block_part_t * )parts )[p ];
54+ mbr_part_t * part = & ((mbr_part_t * )parts )[p ];
5555 print_size (part -> sectors );
5656 } else {
5757 gpt_partition_t * part = & ((gpt_partition_t * )parts )[p ];
@@ -73,7 +73,7 @@ int cmd_lsblk(int argc, char** argv)
7373
7474 /* ---------- MBR DISKS ---------- */
7575 for (int i = 0 ; i < mbr_disks_count ; i ++ ) {
76- block_disk_t * d = & mbr_disks [i ];
76+ mbr_disk_t * d = & mbr_disks [i ];
7777
7878 if (d -> sectors == 0 )
7979 continue ;
You can’t perform that action at this time.
0 commit comments