Structvm_area_struct ** pprev dual pointer Problem

Source: Internet
Author: User
Structvm_area_struct ** pprev dual pointer problem-Linux general technology-Linux programming and kernel information. For details, see the following. Struct vm_area_struct ** pprev dual pointer Problem


// 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;
}
}




What is the purpose of struct vm_area_struct ** pprev dual pointer? Don't you need double pointers?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.