> From: Gerd Hoffmann [mailto:kra...@redhat.com] > Sent: Monday, September 01, 2014 2:43 PM > Subject: Re: [PATCH v6 02/27] bootindex: add del_boot_device_path function > Importance: High > > Hi, > > > +static bool is_same_fw_dev_path(DeviceState *src, DeviceState *dst) > > +{ > > + bool ret = false; > > + char *devpath_src = qdev_get_fw_dev_path(src); > > + char *devpath_dst = qdev_get_fw_dev_path(dst); > > + > > + if (!strcmp(devpath_src, devpath_dst)) { > > + ret = true; > > + } > > + > > + g_free(devpath_src); > > + g_free(devpath_dst); > > + return ret; > > +} > > + > > +void del_boot_device_path(DeviceState *dev) > > +{ > > + FWBootEntry *i; > > + > > + assert(dev != NULL); > > + > > + /* remove all entries of the assigned device */ > > + QTAILQ_FOREACH(i, &fw_boot_order, link) { > > + if (i->dev == NULL) { > > + continue; > > + } > > + if ((i->dev == dev || is_same_fw_dev_path(i->dev, dev))) { > > Why this is needed? Is there any case where i-->dev != dev but > is_same_fw_dev_path() returns true? > Yes, it is needed. At present, the virito-net-pci device compliance with this situation.
Please see the qom path about virtio-net-pci and virtio-net device: id: null, /machine/peripheral/nic1/virtio-backend id: nic1, /machine/peripheral/nic1 Best regards, -Gonglei