Re: 回复: [PATCH v4] rust: pci: reject IRQ vector indices that do not fit in u32

From: Gary Guo

Date: Tue Sep 01 2026 - 08:07:10 EST


On Tue Sep 1, 2026 at 12:47 PM BST, ai qubits wrote:
> Thanks for the question, Alexandre, and for the clarification, Danilo.
> 
> I agree that usize is the more appropriate type for an index-oriented
> Rust API. Callers are likely to obtain indices from ranges, iterators, or
> other Rust indexing operations, which naturally use usize.
> 
> The unsigned int expected by pci_irq_vector() is an implementation detail
> of the C interface, so the necessary validation and conversion should
> remain inside the Rust abstraction rather than being exposed to callers.
> 
> I will therefore keep IrqVectorRegistration::index() accepting usize and
> handle the C API boundary internally.
> 
> Best regards,
> Sophon

Hi Sophon,

Please avoid top-posting. See
https://subspace.kernel.org/etiquette.html#do-not-top-post-when-replying (and
rest of that page, too).

Also, your email contains byte order marks (FEFF). Not sure what clients are you
using, but please pick a proper one for plain text mails.

Thanks,
Gary