scsidev trivial to fix

Raul Miller (moth@magenta.com)
Wed, 13 Oct 1999 12:06:42 -0400


--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii

If I let scsidev have the assumption that disk0 is the only major for scsi
disks, fix is trivial. (this is against 1.5 source from tsx-11
ALPHA/scsi).

-- 
Raul

--envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Description: minor fixes for scsidev 1.5 Content-Disposition: attachment; filename=patch

*** scsidev.c.orig Sat Mar 29 10:45:50 1997 --- scsidev.c Wed Oct 13 12:02:48 1999 *************** *** 304,316 **** * somewhere (there could be sparse partition tables). For anything * else, stop as soon as we find something non-existant. */ ! if( (major == SCSI_DISK_MAJOR) && minor < 128) { minor++; unlink ("/tmp/testdev"); continue; ! } else if ( major != SCSI_DISK_MAJOR ) break; } status = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &id); --- 304,316 ---- * somewhere (there could be sparse partition tables). For anything * else, stop as soon as we find something non-existant. */ ! if( (major == SCSI_DISK0_MAJOR) && minor < 128) { minor++; unlink ("/tmp/testdev"); continue; ! } else if ( major != SCSI_DISK0_MAJOR ) break; } status = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &id); *************** *** 337,343 **** chan = (id[0] >> 16) & 0xff; lun = (id[0] >> 8 ) & 0xff; scsi_id = id[0] & 0xff; ! if(major == SCSI_DISK_MAJOR && (minor & 0xf)) { sprintf(scsidev,"/dev/scsi/s%ch%d-%xc%di%dl%dp%d", devchar, --- 337,343 ---- chan = (id[0] >> 16) & 0xff; lun = (id[0] >> 8 ) & 0xff; scsi_id = id[0] & 0xff; ! if(major == SCSI_DISK0_MAJOR && (minor & 0xf)) { sprintf(scsidev,"/dev/scsi/s%ch%d-%xc%di%dl%dp%d", devchar, *************** *** 369,375 **** */ switch(major) { ! case SCSI_DISK_MAJOR: if( minor & 0xf) sprintf(linkto, "/dev/sd%c%d", (minor >> 4) + 'a', (minor & 0xf)); --- 369,375 ---- */ switch(major) { ! case SCSI_DISK0_MAJOR: if( minor & 0xf) sprintf(linkto, "/dev/sd%c%d", (minor >> 4) + 'a', (minor & 0xf)); *************** *** 548,554 **** register_dev("/dev/scsi/sth4-334c0i5l0", 9, 0,6, 0x334, 0, 5, 0, -1, NULL); register_dev("/dev/scsi/rsth4-334c0i5l0", 9,128,6, 0x334, 0, 5, 0, -1, NULL); #else ! build_sdev(SCSI_DISK_MAJOR, O_RDONLY, S_IFBLK, 'd'); build_sdev(SCSI_CDROM_MAJOR, O_RDONLY, S_IFBLK, 'r'); build_sdev(SCSI_TAPE_MAJOR, O_RDONLY, S_IFCHR, 't'); build_sdev(SCSI_GENERIC_MAJOR, O_RDWR, S_IFCHR, 'g'); --- 548,554 ---- register_dev("/dev/scsi/sth4-334c0i5l0", 9, 0,6, 0x334, 0, 5, 0, -1, NULL); register_dev("/dev/scsi/rsth4-334c0i5l0", 9,128,6, 0x334, 0, 5, 0, -1, NULL); #else ! build_sdev(SCSI_DISK0_MAJOR, O_RDONLY, S_IFBLK, 'd'); build_sdev(SCSI_CDROM_MAJOR, O_RDONLY, S_IFBLK, 'r'); build_sdev(SCSI_TAPE_MAJOR, O_RDONLY, S_IFCHR, 't'); build_sdev(SCSI_GENERIC_MAJOR, O_RDWR, S_IFCHR, 'g'); *************** *** 708,714 **** configfile = fopen("/etc/scsi.alias", "r"); #endif line = 0; ! while(1==1) { fgets(buffer, sizeof(buffer), configfile); line++; --- 708,714 ---- configfile = fopen("/etc/scsi.alias", "r"); #endif line = 0; ! while(configfile) { fgets(buffer, sizeof(buffer), configfile); line++; *************** *** 815,821 **** continue; } if( strcmp(devtype, "disk") == 0 ) ! devtype_i = SCSI_DISK_MAJOR; else if( strcmp(devtype, "cdrom") == 0) devtype_i = SCSI_CDROM_MAJOR; else if( strcmp(devtype, "tape") == 0) --- 815,821 ---- continue; } if( strcmp(devtype, "disk") == 0 ) ! devtype_i = SCSI_DISK0_MAJOR; else if( strcmp(devtype, "cdrom") == 0) devtype_i = SCSI_CDROM_MAJOR; else if( strcmp(devtype, "tape") == 0) *************** *** 910,916 **** */ fprintf(stderr,"Building alias device entries for %s...\n", name); ! if( devtype_i == SCSI_DISK_MAJOR || devtype_i == SCSI_CDROM_MAJOR ) type = S_IFBLK; else --- 910,916 ---- */ fprintf(stderr,"Building alias device entries for %s...\n", name); ! if( devtype_i == SCSI_DISK0_MAJOR || devtype_i == SCSI_CDROM_MAJOR ) type = S_IFBLK; else *************** *** 935,941 **** 0, 0, 0, 0, 0, 0, match); } ! if( devtype_i == SCSI_DISK_MAJOR && match->partition == -1 ) { /* --- 935,941 ---- 0, 0, 0, 0, 0, 0, match); } ! if( devtype_i == SCSI_DISK0_MAJOR && match->partition == -1 ) { /* *************** *** 971,977 **** } } ! fclose(configfile); } /* --- 971,977 ---- } } ! if (configfile) fclose(configfile); } /*

--envbJBWh7q8WU6mo--

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