/* capfs_file_mmap() */ static int capfs_file_mmap(struct file *file, struct vm_area_struct *vma) { struct address_space *mapping = file->f_dentry->d_inode->i_mapping; struct inode *inode = file->f_dentry->d_inode; /* update the statistics */ if(capfs_collect_stats) capfs_vfs_stat.mmap++; PENTRY; PDEBUG(D_FILE, "capfs_file_mmap called.\n"); /* do not allow sneaky stores/mov's into the mapped address range */ if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) { if (!mapping->a_ops->writepage) return -EINVAL; } inode->i_mapping->host = inode; inode->i_mapping->a_ops = &capfs_file_aops; if (!mapping->a_ops->readpage) return -ENOEXEC; vma->vm_flags |= VM_SEQ_READ; vma->vm_flags &= ~VM_RAND_READ; inode->i_mapping->backing_dev_info = &capfs_backing_dev_info; PEXIT; return generic_file_readonly_mmap(file, vma); }
/* * Memory map a region of a file. */ static int orangefs_file_mmap(struct file *file, struct vm_area_struct *vma) { gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_mmap: called on %s\n", (file ? (char *)file->f_path.dentry->d_name.name : (char *)"Unknown")); /* set the sequential readahead hint */ vma->vm_flags |= VM_SEQ_READ; vma->vm_flags &= ~VM_RAND_READ; /* Use readonly mmap since we cannot support writable maps. */ return generic_file_readonly_mmap(file, vma); }