#include <linux/fs.h>
#include <linux/list.h>
#include <linux/highmem.h>
+#include <linux/compiler.h>
#include <asm/uaccess.h>
#include <linux/gfp.h>
static inline unsigned long get_page_cache_size(void)
{
- return atomic_read(&nr_pagecache);
+ int ret = atomic_read(&nr_pagecache);
+ if (unlikely(ret < 0))
+ ret = 0;
+ return ret;
+}
+
+/*
+ * Return byte-offset into filesystem object for page.
+ */
+static inline loff_t page_offset(struct page *page)
+{
+ return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
}
static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
static inline void lock_page(struct page *page)
{
+ might_sleep();
if (TestSetPageLocked(page))
__lock_page(page);
}
volatile char c;
int ret;
- ret = __get_user(c, (char *)uaddr);
+ 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, (char *)end);
+ __get_user(c, end);
}
}