diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-02-11 15:00:12 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-02-16 17:30:19 +0100 |
commit | 439c5e02d59659876e1a2cf019c55e419adab195 (patch) | |
tree | 63b9eb849574b723fc33973d55eb3b22ccd084f2 /include/qemu/rcu.h | |
parent | 341774fe6ccdc0fe42fb79a4ed642e78237da428 (diff) | |
download | qemu-439c5e02d59659876e1a2cf019c55e419adab195.zip qemu-439c5e02d59659876e1a2cf019c55e419adab195.tar.gz qemu-439c5e02d59659876e1a2cf019c55e419adab195.tar.bz2 |
rcu: add g_free_rcu
This simplifies calling g_free from an RCU callback.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/rcu.h')
-rw-r--r-- | include/qemu/rcu.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 068a279..506ab58 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -140,6 +140,14 @@ extern void call_rcu1(struct rcu_head *head, RCUCBFunc *func); }), \ (RCUCBFunc *)(func)) +#define g_free_rcu(obj, field) \ + call_rcu1(({ \ + char __attribute__((unused)) \ + offset_must_be_zero[-offsetof(typeof(*(obj)), field)]; \ + &(obj)->field; \ + }), \ + (RCUCBFunc *)g_free); + #ifdef __cplusplus } #endif |