[libvirt] [Qemu-devel] [PATCH v6 3/4] kvm: add kvm_support_device() helper function

Peter Xu peterx at redhat.com
Thu Mar 24 01:59:10 UTC 2016


On Wed, Mar 23, 2016 at 06:03:32PM +0300, Sergey Fedorov wrote:
> Yes, but kvm_create_device() returns a file descriptor whereas this
> function is predicative. Personally, I like the convention described in
> chapter 16 of Linux kernel coding style [1]:
> 
> 	If the name of a function is an action or an imperative command,
> 	the function should return an error-code integer.  If the name
> 	is a predicate, the function should return a "succeeded" boolean.

The above is talking about return values. Maybe you were trying to
reference this one as example about add_work() and
pci_dev_present():

    For example, "add work" is a command, and the add_work()
    function returns 0 for success or -EBUSY for failure.  In the
    same way, "PCI device present" is a predicate, and the
    pci_dev_present() function returns 1 if it succeeds in finding a
    matching device or 0 if it doesn't.

Seems make sense. Will take your advice.  Thanks.

-- peterx




More information about the libvir-list mailing list