mirror of https://gitee.com/openkylin/libvirt.git
Use size_t instead of int for virDomainDefPtr struct
Many parts of virDomainDefPtr were using 'int' variables as array length counts. Replace all these with size_t and update various format strings & API signatures to adapt Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
25f582e36a
commit
5cbb0d37d4
|
@ -10942,7 +10942,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->ndisks != dst->ndisks) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain disk count %d does not match source %d"),
|
||||
_("Target domain disk count %zu does not match source %zu"),
|
||||
dst->ndisks, src->ndisks);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -10953,7 +10953,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->ncontrollers != dst->ncontrollers) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain disk controller count %d does not match source %d"),
|
||||
_("Target domain disk controller count %zu does not match source %zu"),
|
||||
dst->ncontrollers, src->ncontrollers);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -10964,7 +10964,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nfss != dst->nfss) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain filesystem count %d does not match source %d"),
|
||||
_("Target domain filesystem count %zu does not match source %zu"),
|
||||
dst->nfss, src->nfss);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -10975,7 +10975,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nnets != dst->nnets) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain net card count %d does not match source %d"),
|
||||
_("Target domain net card count %zu does not match source %zu"),
|
||||
dst->nnets, src->nnets);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -10986,7 +10986,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->ninputs != dst->ninputs) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain input device count %d does not match source %d"),
|
||||
_("Target domain input device count %zu does not match source %zu"),
|
||||
dst->ninputs, src->ninputs);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -10997,7 +10997,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nsounds != dst->nsounds) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain sound card count %d does not match source %d"),
|
||||
_("Target domain sound card count %zu does not match source %zu"),
|
||||
dst->nsounds, src->nsounds);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11008,7 +11008,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nvideos != dst->nvideos) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain video card count %d does not match source %d"),
|
||||
_("Target domain video card count %zu does not match source %zu"),
|
||||
dst->nvideos, src->nvideos);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11019,7 +11019,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nhostdevs != dst->nhostdevs) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain host device count %d does not match source %d"),
|
||||
_("Target domain host device count %zu does not match source %zu"),
|
||||
dst->nhostdevs, src->nhostdevs);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11030,7 +11030,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nsmartcards != dst->nsmartcards) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain smartcard count %d does not match source %d"),
|
||||
_("Target domain smartcard count %zu does not match source %zu"),
|
||||
dst->nsmartcards, src->nsmartcards);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11041,7 +11041,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nserials != dst->nserials) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain serial port count %d does not match source %d"),
|
||||
_("Target domain serial port count %zu does not match source %zu"),
|
||||
dst->nserials, src->nserials);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11052,7 +11052,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nparallels != dst->nparallels) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain parallel port count %d does not match source %d"),
|
||||
_("Target domain parallel port count %zu does not match source %zu"),
|
||||
dst->nparallels, src->nparallels);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11063,7 +11063,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nchannels != dst->nchannels) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain channel count %d does not match source %d"),
|
||||
_("Target domain channel count %zu does not match source %zu"),
|
||||
dst->nchannels, src->nchannels);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11074,7 +11074,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nconsoles != dst->nconsoles) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain console count %d does not match source %d"),
|
||||
_("Target domain console count %zu does not match source %zu"),
|
||||
dst->nconsoles, src->nconsoles);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -11085,7 +11085,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
|
||||
if (src->nhubs != dst->nhubs) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain hub device count %d does not match source %d"),
|
||||
_("Target domain hub device count %zu does not match source %zu"),
|
||||
dst->nhubs, src->nhubs);
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ struct _virDomainDiskDef {
|
|||
char *dst;
|
||||
int tray_status;
|
||||
int protocol;
|
||||
int nhosts;
|
||||
size_t nhosts;
|
||||
virDomainDiskHostDefPtr hosts;
|
||||
struct {
|
||||
char *username;
|
||||
|
@ -1048,7 +1048,7 @@ struct _virDomainSoundDef {
|
|||
int model;
|
||||
virDomainDeviceInfo info;
|
||||
|
||||
int ncodecs;
|
||||
size_t ncodecs;
|
||||
virDomainSoundCodecDefPtr *codecs;
|
||||
};
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ struct _virDomainOSDef {
|
|||
char *type;
|
||||
char *arch;
|
||||
char *machine;
|
||||
int nBootDevs;
|
||||
size_t nBootDevs;
|
||||
int bootDevs[VIR_DOMAIN_BOOT_LAST];
|
||||
/* enum virDomainBootMenu */
|
||||
int bootmenu;
|
||||
|
@ -1575,7 +1575,7 @@ struct _virDomainClockDef {
|
|||
char *timezone;
|
||||
} data;
|
||||
|
||||
int ntimers;
|
||||
size_t ntimers;
|
||||
virDomainTimerDefPtr *timers;
|
||||
};
|
||||
|
||||
|
@ -1695,55 +1695,55 @@ struct _virDomainDef {
|
|||
|
||||
virDomainClockDef clock;
|
||||
|
||||
int ngraphics;
|
||||
size_t ngraphics;
|
||||
virDomainGraphicsDefPtr *graphics;
|
||||
|
||||
int ndisks;
|
||||
size_t ndisks;
|
||||
virDomainDiskDefPtr *disks;
|
||||
|
||||
int ncontrollers;
|
||||
size_t ncontrollers;
|
||||
virDomainControllerDefPtr *controllers;
|
||||
|
||||
int nfss;
|
||||
size_t nfss;
|
||||
virDomainFSDefPtr *fss;
|
||||
|
||||
int nnets;
|
||||
size_t nnets;
|
||||
virDomainNetDefPtr *nets;
|
||||
|
||||
int ninputs;
|
||||
size_t ninputs;
|
||||
virDomainInputDefPtr *inputs;
|
||||
|
||||
int nsounds;
|
||||
size_t nsounds;
|
||||
virDomainSoundDefPtr *sounds;
|
||||
|
||||
int nvideos;
|
||||
size_t nvideos;
|
||||
virDomainVideoDefPtr *videos;
|
||||
|
||||
int nhostdevs;
|
||||
size_t nhostdevs;
|
||||
virDomainHostdevDefPtr *hostdevs;
|
||||
|
||||
int nredirdevs;
|
||||
size_t nredirdevs;
|
||||
virDomainRedirdevDefPtr *redirdevs;
|
||||
|
||||
int nsmartcards;
|
||||
size_t nsmartcards;
|
||||
virDomainSmartcardDefPtr *smartcards;
|
||||
|
||||
int nserials;
|
||||
size_t nserials;
|
||||
virDomainChrDefPtr *serials;
|
||||
|
||||
int nparallels;
|
||||
size_t nparallels;
|
||||
virDomainChrDefPtr *parallels;
|
||||
|
||||
int nchannels;
|
||||
size_t nchannels;
|
||||
virDomainChrDefPtr *channels;
|
||||
|
||||
int nconsoles;
|
||||
size_t nconsoles;
|
||||
virDomainChrDefPtr *consoles;
|
||||
|
||||
size_t nleases;
|
||||
virDomainLeaseDefPtr *leases;
|
||||
|
||||
int nhubs;
|
||||
size_t nhubs;
|
||||
virDomainHubDefPtr *hubs;
|
||||
|
||||
size_t nseclabels;
|
||||
|
|
|
@ -319,7 +319,7 @@ static int virLXCControllerValidateNICs(virLXCControllerPtr ctrl)
|
|||
{
|
||||
if (ctrl->def->nnets != ctrl->nveths) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("expecting %d veths, but got %zu"),
|
||||
_("expecting %zu veths, but got %zu"),
|
||||
ctrl->def->nnets, ctrl->nveths);
|
||||
return -1;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ static int virLXCControllerValidateConsoles(virLXCControllerPtr ctrl)
|
|||
{
|
||||
if (ctrl->def->nconsoles != ctrl->nconsoles) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("expecting %d consoles, but got %zu tty file handlers"),
|
||||
_("expecting %zu consoles, but got %zu tty file handlers"),
|
||||
ctrl->def->nconsoles, ctrl->nconsoles);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ parallelsGetSerialInfo(virDomainChrDefPtr chr,
|
|||
}
|
||||
|
||||
static int
|
||||
parallelsAddSerialInfo(virDomainChrDefPtr **serials, int *nserials,
|
||||
parallelsAddSerialInfo(virDomainChrDefPtr **serials, size_t *nserials,
|
||||
const char *key, virJSONValuePtr value)
|
||||
{
|
||||
virDomainChrDefPtr chr = NULL;
|
||||
|
|
|
@ -2090,7 +2090,7 @@ int qemuDomainDetachThisHostDevice(struct qemud_driver *driver,
|
|||
}
|
||||
if (idx >= vm->def->nhostdevs) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("device not found in hostdevs list (%d entries)"),
|
||||
_("device not found in hostdevs list (%zu entries)"),
|
||||
vm->def->nhostdevs);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -3786,7 +3786,7 @@ vboxSetBootDeviceOrder(virDomainDefPtr def, vboxGlobalData *data,
|
|||
VIR_DEBUG("def->os.type %s", def->os.type);
|
||||
VIR_DEBUG("def->os.arch %s", def->os.arch);
|
||||
VIR_DEBUG("def->os.machine %s", def->os.machine);
|
||||
VIR_DEBUG("def->os.nBootDevs %d", def->os.nBootDevs);
|
||||
VIR_DEBUG("def->os.nBootDevs %zu", def->os.nBootDevs);
|
||||
VIR_DEBUG("def->os.bootDevs[0] %d", def->os.bootDevs[0]);
|
||||
VIR_DEBUG("def->os.bootDevs[1] %d", def->os.bootDevs[1]);
|
||||
VIR_DEBUG("def->os.bootDevs[2] %d", def->os.bootDevs[2]);
|
||||
|
@ -4376,7 +4376,7 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||
systemProperties = NULL;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Number of Network Cards to be connected: %d", def->nnets);
|
||||
VIR_DEBUG("Number of Network Cards to be connected: %zu", def->nnets);
|
||||
VIR_DEBUG("Number of Network Cards available: %d", networkAdapterCount);
|
||||
|
||||
for (i = 0; (i < def->nnets) && (i < networkAdapterCount); i++) {
|
||||
|
@ -4538,7 +4538,7 @@ vboxAttachSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||
systemProperties = NULL;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Number of Serial Ports to be connected: %d", def->nserials);
|
||||
VIR_DEBUG("Number of Serial Ports to be connected: %zu", def->nserials);
|
||||
VIR_DEBUG("Number of Serial Ports available: %d", serialPortCount);
|
||||
for (i = 0; (i < def->nserials) && (i < serialPortCount); i++) {
|
||||
ISerialPort *serialPort = NULL;
|
||||
|
@ -4617,7 +4617,7 @@ vboxAttachParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||
systemProperties = NULL;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Number of Parallel Ports to be connected: %d", def->nparallels);
|
||||
VIR_DEBUG("Number of Parallel Ports to be connected: %zu", def->nparallels);
|
||||
VIR_DEBUG("Number of Parallel Ports available: %d", parallelPortCount);
|
||||
for (i = 0; (i < def->nparallels) && (i < parallelPortCount); i++) {
|
||||
IParallelPort *parallelPort = NULL;
|
||||
|
|
|
@ -3299,7 +3299,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def,
|
|||
/* def:fss */
|
||||
if (def->nfss > 0) {
|
||||
virBufferAddLit(&buffer, "isolation.tools.hgfs.disable = \"false\"\n");
|
||||
virBufferAsprintf(&buffer, "sharedFolder.maxNum = \"%d\"\n", def->nfss);
|
||||
virBufferAsprintf(&buffer, "sharedFolder.maxNum = \"%zu\"\n", def->nfss);
|
||||
}
|
||||
|
||||
for (i = 0; i < def->nfss; ++i) {
|
||||
|
|
Loading…
Reference in New Issue