util: make reuse of ccw device address format constant

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Boris Fiuczynski 2022-05-13 12:31:03 +02:00 committed by Michal Privoznik
parent 1df0a19869
commit b41163005c
4 changed files with 4 additions and 3 deletions

View File

@ -202,7 +202,6 @@ int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
virCCWDeviceAddress *addr);
bool virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
virCCWDeviceAddress *addr2);
#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
virDomainDeviceDriveAddress *addr);

View File

@ -601,7 +601,7 @@ qemuBuildDeviceAddressProps(virJSONValue *props,
return 0;
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: {
g_autofree char *devno = g_strdup_printf("%x.%x.%04x",
g_autofree char *devno = g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT,
info->addr.ccw.cssid,
info->addr.ccw.ssid,
info->addr.ccw.devno);

View File

@ -25,5 +25,5 @@
char*
virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
{
return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
return g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT, addr->cssid, addr->ssid, addr->devno);
}

View File

@ -22,6 +22,8 @@
#include "internal.h"
#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
typedef struct _virCCWDeviceAddress virCCWDeviceAddress;
struct _virCCWDeviceAddress {
unsigned int cssid;