On 4/13/2023 2:26 PM, Nipun Gupta wrote: > CDX bus supports multiple type of devices, which can be > exposed to user-space via vfio-cdx. > > vfio-cdx provides the MMIO IO_MEMORY regions as well as the > DMA interface for the device (IOMMU). > > This support aims to enable the DPDK to support the cdx > devices in user-space using VFIO interface. > > Signed-off-by: Nipun Gupta <nipun.gu...@amd.com>
<...> > +/* map a particular resource from a file */ > +void * > +cdx_map_resource(void *requested_addr, int fd, off_t offset, size_t size, > + int additional_flags) > +{ > + void *mapaddr; > + > + /* Map the cdx MMIO memory resource of device */ > + mapaddr = rte_mem_map(requested_addr, size, > + RTE_PROT_READ | RTE_PROT_WRITE, > + RTE_MAP_SHARED | additional_flags, fd, offset); > + if (mapaddr == NULL) { > + CDX_BUS_ERR("%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): > %s (%p)", > + __func__, fd, requested_addr, size, > + (unsigned long long)offset, `checkpatches.sh` complains about '%l' usage, and 'offset' seems defined as 'off_t' type. As far as I can see 'off_t' is not part of C standard (but posix standard), and it is signed, also not clear if 32 bits or 64 bits. Since caller of this function already passes parameter with 'uint64_t' type, why not change the 'offset' type of this function to 'uint64_t' for simplification, and use 'PRIu64' format specifier?