qemu-patch-raspberry4/docs
Daniel P. Berrangé 221db5daf6 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>
2020-09-03 09:38:36 +02:00
..
config docs: Grammar and spelling fixes 2018-07-13 10:16:04 +01:00
devel qapi: enable use of g_autoptr with QAPI types 2020-09-03 09:38:36 +02:00
interop qcow2: Document the Extended L2 Entries feature 2020-08-25 08:33:20 +02:00
specs spapr: Clarify error and documentation for broken KVM XICS 2020-08-12 13:16:27 +10:00
sphinx docs: automatically track manual dependencies 2020-08-21 06:30:41 -04:00
spin docs: create config/, devel/ and spin/ subdirectories 2017-06-07 18:22:03 +02:00
system Pull request trivial patches 20200901 2020-09-01 15:19:33 +01:00
tools virtiofsd: Remove "norace" from cmdline help and docs 2020-08-28 13:34:52 +01:00
user docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
amd-memory-encryption.txt docs: Fix broken links 2020-09-01 09:31:33 +02:00
barrier.txt ui: add an embedded Barrier client 2019-09-17 13:43:22 +02:00
block-replication.txt colo: Update Documentation for continuous replication 2020-03-03 18:04:47 +08:00
bootindex.txt docs qemu-doc: Avoid ide-drive, it's deprecated 2017-06-04 18:42:55 +03:00
can.txt docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
ccid.txt libcacard: improve documentation 2014-06-10 07:44:01 +02:00
COLO-FT.txt colo: Update Documentation for continuous replication 2020-03-03 18:04:47 +08:00
colo-proxy.txt doc: fix typos for documents in tree 2019-03-06 10:40:21 +01:00
conf.py docs: automatically track manual dependencies 2020-08-21 06:30:41 -04:00
cpu-hotplug.rst docs/cpu-hotplug.rst: Fix rST markup issues 2019-03-07 14:26:44 +00:00
defs.rst.inc docs/system: convert Texinfo documentation to rST 2020-03-06 10:05:12 +00:00
generic-loader.txt docs/generic-loader: mention U-Boot and Intel HEX executable formats 2018-08-20 11:24:31 +01:00
hyperv.txt i386/kvm: add NoNonArchitecturalCoreSharing Hyper-V enlightenment 2019-10-22 09:38:42 +02:00
igd-assign.txt vfio/pci: Add IGD documentation 2016-05-26 11:12:05 -06:00
image-fuzzer.txt docs: List all image elements currently supported by the fuzzer 2014-09-22 11:39:35 +01:00
index.html.in meson: sphinx-build 2020-08-21 06:30:41 -04:00
index.rst docs/index.rst, docs/index.html.in: Reorder manuals 2020-03-12 11:14:06 +00:00
memory-hotplug.txt docs: Grammar and spelling fixes 2018-07-13 10:16:04 +01:00
meson.build meson: pass docdir option 2020-09-01 08:51:33 -04:00
microvm.rst docs/microvm.rst: add instructions for shutting down the guest 2019-11-19 10:01:34 +01:00
multi-thread-compression.txt Replace '-enable-kvm' with '-accel kvm' in docs and help texts 2018-06-28 19:05:32 +02:00
multiseat.txt tests/docker/test-mingw and docs: Remove --with-sdlabi=2.0 2019-02-04 15:25:21 +00:00
nvdimm.txt docs/nvdimm: add description of alignment requirement of device dax 2020-06-26 09:39:36 -04:00
pci_expander_bridge.txt pxb: cleanup 2016-03-11 16:59:12 +02:00
pcie.txt docs: pcie: Spell out machine type needs for PCIe features 2018-03-01 16:25:37 +02:00
pcie_pci_bridge.txt pci: removed the is_express field since a uniform interface was inserted 2018-02-08 21:06:41 +02:00
pr-manager.rst scsi: add multipath support to qemu-pr-helper 2017-09-22 21:07:27 +02:00
pvrdma.txt docs: Fix broken links 2020-09-01 09:31:33 +02:00
qcow2-cache.txt qcow2: Document the Extended L2 Entries feature 2020-08-25 08:33:20 +02:00
qdev-device-use.txt docs/qdev-device-use.txt: Add USB U2F key to the QDEV devices examples 2020-08-31 08:23:39 +02:00
qemu-option-trace.rst.inc docs/qemu-option-trace.rst.inc: Remove redundant comment 2020-03-12 11:14:06 +00:00
qemu_logo.pdf docs: add qemu logo to pdf 2017-01-16 10:11:43 +01:00
qemupciserial.inf docs: Grammar and spelling fixes 2018-07-13 10:16:04 +01:00
rdma.txt doc: fix typos for documents in tree 2019-03-06 10:40:21 +01:00
replay.txt docs: Be consistent about capitalization of 'Arm' 2020-03-12 11:20:20 +00:00
spice-port-fqdn.txt docs: add spice-port-fqdn.txt 2012-12-17 14:01:41 +01:00
throttle.txt docs: Fix description of the leaky bucket algorithm in throttle.txt 2016-09-13 18:12:34 +03:00
u2f.txt hw/usb: Add U2F device autoscan to passthru mode 2020-08-31 08:23:39 +02:00
usb-storage.txt usb: Fix typo in documentation 2017-01-24 23:26:52 +03:00
usb2.txt docs/usb2.txt: ehci has six ports 2018-08-21 10:22:03 +02:00
virtio-balloon-stats.txt Remove the deprecated -balloon option 2018-08-31 09:52:13 +02:00
virtio-net-failover.rst docs: fix rst syntax errors in unbuilt docs 2019-12-19 16:20:21 +00:00
virtio-pmem.rst docs: fix rst syntax errors in unbuilt docs 2019-12-19 16:20:21 +00:00
xbzrle.txt docs/xbzrle: update 'cache miss rate' and 'encoding rate' to docs 2020-06-17 17:48:39 +01:00
xen-save-devices-state.txt Fix up dangling references to qmp-commands.* in comment and doc 2018-03-02 13:48:26 -06:00