[libvirt] [PATCH 7/6] Dedicated name for sub-driver open/close methods

Eric Blake eblake at redhat.com
Tue Apr 23 20:44:02 UTC 2013


On 04/23/2013 09:57 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> It will simplify later work if the sub-drivers have dedicated
> APIs / field names. ie virNetworkDriver should have
> virDrvNetworkOpen and virDrvNetworkClose methods
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  docs/hvsupport.pl                       |  4 +++
>  src/datatypes.c                         | 12 ++++-----
>  src/driver.h                            | 47 ++++++++++++++++++++++++---------

>  tests/qemuxml2argvtest.c                |  4 +--
>  31 files changed, 129 insertions(+), 102 deletions(-)

Not as mechanical, but also small enough to review closely.  Still
passes 'make check'.

> +++ b/src/datatypes.c
> @@ -144,17 +144,17 @@ virConnectDispose(void *obj)
>      virConnectPtr conn = obj;
>  
>      if (conn->networkDriver)
> -        conn->networkDriver->connectClose(conn);
> +        conn->networkDriver->networkClose(conn);
>      if (conn->interfaceDriver)
> -        conn->interfaceDriver->connectClose(conn);
> +        conn->interfaceDriver->interfaceClose(conn);

Definite improvement in this use case.

> +++ b/src/esx/esx_device_monitor.c
> @@ -69,8 +69,8 @@ esxDeviceClose(virConnectPtr conn)
>  
>  static virNodeDeviceDriver esxNodeDeviceDriver = {
>      .name = "ESX",
> -    .connectOpen = esxDeviceOpen, /* 0.7.6 */
> -    .connectClose = esxDeviceClose, /* 0.7.6 */
> +    .nodeDeviceOpen = esxDeviceOpen, /* 0.7.6 */
> +    .nodeDeviceClose = esxDeviceClose, /* 0.7.6 */
>  };

In fact, this fixes one of the comments I made in 4/6, at least for this
file (there may be other places where the driver callback function name
doesn't match the driver.h struct member name, still worth cleaning up
separately).

/me peeks ahead

Oh, patch 8 solves that remaining mismatch :)  We must be thinking alike
on the cleanup today.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130423/69ef5473/attachment-0001.sig>


More information about the libvir-list mailing list