Reject non block-aligned transfers (where a block is 512 bytes in length);

they were causing scsi controller lockups.  Replace an occurrence of "512"
with SECSIZE, which is #defined to be 512.
This commit is contained in:
andrew 1993-07-04 07:09:59 +00:00
parent 12b46ebf29
commit 44b5013862
2 changed files with 16 additions and 4 deletions

View File

@ -13,7 +13,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
* $Id: sd.c,v 1.15 1993/06/27 06:59:20 andrew Exp $
* $Id: sd.c,v 1.16 1993/07/04 07:09:59 andrew Exp $
*/
#include "sd.h"
@ -367,6 +367,12 @@ sdstrategy(struct buf *bp)
printf("sd%d: %d bytes @ blk%d\n",
unit, bp->b_bcount, bp->b_blkno);
/* Reject non block-aligned transfers */
if (bp->b_bcount % SECSIZE) {
bp->b_error = EINVAL;
goto bad;
}
sdminphys(bp);
/* If the device has been made invalid, error out */
@ -750,7 +756,7 @@ sdgetdisklabel(u_char unit)
sd->disklabel.d_partitions[RAW_PART].p_offset = 0;
sd->disklabel.d_partitions[RAW_PART].p_size = sd->params.disksize;
sd->disklabel.d_npartitions = MAXPARTITIONS;
sd->disklabel.d_secsize = 512; /* as long as it's not 0 */
sd->disklabel.d_secsize = SECSIZE; /* as long as it's not 0 */
sd->disklabel.d_ntracks = sd->params.heads;
sd->disklabel.d_nsectors = sd->params.sectors;
sd->disklabel.d_ncylinders = sd->params.cyls;

View File

@ -13,7 +13,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
* $Id: sd.c,v 1.15 1993/06/27 06:59:20 andrew Exp $
* $Id: sd.c,v 1.16 1993/07/04 07:09:59 andrew Exp $
*/
#include "sd.h"
@ -367,6 +367,12 @@ sdstrategy(struct buf *bp)
printf("sd%d: %d bytes @ blk%d\n",
unit, bp->b_bcount, bp->b_blkno);
/* Reject non block-aligned transfers */
if (bp->b_bcount % SECSIZE) {
bp->b_error = EINVAL;
goto bad;
}
sdminphys(bp);
/* If the device has been made invalid, error out */
@ -750,7 +756,7 @@ sdgetdisklabel(u_char unit)
sd->disklabel.d_partitions[RAW_PART].p_offset = 0;
sd->disklabel.d_partitions[RAW_PART].p_size = sd->params.disksize;
sd->disklabel.d_npartitions = MAXPARTITIONS;
sd->disklabel.d_secsize = 512; /* as long as it's not 0 */
sd->disklabel.d_secsize = SECSIZE; /* as long as it's not 0 */
sd->disklabel.d_ntracks = sd->params.heads;
sd->disklabel.d_nsectors = sd->params.sectors;
sd->disklabel.d_ncylinders = sd->params.cyls;