From: Scott Wood Subject: Re: [RFC PATCH] KVM: introduce kvm_check_device Date: Tue, 6 Jan 2015 14:52:48 -0600 Message-ID: <1420577568.4961.23.camel@freescale.com> References: <1420560724-5345-1-git-send-email-andre.przywara@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: , , To: Andre Przywara Return-path: Received: from mail-bn1bon0118.outbound.protection.outlook.com ([157.56.111.118]:40034 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752933AbbAFUxD (ORCPT ); Tue, 6 Jan 2015 15:53:03 -0500 In-Reply-To: <1420560724-5345-1-git-send-email-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2015-01-06 at 16:12 +0000, Andre Przywara wrote: > While we can easily register and unregister KVM devices, there is > currently no easy way of checking whether a device has been > registered. > Introduce kvm_check_device() for that purpose and use it in two > existing functions. Also change the return code for an invalid > type number from ENOSPC to EINVAL. > This function will be later used by another patch set to check > whether a KVM_CREATE_IRQCHIP ioctl is valid. You're checking whether a device type has been registered, not the device itself -- so could you make it kvm_check_device_type()? > Signed-off-by: Andre Przywara > --- > Hi, > > can people comment whether there is an easier way to detect KVM > device registration _outside_ of virt/kvm/kvm_main.c? Using the > KVM_CREATE_DEVICE_TEST flag sounds like a fit, but > kvm_ioctl_create_device() isn't exported. Out of curiosity, why do you need to test it from inside the kernel but outside kvm_main.c? -Scott