Query about UIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Greg

I've been reading the UIO code, one place puzzled me a lot.
May I ask one question about it?

-------------------------------------------------------------------------------
drivers/uio/uio.c
static int uio_find_mem_index(struct vm_area_struct *vma)
{
    int mi;
    struct uio_device *idev = vma->vm_private_data;

    for (mi = 0; mi < MAX_UIO_MAPS; mi++) {
        if (idev->info->mem[mi].size == 0)
            return -1;
        if (vma->vm_pgoff == mi)
            return mi;
    }
    return -1;
}

I don't get it why use vma->vm_pgoff as the index for struct uio_mem mem[MAX_UIO_MAPS],
Suppose there are twohardware memory space, if user intends to map the 2nd mem, then
the last parameter of mmap should be 1,

mapaddr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
               fd, 1);

Is my understanding correct?

thanks

bill








_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux