qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/3] Misc QGA patches for 2024-03-11
@ 2024-03-11 16:57 Konstantin Kostiuk
  2024-03-11 16:57 ` [PULL 1/3] qga/commands-win32: Declare const qualifier before type Konstantin Kostiuk
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Konstantin Kostiuk @ 2024-03-11 16:57 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell, Stefan Hajnoczi

The following changes since commit 7489f7f3f81dcb776df8c1b9a9db281fc21bf05f:

  Merge tag 'hw-misc-20240309' of https://github.com/philmd/qemu into staging (2024-03-09 20:12:21 +0000)

are available in the Git repository at:

  https://github.com/kostyanf14/qemu.git tags/qga-pull-2024-03-11-2

for you to fetch changes up to bfded6fe62b859e337386ed3028b85743569a30b:

  qga-win: Add support of Windows Server 2025 in get-osinfo command (2024-03-11 18:24:39 +0200)

----------------------------------------------------------------
qga-pull-2024-03-11-2

----------------------------------------------------------------
Dehan Meng (1):
      qga-win: Add support of Windows Server 2025 in get-osinfo command

Philippe Mathieu-Daudé (2):
      qga/commands-win32: Declare const qualifier before type
      qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays size

 qga/commands-win32.c | 63 ++++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 32 deletions(-)

--
2.44.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] qga/commands-win32: Declare const qualifier before type
  2024-03-11 16:57 [PULL 0/3] Misc QGA patches for 2024-03-11 Konstantin Kostiuk
@ 2024-03-11 16:57 ` Konstantin Kostiuk
  2024-03-11 16:57 ` [PULL 2/3] qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays size Konstantin Kostiuk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Kostiuk @ 2024-03-11 16:57 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell, Stefan Hajnoczi

From: Philippe Mathieu-Daudé <philmd@linaro.org>

Most of the code base use the 'const' qualifier *before*
the type being qualified. Use the same style to unify.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240222152835.72095-2-philmd@linaro.org>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Link: https://lore.kernel.org/r/20240304134532.28506-2-kkostiuk@redhat.com
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
 qga/commands-win32.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a1015757d8..79b5a580c9 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -2120,11 +2120,11 @@ GuestUserList *qmp_guest_get_users(Error **errp)
 typedef struct _ga_matrix_lookup_t {
     int major;
     int minor;
-    char const *version;
-    char const *version_id;
+    const char *version;
+    const char *version_id;
 } ga_matrix_lookup_t;
 
-static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][7] = {
+static const ga_matrix_lookup_t WIN_VERSION_MATRIX[2][7] = {
     {
         /* Desktop editions */
         { 5, 0, "Microsoft Windows 2000",   "2000"},
@@ -2148,18 +2148,18 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][7] = {
 
 typedef struct _ga_win_10_0_t {
     int first_build;
-    char const *version;
-    char const *version_id;
+    const char *version;
+    const char *version_id;
 } ga_win_10_0_t;
 
-static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX[4] = {
+static const ga_win_10_0_t WIN_10_0_SERVER_VERSION_MATRIX[4] = {
     {14393, "Microsoft Windows Server 2016",    "2016"},
     {17763, "Microsoft Windows Server 2019",    "2019"},
     {20344, "Microsoft Windows Server 2022",    "2022"},
     {0, 0}
 };
 
-static ga_win_10_0_t const WIN_10_0_CLIENT_VERSION_MATRIX[3] = {
+static const ga_win_10_0_t WIN_10_0_CLIENT_VERSION_MATRIX[3] = {
     {10240, "Microsoft Windows 10",    "10"},
     {22000, "Microsoft Windows 11",    "11"},
     {0, 0}
@@ -2185,16 +2185,16 @@ static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp)
     return;
 }
 
-static char *ga_get_win_name(OSVERSIONINFOEXW const *os_version, bool id)
+static char *ga_get_win_name(const OSVERSIONINFOEXW *os_version, bool id)
 {
     DWORD major = os_version->dwMajorVersion;
     DWORD minor = os_version->dwMinorVersion;
     DWORD build = os_version->dwBuildNumber;
     int tbl_idx = (os_version->wProductType != VER_NT_WORKSTATION);
-    ga_matrix_lookup_t const *table = WIN_VERSION_MATRIX[tbl_idx];
-    ga_win_10_0_t const *win_10_0_table = tbl_idx ?
+    const ga_matrix_lookup_t *table = WIN_VERSION_MATRIX[tbl_idx];
+    const ga_win_10_0_t *win_10_0_table = tbl_idx ?
         WIN_10_0_SERVER_VERSION_MATRIX : WIN_10_0_CLIENT_VERSION_MATRIX;
-    ga_win_10_0_t const *win_10_0_version = NULL;
+    const ga_win_10_0_t *win_10_0_version = NULL;
     while (table->version != NULL) {
         if (major == 10 && minor == 0) {
             while (win_10_0_table->version != NULL) {
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays size
  2024-03-11 16:57 [PULL 0/3] Misc QGA patches for 2024-03-11 Konstantin Kostiuk
  2024-03-11 16:57 ` [PULL 1/3] qga/commands-win32: Declare const qualifier before type Konstantin Kostiuk
@ 2024-03-11 16:57 ` Konstantin Kostiuk
  2024-03-11 16:57 ` [PULL 3/3] qga-win: Add support of Windows Server 2025 in get-osinfo command Konstantin Kostiuk
  2024-03-12 11:05 ` [PULL 0/3] Misc QGA patches for 2024-03-11 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Kostiuk @ 2024-03-11 16:57 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell, Stefan Hajnoczi

From: Philippe Mathieu-Daudé <philmd@linaro.org>

ga_get_win_name() iterates over all elements in the arrays by
checking the 'version' field is non-NULL. Since the arrays are
guarded by a NULL terminating element, we don't need to specify
their size:

  static char *ga_get_win_name(...)
  {
      ...
      const ga_matrix_lookup_t *table = WIN_VERSION_MATRIX[tbl_idx];
      const ga_win_10_0_t *win_10_0_table = ...
      ...
      while (table->version != NULL) {
                    ^^^^^^^^^^^^^^^
              while (win_10_0_table->version != NULL) {
                                     ^^^^^^^^^^^^^^^

This will simplify maintenance when adding new entries to these
arrays.

Split WIN_VERSION_MATRIX into WIN_CLIENT_VERSION_MATRIX and
WIN_SERVER_VERSION_MATRIX because  multidimensional array must
have bounds for all dimensions except the first.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240222152835.72095-3-philmd@linaro.org>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Link: https://lore.kernel.org/r/20240304134532.28506-3-kkostiuk@redhat.com
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
 qga/commands-win32.c | 48 +++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 79b5a580c9..659dfb624a 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -2124,26 +2124,23 @@ typedef struct _ga_matrix_lookup_t {
     const char *version_id;
 } ga_matrix_lookup_t;
 
-static const ga_matrix_lookup_t WIN_VERSION_MATRIX[2][7] = {
-    {
-        /* Desktop editions */
-        { 5, 0, "Microsoft Windows 2000",   "2000"},
-        { 5, 1, "Microsoft Windows XP",     "xp"},
-        { 6, 0, "Microsoft Windows Vista",  "vista"},
-        { 6, 1, "Microsoft Windows 7"       "7"},
-        { 6, 2, "Microsoft Windows 8",      "8"},
-        { 6, 3, "Microsoft Windows 8.1",    "8.1"},
-        { 0, 0, 0}
-    },{
-        /* Server editions */
-        { 5, 2, "Microsoft Windows Server 2003",        "2003"},
-        { 6, 0, "Microsoft Windows Server 2008",        "2008"},
-        { 6, 1, "Microsoft Windows Server 2008 R2",     "2008r2"},
-        { 6, 2, "Microsoft Windows Server 2012",        "2012"},
-        { 6, 3, "Microsoft Windows Server 2012 R2",     "2012r2"},
-        { 0, 0, 0},
-        { 0, 0, 0}
-    }
+static const ga_matrix_lookup_t WIN_CLIENT_VERSION_MATRIX[] = {
+    { 5, 0, "Microsoft Windows 2000",   "2000"},
+    { 5, 1, "Microsoft Windows XP",     "xp"},
+    { 6, 0, "Microsoft Windows Vista",  "vista"},
+    { 6, 1, "Microsoft Windows 7"       "7"},
+    { 6, 2, "Microsoft Windows 8",      "8"},
+    { 6, 3, "Microsoft Windows 8.1",    "8.1"},
+    { }
+};
+
+static const ga_matrix_lookup_t WIN_SERVER_VERSION_MATRIX[] = {
+    { 5, 2, "Microsoft Windows Server 2003",        "2003"},
+    { 6, 0, "Microsoft Windows Server 2008",        "2008"},
+    { 6, 1, "Microsoft Windows Server 2008 R2",     "2008r2"},
+    { 6, 2, "Microsoft Windows Server 2012",        "2012"},
+    { 6, 3, "Microsoft Windows Server 2012 R2",     "2012r2"},
+    { },
 };
 
 typedef struct _ga_win_10_0_t {
@@ -2152,17 +2149,17 @@ typedef struct _ga_win_10_0_t {
     const char *version_id;
 } ga_win_10_0_t;
 
-static const ga_win_10_0_t WIN_10_0_SERVER_VERSION_MATRIX[4] = {
+static const ga_win_10_0_t WIN_10_0_SERVER_VERSION_MATRIX[] = {
     {14393, "Microsoft Windows Server 2016",    "2016"},
     {17763, "Microsoft Windows Server 2019",    "2019"},
     {20344, "Microsoft Windows Server 2022",    "2022"},
-    {0, 0}
+    { }
 };
 
-static const ga_win_10_0_t WIN_10_0_CLIENT_VERSION_MATRIX[3] = {
+static const ga_win_10_0_t WIN_10_0_CLIENT_VERSION_MATRIX[] = {
     {10240, "Microsoft Windows 10",    "10"},
     {22000, "Microsoft Windows 11",    "11"},
-    {0, 0}
+    { }
 };
 
 static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp)
@@ -2191,7 +2188,8 @@ static char *ga_get_win_name(const OSVERSIONINFOEXW *os_version, bool id)
     DWORD minor = os_version->dwMinorVersion;
     DWORD build = os_version->dwBuildNumber;
     int tbl_idx = (os_version->wProductType != VER_NT_WORKSTATION);
-    const ga_matrix_lookup_t *table = WIN_VERSION_MATRIX[tbl_idx];
+    const ga_matrix_lookup_t *table = tbl_idx ?
+        WIN_SERVER_VERSION_MATRIX : WIN_CLIENT_VERSION_MATRIX;
     const ga_win_10_0_t *win_10_0_table = tbl_idx ?
         WIN_10_0_SERVER_VERSION_MATRIX : WIN_10_0_CLIENT_VERSION_MATRIX;
     const ga_win_10_0_t *win_10_0_version = NULL;
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] qga-win: Add support of Windows Server 2025 in get-osinfo command
  2024-03-11 16:57 [PULL 0/3] Misc QGA patches for 2024-03-11 Konstantin Kostiuk
  2024-03-11 16:57 ` [PULL 1/3] qga/commands-win32: Declare const qualifier before type Konstantin Kostiuk
  2024-03-11 16:57 ` [PULL 2/3] qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays size Konstantin Kostiuk
@ 2024-03-11 16:57 ` Konstantin Kostiuk
  2024-03-12 11:05 ` [PULL 0/3] Misc QGA patches for 2024-03-11 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Kostiuk @ 2024-03-11 16:57 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell, Stefan Hajnoczi

From: Dehan Meng <demeng@redhat.com>

Add support of Windows Server 2025 in get-osinfo command

Signed-off-by: Dehan Meng <demeng@redhat.com>
Message-ID: <20240222152835.72095-4-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Link: https://lore.kernel.org/r/20240304134532.28506-4-kkostiuk@redhat.com
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
 qga/commands-win32.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 659dfb624a..6242737b00 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -2153,6 +2153,7 @@ static const ga_win_10_0_t WIN_10_0_SERVER_VERSION_MATRIX[] = {
     {14393, "Microsoft Windows Server 2016",    "2016"},
     {17763, "Microsoft Windows Server 2019",    "2019"},
     {20344, "Microsoft Windows Server 2022",    "2022"},
+    {26040, "MIcrosoft Windows Server 2025",    "2025"},
     { }
 };
 
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] Misc QGA patches for 2024-03-11
  2024-03-11 16:57 [PULL 0/3] Misc QGA patches for 2024-03-11 Konstantin Kostiuk
                   ` (2 preceding siblings ...)
  2024-03-11 16:57 ` [PULL 3/3] qga-win: Add support of Windows Server 2025 in get-osinfo command Konstantin Kostiuk
@ 2024-03-12 11:05 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2024-03-12 11:05 UTC (permalink / raw)
  To: Konstantin Kostiuk; +Cc: qemu-devel, Stefan Hajnoczi

On Mon, 11 Mar 2024 at 16:57, Konstantin Kostiuk <kkostiuk@redhat.com> wrote:
>
> The following changes since commit 7489f7f3f81dcb776df8c1b9a9db281fc21bf05f:
>
>   Merge tag 'hw-misc-20240309' of https://github.com/philmd/qemu into staging (2024-03-09 20:12:21 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/kostyanf14/qemu.git tags/qga-pull-2024-03-11-2
>
> for you to fetch changes up to bfded6fe62b859e337386ed3028b85743569a30b:
>
>   qga-win: Add support of Windows Server 2025 in get-osinfo command (2024-03-11 18:24:39 +0200)
>
> ----------------------------------------------------------------
> qga-pull-2024-03-11-2


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-12 11:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-11 16:57 [PULL 0/3] Misc QGA patches for 2024-03-11 Konstantin Kostiuk
2024-03-11 16:57 ` [PULL 1/3] qga/commands-win32: Declare const qualifier before type Konstantin Kostiuk
2024-03-11 16:57 ` [PULL 2/3] qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays size Konstantin Kostiuk
2024-03-11 16:57 ` [PULL 3/3] qga-win: Add support of Windows Server 2025 in get-osinfo command Konstantin Kostiuk
2024-03-12 11:05 ` [PULL 0/3] Misc QGA patches for 2024-03-11 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).