Skip to content

Commit 44ac8ea

Browse files
committed
system: Replace arch_type global by qemu_arch_available() helper
qemu_arch_available() is a bit simpler to understand while reviewing than the undocumented arch_type variable. Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]>
1 parent 5dc4337 commit 44ac8ea

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

hw/scsi/scsi-disk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@ static void scsi_property_add_specifics(DeviceClass *dc)
31653165
ObjectClass *oc = OBJECT_CLASS(dc);
31663166

31673167
/* The loadparm property is only supported on s390x */
3168-
if (arch_type & QEMU_ARCH_S390X) {
3168+
if (qemu_arch_available(QEMU_ARCH_S390X)) {
31693169
object_class_property_add_str(oc, "loadparm",
31703170
scsi_property_get_loadparm,
31713171
scsi_property_set_loadparm);

include/system/arch_init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ enum {
2525
QEMU_ARCH_LOONGARCH = (1 << 23),
2626
};
2727

28-
extern const uint32_t arch_type;
28+
bool qemu_arch_available(unsigned qemu_arch_mask);
2929

3030
#endif

system/arch_init.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@
2424
#include "qemu/osdep.h"
2525
#include "system/arch_init.h"
2626

27-
const uint32_t arch_type = QEMU_ARCH;
27+
bool qemu_arch_available(unsigned qemu_arch_mask)
28+
{
29+
return qemu_arch_mask & QEMU_ARCH;
30+
}

system/qdev-monitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static const char *qdev_class_get_alias(DeviceClass *dc)
132132

133133
for (i = 0; qdev_alias_table[i].typename; i++) {
134134
if (qdev_alias_table[i].arch_mask &&
135-
!(qdev_alias_table[i].arch_mask & arch_type)) {
135+
!qemu_arch_available(qdev_alias_table[i].arch_mask)) {
136136
continue;
137137
}
138138

@@ -218,7 +218,7 @@ static const char *find_typename_by_alias(const char *alias)
218218

219219
for (i = 0; qdev_alias_table[i].alias; i++) {
220220
if (qdev_alias_table[i].arch_mask &&
221-
!(qdev_alias_table[i].arch_mask & arch_type)) {
221+
!qemu_arch_available(qdev_alias_table[i].arch_mask)) {
222222
continue;
223223
}
224224

system/vl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,11 +878,11 @@ static void help(int exitcode)
878878
g_get_prgname());
879879

880880
#define DEF(option, opt_arg, opt_enum, opt_help, arch_mask) \
881-
if ((arch_mask) & arch_type) \
881+
if (qemu_arch_available(arch_mask)) \
882882
fputs(opt_help, stdout);
883883

884884
#define ARCHHEADING(text, arch_mask) \
885-
if ((arch_mask) & arch_type) \
885+
if (qemu_arch_available(arch_mask)) \
886886
puts(stringify(text));
887887

888888
#define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL)
@@ -2929,7 +2929,7 @@ void qemu_init(int argc, char **argv)
29292929
const QEMUOption *popt;
29302930

29312931
popt = lookup_opt(argc, argv, &optarg, &optind);
2932-
if (!(popt->arch_mask & arch_type)) {
2932+
if (!qemu_arch_available(popt->arch_mask)) {
29332933
error_report("Option not supported for this target");
29342934
exit(1);
29352935
}

0 commit comments

Comments
 (0)