mirror of
https://github.com/ipmitool/ipmitool.git
synced 2026-06-03 20:51:36 +00:00
mc: watchdog set: Refactor to reduce complexity
Move option parsing for `mc wathdog set` to a separate function, add a function for host to ipmi integer conversion (reduce manual byte juggling).
This commit is contained in:
@@ -111,8 +111,8 @@ uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
|
||||
|
||||
#define IS_SET(v, b) ((v) & (1 << (b)))
|
||||
|
||||
/* le16toh() doesn't exist for Windows or Apple */
|
||||
/* For portability, let's simply define our own version of it here */
|
||||
/* le16toh(), hto16le(), et. al. don't exist for Windows or Apple */
|
||||
/* For portability, let's simply define our own versions here */
|
||||
static inline uint16_t ipmi16toh(uint16_t le)
|
||||
{
|
||||
uint8_t *data = (uint8_t *)≤
|
||||
@@ -124,6 +124,12 @@ static inline uint16_t ipmi16toh(uint16_t le)
|
||||
return h;
|
||||
}
|
||||
|
||||
static inline void htoipmi16(uint16_t h, uint8_t *ipmi)
|
||||
{
|
||||
ipmi[0] = h & 0xFF; /* LSB */
|
||||
ipmi[1] = h >> 8; /* MSB */
|
||||
}
|
||||
|
||||
#define ipmi_open_file_read(file) ipmi_open_file(file, 0)
|
||||
#define ipmi_open_file_write(file) ipmi_open_file(file, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user