On Thu, Apr 26, 2018 at 05:07 PM +0200, John Ferlan wrote:
> On 04/12/2018 08:40 AM, Marc Hartmayer wrote:
>> The test driver state (@testDriver) uses it's own reference counting
>> and locking implementation. Instead of doing that, convert @testDriver
>> into a virObjectLockable and use the provided functionalities.
>>
>> Signed-off-by: Marc Hartmayer
>> Reviewed-by: Boris Fiuczynski
>> ---
>> src/test/test_driver.c | 200
>> ++---
>> 1 file changed, 90 insertions(+), 110 deletions(-)
>>
>> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
>> index 856869c9d3a9..1a219316e7c5 100644
>> --- a/src/test/test_driver.c
>> +++ b/src/test/test_driver.c
>> @@ -94,7 +94,7 @@ typedef struct _testAuth testAuth;
>> typedef struct _testAuth *testAuthPtr;
>>
>> struct _testDriver {
>> -virMutex lock;
>> +virObjectLockable parent;
>>
>> virNodeInfo nodeInfo;
>> virInterfaceObjListPtr ifaces;
>> @@ -126,9 +126,22 @@ typedef struct _testDriver testDriver;
>> typedef testDriver *testDriverPtr;
>>
>> static testDriverPtr defaultPrivconn;
>> -static int defaultConnections;
>> static virMutex defaultLock = VIR_MUTEX_INITIALIZER;
>>
>> +static virClassPtr testDriverClass;
>> +static void testDriverDispose(void *obj);
>> +static int testDriverOnceInit(void)
>> +{
>> +if (!(testDriverClass = virClassNew(virClassForObjectLockable(),
>> +"testDriver",
>> +sizeof(testDriver),
>> +testDriverDispose)))
>
> Probably posted/pushed after this posting, but commit id '10f94828'
> added a new VIR_CLASS_NEW definition and commit id '825bb9b8' required
> using it.
Yep.
>
> Simple to change:
>
> if (!(VIR_CLASS_NEW(testDriver, virClassForObjectLockable(
>
> But figured you should know.
>
>> +return -1;
>> +
>> +return 0;
>> +}
>> +VIR_ONCE_GLOBAL_INIT(testDriver)
>> +
>
> Reviewed-by: John Ferlan
Thanks.
>
> John
>
--
Beste Grüße / Kind regards
Marc Hartmayer
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list