PATCH: Error Checking for pagemap.h.

From: Christopher Sacchi
Date: Mon Dec 31 2012 - 13:50:04 EST


This patch is for the pagemap.h. This checks to see if the
page_size_int is 2, if not, set the value to 2, and return 1.
The code is under the double-dashed lines. It is for Kernel Version 3.8-rc1.
This is a rewrite.

--
Signed-off-by: Christopher P. Sacchi chris.sacchi@xxxxxxxxx
--- pagemap.h 2012-12-21 20:19:00.000000000 -0500
+++ pagemap.h 2012-12-31 13:07:51.566631871 -0500
@@ -14,11 +14,15 @@
#include <linux/bitops.h>
#include <linux/hardirq.h> /* for in_interrupt() */
#include <linux/hugetlb_inline.h>
-
/*
* Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
* allocation mode flags.
*/
+/*
+* Here we declare the number that
+* the PAGE_SIZE should have.
+* We need it an integer for checking
+* and writing. This value should be two.
+* If not, later we'll check.
+*/
+int page_size_integer = 2;
enum mapping_flags {
AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */
AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
@@ -426,6 +430,18 @@ extern void add_page_wait_queue(struct p
* This assumes that two userspace pages are always sufficient. That's
* not true if PAGE_CACHE_SIZE > PAGE_SIZE.
*/
+
+/*
+* Here we'll check for if the two userspace pages are not sufficient,
+* and if PAGE_CACHE_SIZE > PAGE_SIZE.
+* This will return 1 if true,
+* and will set the value back to 2 in case of a fault.
+*/
+static inline int fault_userspace_assumption_sufficient_not_true()
+{
+ if (PAGE_CACHE_SIZE > PAGE_SIZE) {
+ page_size_int = 2;
+ return 1;
+ }
+}
static inline int fault_in_pages_writeable(char __user *uaddr, int size)
{
int ret;
--

Regards,
Christopher
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/