Merge ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[cascardo/linux.git] / include / linux / pagemap.h
index 862fc07..db8a410 100644 (file)
@@ -96,6 +96,8 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
 unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
                        int tag, unsigned int nr_pages, struct page **pages);
 
+struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index);
+
 /*
  * Returns locked page at given index in given cache, creating it if needed.
  */
@@ -219,6 +221,9 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
 {
        int ret;
 
+       if (unlikely(size == 0))
+               return 0;
+
        /*
         * Writing zeroes into userspace here is OK, because we know that if
         * the zero gets there, we'll be overwriting it.
@@ -238,19 +243,23 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
        return ret;
 }
 
-static inline void fault_in_pages_readable(const char __user *uaddr, int size)
+static inline int fault_in_pages_readable(const char __user *uaddr, int size)
 {
        volatile char c;
        int ret;
 
+       if (unlikely(size == 0))
+               return 0;
+
        ret = __get_user(c, uaddr);
        if (ret == 0) {
                const char __user *end = uaddr + size - 1;
 
                if (((unsigned long)uaddr & PAGE_MASK) !=
                                ((unsigned long)end & PAGE_MASK))
-                       __get_user(c, end);
+                       ret = __get_user(c, end);
        }
+       return ret;
 }
 
 #endif /* _LINUX_PAGEMAP_H */