提交 30e32af7 编写于 作者: A Alexey Kardashevskiy 提交者: Andreas Färber

vl.c: Extend get_boot_devices_list() to ignore suffixes

As suffixes do not make sense for sPAPR's device tree and
there is no way to filter them out on the BusState::get_fw_dev_path()
level, let's add an ability for the external caller to specify
whether to apply suffixes or not.

We could handle suffixes in SLOF (ignored for now) but this would require
serious rework in the node opening code in SLOF, which has no obvious
benefit for the currently emulated sPAPR machine.
Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 a46622fd
...@@ -504,7 +504,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data) ...@@ -504,7 +504,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
{ {
size_t len; size_t len;
FWCfgState *s = container_of(n, FWCfgState, machine_ready); FWCfgState *s = container_of(n, FWCfgState, machine_ready);
char *bootindex = get_boot_devices_list(&len); char *bootindex = get_boot_devices_list(&len, false);
fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len); fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len);
} }
......
...@@ -186,7 +186,7 @@ void rtc_change_mon_event(struct tm *tm); ...@@ -186,7 +186,7 @@ void rtc_change_mon_event(struct tm *tm);
void add_boot_device_path(int32_t bootindex, DeviceState *dev, void add_boot_device_path(int32_t bootindex, DeviceState *dev,
const char *suffix); const char *suffix);
char *get_boot_devices_list(size_t *size); char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
DeviceState *get_boot_device(uint32_t position); DeviceState *get_boot_device(uint32_t position);
......
...@@ -1209,7 +1209,7 @@ DeviceState *get_boot_device(uint32_t position) ...@@ -1209,7 +1209,7 @@ DeviceState *get_boot_device(uint32_t position)
* memory pointed by "size" is assigned total length of the array in bytes * memory pointed by "size" is assigned total length of the array in bytes
* *
*/ */
char *get_boot_devices_list(size_t *size) char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
{ {
FWBootEntry *i; FWBootEntry *i;
size_t total = 0; size_t total = 0;
...@@ -1224,7 +1224,7 @@ char *get_boot_devices_list(size_t *size) ...@@ -1224,7 +1224,7 @@ char *get_boot_devices_list(size_t *size)
assert(devpath); assert(devpath);
} }
if (i->suffix && devpath) { if (i->suffix && !ignore_suffixes && devpath) {
size_t bootpathlen = strlen(devpath) + strlen(i->suffix) + 1; size_t bootpathlen = strlen(devpath) + strlen(i->suffix) + 1;
bootpath = g_malloc(bootpathlen); bootpath = g_malloc(bootpathlen);
...@@ -1232,9 +1232,11 @@ char *get_boot_devices_list(size_t *size) ...@@ -1232,9 +1232,11 @@ char *get_boot_devices_list(size_t *size)
g_free(devpath); g_free(devpath);
} else if (devpath) { } else if (devpath) {
bootpath = devpath; bootpath = devpath;
} else { } else if (!ignore_suffixes) {
assert(i->suffix); assert(i->suffix);
bootpath = g_strdup(i->suffix); bootpath = g_strdup(i->suffix);
} else {
bootpath = g_strdup("");
} }
if (total) { if (total) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册