diff options
author | SliderLu <314238828@qq.com> | 2022-11-16 23:39:49 +0800 |
---|---|---|
committer | Alexander Amelkin <mocbuhtig@amelkin.msk.ru> | 2023-01-09 12:01:28 +0300 |
commit | 206dba615d740a31e881861c86bcc8daafd9d5b1 (patch) | |
tree | f477c4c7097920cb85b753b3ea59b2a97dee6548 | |
parent | 8f0946a81eb22c14823d726afc486139bb2094ca (diff) | |
download | ipmitool-206dba615d740a31e881861c86bcc8daafd9d5b1.tar.gz |
delloem: Fix the unalign bug in arm64
For computers using the arm64 of the Apple chip, the link requires strict
alignment of pointers in 32-bit form. Replace the struct vFlashstr to valstr.
Replace the Function get_vFlash_compcode_str to val2str.
Resolves ipmitool/ipmitool#332
Signed-off-by: SliderLu <314238828@qq.com>
-rw-r--r-- | include/ipmitool/ipmi_delloem.h | 4 | ||||
-rw-r--r-- | lib/ipmi_delloem.c | 28 |
2 files changed, 2 insertions, 30 deletions
diff --git a/include/ipmitool/ipmi_delloem.h b/include/ipmitool/ipmi_delloem.h index 915a36c..2713da4 100644 --- a/include/ipmitool/ipmi_delloem.h +++ b/include/ipmitool/ipmi_delloem.h @@ -343,10 +343,6 @@ typedef struct _power_headroom uint16_t peakheadroom; } __attribute__ ((packed)) POWER_HEADROOM; -struct vFlashstr { - uint8_t val; - const char * str; -}; typedef struct ipmi_vFlash_extended_info { uint8_t vflashcompcode; diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c index e868913..a12c3b7 100644 --- a/lib/ipmi_delloem.c +++ b/lib/ipmi_delloem.c @@ -115,7 +115,7 @@ char NIC_Selection_Mode_String_12g[] [50] = { "shared with failover all loms" }; -const struct vFlashstr vFlash_completion_code_vals[] = { +const struct valstr vFlash_completion_code_vals[] = { {0x00, "SUCCESS"}, {0x01, "NO_SD_CARD"}, {0x63, "UNKNOWN_ERROR"}, @@ -232,8 +232,6 @@ static void ipmi_powermonitor_usage(void); /* vFlash Function prototypes */ static int ipmi_delloem_vFlash_main(struct ipmi_intf *intf, int argc, char **argv); -const char *get_vFlash_compcode_str(uint8_t vflashcompcode, - const struct vFlashstr *vs); static int ipmi_get_sd_card_info(struct ipmi_intf *intf); static int ipmi_delloem_vFlash_process(struct ipmi_intf *intf, int current_arg, char **argv); @@ -3757,28 +3755,6 @@ ipmi_delloem_vFlash_main(struct ipmi_intf * intf, int __UNUSED__(argc), char ** return rc; } /* - * Function Name: get_vFlash_compcode_str - * - * Description: This function maps the vFlash completion code - * to a string - * Input : vFlash completion code and static array of codes vs strings - * Output: - - * Return: returns the mapped string - */ -const char * -get_vFlash_compcode_str(uint8_t vflashcompcode, const struct vFlashstr *vs) -{ - static char un_str[32]; - int i; - for (i = 0; vs[i].str; i++) { - if (vs[i].val == vflashcompcode) - return vs[i].str; - } - memset(un_str, 0, 32); - snprintf(un_str, 32, "Unknown (0x%02X)", vflashcompcode); - return un_str; -} -/* * Function Name: ipmi_get_sd_card_info * * Description: This function prints the vFlash Extended SD card info @@ -3822,7 +3798,7 @@ ipmi_get_sd_card_info(struct ipmi_intf * intf) { return -1; } else if (sdcardinfoblock->vflashcompcode != 0x00) { lprintf(LOG_ERR, "Error in getting SD Card Extended Information (%s)", - get_vFlash_compcode_str(sdcardinfoblock->vflashcompcode, + val2str(sdcardinfoblock->vflashcompcode, vFlash_completion_code_vals)); return -1; } |