From e255113342dbf391b4b62564bb4b6afbba21a0ea Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Jun 2008 00:08:06 -0700 Subject: [PATCH] Export shmem_getpage for DRM-GEM GEM needs to get pages related to a shmem file and using shmem_getpage is the easiest way to do that. This makes the function non-static and exported, along with the enum used to control its behaviour. --- include/linux/mm.h | 11 +++++++++++ mm/shmem.c | 16 +++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index b695875..83cfac2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -694,6 +694,17 @@ static inline int shmem_lock(struct file *file, int lock, #endif struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); +/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */ +enum sgp_type { + SGP_READ, /* don't exceed i_size, don't allocate page */ + SGP_CACHE, /* don't exceed i_size, may allocate page */ + SGP_DIRTY, /* like SGP_CACHE, but set new page dirty */ + SGP_WRITE, /* may exceed i_size, may allocate page */ +}; + +int shmem_getpage(struct inode *inode, unsigned long idx, + struct page **pagep, enum sgp_type sgp, int *type); + int shmem_zero_setup(struct vm_area_struct *); #ifndef CONFIG_MMU diff --git a/mm/shmem.c b/mm/shmem.c index 2c4b6b3..a0f9415 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -77,14 +77,6 @@ /* Pretend that each entry is of this size in directory's i_size */ #define BOGO_DIRENT_SIZE 20 -/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */ -enum sgp_type { - SGP_READ, /* don't exceed i_size, don't allocate page */ - SGP_CACHE, /* don't exceed i_size, may allocate page */ - SGP_DIRTY, /* like SGP_CACHE, but set new page dirty */ - SGP_WRITE, /* may exceed i_size, may allocate page */ -}; - #ifdef CONFIG_TMPFS static unsigned long shmem_default_max_blocks(void) { @@ -97,9 +89,6 @@ static unsigned long shmem_default_max_inodes(void) } #endif -static int shmem_getpage(struct inode *inode, unsigned long idx, - struct page **pagep, enum sgp_type sgp, int *type); - static inline struct page *shmem_dir_alloc(gfp_t gfp_mask) { /* @@ -1229,8 +1218,8 @@ static inline struct page *shmem_alloc_page(gfp_t gfp, * vm. If we swap it in we mark it dirty since we also free the swap * entry since a page cannot live in both the swap and page cache */ -static int shmem_getpage(struct inode *inode, unsigned long idx, - struct page **pagep, enum sgp_type sgp, int *type) +int shmem_getpage(struct inode *inode, unsigned long idx, + struct page **pagep, enum sgp_type sgp, int *type) { struct address_space *mapping = inode->i_mapping; struct shmem_inode_info *info = SHMEM_I(inode); @@ -1477,6 +1466,7 @@ failed: } return error; } +EXPORT_SYMBOL(shmem_getpage); static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { -- 1.5.5.4