Re: [PATCH v2 08/14] libxl: initialize device structures

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

 



Jim Fehlig wrote:
> Marek Marczykowski-Górecki wrote:
>   
>> Do not leave uninitialized variables, not all parameters are set in
>> libxlMake*.
>>
>> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
>> ---
>>  src/libxl/libxl_conf.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
>> index e5d8dc5..d654ace 100644
>> --- a/src/libxl/libxl_conf.c
>> +++ b/src/libxl/libxl_conf.c
>> @@ -522,6 +522,8 @@ libxlMakeDisk(libxlDriverPrivatePtr driver,
>>                virDomainDiskDefPtr l_disk,
>>                libxl_device_disk *x_disk)
>>  {
>> +    libxl_device_disk_init(x_disk);
>> +
>>      if (VIR_STRDUP(x_disk->pdev_path, l_disk->src) < 0)
>>          return -1;
>>  
>> @@ -659,6 +661,8 @@ libxlMakeNic(libxlDriverPrivatePtr driver,
>>       * x_nics[i].mtu = 1492;
>>       */
>>  
>> +    libxl_device_nic_init(x_nic);
>>     

Hmm, after committing this I realized the init here clears the devid set
in libxlMakeNicList.  It wasn't spotted in my testing since libxl will
provide a sane devid when not specified.  In fact, for all the other
devices we allow libxl to determine devid.  I'll send a patch to remove
the nic devid assignment.  It's trivial, but maybe you can review it -
quick sanity check to ensure I'm not overlooking something.

Regards,
Jim

>> +
>>      virMacAddrGetRaw(&l_nic->mac, x_nic->mac);
>>  
>>      if (l_nic->model && !STREQ(l_nic->model, "netfront")) {
>> @@ -756,6 +760,8 @@ libxlMakeVfb(libxlDriverPrivatePtr driver,
>>               virDomainGraphicsDefPtr l_vfb,
>>               libxl_device_vfb *x_vfb)
>>  {
>> +    libxl_device_vfb_init(x_vfb);
>>   
>>     
>
> This was already being called in libxlMakeVfbList, but agreed it is
> better called here.  I rebased the patch, removed the extra
> libxl_device_vfb_init call in libxlMakeVfbList, and pushed the patch.
>
> Regards,
> Jim
>
>   
>> +
>>      switch (l_vfb->type) {
>>          case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
>>              if (libxlMakeSDLInfo(l_vfb, &x_vfb->sdl) < 0)
>> @@ -859,6 +865,8 @@ libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
>>                         virDomainDefPtr def, libxl_domain_config *d_config)
>>  {
>>  
>> +    libxl_domain_config_init(d_config);
>> +
>>      if (libxlMakeDomCreateInfo(driver, def, &d_config->c_info) < 0)
>>          return -1;
>>  
>>   
>>     
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

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