src/partmac.[ch]: Fix mac structure to avoid using pointers
This commit is contained in:
parent
2c2b9e20e7
commit
952415ee99
2 changed files with 24 additions and 8 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined(SINGLE_PARTITION_TYPE) || defined(SINGLE_PARTITION_MAC)
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -186,7 +186,7 @@ static list_part_t *read_part_mac(disk_t *disk_car, const int verbose, const int
|
||||||
}
|
}
|
||||||
for(i=1;i<=limit;i++)
|
for(i=1;i<=limit;i++)
|
||||||
{
|
{
|
||||||
mac_DPME *dpme=(mac_DPME *)buffer;
|
const mac_DPME *dpme=(const mac_DPME *)buffer;
|
||||||
if(disk_car->pread(disk_car, &buffer, sizeof(buffer), (uint64_t)i * PBLOCK_SIZE) != sizeof(buffer))
|
if(disk_car->pread(disk_car, &buffer, sizeof(buffer), (uint64_t)i * PBLOCK_SIZE) != sizeof(buffer))
|
||||||
return new_list_part;
|
return new_list_part;
|
||||||
if(be16(dpme->dpme_signature) != DPME_SIGNATURE)
|
if(be16(dpme->dpme_signature) != DPME_SIGNATURE)
|
||||||
|
@ -473,3 +473,4 @@ static const char *get_partition_typename_mac(const partition_t *partition)
|
||||||
{
|
{
|
||||||
return get_partition_typename_mac_aux(partition->part_type_mac);
|
return get_partition_typename_mac_aux(partition->part_type_mac);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(SINGLE_PARTITION_TYPE) || defined(SINGLE_PARTITION_MAC)
|
||||||
|
|
||||||
#define BLOCK0_SIGNATURE 0x4552 /* Signature value. */
|
#define BLOCK0_SIGNATURE 0x4552 /* Signature value. */
|
||||||
|
|
||||||
|
@ -83,20 +83,35 @@ struct dpme {
|
||||||
#endif
|
#endif
|
||||||
uint32_t dpme_boot_block ;
|
uint32_t dpme_boot_block ;
|
||||||
uint32_t dpme_boot_bytes ;
|
uint32_t dpme_boot_bytes ;
|
||||||
uint8_t *dpme_load_addr ;
|
uint32_t dpme_load_addr ;
|
||||||
uint8_t *dpme_load_addr_2 ;
|
uint32_t dpme_load_addr_2 ;
|
||||||
uint8_t *dpme_goto_addr ;
|
uint32_t dpme_goto_addr ;
|
||||||
uint8_t *dpme_goto_addr_2 ;
|
uint32_t dpme_goto_addr_2 ;
|
||||||
uint32_t dpme_checksum ;
|
uint32_t dpme_checksum ;
|
||||||
char dpme_process_id[16] ;
|
char dpme_process_id[16] ;
|
||||||
uint32_t dpme_boot_args[32] ;
|
uint32_t dpme_boot_args[32] ;
|
||||||
uint32_t dpme_reserved_3[62] ;
|
uint32_t dpme_reserved_3[62] ;
|
||||||
};
|
} __attribute__ ((gcc_struct, __packed__));
|
||||||
typedef struct dpme mac_DPME;
|
typedef struct dpme mac_DPME;
|
||||||
|
|
||||||
|
/*@
|
||||||
|
@ requires valid_list_part(list_part);
|
||||||
|
@*/
|
||||||
int test_structure_mac(const list_part_t *list_part);
|
int test_structure_mac(const list_part_t *list_part);
|
||||||
|
|
||||||
|
/*@
|
||||||
|
@ requires valid_disk(disk_car);
|
||||||
|
@ requires \valid_read(disk_car);
|
||||||
|
@ requires valid_list_part(list_part);
|
||||||
|
@ requires \valid(current_cmd);
|
||||||
|
@ requires separation: \separated(disk_car, list_part, current_cmd, *current_cmd);
|
||||||
|
@ requires valid_read_string(*current_cmd);
|
||||||
|
@*/
|
||||||
|
// ensures valid_list_part(\result);
|
||||||
|
// ensures valid_read_string(*current_cmd);
|
||||||
list_part_t *add_partition_mac_cli(disk_t *disk_car,list_part_t *list_part, char **current_cmd);
|
list_part_t *add_partition_mac_cli(disk_t *disk_car,list_part_t *list_part, char **current_cmd);
|
||||||
|
|
||||||
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* closing brace for extern "C" */
|
} /* closing brace for extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue