update the array size
v2 cover update the array size
v1 -> v2
update the array size "WIN_10_0_SERVER_VERSION_MATRIX" in case array out of range elements.
Dehan Meng (1):
qga-win: Add support of Windows Server 2025 in get-osinfo command
qga/commands-win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.1
PATCH v2 1/1 qga-win: Add support of Windows Server 2025 in get-osinfo command
Add support of Windows Server 2025 in get-osinfo command
--- qga/commands-win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
qga/commands-win32.c +2 -1
@@ -2150,10 +2150,11 @@ typedef struct _ga_win_10_0_t {char const *version_id; } ga_win_10_0_t; -static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX [4 ] = { +static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX [5 ] = { {14393 ,"Microsoft Windows Server 2016" ,"2016" }, {17763 ,"Microsoft Windows Server 2019" ,"2019" }, {20344 ,"Microsoft Windows Server 2022" ,"2022" }, + {26040 ,"MIcrosoft Windows Server 2025" ,"2025" }, {0 ,0 } };
Signature · 1 line
2.35.1
Re: [PATCH v2 1/1] qga-win: Add support of Windows Server 2025 in get-osinfo command
Hi Dehan,
Quoted 12 lines · Dehan Meng
Add support of Windows Server 2025 in get-osinfo command
Signed-off-by Dehan Meng <[email protected]>--- qga/commands-win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)qga/commands-win32.c +0
-0
qga/commands-win32.c typedef struct _ga_win_10_0_t { · line 2153
Quoted 5 lines
qga/commands-win32.c +1
-1@@ -2150,10 +2150,11 @@ typedef struct _ga_win_10_0_t {char const *version_id; } ga_win_10_0_t; -static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX [4 ] = { +static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX [5 ] = {
These arrays are NULL-terminated, they are iterated until the NULL value is found:
while (table->version != NULL) {So setting their size isn't really useful.
qga/commands-win32.c typedef struct _ga_win_10_0_t { · line 2160
Quoted 7 lines
qga/commands-win32.c +1
-0{14393, "Microsoft Windows Server 2016", "2016"}, {17763, "Microsoft Windows Server 2019", "2019"}, {20344, "Microsoft Windows Server 2022", "2022"}, + {26040, "MIcrosoft Windows Server 2025", "2025"}, {0, 0} };
IMO this can be simplified in a preliminary patch as (untested):
-- >8 --
qga/commands-win32.c +7 -8
@@ -2126,3 +2126,3 @@ typedef struct _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 ][] = { {
@@ -2135,3 +2135,3 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][7] = { { 6, 3, "Microsoft Windows 8.1", "8.1"}, - { 0, 0, 0} + { } },{
@@ -2143,4 +2143,3 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][7] = { { 6, 3, "Microsoft Windows Server 2012 R2", "2012r2"}, - { 0, 0, 0}, - { 0, 0, 0} + { }, }
@@ -2154,3 +2153,3 @@ typedef struct _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 [] = { {14393 ,"Microsoft Windows Server 2016" ,"2016" },
@@ -2158,9 +2157,9 @@ static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX[4] = { {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 [] = { {10240 ,"Microsoft Windows 10" ,"10" }, {22000 ,"Microsoft Windows 11" ,"11" }, - {0 ,0 } + { } };
---
Then your patch becomes a one-line one.
Regard,
Phil.