qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: [PATCH 0/5] introduce QArray
Date: Sat, 21 Aug 2021 22:47:55 +0200	[thread overview]
Message-ID: <cover.1629578875.git.qemu_oss@crudebyte.com> (raw)

Patches 1 and 2 introduce include/qemu/qarray.h which implements a deep auto
free mechanism for arrays. Unlike GArray it does not require special macros,
function calls or member dereferencing to access the individual array
elements. So existing C-style array code can be retained with only very
little changes.

In this initial version QArray only supports the concept of unique pointers,
i.e. it does not support reference counting. The array (and all dynamically
allocated memory of individual array elements) is auto freed once execution
leaves the scope of the reference variable (unique pointer) associated with
the array.

Patches 3..5 are provided (e.g. as example) for 9p being the first user of
this new QArray API. These particular patches 3..5 are rebased on my
current 9p queue: https://github.com/cschoenebeck/qemu/commits/9p.next
which are basically just the following two queued patches:

https://github.com/cschoenebeck/qemu/commit/7772715d43908235940f5b7dec68d0458b1ccdf4
https://github.com/cschoenebeck/qemu/commit/838b55e392ea7d52e714fdba1db777f658aee2cc

Christian Schoenebeck (5):
  qemu/qarray.h: introduce QArray
  qemu/qarray.h: weak scalar type check in QARRAY_CREATE()
  9pfs: make V9fsString usable via QArray API
  9pfs: make V9fsPath usable via QArray API
  9pfs: use QArray in v9fs_walk()

 fsdev/9p-marshal.c    |   2 +
 fsdev/9p-marshal.h    |   3 +
 fsdev/file-op-9p.h    |   2 +
 hw/9pfs/9p.c          |  19 ++----
 include/qemu/qarray.h | 154 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 168 insertions(+), 12 deletions(-)
 create mode 100644 include/qemu/qarray.h

-- 
2.20.1



             reply	other threads:[~2021-08-21 21:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 20:47 Christian Schoenebeck [this message]
2021-08-21 20:18 ` [PATCH 1/5] qemu/qarray.h: introduce QArray Christian Schoenebeck
2021-08-22 12:39   ` Christian Schoenebeck
2021-08-21 20:30 ` [PATCH 2/5] qemu/qarray.h: weak scalar type check in QARRAY_CREATE() Christian Schoenebeck
2021-08-22  4:11   ` Richard Henderson
2021-08-22 12:16     ` Christian Schoenebeck
2021-08-21 20:35 ` [PATCH 3/5] 9pfs: make V9fsString usable via QArray API Christian Schoenebeck
2021-08-21 20:37 ` [PATCH 4/5] 9pfs: make V9fsPath " Christian Schoenebeck
2021-08-21 20:39 ` [PATCH 5/5] 9pfs: use QArray in v9fs_walk() Christian Schoenebeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1629578875.git.qemu_oss@crudebyte.com \
    --to=qemu_oss@crudebyte.com \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).