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

View File

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

View File

@ -8137,7 +8137,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} else if (STREQ(keywords[i], "media")) {
if (STREQ(values[i], "cdrom")) {
def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
def->readonly = 1;
def->readonly = true;
} else if (STREQ(values[i], "floppy"))
def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
} else if (STREQ(keywords[i], "format")) {
@ -8196,7 +8196,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
}
} else if (STREQ(keywords[i], "readonly")) {
if ((values[i] == NULL) || STREQ(values[i], "on"))
def->readonly = 1;
def->readonly = true;
} else if (STREQ(keywords[i], "aio")) {
if ((def->iomode = virDomainDiskIoTypeFromString(values[i])) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -9303,7 +9303,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
disk->dst = strdup("hdc");
if (!disk->dst)
goto no_memory;
disk->readonly = 1;
disk->readonly = true;
} else {
if (STRPREFIX(arg, "-fd")) {
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);
if (hddType == HardDiskType_Immutable)
def->disks[hddNum]->readonly = 1;
def->disks[hddNum]->readonly = true;
def->disks[hddNum]->src = strdup(hddlocation);
def->disks[hddNum]->dst = strdup("hda");
hddNum++;
@ -2668,7 +2668,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
hardDiskPS->vtbl->GetType(hardDiskPS, &hddType);
if (hddType == HardDiskType_Immutable)
def->disks[hddNum]->readonly = 1;
def->disks[hddNum]->readonly = true;
def->disks[hddNum]->src = strdup(hddlocation);
def->disks[hddNum]->dst = strdup("hdb");
hddNum++;
@ -2689,7 +2689,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
hardDiskSS->vtbl->GetType(hardDiskSS, &hddType);
if (hddType == HardDiskType_Immutable)
def->disks[hddNum]->readonly = 1;
def->disks[hddNum]->readonly = true;
def->disks[hddNum]->src = strdup(hddlocation);
def->disks[hddNum]->dst = strdup("hdd");
hddNum++;
@ -2830,7 +2830,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
medium->vtbl->GetReadOnly(medium, &readOnly);
if (readOnly == PR_TRUE)
def->disks[diskCount]->readonly = 1;
def->disks[diskCount]->readonly = true;
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]->bus = VIR_DOMAIN_DISK_BUS_IDE;
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]->dst = strdup("hdc");
} else {
@ -3165,7 +3165,7 @@ sharedFoldersCleanup:
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]->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]->dst = strdup("fda");
} else {

View File

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

View File

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