From: Avi Kivity <avi@qumranet.com>
To: Amit Shah <amit.shah@qumranet.com>
Cc: "Yang, Sheng" <sheng.yang@intel.com>,
kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
Ben-Ami Yassour <benami@il.ibm.com>,
muli@il.ibm.com, weidong.han@intel.com, anthony@codemonkey.ws
Subject: Re: [PATCH 2/5] KVM: Add irq ack notifier list
Date: Thu, 31 Jul 2008 11:55:20 +0300 [thread overview]
Message-ID: <48917DF8.6090603@qumranet.com> (raw)
In-Reply-To: <200807301124.20158.amit.shah@qumranet.com>
Amit Shah wrote:
>>> 'opaque' fields can be later made to point to other structures
>>> without changing the structure itself. This is an advantage. Will
>>> the kvm_pic struct be needed to change in the future? Very
>>> unlikely. So we can rename it to struct kvm *, however, that gives
>>> us no real benefit as against opaque (just readability).
>>>
>> Yes, the readability...
>>
>> I think people would be very curious about why
>>
>> void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi)
>>
>> got a irq_request_opaque as a parameter. It's more like a hack, which
>> is not my meaning...
>>
>> Anyway, it's trivial one and just a coding style. :)
>>
>
> However, this idiom is used in quite a few places in the kernel already so it
> shouldn't come as a big surprise to someone reading the code.
>
Void pointers are useful where there are multiple clients for a service
which needs a callback. When there is just one client (and not because
no one has written another, but because logically there is only one
client), specifying it explicity is better.
An alternative to void pointers (which I prefer) is to embed the
structure that holds the callback within the structure that needs to be
passed to the callback, and use container_of(). This saves the space to
store the void pointer, and is also cleaner, IMO.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-07-31 8:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 16:26 Device assignemnt: updated patches Ben-Ami Yassour
2008-07-28 16:26 ` [PATCH 1/5] KVM: PCIPT: direct mmio pfn check Ben-Ami Yassour
2008-07-28 16:26 ` [PATCH 2/5] KVM: Add irq ack notifier list Ben-Ami Yassour
2008-07-28 16:26 ` [PATCH 3/5] KVM: pci device assignment Ben-Ami Yassour
2008-07-28 16:26 ` [PATCH 4/5] VT-d: changes to support KVM Ben-Ami Yassour
2008-07-28 16:26 ` [PATCH 5/5] This patch extends the VT-d driver " Ben-Ami Yassour
2008-07-28 16:32 ` Device assignment - userspace part Ben-Ami Yassour
2008-07-28 16:32 ` [PATCH 1/1] KVM/userspace: Support for assigning PCI devices to guest Ben-Ami Yassour
2008-08-01 3:09 ` Han, Weidong
2008-08-05 9:41 ` Ben-Ami Yassour
2008-07-29 7:28 ` [PATCH 5/5] This patch extends the VT-d driver to support KVM Yang, Sheng
2008-08-05 6:01 ` Yang, Sheng
2008-08-05 9:32 ` Ben-Ami Yassour
2008-08-05 14:46 ` Han, Weidong
2008-08-06 5:50 ` Ben-Ami Yassour
2008-08-06 6:18 ` Han, Weidong
2008-08-06 8:56 ` Ben-Ami Yassour
2008-08-06 9:12 ` Han, Weidong
2008-08-06 9:42 ` Ben-Ami Yassour
2008-08-07 1:21 ` Han, Weidong
2008-08-07 10:35 ` Ben-Ami Yassour
2008-08-12 3:29 ` Han, Weidong
2008-07-29 9:19 ` [PATCH 3/5] KVM: pci device assignment Amit Shah
2008-07-29 9:38 ` Ben-Ami Yassour
2008-07-29 14:02 ` Avi Kivity
2008-07-30 6:00 ` Amit Shah
2008-07-30 6:03 ` Amit Shah
2008-07-30 11:58 ` Ben-Ami Yassour
2008-08-01 11:24 ` Amit Shah
2008-07-29 12:27 ` Ben-Ami Yassour
2008-07-29 7:14 ` [PATCH 2/5] KVM: Add irq ack notifier list Yang, Sheng
2008-07-29 9:34 ` Amit Shah
2008-07-29 9:56 ` Yang, Sheng
2008-07-30 5:54 ` Amit Shah
2008-07-31 8:55 ` Avi Kivity [this message]
2008-07-30 15:21 ` Device assignemnt: updated patches Avi Kivity
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=48917DF8.6090603@qumranet.com \
--to=avi@qumranet.com \
--cc=amit.shah@qumranet.com \
--cc=anthony@codemonkey.ws \
--cc=benami@il.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=muli@il.ibm.com \
--cc=sheng.yang@intel.com \
--cc=weidong.han@intel.com \
/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).