Re: [PATCH 02/21] libmultipath: add alias_already_taken()

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

 



On Fri, Sep 01, 2023 at 08:02:15PM +0200, mwilck@xxxxxxxx wrote:
> From: Martin Wilck <mwilck@xxxxxxxx>
> 
> Factor out a trivial helper function.
> 
> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
> Cc: David Bond <dbond@xxxxxxxx>
> ---
>  libmultipath/alias.c | 34 ++++++++++++++++++++--------------
>  1 file changed, 20 insertions(+), 14 deletions(-)
> @@ -120,20 +137,9 @@ id_already_taken(int id, const char *prefix, const char *map_wwid)
>  		return 0;
>  
>  	alias = get_strbuf_str(&buf);
> -	if (dm_map_present(alias)) {
> -		char wwid[WWID_SIZE];
> -
> -		/* If both the name and the wwid match, then it's fine.*/
> -		if (dm_get_uuid(alias, wwid, sizeof(wwid)) == 0 &&
> -		    strncmp(map_wwid, wwid, sizeof(wwid)) == 0)

Possibly this should return "false" to match the bool return type.
Otherwise, it looks fine.

-Ben

> -			return 0;
> -		condlog(3, "%s: alias '%s' already taken, but not in bindings file. reselecting alias", map_wwid, alias);
> -		return 1;
> -	}
> -	return 0;
> +	return alias_already_taken(alias, map_wwid);
>  }
>  
> -
>  /*
>   * Returns: 0   if matching entry in WWIDs file found
>   *         -1   if an error occurs
> -- 
> 2.41.0
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux