[libvirt] [PATCH] bhyve: implement virConnectGetType

This implements virConnectGetType for the bhyve driver. --- src/bhyve/bhyve_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 4fc504e..a853e94 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1508,6 +1508,15 @@ bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return ret; } +static const char * +bhyveConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED) +{ + if (virConnectGetTypeEnsureACL(conn) < 0) + return NULL; + + return "BHYVE"; +} + static virHypervisorDriver bhyveHypervisorDriver = { .name = "bhyve", .connectOpen = bhyveConnectOpen, /* 1.2.2 */ @@ -1557,6 +1566,7 @@ static virHypervisorDriver bhyveHypervisorDriver = { .connectDomainEventRegisterAny = bhyveConnectDomainEventRegisterAny, /* 1.2.5 */ .connectDomainEventDeregisterAny = bhyveConnectDomainEventDeregisterAny, /* 1.2.5 */ .domainHasManagedSaveImage = bhyveDomainHasManagedSaveImage, /* 1.2.13 */ + .connectGetType = bhyveConnectGetType, /* 1.3.5 */ }; -- 2.1.4

Fabian Freyer wrote:
This implements virConnectGetType for the bhyve driver.
--- src/bhyve/bhyve_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 4fc504e..a853e94 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1508,6 +1508,15 @@ bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return ret; }
+static const char * +bhyveConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED)
ATTRIBUTE_UNUSED is not needed here.
+{ + if (virConnectGetTypeEnsureACL(conn) < 0) + return NULL; + + return "BHYVE"; +} + static virHypervisorDriver bhyveHypervisorDriver = { .name = "bhyve", .connectOpen = bhyveConnectOpen, /* 1.2.2 */ @@ -1557,6 +1566,7 @@ static virHypervisorDriver bhyveHypervisorDriver = { .connectDomainEventRegisterAny = bhyveConnectDomainEventRegisterAny, /* 1.2.5 */ .connectDomainEventDeregisterAny = bhyveConnectDomainEventDeregisterAny, /* 1.2.5 */ .domainHasManagedSaveImage = bhyveDomainHasManagedSaveImage, /* 1.2.13 */ + .connectGetType = bhyveConnectGetType, /* 1.3.5 */ };
ACK and pushed with ATTRIBUTE_UNUSED removed. Congrats on the first patch! Roman Bogorodskiy

On 05/13/2016 02:13 PM, Roman Bogorodskiy wrote:
Fabian Freyer wrote:
This implements virConnectGetType for the bhyve driver.
--- src/bhyve/bhyve_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 4fc504e..a853e94 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1508,6 +1508,15 @@ bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return ret; }
+static const char * +bhyveConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED)
ATTRIBUTE_UNUSED is not needed here.
ATTRIBUTED_UNUSED tells the compiler not to throw a warning if the parameter ('conn' in this case) isn't used in the function. So if the function _does_ use the parameter, the annotation is incorrect. That means that if you grabbed that pattern from any other GetType implementations, the ATTRIBUTE_UNUSED usage there may be incorrect as well. So more opportunity for patches :) - Cole

This is not needed here, since the conn parameter is used in the ACL checking calls, which were introduced in abf75aea2. --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c4c4968..37d970e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1228,7 +1228,7 @@ qemuConnectSupportsFeature(virConnectPtr conn, int feature) } } -static const char *qemuConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED) { +static const char *qemuConnectGetType(virConnectPtr conn) { if (virConnectGetTypeEnsureACL(conn) < 0) return NULL; -- 2.1.4

On 05/13/2016 03:07 PM, Fabian Freyer wrote:
This is not needed here, since the conn parameter is used in the ACL checking calls, which were introduced in abf75aea2. --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c4c4968..37d970e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1228,7 +1228,7 @@ qemuConnectSupportsFeature(virConnectPtr conn, int feature) } }
-static const char *qemuConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED) { +static const char *qemuConnectGetType(virConnectPtr conn) { if (virConnectGetTypeEnsureACL(conn) < 0) return NULL;
ACK and pushed Thanks, Cole

On 13.05.2016 20:37, Cole Robinson wrote:
ATTRIBUTED_UNUSED tells the compiler not to throw a warning if the parameter ('conn' in this case) isn't used in the function. So if the function _does_ use the parameter, the annotation is incorrect.
That means that if you grabbed that pattern from any other GetType implementations, the ATTRIBUTE_UNUSED usage there may be incorrect as well. So more opportunity for patches :)
Done, submitted patch for the qemu driver as well. Fabian
participants (3)
-
Cole Robinson
-
Fabian Freyer
-
Roman Bogorodskiy