Trivial patches for 2025-11-21
The following changes since commit 5a5b06d2f6f71d7789719b97143fc5b543bec07a:
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2025-11-20 08:12:59 +0100)
are available in the Git repository at:
https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches
for you to fetch changes up to 5f9ac963735598c1efbdce9c4a09f0a64e13d613:
Fix the typo of vfio-pci device's enable-migration option (2025-11-21 15:53:06 +0300)
----------------------------------------------------------------
trivial patches for 2025-11-21
Just 3 patches so far, but since we're reaching a
release, there's no point at waiting longer :)
----------------------------------------------------------------
Jack Wang (1):
qmp: Fix a typo for a USO feature
Michael Tokarev (1):
qga: use access(2) to check for command existance instead of questionable stat(2)
Yanghang Liu (1):
Fix the typo of vfio-pci device's enable-migration option
hw/vfio/pci.c | 2 +- hw/virtio/virtio-qmp.c | 2 +- qga/commands-posix.c | 12 +++--------- 3 files changed, 5 insertions(+), 11 deletions(-)
[PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2)
The code checks existance of a command (halt/poweroff/reboot) by using stat(2) and immediately checking for S_ISLNK() on the returned stat struct. This check will never be true, because stat(2) always follows symbolic links and hence will either return ENOENT (in case of dangling symlink) or the properties for the final target file. It is lstat(2) which might return information about the symlink itself. However, even there, we want to check the final file properties, not the first symlink.
This check - S_ISLNK - is harmful but useless in this case. However, it is confusing and it helps the wrong usage of stat(2) to spread, so it is better to remove it.
Additionally, the code would better to check for the executable bits of the final file, not check if it's a regular file - it's sort of dubious to have anything but regular files in /sbin/.
But a POSIX system provides another command which suits the purpose
perfectly: it is access(2). And it is so simple that it's not necessary to create a separate function when usin it.
Replace stat(2) with access(X_OK) to check for file existance in qga/commands-posix.c
--- qga/commands-posix.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
qga/commands-posix.c +3 -9
@@ -216,12 +216,6 @@ out:return retcode; } -static bool file_exists (const char *path) -{ -struct stat st; -return stat (path, &st) ==0 && (S_ISREG (st.st_mode) ||S_ISLNK (st.st_mode)); -} -#define POWEROFF_CMD_PATH "/sbin/poweroff"#define HALT_CMD_PATH "/sbin/halt"#define REBOOT_CMD_PATH "/sbin/reboot"
@@ -248,17 +242,17 @@ void qmp_guest_shutdown(const char *mode, Error **errp)slog ("guest-shutdown called, mode: %s" , mode);if (!mode ||strcmp (mode,"powerdown" ) ==0 ) { -if (file_exists (POWEROFF_CMD_PATH )) { +if (access (POWEROFF_CMD_PATH ,X_OK ) ==0 ) { shutdown_cmd =POWEROFF_CMD_PATH ; } shutdown_flag = powerdown_flag; }else if (strcmp (mode,"halt" ) ==0 ) { -if (file_exists (HALT_CMD_PATH )) { +if (access (HALT_CMD_PATH ,X_OK ) ==0 ) { shutdown_cmd =HALT_CMD_PATH ; } shutdown_flag = halt_flag; }else if (strcmp (mode,"reboot" ) ==0 ) { -if (file_exists (REBOOT_CMD_PATH )) { +if (access (REBOOT_CMD_PATH ,X_OK ) ==0 ) { shutdown_cmd =REBOOT_CMD_PATH ; } shutdown_flag = reboot_flag;
Signature · 1 line
2.47.3
[PULL 2/3] qmp: Fix a typo for a USO feature
In reply to Michael TokarevFrom: Jack Wang <[email protected]>
There is a copy & paste error, USO6 should be there.
--- hw/virtio/virtio-qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-qmp.c +1 -1
@@ -299,7 +299,7 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {FEATURE_ENTRY (VIRTIO_NET_F_GUEST_USO4 , \"VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv4" ),FEATURE_ENTRY (VIRTIO_NET_F_GUEST_USO6 , \ -"VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv6" ), +"VIRTIO_NET_F_GUEST_USO6: Driver can receive USOv6" ),FEATURE_ENTRY (VIRTIO_NET_F_HOST_USO , \"VIRTIO_NET_F_HOST_USO: Device can receive USO" ), FEATURE_ENTRY(VIRTIO_NET_F_HASH_REPORT, \
Signature · 1 line
2.47.3
[PULL 3/3] Fix the typo of vfio-pci device's enable-migration option
In reply to Michael TokarevFrom: Yanghang Liu <[email protected]>
--- hw/vfio/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/pci.c +1 -1
@@ -3871,7 +3871,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data) "(DEBUG)");object_class_property_set_description (klass,/* 5.2, 8.0 non-experimetal */ "enable-migration" , -"Enale device migration. Also requires a host VFIO PCI " +"Enable device migration. Also requires a host VFIO PCI " "variant or mdev driver with migration support enabled" ); object_class_property_set_description(klass, /* 8.1 */ "vf-token",
Signature · 1 line
2.47.3
Richard Henderson
AppliedQuoted 8 lines · Michael Tokarev
The following changes since commit
5a5b06d2f6f71d7789719b97143fc5b543bec07a:Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2025-11-20 08:12:59 +0100)are available in the Git repository at:
https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches
Quoted 8 lines
for you to fetch changes up to
5f9ac963735598c1efbdce9c4a09f0a64e13d613:Fix the typo of vfio-pci device's enable-migration option (2025-11-21 15:53:06 +0300)----------------------------------------------------------------
trivial patches for 2025-11-21
Just 3 patches so far, but since we're reaching a
release, there's no point at waiting longer :)
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.
r~