include/linux/major.h and drivers/char/sysrq.c

From: Jan Dvorak (johnydog@go.cz)
Date: Thu Aug 10 2000 - 18:42:55 EST


Hi,

i doesn't found maintainer of neither include files nor sysrq.c so i'm
posting here.

It would be good to have ide_blk_major() (as scsi_blk_major() is) in
major.h. (this is done in first patch i was attached.)
        
File sysrq.c is excellent example for do so - IDE(4-9)_MAJOR defines were
adding, but author/maintainer of sysrq.c didn't notice, and so, in
kernel 2.4.0-test6 is still coutered only with IDE(0-3)_MAJOR.

Second attached patch corrects sysrq.c by making use of (existing)
scsi_blk_major and (new) ide_blk_major.

(I supposed that IDE block majors are only IDE0-IDE9, where scsi has
 additional SCSI_CDROM_MAJOR so i named it ide_blk - if this is untrue
 correct me please.)

Also these patches are not tested, it is exemplary, but should work.

Thanks

Jan Dvorak <johnydog@go.cz>

--- linux-2.4.0-test6/include/linux/major.h Mon Jun 19 22:42:00 2000
+++ linux/include/linux/major.h Fri Aug 11 00:59:56 2000
@@ -156,4 +156,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

--- linux-2.4.0-test6/drivers/char/sysrq.c Tue Aug 1 04:36:00 2000
+++ linux/drivers/char/sysrq.c Fri Aug 11 01:20:37 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>
+ *
+ * 11-Aug-2000 Modified by Jan Dvorak <johnydog@go.cz>
+ *
+ * is_local_disk() now depends on <linux/major.h>
+ *
  */
 
 #include <linux/config.h>
@@ -161,23 +166,10 @@
 {
         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:
+ if (scsi_blk_major(major) || ide_blk_major(major))
                 return 1;
- default:
+ else
                 return 0;
- }
 }
 
 static void go_sync(struct super_block *sb, int remount_flag)

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



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:23 EST