[patch-2.3.35-pre4] misc fixes.

Tigran Aivazian (tigran@ocston.org)
Sun, 26 Dec 1999 04:32:11 -0800 (PST)


Hi Linus,

This patch is small so I concatenated a few things without fear of
breaking the known rules.

1. typo in Documentation/CodingStyle

2. Clearer explanation of ROOT_DEV in Makefile

3. lock/unlock_kernel() optimization in fsync(2)/fdatasync(2)

4. a couple of trivial bugs in read_kmem() (should return -EFAULT
and it doesn't)

5. TASK_SWAPPING is obsolete so I removed al references to it

6. <linux/mm.h> explains page->index instead of non-existent page->offset

Regards,
Tigran.

http://www.ocston.org/~tigran/patches/misc-2.3.35-pre4-a.patch

diff -urN -X dontdiff linux/Documentation/CodingStyle work/Documentation/CodingStyle
--- linux/Documentation/CodingStyle Wed Sep 29 21:59:12 1999
+++ work/Documentation/CodingStyle Sun Dec 26 12:42:02 1999
@@ -173,7 +173,7 @@
user helper that "GNU emacs" automatically formats the C sources for
you, and you've noticed that yes, it does do that, but the defaults it
uses are less than desirable (in fact, they are worse than random
-typing - a infinite number of monkeys typing into GNU emacs would never
+typing - an infinite number of monkeys typing into GNU emacs would never
make a good program).

So, you can either get rid of GNU emacs, or change it to use saner
diff -urN -X dontdiff linux/Makefile work/Makefile
--- linux/Makefile Sun Dec 26 11:39:11 1999
+++ work/Makefile Sun Dec 26 12:41:43 1999
@@ -54,7 +54,9 @@
#
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
-# the default of FLOPPY is used by 'build'.
+# the default of 0x0000 is used by 'build' which is considered to be
+# 'undefined' by the bootsector code which uses 1.2M or 1.44M or 2.88M
+# or 'autodetect' floppy device, depending on the number of sectors per track.
#

ROOT_DEV = CURRENT
diff -urN -X dontdiff linux/drivers/char/mem.c work/drivers/char/mem.c
--- linux/drivers/char/mem.c Thu Dec 16 21:59:38 1999
+++ work/drivers/char/mem.c Sun Dec 26 12:46:19 1999
@@ -238,14 +238,16 @@
if (p < PAGE_SIZE && read > 0) {
size_t tmp = PAGE_SIZE - p;
if (tmp > read) tmp = read;
- clear_user(buf, tmp);
+ if (clear_user(buf, tmp))
+ return -EFAULT;
buf += tmp;
p += tmp;
read -= tmp;
count -= tmp;
}
#endif
- copy_to_user(buf, (char *)p, read);
+ if (copy_to_user(buf, (char *)p, read))
+ return -EFAULT;
p += read;
buf += read;
count -= read;
diff -urN -X dontdiff linux/fs/buffer.c work/fs/buffer.c
--- linux/fs/buffer.c Mon Dec 20 22:52:57 1999
+++ work/fs/buffer.c Sun Dec 26 12:43:02 1999
@@ -345,7 +345,6 @@
struct inode * inode;
int err;

- lock_kernel();
err = -EBADF;
file = fget(fd);
if (!file)
@@ -365,13 +364,14 @@

/* We need to protect against concurrent writers.. */
down(&inode->i_sem);
+ lock_kernel();
err = file->f_op->fsync(file, dentry);
+ unlock_kernel();
up(&inode->i_sem);

out_putf:
fput(file);
out:
- unlock_kernel();
return err;
}

@@ -382,7 +382,6 @@
struct inode * inode;
int err;

- lock_kernel();
err = -EBADF;
file = fget(fd);
if (!file)
@@ -402,13 +401,14 @@

/* this needs further work, at the moment it is identical to fsync() */
down(&inode->i_sem);
+ lock_kernel();
err = file->f_op->fsync(file, dentry);
+ unlock_kernel();
up(&inode->i_sem);

out_putf:
fput(file);
out:
- unlock_kernel();
return err;
}

diff -urN -X dontdiff linux/fs/proc/array.c work/fs/proc/array.c
--- linux/fs/proc/array.c Fri Nov 12 12:29:47 1999
+++ work/fs/proc/array.c Sun Dec 26 12:44:23 1999
@@ -133,8 +133,7 @@
TASK_INTERRUPTIBLE |
TASK_UNINTERRUPTIBLE |
TASK_ZOMBIE |
- TASK_STOPPED |
- TASK_SWAPPING);
+ TASK_STOPPED);
const char **p = &task_state_array[0];

while (state) {
diff -urN -X dontdiff linux/include/linux/mm.h work/include/linux/mm.h
--- linux/include/linux/mm.h Tue Dec 21 00:01:14 1999
+++ work/include/linux/mm.h Sun Dec 26 12:47:30 1999
@@ -244,8 +244,14 @@
* The following discussion applies only to them.
*
* A page may belong to an inode's memory mapping. In this case,
- * page->inode is the pointer to the inode, and page->offset is the
- * file offset of the page (not necessarily a multiple of PAGE_SIZE).
+ * page->inode is the pointer to the inode, and page->index is the
+ * file offset of the page in PAGE_CACHE_SIZE (not PAGE_SIZE!) units.
+ * Although currently (2.3.34) PAGE_SIZE == PAGE_CACHE_SIZE, i.e. there
+ * happens to be one page per page cache entry and MM code can't hanlde
+ * anything else, this may well change. The link to the old page->offset
+ * is given by:
+ *
+ * page->index == (page->offset >> PAGE_CACHE_SHIFT);
*
* A page may have buffers allocated to it. In this case,
* page->buffers is a circular list of these buffer heads. Else,
diff -urN -X dontdiff linux/include/linux/sched.h work/include/linux/sched.h
--- linux/include/linux/sched.h Tue Dec 21 00:01:14 1999
+++ work/include/linux/sched.h Sun Dec 26 12:44:38 1999
@@ -80,7 +80,6 @@
#define TASK_UNINTERRUPTIBLE 2
#define TASK_ZOMBIE 4
#define TASK_STOPPED 8
-#define TASK_SWAPPING 16
#define TASK_EXCLUSIVE 32

#define __set_task_state(tsk, state_value) \
diff -urN -X dontdiff linux/kernel/timer.c work/kernel/timer.c
--- linux/kernel/timer.c Tue Dec 14 00:13:36 1999
+++ work/kernel/timer.c Sun Dec 26 12:44:56 1999
@@ -553,8 +553,7 @@
read_lock(&tasklist_lock);
for_each_task(p) {
if ((p->state == TASK_RUNNING ||
- (p->state & TASK_UNINTERRUPTIBLE) ||
- (p->state & TASK_SWAPPING)))
+ (p->state & TASK_UNINTERRUPTIBLE)))
nr += FIXED_1;
}
read_unlock(&tasklist_lock);

-
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/