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

Re: [libvirt] [PATCH 09/15] util: Move scsi_host specific functions from virutil



On Wed, Jan 25, 2017 at 03:27:35PM -0500, John Ferlan wrote:
> Create a virscsihost.c and place the functions there. That removes the
> last #ifdef __linux__ from virutil.c.
> 
> Take the opporunity to also change the function names and in one case
> the parameters slightly
> 
> Signed-off-by: John Ferlan <jferlan redhat com>
> ---
>  po/POTFILES.in                            |   1 +
>  src/Makefile.am                           |   1 +
>  src/conf/storage_conf.c                   |  34 ++--
>  src/libvirt_private.syms                  |  10 +-
>  src/node_device/node_device_linux_sysfs.c |   5 +-
>  src/storage/storage_backend_scsi.c        |  15 +-
>  src/util/virscsihost.c                    | 297 ++++++++++++++++++++++++++++++
>  src/util/virscsihost.h                    |  40 ++++
>  src/util/virutil.c                        | 269 ---------------------------
>  src/util/virutil.h                        |  20 --
>  tests/scsihosttest.c                      |  16 +-
>  11 files changed, 386 insertions(+), 322 deletions(-)
>  create mode 100644 src/util/virscsihost.c
>  create mode 100644 src/util/virscsihost.h

[...]

> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
> index 5e13bbf..8289ccc 100644
> --- a/src/conf/storage_conf.c
> +++ b/src/conf/storage_conf.c
> @@ -43,6 +43,7 @@
>  #include "virbuffer.h"
>  #include "viralloc.h"
>  #include "virfile.h"
> +#include "virscsihost.h"
>  #include "virstring.h"
>  #include "virlog.h"
>  #include "virvhba.h"
> @@ -2277,16 +2278,16 @@ getSCSIHostNumber(virStoragePoolSourceAdapter adapter,
>          virPCIDeviceAddress addr = adapter.data.scsi_host.parentaddr;
>          unsigned int unique_id = adapter.data.scsi_host.unique_id;
>  
> -        if (!(name = virGetSCSIHostNameByParentaddr(addr.domain,
> +        if (!(name = virSCSIHostGetNameByParentaddr(addr.domain,
>                                                      addr.bus,
>                                                      addr.slot,
>                                                      addr.function,
>                                                      unique_id)))
>              goto cleanup;
> -        if (virGetSCSIHostNumber(name, &num) < 0)
> +        if (virSCSIHostGetNumber(name, &num) < 0)
>              goto cleanup;
>      } else {
> -        if (virGetSCSIHostNumber(adapter.data.scsi_host.name, &num) < 0)
> +        if (virSCSIHostGetNumber(adapter.data.scsi_host.name, &num) < 0)
>              goto cleanup;
>      }
>  
> @@ -2298,6 +2299,20 @@ getSCSIHostNumber(virStoragePoolSourceAdapter adapter,
>      return ret;
>  }
>  
> +
> +static bool
> +isSameHostnum(const char *name, unsigned int scsi_hostnum)

It's better to name it virStorateIsSameHostnum.

ACK

Pavel

> +{
> +    unsigned int fc_hostnum;
> +
> +    if (virSCSIHostGetNumber(name, &fc_hostnum) == 0 &&
> +        scsi_hostnum == fc_hostnum)
> +        return true;
> +
> +    return false;
> +}
> +
> +

Attachment: signature.asc
Description: Digital signature


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