mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-09 23:10:08 +00:00
node_device_udev: Add support for g_autoptr
to udevEventData
Use this feature in `udevEventDataNew`. Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
This commit is contained in:
parent
140cdf7f9a
commit
0f8717b1c7
@ -78,6 +78,7 @@ struct _udevEventData {
|
|||||||
/* Immutable pointer, self-locking APIs */
|
/* Immutable pointer, self-locking APIs */
|
||||||
virThreadPool *workerPool;
|
virThreadPool *workerPool;
|
||||||
};
|
};
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(udevEventData, virObjectUnref);
|
||||||
|
|
||||||
static virClass *udevEventDataClass;
|
static virClass *udevEventDataClass;
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ VIR_ONCE_GLOBAL_INIT(udevEventData);
|
|||||||
static udevEventData *
|
static udevEventData *
|
||||||
udevEventDataNew(void)
|
udevEventDataNew(void)
|
||||||
{
|
{
|
||||||
udevEventData *ret = NULL;
|
g_autoptr(udevEventData) ret = NULL;
|
||||||
|
|
||||||
if (udevEventDataInitialize() < 0)
|
if (udevEventDataInitialize() < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -129,19 +130,15 @@ udevEventDataNew(void)
|
|||||||
if (!(ret = virObjectLockableNew(udevEventDataClass)))
|
if (!(ret = virObjectLockableNew(udevEventDataClass)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (virCondInit(&ret->udevThreadCond) < 0) {
|
if (virCondInit(&ret->udevThreadCond) < 0)
|
||||||
virObjectUnref(ret);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (virMutexInit(&ret->mdevctlLock) < 0) {
|
if (virMutexInit(&ret->mdevctlLock) < 0)
|
||||||
virObjectUnref(ret);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
ret->mdevctlTimeout = -1;
|
ret->mdevctlTimeout = -1;
|
||||||
ret->watch = -1;
|
ret->watch = -1;
|
||||||
return ret;
|
return g_steal_pointer(&ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Loading…
Reference in New Issue
Block a user