Re: [PATCH 1/5] Print SCSI logical unit as a positive integer

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

 



On 06/16/2015 11:29 PM, Eric Farman wrote:
> A logical unit address is a positive integer, so it would be wise
> to reject any negative inputs.
> 
> Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 2 +-
>  tools/virsh-domain.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

While we're at it - why not bus and target as well?  That's doable in
one patch...  I'll adjust this in order

Looking back through history it seems commit id '5c811dce' added this
functionality to domain.conf.c and commit id 'e962a579' added address
parsing for the attach-disk command.

I also peeked at the review cycle of the domain_conf.c change and found
my name, but at the time I didn't notice that we were expecting a non
negative value storing as unsigned, but printing as signed... In my
defense I was newer to the group though ;-)

So, I'll add bus/target as _uip and then adjust the title/commit message
appropriately when I push the changes.

John
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ca55981..9e77b87 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4954,7 +4954,7 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
>                      goto cleanup;
>                  }
>  
> -                if (virStrToLong_ui(unit, NULL, 0, &scsihostsrc->unit) < 0) {
> +                if (virStrToLong_uip(unit, NULL, 0, &scsihostsrc->unit) < 0) {
>                      virReportError(VIR_ERR_INTERNAL_ERROR,
>                                     _("cannot parse unit '%s'"), unit);
>                      goto cleanup;
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 4c47473..0bea462 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -488,7 +488,7 @@ static int str2SCSIAddress(const char *str, struct SCSIAddress *scsiAddr)
>          return -1;
>  
>      unit++;
> -    if (virStrToLong_ui(unit, NULL, 0, &scsiAddr->unit) != 0)
> +    if (virStrToLong_uip(unit, NULL, 0, &scsiAddr->unit) != 0)
>          return -1;
>  
>      return 0;
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]