fn gpuid_to_minor(gpu_id: u32) -> i32Expand description
Map an RM gpuId to the /dev/nvidia minor that node_reachable needs: the id only
carries a PCI address, not a device minor, so this bridges the two by scanning
/proc/driver/nvidia/gpus, returning -1 when no match is found.
- Extract the PCI address from the id: the PCI address is encoded in
gpuId >> 8, sowant_busis the low bus byte(gpuId >> 8) & 0xFFandwant_fullis the fullgpuId >> 8(domain folded in for larger ids). - Match a /proc entry: each subdirectory is named by its PCI address
domain:bus:slot.funcin hex; split on:and.(expecting four fields) and parse the domain and bus. An entry matches when its bus equalswant_busor its combined(domain << 8) | busequalswant_full— the dual test covers ids that fold the domain in. - Read the minor: from the matched entry’s
informationfile, parse theDevice Minor: Nline and returnN. The scan processes only the first matching directory (itbreaks afterward) and returns -1 if no minor line is present.