From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAFxm-0008Me-Gp for qemu-devel@nongnu.org; Thu, 24 Jul 2014 06:09:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAFxh-0005SI-Lb for qemu-devel@nongnu.org; Thu, 24 Jul 2014 06:09:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAFxh-0005S8-Cy for qemu-devel@nongnu.org; Thu, 24 Jul 2014 06:09:21 -0400 Message-ID: <1406196531.13444.9.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Thu, 24 Jul 2014 12:08:51 +0200 In-Reply-To: <1406191142-16556-2-git-send-email-arei.gonglei@huawei.com> References: <1406191142-16556-1-git-send-email-arei.gonglei@huawei.com> <1406191142-16556-2-git-send-email-arei.gonglei@huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/6] bootindex: add {del, modify}_boot_device_path function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: peter.maydell@linaro.org, weidong.huang@huawei.com, mst@redhat.com, aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, dmitry@daynix.com, akong@redhat.com, armbru@redhat.com, lersek@redhat.com, marcel.a@redhat.com, somlo@cmu.edu, luonengjun@huawei.com, peter.huangpeng@huawei.com, alex.williamson@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, rth@twiddle.net, kwolf@redhat.com, peter.crosthwaite@xilinx.com, Chenliang , imammedo@redhat.com, afaerber@suse.de On Do, 2014-07-24 at 16:38 +0800, arei.gonglei@huawei.com wrote: > From: Gonglei > > When we want to change one device's bootindex, we should do three > things. On the on hand, remove the device from global fw_boot_order list, > regardless attaching suffix or not delete. On the other hand, delete > original object of the assigned bootindex. Finally add the new device's > bootindex into the global fw_boot_order list. Hmm. I think we should simply lookup the device and modify the bootindex, leaving the entry as-is otherwise. In case the new bootindex is already used by another device just throw an error. > +void del_boot_device_path(int32_t bootindex, DeviceState *dev, > + const char *suffix); Should be del_boot_device_path(DeviceState *dev) and simply delete all entries belonging to the device. Patch #3 can be much simpler then as we can call the function from generic device cleanup code. > +void modify_boot_device_path(int32_t bootindex, DeviceState *dev, > + const char *suffix); No need for suffix here if we just update the existing entry. cheers, Gerd