qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function
@ 2023-03-20 15:26 Philippe Mathieu-Daudé
  2023-03-20 15:56 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-03-20 15:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Kevin Wolf, qemu-trivial,
	Daniel P . Berrangé, qemu-block, Hanna Reitz,
	Philippe Mathieu-Daudé

Introduce the BdrvDmgUncompressFunc type defintion. To emphasis
dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions,
declare them using this new typedef.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 block/dmg.h | 8 ++++----
 block/dmg.c | 7 ++-----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/block/dmg.h b/block/dmg.h
index e488601b62..dcd6165e63 100644
--- a/block/dmg.h
+++ b/block/dmg.h
@@ -51,10 +51,10 @@ typedef struct BDRVDMGState {
     z_stream zstream;
 } BDRVDMGState;
 
-extern int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,
-                                 char *next_out, unsigned int avail_out);
+typedef int BdrvDmgUncompressFunc(char *next_in, unsigned int avail_in,
+                                  char *next_out, unsigned int avail_out);
 
-extern int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in,
-                                   char *next_out, unsigned int avail_out);
+extern BdrvDmgUncompressFunc *dmg_uncompress_bz2;
+extern BdrvDmgUncompressFunc *dmg_uncompress_lzfse;
 
 #endif
diff --git a/block/dmg.c b/block/dmg.c
index e10b9a2ba5..2769900359 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -31,11 +31,8 @@
 #include "qemu/memalign.h"
 #include "dmg.h"
 
-int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,
-                          char *next_out, unsigned int avail_out);
-
-int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in,
-                            char *next_out, unsigned int avail_out);
+BdrvDmgUncompressFunc *dmg_uncompress_bz2;
+BdrvDmgUncompressFunc *dmg_uncompress_lzfse;
 
 enum {
     /* Limit chunk sizes to prevent unreasonable amounts of memory being used
-- 
2.38.1



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

* Re: [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function
  2023-03-20 15:26 [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function Philippe Mathieu-Daudé
@ 2023-03-20 15:56 ` Philippe Mathieu-Daudé
  2023-03-20 16:00   ` Philippe Mathieu-Daudé
  2023-03-20 16:00 ` Philippe Mathieu-Daudé
  2023-04-05 19:56 ` Stefan Hajnoczi
  2 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-03-20 15:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Kevin Wolf, qemu-trivial,
	Daniel P . Berrangé, qemu-block, Hanna Reitz

On 20/3/23 16:26, Philippe Mathieu-Daudé wrote:
> Introduce the BdrvDmgUncompressFunc type defintion. To emphasis
> dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions,
> declare them using this new typedef.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   block/dmg.h | 8 ++++----
>   block/dmg.c | 7 ++-----
>   2 files changed, 6 insertions(+), 9 deletions(-)


> diff --git a/block/dmg.c b/block/dmg.c
> index e10b9a2ba5..2769900359 100644
> --- a/block/dmg.c
> +++ b/block/dmg.c
> @@ -31,11 +31,8 @@
>   #include "qemu/memalign.h"
>   #include "dmg.h"
>   
> -int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,
> -                          char *next_out, unsigned int avail_out);
> -
> -int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in,
> -                            char *next_out, unsigned int avail_out);
> +BdrvDmgUncompressFunc *dmg_uncompress_bz2;
> +BdrvDmgUncompressFunc *dmg_uncompress_lzfse;

Unrelated, but since DMG maintainers are Cc'ed, upstream lzfse warning:

In file included from ../../block/dmg-lzfse.c:26:
/opt/homebrew/Cellar/lzfse/1.0/include/lzfse.h:56:43: warning: this 
function declaration is not a prototype [-Wstrict-prototypes]
LZFSE_API size_t lzfse_encode_scratch_size();
                                           ^
                                            void

Unfortunately last upstream activity was 6 years ago...
https://github.com/lzfse/lzfse/pulls


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

* Re: [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function
  2023-03-20 15:56 ` Philippe Mathieu-Daudé
@ 2023-03-20 16:00   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-03-20 16:00 UTC (permalink / raw)
  To: qemu-devel, Evan Nemerson
  Cc: Stefan Hajnoczi, Kevin Wolf, qemu-trivial,
	Daniel P . Berrangé, qemu-block, Hanna Reitz

On 20/3/23 16:56, Philippe Mathieu-Daudé wrote:
> On 20/3/23 16:26, Philippe Mathieu-Daudé wrote:
>> Introduce the BdrvDmgUncompressFunc type defintion. To emphasis
>> dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions,
>> declare them using this new typedef.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   block/dmg.h | 8 ++++----
>>   block/dmg.c | 7 ++-----
>>   2 files changed, 6 insertions(+), 9 deletions(-)
> 
> 
>> diff --git a/block/dmg.c b/block/dmg.c
>> index e10b9a2ba5..2769900359 100644
>> --- a/block/dmg.c
>> +++ b/block/dmg.c
>> @@ -31,11 +31,8 @@
>>   #include "qemu/memalign.h"
>>   #include "dmg.h"
>> -int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,
>> -                          char *next_out, unsigned int avail_out);
>> -
>> -int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in,
>> -                            char *next_out, unsigned int avail_out);
>> +BdrvDmgUncompressFunc *dmg_uncompress_bz2;
>> +BdrvDmgUncompressFunc *dmg_uncompress_lzfse;
> 
> Unrelated, but since DMG maintainers are Cc'ed, upstream lzfse warning:
> 
> In file included from ../../block/dmg-lzfse.c:26:
> /opt/homebrew/Cellar/lzfse/1.0/include/lzfse.h:56:43: warning: this 
> function declaration is not a prototype [-Wstrict-prototypes]
> LZFSE_API size_t lzfse_encode_scratch_size();
>                                            ^
>                                             void

Reported in 2016:
https://github.com/lzfse/lzfse/issues/3#issuecomment-226574719

> Unfortunately last upstream activity was 6 years ago...
> https://github.com/lzfse/lzfse/pulls



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

* Re: [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function
  2023-03-20 15:26 [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function Philippe Mathieu-Daudé
  2023-03-20 15:56 ` Philippe Mathieu-Daudé
@ 2023-03-20 16:00 ` Philippe Mathieu-Daudé
  2023-04-05 19:56 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-03-20 16:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Kevin Wolf, qemu-trivial,
	Daniel P . Berrangé, qemu-block, Hanna Reitz

On 20/3/23 16:26, Philippe Mathieu-Daudé wrote:
> Introduce the BdrvDmgUncompressFunc type defintion. To emphasis

Typo "definition".

> dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions,
> declare them using this new typedef.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   block/dmg.h | 8 ++++----
>   block/dmg.c | 7 ++-----
>   2 files changed, 6 insertions(+), 9 deletions(-)



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

* Re: [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function
  2023-03-20 15:26 [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function Philippe Mathieu-Daudé
  2023-03-20 15:56 ` Philippe Mathieu-Daudé
  2023-03-20 16:00 ` Philippe Mathieu-Daudé
@ 2023-04-05 19:56 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2023-04-05 19:56 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Kevin Wolf, qemu-trivial, Daniel P . Berrangé,
	qemu-block, Hanna Reitz

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

On Mon, Mar 20, 2023 at 04:26:10PM +0100, Philippe Mathieu-Daudé wrote:
> Introduce the BdrvDmgUncompressFunc type defintion. To emphasis
> dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions,
> declare them using this new typedef.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  block/dmg.h | 8 ++++----
>  block/dmg.c | 7 ++-----
>  2 files changed, 6 insertions(+), 9 deletions(-)

Sorry for the delay, applied to my block-next tree:
https://gitlab.com/stefanha/qemu/commits/block-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-04-05 19:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-20 15:26 [PATCH-for-8.1] block/dmg: Declare a type definition for DMG uncompress function Philippe Mathieu-Daudé
2023-03-20 15:56 ` Philippe Mathieu-Daudé
2023-03-20 16:00   ` Philippe Mathieu-Daudé
2023-03-20 16:00 ` Philippe Mathieu-Daudé
2023-04-05 19:56 ` Stefan Hajnoczi

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).