Changeset 271e24a in mainline for uspace/lib/mbr/libmbr.h
- Timestamp:
- 2013-03-24T00:12:25Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30440ed
- Parents:
- ec50ac4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/mbr/libmbr.h
rec50ac4a r271e24a 36 36 #define LIBMBR_LIBMBR_H_ 37 37 38 #define NAME "libmbr" 38 #include <sys/types.h> 39 40 #define LIBMBR_NAME "libmbr" 39 41 40 42 /** Number of primary partition records */ … … 108 110 109 111 110 //FIXME: make mbr_part s_t as the linked list for keeping the same interface as with GPT112 //FIXME: make mbr_partitions_t as the linked list for keeping the same interface as with GPT 111 113 /** Partition */ 112 typedef struct part {114 typedef struct mbr_part { 113 115 /** The link in the doubly-linked list */ 114 116 link_t link; … … 118 120 uint8_t status; 119 121 /** Address of first block */ 120 aoff64_t start_addr;122 uint32_t start_addr; 121 123 /** Number of blocks */ 122 aoff64_t length;124 uint32_t length; 123 125 /** Points to Extended Boot Record of logical partition */ 124 126 br_block_t * ebr; 125 } part_t;127 } mbr_part_t; 126 128 127 129 typedef struct mbr_parts { … … 134 136 /** Partition linked list */ 135 137 list_t list; 136 } mbr_part s_t;138 } mbr_partitions_t; 137 139 140 typedef struct mbr_table { 141 mbr_t * mbr; 142 mbr_partitions_t * parts; 143 } mbr_table_t; 138 144 139 145 /** Read/Write MBR header. … … 146 152 147 153 /** Read/Write/Set MBR partitions. */ 148 extern mbr_part s_t * mbr_read_partitions(mbr_t * mbr);149 extern int mbr_write_partitions(mbr_parts_t * parts, mbr_t * mbr, service_id_t dev_handle);150 extern part_t *mbr_alloc_partition(void);151 extern mbr_part s_t * mbr_alloc_partitions(void);152 extern void mbr_add_partition(mbr_parts_t * parts,part_t * partition);153 extern void mbr_remove_partition(mbr_parts_t * parts, int idx);154 extern int mbr_get_flag(part_t * p, MBR_FLAGS flag);155 extern void mbr_set_flag(part_t * p, MBR_FLAGS flag, bool value);154 extern mbr_partitions_t * mbr_read_partitions(mbr_t * mbr); 155 extern int mbr_write_partitions(mbr_partitions_t * parts, mbr_t * mbr, service_id_t dev_handle); 156 extern mbr_part_t * mbr_alloc_partition(void); 157 extern mbr_partitions_t * mbr_alloc_partitions(void); 158 extern int mbr_add_partition(mbr_partitions_t * parts, mbr_part_t * partition); 159 extern int mbr_remove_partition(mbr_partitions_t * parts, size_t idx); 160 extern int mbr_get_flag(mbr_part_t * p, MBR_FLAGS flag); 161 extern void mbr_set_flag(mbr_part_t * p, MBR_FLAGS flag, bool value); 156 162 157 163 #define mbr_part_foreach(parts, iterator) \ 158 list_foreach(parts->list, iterator) 164 for (mbr_part_t * iterator = list_get_instance((parts)->list.head.next, mbr_part_t, link); \ 165 iterator != list_get_instance(&(parts)->list.head, mbr_part_t, link); \ 166 iterator = list_get_instance(iterator->link.next, mbr_part_t, link)) 167 159 168 160 169 /** free() wrapper functions. */ 161 170 extern void mbr_free_mbr(mbr_t * mbr); 162 extern void mbr_free_partition( part_t * p);163 extern void mbr_free_partitions(mbr_part s_t * parts);171 extern void mbr_free_partition(mbr_part_t * p); 172 extern void mbr_free_partitions(mbr_partitions_t * parts); 164 173 165 174 #endif
Note:
See TracChangeset
for help on using the changeset viewer.