[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/7] bootindex: add modify_boot_device_path f
From: |
Gonglei (Arei) |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/7] bootindex: add modify_boot_device_path function |
Date: |
Mon, 28 Jul 2014 02:57:32 +0000 |
> -----Original Message-----
> From: 陈梁 [mailto:address@hidden
> Sent: Sunday, July 27, 2014 11:51 AM
> Subject: Re: [Qemu-devel] [PATCH v3 1/7] bootindex: add
> modify_boot_device_path function
>
> Hi
> > + if (bootindex >= 0) {
> > + node = g_malloc0(sizeof(FWBootEntry));
> > + node->bootindex = bootindex;
> > + if (suffix) {
> > + node->suffix = g_strdup(suffix);
> > + } else if (old_entry) {
> > + node->suffix = g_strdup(old_entry->suffix);
> > + } else {
> > + node->suffix = NULL;
> > + }
> > + node->dev = dev;
> > +
> > + /* add to the global boot list */
> > + QTAILQ_FOREACH(i, &fw_boot_order, link) {
> > + if (i->bootindex < bootindex) {
> > + continue;
> > + }
> > + QTAILQ_INSERT_BEFORE(i, node, link);
> > + goto out;
> > + }
> > +
> > + QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
> > + }
>
> this code can be simply like this:
>
> suffix = suffix ? suffix : old_entry->suffix ? old_entry->suffix : NULL;
>
> add_boot_device_path(boot_index, dev, suffix)
>
Nice, thanks.
Best regards,
-Gonglei
- [Qemu-devel] [PATCH v3 0/7] modify boot order of guest, and take effect after rebooting, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 4/7] bootindex: delete bootindex when device is removed, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 5/7] qmp: add set-bootindex command, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 1/7] bootindex: add modify_boot_device_path function, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 2/7] bootindex: add del_boot_device_path function, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 3/7] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 7/7] spapr: fix possible memory leak, arei.gonglei, 2014/07/26
- [Qemu-devel] [PATCH v3 6/7] qemu-monitor: HMP set-bootindex wrapper, arei.gonglei, 2014/07/26