[Libguestfs] [PATCH 1/7] v2v: check next free oem%d.inf in /Windows/Inf

Richard W.M. Jones rjones at redhat.com
Tue Apr 5 12:26:41 UTC 2016


On Tue, Apr 05, 2016 at 02:24:33PM +0200, Cedric Bosdonnat wrote:
> On Tue, 2016-04-05 at 13:04 +0100, Richard W.M. Jones wrote:
> > On Tue, Apr 05, 2016 at 01:47:27PM +0200, Cédric Bosdonnat wrote:
> > > +  let oem_inf = set_free_oem_inf g root scsi_adapter_guid
> > > "viostor.inf" driverdir in
> > 
> > Seems better if it was called *get_next*_free_oem_inf?
> 
> Yes, sounds better.
> 
> > >    (* There should be a key
> > >     *   HKLM\SYSTEM\ControlSet001\Control\Class\<scsi_adapter_guid>
> > > @@ -398,6 +378,28 @@ and add_viostor_to_driver_database g root arch
> > > current_cs =
> > >        
> > >  @=hex(ffff0012):6f,00,65,00,6d,00,31,00,2e,00,69,00,6e,00,66,00,00
> > > ,00
> > >  *)
> > >  
> > > +(* There should be a key
> > > + *   HKLM\SYSTEM\DriverDatabase\DeviceIds\<guid>
> > > + * We want to add:
> > > + *   "oem1.inf"=hex(0):
> > > + * but if we find "oem1.inf" we'll add "oem2.inf" (etc).
> > > + *)
> > > +and set_free_oem_inf g root guid driver_inf driverdir =
> > > +  let path = [ "DriverDatabase"; "DeviceIds"; guid ] in
> > > +  match Windows.get_node g root path with
> > > +  | None ->
> > > +     error (f_"cannot find
> > > HKLM\\SYSTEM\\DriverDatabase\\DeviceIds\\%s in the guest registry")
> > > guid
> > > +  | Some node ->
> > > +    let rec loop i =
> > > +      let oem_inf = sprintf "oem%d.inf" i in
> > > +      if not (g#exists ("/Windows/Inf/" ^ oem_inf)) then oem_inf
> > > else loop (i+1)
> > > +    in
> > 
> > This bit doesn't match what is described in the comment.  It's also
> > incorrect for a few reasons:
> 
> May be I should add to the comment that it searches for the next
> available oem%d.inf in the Windows\Inf folder?

That would seem to be more accurate.

On the other points, I'd like to see what Roman suggests.  Maybe
we can just make up a random name instead of using oemNN.inf?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list