|
//linux/mm/mmap.c
/* Insert vm structure into process list sorted by address
* and into the inode's i_mmap ring. If vm_file is non-NULL
* then the i_shared_lock must be held here.
*/
void __insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vmp)
{
struct vm_area_struct **pprev;
struct file * file;
if (!mm->mmap_avl) {
pprev = &mm->mmap;
while (*pprev && (*pprev)->vm_start <= vmp->vm_start)
pprev = &(*pprev)->vm_next;
} else {
struct vm_area_struct *prev, *next;
avl_insert_neighbours(vmp, &mm->mmap_avl, &prev, &next);
pprev = (prev ? &prev->vm_next : &mm->mmap);
if (*pprev != next)
printk("insert_vm_struct: tree inconsistent with list\n");
}
vmp->vm_next = *pprev;
*pprev = vmp;
mm->map_count++;
if (mm->map_count >= AVL_MIN_MAP_COUNT && !mm->mmap_avl)
build_mmap_avl(mm);
file = vmp->vm_file;
if (file) {
struct inode * inode = file->f_dentry->d_inode;
struct address_space *mapping = inode->i_mapping;
struct vm_area_struct **head;
if (vmp->vm_flags & VM_DENYWRITE)
atomic_dec(&inode->i_writecount);
head = &mapping->i_mmap;
if (vmp->vm_flags & VM_SHARED)
head = &mapping->i_mmap_shared;
/* insert vmp into inode's share list */
if((vmp->vm_next_share = *head) != NULL)
(*head)->vm_pprev_share = &vmp->vm_next_share;
*head = vmp;
vmp->vm_pprev_share = head;
}
}
请问这里 struct vm_area_struct **pprev双指针 做什么 用 ?不用双指针 不行 吗 |
|