[PATCH] fix fat fs for 2.3.23/2.3.24pre1

Mikael Pettersson (mikpe@csd.uu.se)
Tue, 26 Oct 1999 18:55:17 +0200 (MET DST)


Compiling the fat file system in kernel 2.3.24pre1 produces
these warnings:

gcc -D__KERNEL__ -I/tmp/linux-2.3.24-pre1/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -mpreferred-stack-boundary=2 -msoft-float -DCPU=686 -march=i686 -c -o file.o file.c
file.c: In function `fat_write_partial_page':
file.c:127: warning: assignment makes integer from pointer without a cast
file.c:148: warning: passing arg 1 of `__free_page' makes pointer from integer without a cast
...
gcc -D__KERNEL__ -I/tmp/linux-2.3.24-pre1/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -mpreferred-stack-boundary=2 -msoft-float -DCPU=686 -march=i686 -c -o mmap.o mmap.c
mmap.c:88: warning: initialization from incompatible pointer type

The warning in file.c is almost harmless, but mmap.c's nopage
was broken completely (it would return an "unsigned long" page
address instead of a "struct page*").

The patch below for 2.3.23/2.3.24pre1 fixes these problems.

/Mikael

--- linux-2.3.23/fs/fat/file.c.orig Sun Oct 10 12:40:42 1999
+++ linux-2.3.23/fs/fat/file.c Tue Oct 26 17:51:21 1999
@@ -115,7 +115,7 @@
struct inode *inode = dentry->d_inode;
struct page *new_page, **hash;
unsigned long pgpos;
- unsigned long page_cache = 0;
+ struct page *page_cache = NULL;
long status;

pgpos = MSDOS_I(inode)->i_realsize & PAGE_CACHE_MASK;
--- linux-2.3.23/fs/fat/mmap.c.orig Fri Jul 9 14:28:12 1999
+++ linux-2.3.23/fs/fat/mmap.c Tue Oct 26 17:51:21 1999
@@ -14,6 +14,7 @@
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
+#include <linux/pagemap.h>
#include <linux/shm.h>
#include <linux/errno.h>
#include <linux/mman.h>
@@ -27,10 +28,10 @@
/*
* Fill in the supplied page for mmap
*/
-static unsigned long fat_file_mmap_nopage(
+static struct page *fat_file_mmap_nopage(
struct vm_area_struct * area,
unsigned long address,
- int error_code)
+ int write_access)
{
struct inode * inode = area->vm_file->f_dentry->d_inode;
unsigned long page;
@@ -40,7 +41,7 @@

page = __get_free_page(GFP_KERNEL);
if (!page)
- return page;
+ return NULL;
address &= PAGE_MASK;
pos = address - area->vm_start + area->vm_offset;

@@ -75,7 +76,7 @@
if (clear > 0){
memset ((char*)page+PAGE_SIZE-clear,0,clear);
}
- return page;
+ return page_cache_entry(page);
}

struct vm_operations_struct fat_file_mmap = {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/