On Fri, Sep 05, 2014 at 02:42:48AM +0000, Gonglei (Arei) wrote:
> > From: Eduardo Habkost [mailto:ehabk...@redhat.com]
> > Sent: Friday, September 05, 2014 10:20 AM
> > Subject: Re: [PATCH v6 02/27] bootindex: add del_boot_device_path function
> > 
> > On Fri, Sep 05, 2014 at 12:44:56AM +0000, Gonglei (Arei) wrote:
> > [...]
> > > > can we have a wrapper to reduce code
> > > > duplication? e.g. a:
> > > >   void device_add_bootindex_property(DeviceState *dev, int32_t *field,
> > const
> > > > char *suffix)
> > > > function.
> > > >
> > > > Then instead of reimplementing set/get/finalize functions, device code
> > > > could just call something like:
> > > >   device_add_bootindex_property(dev, &n->nic_conf.bootindex,
> > > >                                 "/ethernet-phy@0");
> > > >
> > >
> > > This way we cannot attach our target that changing bootindex and take
> > effect
> > > during vm rebooting.
> > 
> > I don't understand what you mean, here. Whatever you are planning to do on
> > the
> > device-specific setter/getters, if they all look the same, you can write a
> > common getter/setter to do exactly the same steps, and register it inside
> > device_add_bootindex_property(). This way, patches 08/27 to 26/27 can
> > become
> > one-liners, instead of adding more 20 lines each.
> > 
> > I mean something like this:
> > 
> OK. Thanks for explanation. :)
> 
> I have two questions:
> 
> 1) virtio-net-pci device do need special handle in device_set_bootindex(). 
> 2) isa-fdc' property is bootindexA and bootindexB, maybe we
> can add more a parameter for device_add_bootindex_property()?

I see that you added two extra parameters to
device_add_bootindex_property(). Looks like a good solution, to me.

-- 
Eduardo

Reply via email to