qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 221db5: qapi: enable use of g_autoptr with QA


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 221db5: qapi: enable use of g_autoptr with QAPI types
Date: Sat, 05 Sep 2020 07:31:16 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 221db5daf6b3666f1c8e4ca06ae45892e99a112f
      
https://github.com/qemu/qemu/commit/221db5daf6b3666f1c8e4ca06ae45892e99a112f
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M docs/devel/qapi-code-gen.txt
    M include/crypto/block.h
    M scripts/qapi/types.py
    M tests/test-qobject-input-visitor.c

  Log Message:
  -----------
  qapi: enable use of g_autoptr with QAPI types

Currently QAPI generates a type and function for free'ing it:

  typedef struct QCryptoBlockCreateOptions QCryptoBlockCreateOptions;
  void qapi_free_QCryptoBlockCreateOptions(QCryptoBlockCreateOptions *obj);

This is used in the traditional manner:

  QCryptoBlockCreateOptions *opts = NULL;

  opts = g_new0(QCryptoBlockCreateOptions, 1);

  ....do stuff with opts...

  qapi_free_QCryptoBlockCreateOptions(opts);

Since bumping the min glib to 2.48, QEMU has incrementally adopted the
use of g_auto/g_autoptr. This allows the compiler to run a function to
free a variable when it goes out of scope, the benefit being the
compiler can guarantee it is freed in all possible code ptahs.

This benefit is applicable to QAPI types too, and given the seriously
long method names for some qapi_free_XXXX() functions, is much less
typing. This change thus makes the code generator emit:

 G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockCreateOptions,
                              qapi_free_QCryptoBlockCreateOptions)

The above code example now becomes

  g_autoptr(QCryptoBlockCreateOptions) opts = NULL;

  opts = g_new0(QCryptoBlockCreateOptions, 1);

  ....do stuff with opts...

Note, if the local pointer needs to live beyond the scope holding the
variable, then g_steal_pointer can be used. This is useful to return the
pointer to the caller in the success codepath, while letting it be freed
in all error codepaths.

  return g_steal_pointer(&opts);

The crypto/block.h header needs updating to avoid symbol clash now that
the g_autoptr support is a standard QAPI feature.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200723153845.2934357-1-berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: e947e9c8012b779dff6039fbe738a5584db6431d
      
https://github.com/qemu/qemu/commit/e947e9c8012b779dff6039fbe738a5584db6431d
  Author: Kashyap Chamarthy <kchamart@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M qapi/block-core.json

  Log Message:
  -----------
  qapi/block-core.json: Remove stale description of 'blockdev-add'

On a 'qemu-discuss' thread[1], Kevin identifies that the current doc
blurb for @blockdev-add is stale:

    This is actually a documentation bug. @id doesn't exist,
    blockdev-add never creates a BlockBackend. This was different in the
    very first versions of the patches to add blockdev-add and we
    probably just forgot to update the documentation after removing it.

So remove the stale bits.

And the requirement for 'node-name' is already mentioned in the
documentation of @BlockdevOptions:

    [...]
    # @node-name: the node name of the new node (Since 2.0).
    #             This option is required on the top level of blockdev-add.
    #             Valid node names start with an alphabetic character and may
    #             contain only alphanumeric characters, '-', '.' and '_'. Their
    #             maximum length is 31 characters.
    [...]

[1] https://lists.nongnu.org/archive/html/qemu-discuss/2020-07/msg00071.html
    -- equivalent to "-drive if=ide,id=disk0....."

Fixes: be4b67bc7d ("blockdev: Allow creation of BDS trees without BB")

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200805100158.1239390-1-kchamart@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 67abc3ddea74c60a282f46ac6e0af802c3b146f1
      
https://github.com/qemu/qemu/commit/67abc3ddea74c60a282f46ac6e0af802c3b146f1
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M scripts/qmp/qom-fuse

  Log Message:
  -----------
  scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol

Commit c7b942d7f8 "scripts/qmp: Fix shebang and imports" messed with
it for reasons I don't quite understand.  I do understand how it fails
now: it neglects to import sys.  Fix that.

It now fails because it expects an old version of module fuse.  That's
next.

Fixes: c7b942d7f84ef54f266921bf7668d43f1f2c7c79
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200723142738.1868568-2-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>


  Commit: f713ed4f7eac18dc43d75b08de99196139e56d08
      
https://github.com/qemu/qemu/commit/f713ed4f7eac18dc43d75b08de99196139e56d08
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M scripts/qmp/qom-fuse

  Log Message:
  -----------
  scripts/qmp/qom-fuse: Port to current Python module fuse

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200723142738.1868568-3-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>


  Commit: 3a14019e8216eb5f48074d781343317274b8292a
      
https://github.com/qemu/qemu/commit/3a14019e8216eb5f48074d781343317274b8292a
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M scripts/qmp/qom-fuse

  Log Message:
  -----------
  scripts/qmp/qom-fuse: Fix getattr(), read() for files in /

path, prop = "type".rsplit('/', 1) sets path to "", which doesn't
work.  Correct to "/".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200723142738.1868568-4-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>


  Commit: a7742549ea057431d0e07d5ee9df1c8ab7bf7a72
      
https://github.com/qemu/qemu/commit/a7742549ea057431d0e07d5ee9df1c8ab7bf7a72
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M docs/interop/qmp-spec.txt

  Log Message:
  -----------
  docs/interop/qmp-spec: Point to the QEMU QMP reference manual

Commit 4d8bb958fa0..231aaf3a821 integrated the contents of
docs/qmp-events.txt into QAPI schema doc comments.  It left dangling
references to qmp-events.txt behind.  Fix to point to the QEMU QMP
reference manual generated from the QAPI schema.

Add a similar reference for commands.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200806081147.3123652-2-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


  Commit: 382bd1cbbde73a5815df0ba189e72b82a11fff04
      
https://github.com/qemu/qemu/commit/382bd1cbbde73a5815df0ba189e72b82a11fff04
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M qapi/char.json

  Log Message:
  -----------
  qapi: Document event VSERPORT_CHANGE is rate-limited

Commit e2ae6159de "virtio-serial: report frontend connection state via
monitor" neglected to document the new event is rate-limited.  Fix
that.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200806081147.3123652-3-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


  Commit: 923fbd4cbd485dc72e9f2578cd891607ec43ac70
      
https://github.com/qemu/qemu/commit/923fbd4cbd485dc72e9f2578cd891607ec43ac70
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-09-03 (Thu, 03 Sep 2020)

  Changed paths:
    M docs/qdev-device-use.txt

  Log Message:
  -----------
  docs/qdev-device-use: Don't suggest -drive and -net can do USB

Commit 480324ec8d "docs/qdev-device-use: Clean up the sentences
related to -usbdevice" deleted the information on syntax that no
longer works.  Unfortunately, the resulting text suggests you can
configure USB block devices with -drive, and USB network devices with
-net, which is misleading.

Instead of rephrasing the now misleading text, I'm putting the
information back, and just make clear it's about old versions of QEMU.

Cc: Thomas Huth <thuth@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200806081147.3123652-4-armbru@redhat.com>


  Commit: 8ca019b9c9ff916414371dd13d265bbab308b14a
      
https://github.com/qemu/qemu/commit/8ca019b9c9ff916414371dd13d265bbab308b14a
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-09-04 (Fri, 04 Sep 2020)

  Changed paths:
    M docs/devel/qapi-code-gen.txt
    M docs/interop/qmp-spec.txt
    M docs/qdev-device-use.txt
    M include/crypto/block.h
    M qapi/block-core.json
    M qapi/char.json
    M scripts/qapi/types.py
    M scripts/qmp/qom-fuse
    M tests/test-qobject-input-visitor.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-09-03' into 
staging

QAPI patches patches for 2020-09-03

# gpg: Signature made Thu 03 Sep 2020 09:00:37 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2020-09-03:
  docs/qdev-device-use: Don't suggest -drive and -net can do USB
  qapi: Document event VSERPORT_CHANGE is rate-limited
  docs/interop/qmp-spec: Point to the QEMU QMP reference manual
  scripts/qmp/qom-fuse: Fix getattr(), read() for files in /
  scripts/qmp/qom-fuse: Port to current Python module fuse
  scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol
  qapi/block-core.json: Remove stale description of 'blockdev-add'
  qapi: enable use of g_autoptr with QAPI types

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/1133ce5ec967...8ca019b9c9ff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]