[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 15/44] x86/boot: introduce boot module interator
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 9 Oct 2024 21:45:19 -0400
- Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728524723; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=kEY0/JxYBl9rMBwu2TjcMrKBBW8DfWr1jIIDxjRnGJM=; b=HYC4zRMQsq1EdnnxzRgvROqx+P2MFIcnwENbeYdpVUakREilAavmT70dxkpZAIpWaXvW7+jKuN6B5MlS1Tdh2+K/FbCBm7yyTDackY+xHe2q55KQe1lPntaQMxj48gG0HeI1FeP1nMZyHD/l8Vs7s6S7nlE2/YVENy/7Pt7ramI=
- Arc-seal: i=1; a=rsa-sha256; t=1728524723; cv=none; d=zohomail.com; s=zohoarc; b=gO4//fjoGCFoNFCayZSF/Lv149ErSuHK9E/hrLzPSlSr0X6TOoXn1KfHyWdhainIVwDfdQxun0wQpptOLJOdyfSvHBBXTDlUtO2JAdFRtLhEnX7mczfhhJoGKc30JfCIae/BE+3zpvRa1J/7utiePTSF4bopjsoMKkHzJmqhELQ=
- Cc: jason.andryuk@xxxxxxx, christopher.w.clark@xxxxxxxxx, stefano.stabellini@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 10 Oct 2024 01:45:40 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 10/9/24 11:53, Jan Beulich wrote:
On 06.10.2024 23:49, Daniel P. Smith wrote:
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -54,8 +54,24 @@ struct boot_info {
struct boot_module mods[MAX_NR_BOOTMODS + 1];
};
-#endif /* __XEN_X86_BOOTINFO_H__ */
+static inline int __init next_boot_module_index(
+ const struct boot_info *bi, enum bootmod_type t, int offset)
Instead of "offset" maybe better "start" or "from"? Further, plain int
(as also used ...
Will change to start.
+{
+ int i;
... here) isn't really liked for ...
+ for ( i = offset; i < bi->nr_modules; i++ )
+ {
+ if ( bi->mods[i].type == t )
... array indexing. Perhaps the function itself would better have
unsigned int return type as well, ...
+ return i;
+ }
+
+ return -1;
... using UINT_MAX or some other suitable constant here instead?
I was initially going to disagree as returning a value less than zero is
much more natural/reasonable than UINIT_MAX. But then thinking about it,
another natural value to reflect an error/not found is a value larger
than MAX_NR_BOOTMODS.
Will switch to unsigned and add code comment that larger than
MAX_NR_BOOTMODS is error/not found condition.
v/r,
dps
|