lkml.org 
[lkml]   [2000]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fix for drivers/char/sysrq.c, addition to include/linux/major.h, 2.4.0-test9
Hi,

i've sent this patch months ago, but it didn't came into kernel, so i
reposting it. It fixes sysrq.c bug (not all ide disks unmounted) once
for all, and adding new macro to include/linux/major.h (already discussed
here). Applies correctly to 2.4.0-test9 and test10-pre*

Jan Dvorak <johnydog@go.cz>



diff -ur linux-2.4.0-test9/drivers/char/sysrq.c linux/drivers/char/sysrq.c
--- linux-2.4.0-test9/drivers/char/sysrq.c Tue Aug 1 04:36:10 2000
+++ linux/drivers/char/sysrq.c Wed Oct 18 18:01:44 2000
@@ -6,6 +6,11 @@
*
* (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
* based on ideas by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>
+ *
+ * 13-Aug-2000 Modified by Jan Dvorak <johnydog@go.cz>
+ *
+ * is_local_disk() is now macro, and depends on <linux/major.h>
+ *
*/

#include <linux/config.h>
@@ -157,28 +162,8 @@

/* Aux routines for the syncer */

-static int is_local_disk(kdev_t dev) /* Guess if the device is a local hard drive */
-{
- unsigned int major = MAJOR(dev);
-
- switch (major) {
- case IDE0_MAJOR:
- case IDE1_MAJOR:
- case IDE2_MAJOR:
- case IDE3_MAJOR:
- case SCSI_DISK0_MAJOR:
- case SCSI_DISK1_MAJOR:
- case SCSI_DISK2_MAJOR:
- case SCSI_DISK3_MAJOR:
- case SCSI_DISK4_MAJOR:
- case SCSI_DISK5_MAJOR:
- case SCSI_DISK6_MAJOR:
- case SCSI_DISK7_MAJOR:
- return 1;
- default:
- return 0;
- }
-}
+#define is_local_disk(dev) \
+ (scsi_blk_major(MAJOR(dev)) || ide_blk_major(MAJOR(dev)))

static void go_sync(struct super_block *sb, int remount_flag)
{
diff -ur linux-2.4.0-test9/include/linux/major.h linux/include/linux/major.h
--- linux-2.4.0-test9/include/linux/major.h Wed Oct 18 17:57:27 2000
+++ linux/include/linux/major.h Wed Oct 18 18:01:44 2000
@@ -169,4 +169,20 @@
return SCSI_BLK_MAJOR(m);
}

+/*
+ * Test for IDE devices.
+ */
+
+#define IDE_BLK_MAJOR(M) ((M) == IDE0_MAJOR || \
+ (M) == IDE1_MAJOR || \
+ (M) == IDE2_MAJOR || \
+ (M) == IDE3_MAJOR || \
+ (M) == IDE4_MAJOR || \
+ (M) == IDE5_MAJOR || \
+ ((M) >= IDE6_MAJOR && (M) <= IDE9_MAJOR))
+
+static __inline__ int ide_blk_major(int m) {
+ return IDE_BLK_MAJOR(m);
+}
+
#endif
\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.085 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site