[libvirt] [TCK PATCHv3] block devices: allow specification of size for safety
Jim Meyering
jim at meyering.net
Thu May 6 09:01:43 UTC 2010
Jim Meyering wrote:
> However, I find it more readable to group the two $device-setting
> statements together:
>
> my $device = $self->config("host_block_devices/[$devindex]/path", undef);
> $device ||= $self->config("host_block_devices/[$devindex]", undef);
Taking Dan's correction into account, you might want to write it like this:
my $device = ($self->config("host_block_devices/[$devindex]/path", undef)
|| $self->config("host_block_devices/[$devindex]", undef)
|| return undef);
or perhaps, more technically correct, in case the config value is "0":
my $device = ($self->config("host_block_devices/[$devindex]/path", undef)
|| $self->config("host_block_devices/[$devindex]", undef));
defined $device
or return undef;
More information about the libvir-list
mailing list