qemu-devel
[Top][All Lists]
Advanced

[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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]