Re: [libvirt] [PATCH] Fix ejecting cdroms with latest qemu syntax

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

 



Cole Robinson <crobinso@xxxxxxxxxx> wrote:
...
> Okay, second cut attached. I followed your recommendations:
...

With all of Dan's comments addressed, this should be fine.

> diff --git a/src/domain_conf.c b/src/domain_conf.c
...
> +int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
...
> +    switch (disk->bus) {
> +        case VIR_DOMAIN_DISK_BUS_IDE:
> +            *busIdx = ((idx - (idx % 2)) / 2);
> +            *devIdx = (idx % 2);
> +            break;
> +        case VIR_DOMAIN_DISK_BUS_SCSI:
> +            *busIdx = ((idx - (idx % 7)) / 7);
> +            *devIdx = (idx % 7);
> +            break;

It doesn't affect correctness, but you can remove the
unnecessary "- (idx % 2)" and "- (idx % 7)" expressions:

    switch (disk->bus) {
        case VIR_DOMAIN_DISK_BUS_IDE:
            *busIdx = idx / 2;
            *devIdx = idx % 2;
            break;
        case VIR_DOMAIN_DISK_BUS_SCSI:
            *busIdx = idx / 7;
            *devIdx = idx % 7;
            break;

--
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]