qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 2/3] VFIO: Helper function to retrieve contai


From: Gavin Shan
Subject: Re: [Qemu-devel] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd
Date: Wed, 28 May 2014 01:17:13 +1000
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, May 27, 2014 at 08:16:47AM -0600, Alex Williamson wrote:
>On Tue, 2014-05-27 at 18:51 +1000, Gavin Shan wrote:
>> The patch adds function vfio_get_container_fd_by_group_id() to retrieve
>> the container's fd of the specified VFIO group. The fd will be used
>> by subsequent patches.
>> 
>> Signed-off-by: Gavin Shan <address@hidden>
>> ---
>>  hw/misc/vfio.c         | 17 +++++++++++++++++
>>  include/hw/misc/vfio.h |  1 +
>>  2 files changed, 18 insertions(+)
>> 
>> diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
>> index 0796abf..424d467 100644
>> --- a/hw/misc/vfio.c
>> +++ b/hw/misc/vfio.c
>> @@ -4310,3 +4310,20 @@ put_group_exit:
>>  
>>      return n;
>>  }
>> +
>> +int vfio_get_container_fd_by_group_id(int32_t groupid)
>> +{
>> +    VFIOGroup *group;
>> +
>> +    QLIST_FOREACH(group, &group_list, next) {
>> +        if (group->groupid == groupid) {
>> +            if (group->container) {
>> +                return group->container->fd;
>> +            } else {
>> +                return -ENOENT;
>> +            }
>> +        }
>> +    }
>> +
>> +    return -ENOENT;
>> +}
>> diff --git a/include/hw/misc/vfio.h b/include/hw/misc/vfio.h
>> index 53ec665..a5afebd 100644
>> --- a/include/hw/misc/vfio.h
>> +++ b/include/hw/misc/vfio.h
>> @@ -30,4 +30,5 @@ static inline long vfio_kvm_notify(Notifier *n, unsigned 
>> request, void *data)
>>      return p.ret;
>>  }
>>  
>> +extern int vfio_get_container_fd_by_group_id(int32_t groupid);
>>  #endif
>
>NAK, get implies a reference, there is none here.
>

Well, how about to have vfio_find_container_fd_by_group_id()
or just vfio_container_fd_by_group_id() ?

Thanks,
Gavin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]