/* Install a file pte to a given virtual memory address, release any previously existing mapping.  */
static int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot)
/* Install a file pte to a given virtual memory address, release any previously existing mapping.  */
static int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot)
{
	int err = -ENOMEM;
	pte_t *pte;
	spinlock_t *ptl;
	pte = get_locked_pte(mm, addr, &ptl);
	if (!pte)
		goto out;
	if (!pte_none(*pte))
		zap_pte(mm, vma, addr, pte);
	set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));
	pte_unmap_unlock(pte, ptl);
	err = 0;
out:
	return err;
}