kernels/linux-2.4.0/mm/filemap.c
/* This is used for a general mmap of a disk file */
This is used for a general mmap of a disk file
This is used for a general mmap of a disk file
int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
{
	struct vm_operations_struct * ops;
	struct inode *inode = file->f_dentry->d_inode;
	ops = &file_private_mmap;
	if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) {
		if (!inode->i_mapping->a_ops->writepage)
			return -EINVAL;
		ops = &file_shared_mmap;
	}
	if (!inode->i_sb || !S_ISREG(inode->i_mode))
		return -EACCES;
	if (!inode->i_mapping->a_ops->readpage)
		return -ENOEXEC;
	UPDATE_ATIME(inode);
	vma->vm_ops = ops;
	return 0;
}
int generic_file_mmap ( struct file * file , struct vm_area_struct * vma ) { struct vm_operations_struct * ops ; struct inode * inode = file -> f_dentry -> d_inode ; ops = & file_private_mmap ; if ( ( vma -> vm_flags & VM_SHARED ) && ( vma -> vm_flags & VM_MAYWRITE ) ) { if ( ! inode -> i_mapping -> a_ops -> writepage ) return - EINVAL ; ops = & file_shared_mmap ; } if ( ! inode -> i_sb || ! S_ISREG ( inode -> i_mode ) ) return - EACCES ; if ( ! inode -> i_mapping -> a_ops -> readpage ) return - ENOEXEC ; UPDATE_ATIME ( inode ) ; vma -> vm_ops = ops ; return 0 ; }
This is used for a general mmap of a disk file
This is used for a general mmap of a disk file