Exorcise something evil and wrong in scsipi_mode_sense().

This commit is contained in:
mycroft 2003-09-08 03:24:12 +00:00
parent 0239de4901
commit 4588667f28
2 changed files with 10 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_all.h,v 1.22 2001/11/19 17:18:09 soren Exp $ */
/* $NetBSD: scsipi_all.h,v 1.23 2003/09/08 03:24:12 mycroft Exp $ */
/*
* SCSI and SCSI-like general interface description
@ -83,15 +83,8 @@ struct scsipi_mode_sense {
#define SMS_PAGE_CTRL_CHANGEABLE 0x40
#define SMS_PAGE_CTRL_DEFAULT 0x80
#define SMS_PAGE_CTRL_SAVED 0xC0
union {
struct {
u_int8_t unused;
u_int8_t length;
} scsi __attribute__((packed));
struct {
u_int8_t length[2];
} atapi __attribute__((packed));
} u_len;
u_int8_t control;
} __attribute__((packed));

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_base.c,v 1.88 2003/04/19 19:12:59 fvdl Exp $ */
/* $NetBSD: scsipi_base.c,v 1.89 2003/09/08 03:24:12 mycroft Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.88 2003/04/19 19:12:59 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.89 2003/09/08 03:24:12 mycroft Exp $");
#include "opt_scsi.h"
@ -1200,14 +1200,15 @@ scsipi_mode_sense(periph, byte2, page, data, len, flags, retries, timeout)
struct scsipi_mode_sense scsipi_cmd;
int error;
#if 1
if (scsipi_periph_bustype(periph) == SCSIPI_BUSTYPE_ATAPI)
panic("scsipi_mode_sense: what the Hell am I doing here?");
#endif
memset(&scsipi_cmd, 0, sizeof(scsipi_cmd));
scsipi_cmd.opcode = MODE_SENSE;
scsipi_cmd.byte2 = byte2;
scsipi_cmd.page = page;
if (scsipi_periph_bustype(periph) == SCSIPI_BUSTYPE_ATAPI)
_lto2b(len, scsipi_cmd.u_len.atapi.length);
else
scsipi_cmd.u_len.scsi.length = len & 0xff;
scsipi_cmd.length = len & 0xff;
error = scsipi_command(periph, (struct scsipi_generic *)&scsipi_cmd,
sizeof(scsipi_cmd), (void *)data, len, retries, timeout, NULL,
flags | XS_CTL_DATA_IN);