* [PATCH 2.0] Fixed kernel stuff
[not found] ` <20021014220527.GU26715@khan.acc.umu.se>
2002-10-15 15:37 ` [PATCH 2.0] Fixed kernel stuff Fernando Alencar Maróstica
@ 2002-10-15 19:02 ` Fernando Alencar Maróstica
2002-10-15 21:11 ` David Weinehall
1 sibling, 1 reply; 4+ messages in thread
From: Fernando Alencar Maróstica @ 2002-10-15 19:02 UTC (permalink / raw)
To: David Weinehall; +Cc: fadel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 493 bytes --]
Hello all, specially David
I think this patch is trivial enough to be accepted, but...
This patch fixed some stuff:
* Fixed warning in script/lxdialog/menubox.c
* Fixed warning in script/lxdialog/textbox.c
* Small VM updates ...
Please apply.
best regards,
--
Fernando Alencar Maróstica
Graduate Student, Computer Science
Linux Register User Id #281457
University Methodist of Piracicaba
Departament of Computer Science
home: http://www.unimep.br/~famarost
[-- Attachment #2: linux-2.0.40-rc6.patch --]
[-- Type: text/x-patch, Size: 7570 bytes --]
diff -urN linux-2.0.39/CREDITS linux-2.0.39-patch/CREDITS
--- linux-2.0.39/CREDITS Tue Jan 9 19:29:20 2001
+++ linux-2.0.39-patch/CREDITS Tue Oct 15 13:22:10 2002
@@ -1409,6 +1409,16 @@
S: Santa Clara, California 95051
S: USA
+N: Fernando Alencar Maróstica
+E: famarost@unimep.br
+W: http://www.unimep.br/~famarost
+D: Miscellaneous kernel hacker
+S: UNIMEP University Methodist of Piracicaba
+S: Departament of Computer Science
+S: Rodovia do Açucar, Km 156
+S: 13400-911 - Piracicaba - São Paulo
+S: Brazil
+
N: Jeff Tranter
E: Jeff_Tranter@Mitel.COM
D: Enhancements to Joystick driver
diff -urN linux-2.0.39/include/asm-i386/page.h linux-2.0.39-patch/include/asm-i386/page.h
--- linux-2.0.39/include/asm-i386/page.h Sun Jun 13 14:21:03 1999
+++ linux-2.0.39-patch/include/asm-i386/page.h Sun Oct 13 12:42:04 2002
@@ -11,6 +11,9 @@
#define STRICT_MM_TYPECHECKS
+#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
+#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
+
#ifdef STRICT_MM_TYPECHECKS
/*
* These are used to make use of C type-checking..
diff -urN linux-2.0.39/include/asm-i386/pgtable.h linux-2.0.39-patch/include/asm-i386/pgtable.h
--- linux-2.0.39/include/asm-i386/pgtable.h Wed Aug 25 19:08:27 1999
+++ linux-2.0.39-patch/include/asm-i386/pgtable.h Sun Oct 13 13:08:24 2002
@@ -229,7 +229,7 @@
* area for the same reason. ;)
*/
#define VMALLOC_OFFSET (8*1024*1024)
-#define VMALLOC_START ((high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
+#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
#define VMALLOC_VMADDR(x) (TASK_SIZE + (unsigned long)(x))
/*
@@ -302,7 +302,7 @@
#define BAD_PAGETABLE __bad_pagetable()
#define BAD_PAGE __bad_page()
-#define ZERO_PAGE ((unsigned long) empty_zero_page)
+#define ZERO_PAGE(vaddr) ((unsigned long) empty_zero_page)
/* number of bits that fit into a memory pointer */
#define BITS_PER_PTR (8*sizeof(unsigned long))
diff -urN linux-2.0.39/mm/filemap.c linux-2.0.39-patch/mm/filemap.c
--- linux-2.0.39/mm/filemap.c Wed Jun 3 19:17:50 1998
+++ linux-2.0.39-patch/mm/filemap.c Sun Oct 13 12:56:38 2002
@@ -817,7 +817,7 @@
/*
* No sharing ... copy to the new page.
*/
- memcpy((void *) new_page, (void *) old_page, PAGE_SIZE);
+ copy_page(new_page, old_page);
flush_page_to_ram(new_page);
release_page(page);
return new_page;
diff -urN linux-2.0.39/mm/memory.c linux-2.0.39-patch/mm/memory.c
--- linux-2.0.39/mm/memory.c Wed Sep 11 11:57:19 1996
+++ linux-2.0.39-patch/mm/memory.c Sun Oct 13 13:19:20 2002
@@ -57,18 +57,18 @@
* a common occurrence (no need to read the page to know
* that it's zero - better for the cache and memory subsystem).
*/
-static inline void copy_page(unsigned long from, unsigned long to)
+static inline void copy_cow_page(unsigned long from, unsigned long to)
{
- if (from == ZERO_PAGE) {
- memset((void *) to, 0, PAGE_SIZE);
+ if (from == ZERO_PAGE(to)) {
+ clear_page(to);
return;
}
- memcpy((void *) to, (void *) from, PAGE_SIZE);
+ copy_page(to,from);
}
#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
-mem_map_t * mem_map = NULL;
+mem_map_t *mem_map = NULL;
/*
* oom() prints a message (so that the user knows why the process died),
@@ -88,7 +88,7 @@
*/
static inline void free_one_pmd(pmd_t * dir)
{
- pte_t * pte;
+ pte_t *pte;
if (pmd_none(*dir))
return;
@@ -632,7 +632,7 @@
if (new_page) {
if (PageReserved(mem_map + MAP_NR(old_page)))
++vma->vm_mm->rss;
- copy_page(old_page,new_page);
+ copy_cow_page(old_page, new_page);
flush_page_to_ram(old_page);
flush_page_to_ram(new_page);
flush_cache_page(vma, address);
@@ -930,7 +930,7 @@
unsigned long page = __get_free_page(GFP_KERNEL);
if (!page)
goto sigbus;
- memset((void *) page, 0, PAGE_SIZE);
+ clear_page(page);
entry = pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
vma->vm_mm->rss++;
tsk->min_flt++;
diff -urN linux-2.0.39/mm/page_alloc.c linux-2.0.39-patch/mm/page_alloc.c
--- linux-2.0.39/mm/page_alloc.c Mon Jul 13 17:47:40 1998
+++ linux-2.0.39-patch/mm/page_alloc.c Tue Oct 15 12:34:58 2002
@@ -42,7 +42,7 @@
struct free_area_struct {
struct page *next;
struct page *prev;
- unsigned int * map;
+ unsigned int *map;
};
#define memory_head(x) ((struct page *)(x))
diff -urN linux-2.0.39/mm/vmalloc.c linux-2.0.39-patch/mm/vmalloc.c
--- linux-2.0.39/mm/vmalloc.c Wed Jun 3 19:17:50 1998
+++ linux-2.0.39-patch/mm/vmalloc.c Tue Oct 15 12:52:09 2002
@@ -97,11 +97,12 @@
static void free_area_pages(unsigned long address, unsigned long size)
{
pgd_t * dir;
+ unsigned long start = address;
unsigned long end = address + size;
dir = pgd_offset(&init_mm, address);
flush_cache_all();
- while (address < end) {
+ while (address >= start && address < end) {
free_area_pmd(dir, address, end - address);
address = (address + PGDIR_SIZE) & PGDIR_MASK;
dir++;
@@ -154,11 +155,12 @@
static int alloc_area_pages(unsigned long address, unsigned long size)
{
pgd_t * dir;
+ unsigned long start = address;
unsigned long end = address + size;
dir = pgd_offset(&init_mm, address);
flush_cache_all();
- while (address < end) {
+ while (address >= start && address < end) {
pmd_t *pmd = pmd_alloc_kernel(dir, address);
if (!pmd)
return -ENOMEM;
@@ -250,7 +252,7 @@
break;
addr = (void *) (tmp->size + (unsigned long) tmp->addr);
}
- area->addr = addr;
+ area->addr = (void *)addr;
area->next = *p;
*p = area;
return area;
diff -urN linux-2.0.39/mm/vmscan.c linux-2.0.39-patch/mm/vmscan.c
--- linux-2.0.39/mm/vmscan.c Sun Nov 15 16:33:20 1998
+++ linux-2.0.39-patch/mm/vmscan.c Tue Oct 15 12:21:40 2002
@@ -461,7 +461,7 @@
current->session = 1;
current->pgrp = 1;
- sprintf(current->comm, "kswapd");
+ strcpy(current->comm, "kswapd");
current->blocked = ~0UL;
/*
diff -urN linux-2.0.39/scripts/lxdialog/menubox.c linux-2.0.39-patch/scripts/lxdialog/menubox.c
--- linux-2.0.39/scripts/lxdialog/menubox.c Sun Nov 15 16:33:24 1998
+++ linux-2.0.39-patch/scripts/lxdialog/menubox.c Sun Oct 13 13:30:54 2002
@@ -29,7 +29,7 @@
static void
print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey)
{
- int i, j;
+ int j;
char menu_item[menu_width+1];
strncpy(menu_item, item, menu_width);
@@ -40,8 +40,11 @@
wattrset (win, menubox_attr);
wmove (win, choice, 0);
#if OLD_NCURSES
- for (i = 0; i < menu_width; i++)
- waddch (win, ' ');
+ {
+ int i;
+ for (i = 0; i < menu_width; i++)
+ waddch (win, ' ');
+ }
#else
wclrtoeol(win);
#endif
diff -urN linux-2.0.39/scripts/lxdialog/textbox.c linux-2.0.39-patch/scripts/lxdialog/textbox.c
--- linux-2.0.39/scripts/lxdialog/textbox.c Sun Nov 15 16:33:24 1998
+++ linux-2.0.39-patch/scripts/lxdialog/textbox.c Sun Oct 13 13:31:23 2002
@@ -451,7 +451,7 @@
static void
print_line (WINDOW * win, int row, int width)
{
- int i, y, x;
+ int y, x;
char *line;
line = get_line ();
@@ -463,8 +463,11 @@
getyx (win, y, x);
/* Clear 'residue' of previous line */
#if OLD_NCURSES
- for (i = 0; i < width - x; i++)
- waddch (win, ' ');
+ {
+ int i;
+ for (i = 0; i < width - x; i++)
+ waddch (win, ' ');
+ }
#else
wclrtoeol(win);
#endif
^ permalink raw reply [flat|nested] 4+ messages in thread