cleanup: Change datatype of disk->readonly to boolean

This commit is contained in:
Osier Yang 2013-04-10 19:23:56 +08:00
parent 71dae03f9b
commit e9e37538bb
6 changed files with 16 additions and 16 deletions

View File

@ -4637,7 +4637,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) { } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
def->readonly = 1; def->readonly = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) { } else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
def->shared = true; def->shared = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "transient")) { } else if (xmlStrEqual(cur->name, BAD_CAST "transient")) {
@ -4765,7 +4765,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
/* Force CDROM to be listed as read only */ /* Force CDROM to be listed as read only */
if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
def->readonly = 1; def->readonly = true;
if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK || if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
def->device == VIR_DOMAIN_DISK_DEVICE_LUN) && def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&

View File

@ -674,7 +674,7 @@ struct _virDomainDiskDef {
int copy_on_read; int copy_on_read;
int snapshot; /* enum virDomainSnapshotLocation, snapshot_conf.h */ int snapshot; /* enum virDomainSnapshotLocation, snapshot_conf.h */
int startupPolicy; /* enum virDomainStartupPolicy */ int startupPolicy; /* enum virDomainStartupPolicy */
unsigned int readonly : 1; bool readonly;
bool shared; bool shared;
bool transient; bool transient;
virDomainDeviceInfo info; virDomainDeviceInfo info;

View File

@ -8137,7 +8137,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} else if (STREQ(keywords[i], "media")) { } else if (STREQ(keywords[i], "media")) {
if (STREQ(values[i], "cdrom")) { if (STREQ(values[i], "cdrom")) {
def->device = VIR_DOMAIN_DISK_DEVICE_CDROM; def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
def->readonly = 1; def->readonly = true;
} else if (STREQ(values[i], "floppy")) } else if (STREQ(values[i], "floppy"))
def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
} else if (STREQ(keywords[i], "format")) { } else if (STREQ(keywords[i], "format")) {
@ -8196,7 +8196,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} }
} else if (STREQ(keywords[i], "readonly")) { } else if (STREQ(keywords[i], "readonly")) {
if ((values[i] == NULL) || STREQ(values[i], "on")) if ((values[i] == NULL) || STREQ(values[i], "on"))
def->readonly = 1; def->readonly = true;
} else if (STREQ(keywords[i], "aio")) { } else if (STREQ(keywords[i], "aio")) {
if ((def->iomode = virDomainDiskIoTypeFromString(values[i])) < 0) { if ((def->iomode = virDomainDiskIoTypeFromString(values[i])) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
@ -9303,7 +9303,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
disk->dst = strdup("hdc"); disk->dst = strdup("hdc");
if (!disk->dst) if (!disk->dst)
goto no_memory; goto no_memory;
disk->readonly = 1; disk->readonly = true;
} else { } else {
if (STRPREFIX(arg, "-fd")) { if (STRPREFIX(arg, "-fd")) {
disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;

View File

@ -2647,7 +2647,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
hardDiskPM->vtbl->GetType(hardDiskPM, &hddType); hardDiskPM->vtbl->GetType(hardDiskPM, &hddType);
if (hddType == HardDiskType_Immutable) if (hddType == HardDiskType_Immutable)
def->disks[hddNum]->readonly = 1; def->disks[hddNum]->readonly = true;
def->disks[hddNum]->src = strdup(hddlocation); def->disks[hddNum]->src = strdup(hddlocation);
def->disks[hddNum]->dst = strdup("hda"); def->disks[hddNum]->dst = strdup("hda");
hddNum++; hddNum++;
@ -2668,7 +2668,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
hardDiskPS->vtbl->GetType(hardDiskPS, &hddType); hardDiskPS->vtbl->GetType(hardDiskPS, &hddType);
if (hddType == HardDiskType_Immutable) if (hddType == HardDiskType_Immutable)
def->disks[hddNum]->readonly = 1; def->disks[hddNum]->readonly = true;
def->disks[hddNum]->src = strdup(hddlocation); def->disks[hddNum]->src = strdup(hddlocation);
def->disks[hddNum]->dst = strdup("hdb"); def->disks[hddNum]->dst = strdup("hdb");
hddNum++; hddNum++;
@ -2689,7 +2689,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
hardDiskSS->vtbl->GetType(hardDiskSS, &hddType); hardDiskSS->vtbl->GetType(hardDiskSS, &hddType);
if (hddType == HardDiskType_Immutable) if (hddType == HardDiskType_Immutable)
def->disks[hddNum]->readonly = 1; def->disks[hddNum]->readonly = true;
def->disks[hddNum]->src = strdup(hddlocation); def->disks[hddNum]->src = strdup(hddlocation);
def->disks[hddNum]->dst = strdup("hdd"); def->disks[hddNum]->dst = strdup("hdd");
hddNum++; hddNum++;
@ -2830,7 +2830,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
medium->vtbl->GetReadOnly(medium, &readOnly); medium->vtbl->GetReadOnly(medium, &readOnly);
if (readOnly == PR_TRUE) if (readOnly == PR_TRUE)
def->disks[diskCount]->readonly = 1; def->disks[diskCount]->readonly = true;
def->disks[diskCount]->type = VIR_DOMAIN_DISK_TYPE_FILE; def->disks[diskCount]->type = VIR_DOMAIN_DISK_TYPE_FILE;
@ -3118,7 +3118,7 @@ sharedFoldersCleanup:
def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_CDROM; def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE; def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE;
def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE; def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE;
def->disks[def->ndisks - 1]->readonly = 1; def->disks[def->ndisks - 1]->readonly = true;
def->disks[def->ndisks - 1]->src = strdup(location); def->disks[def->ndisks - 1]->src = strdup(location);
def->disks[def->ndisks - 1]->dst = strdup("hdc"); def->disks[def->ndisks - 1]->dst = strdup("hdc");
} else { } else {
@ -3165,7 +3165,7 @@ sharedFoldersCleanup:
def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC; def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC;
def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE; def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE;
def->disks[def->ndisks - 1]->readonly = 0; def->disks[def->ndisks - 1]->readonly = false;
def->disks[def->ndisks - 1]->src = strdup(location); def->disks[def->ndisks - 1]->src = strdup(location);
def->disks[def->ndisks - 1]->dst = strdup("fda"); def->disks[def->ndisks - 1]->dst = strdup("fda");
} else { } else {

View File

@ -506,7 +506,7 @@ xenParseSxprDisks(virDomainDefPtr def,
if (mode && if (mode &&
strchr(mode, 'r')) strchr(mode, 'r'))
disk->readonly = 1; disk->readonly = true;
if (mode && if (mode &&
strchr(mode, '!')) strchr(mode, '!'))
disk->shared = true; disk->shared = true;
@ -1371,7 +1371,7 @@ xenParseSxpr(const struct sexpr *root,
goto no_memory; goto no_memory;
} }
disk->bus = VIR_DOMAIN_DISK_BUS_IDE; disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
disk->readonly = 1; disk->readonly = true;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) { if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
virDomainDiskDefFree(disk); virDomainDiskDefFree(disk);

View File

@ -610,7 +610,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (STREQ(head, "r") || if (STREQ(head, "r") ||
STREQ(head, "ro")) STREQ(head, "ro"))
disk->readonly = 1; disk->readonly = true;
else if ((STREQ(head, "w!")) || else if ((STREQ(head, "w!")) ||
(STREQ(head, "!"))) (STREQ(head, "!")))
disk->shared = true; disk->shared = true;
@ -643,7 +643,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (!(disk->dst = strdup("hdc"))) if (!(disk->dst = strdup("hdc")))
goto no_memory; goto no_memory;
disk->bus = VIR_DOMAIN_DISK_BUS_IDE; disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
disk->readonly = 1; disk->readonly = true;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
goto no_memory; goto no_memory;