summaryrefslogtreecommitdiffstats
path: root/sys/scsi/scsi_base.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2019-12-06 13:53:26 +0000
committerkrw <krw@openbsd.org>2019-12-06 13:53:26 +0000
commit3d8812d3478cd6c6b2c953adbd3bd5d78823379f (patch)
treeb2ffce180207ad06c7d41df48c781716325ae00e /sys/scsi/scsi_base.c
parentStop fiddling with openlog / closelog in libunbound. unwind handles (diff)
downloadwireguard-openbsd-3d8812d3478cd6c6b2c953adbd3bd5d78823379f.tar.xz
wireguard-openbsd-3d8812d3478cd6c6b2c953adbd3bd5d78823379f.zip
Various cleanup tweaks. 'return' is not a function. KNF. Whitespace,
Comment fixes.
Diffstat (limited to 'sys/scsi/scsi_base.c')
-rw-r--r--sys/scsi/scsi_base.c310
1 files changed, 155 insertions, 155 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 0c1f7592577..114b1d1f7d8 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.259 2019/12/05 19:53:05 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.260 2019/12/06 13:53:26 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -89,12 +89,14 @@ void * scsi_iopool_get(struct scsi_iopool *);
void scsi_iopool_put(struct scsi_iopool *, void *);
/* Various helper functions for scsi_do_mode_sense() */
-int scsi_mode_sense(struct scsi_link *, int, struct scsi_mode_header *,
- size_t, int, int);
+int scsi_mode_sense(struct scsi_link *, int,
+ struct scsi_mode_header *, size_t, int, int);
int scsi_mode_sense_big(struct scsi_link *, int,
struct scsi_mode_header_big *, size_t, int, int);
-void * scsi_mode_sense_page(struct scsi_mode_header *, int, int);
-void * scsi_mode_sense_big_page(struct scsi_mode_header_big *, int, int);
+void * scsi_mode_sense_page(struct scsi_mode_header *, int,
+ int);
+void * scsi_mode_sense_big_page(struct scsi_mode_header_big *,
+ int, int);
/* ioh/xsh queue state */
#define RUNQ_IDLE 0
@@ -146,7 +148,7 @@ scsi_req_probe(struct scsibus_softc *sb, int target, int lun)
p = pool_get(&scsi_plug_pool, PR_NOWAIT);
if (p == NULL)
- return (ENOMEM);
+ return ENOMEM;
task_set(&p->task, scsi_plug_probe, p);
p->sb = sb;
@@ -155,7 +157,7 @@ scsi_req_probe(struct scsibus_softc *sb, int target, int lun)
task_add(systq, &p->task);
- return (0);
+ return 0;
}
int
@@ -165,7 +167,7 @@ scsi_req_detach(struct scsibus_softc *sb, int target, int lun, int how)
p = pool_get(&scsi_plug_pool, PR_NOWAIT);
if (p == NULL)
- return (ENOMEM);
+ return ENOMEM;
task_set(&p->task, scsi_plug_detach, p);
p->sb = sb;
@@ -175,15 +177,15 @@ scsi_req_detach(struct scsibus_softc *sb, int target, int lun, int how)
task_add(systq, &p->task);
- return (0);
+ return 0;
}
void
scsi_plug_probe(void *xp)
{
- struct scsi_plug *p = xp;
- struct scsibus_softc *sb = p->sb;
- int target = p->target, lun = p->lun;
+ struct scsi_plug *p = xp;
+ struct scsibus_softc *sb = p->sb;
+ int target = p->target, lun = p->lun;
pool_put(&scsi_plug_pool, p);
@@ -193,10 +195,10 @@ scsi_plug_probe(void *xp)
void
scsi_plug_detach(void *xp)
{
- struct scsi_plug *p = xp;
- struct scsibus_softc *sb = p->sb;
- int target = p->target, lun = p->lun;
- int how = p->how;
+ struct scsi_plug *p = xp;
+ struct scsibus_softc *sb = p->sb;
+ int target = p->target, lun = p->lun;
+ int how = p->how;
pool_put(&scsi_plug_pool, p);
@@ -214,7 +216,7 @@ scsi_pending_start(struct mutex *mtx, u_int *running)
rv = 0;
mtx_leave(mtx);
- return (rv);
+ return rv;
}
int
@@ -230,7 +232,7 @@ scsi_pending_finish(struct mutex *mtx, u_int *running)
}
mtx_leave(mtx);
- return (rv);
+ return rv;
}
void
@@ -255,7 +257,7 @@ scsi_iopool_get(struct scsi_iopool *iopl)
io = iopl->io_get(iopl->iocookie);
KERNEL_UNLOCK();
- return (io);
+ return io;
}
void
@@ -269,8 +271,8 @@ scsi_iopool_put(struct scsi_iopool *iopl, void *io)
void
scsi_iopool_destroy(struct scsi_iopool *iopl)
{
- struct scsi_runq sleepers = TAILQ_HEAD_INITIALIZER(sleepers);
- struct scsi_iohandler *ioh = NULL;
+ struct scsi_runq sleepers = TAILQ_HEAD_INITIALIZER(sleepers);
+ struct scsi_iohandler *ioh = NULL;
mtx_enter(&iopl->mtx);
while ((ioh = TAILQ_FIRST(&iopl->queue)) != NULL) {
@@ -295,7 +297,7 @@ scsi_iopool_destroy(struct scsi_iopool *iopl)
void *
scsi_default_get(void *iocookie)
{
- return (SCSI_IOPOOL_POISON);
+ return SCSI_IOPOOL_POISON;
}
void
@@ -324,8 +326,8 @@ scsi_ioh_set(struct scsi_iohandler *ioh, struct scsi_iopool *iopl,
int
scsi_ioh_add(struct scsi_iohandler *ioh)
{
- struct scsi_iopool *iopl = ioh->pool;
- int rv = 0;
+ struct scsi_iopool *iopl = ioh->pool;
+ int rv = 0;
mtx_enter(&iopl->mtx);
switch (ioh->q_state) {
@@ -346,14 +348,14 @@ scsi_ioh_add(struct scsi_iohandler *ioh)
/* lets get some io up in the air */
scsi_iopool_run(iopl);
- return (rv);
+ return rv;
}
int
scsi_ioh_del(struct scsi_iohandler *ioh)
{
- struct scsi_iopool *iopl = ioh->pool;
- int rv = 0;
+ struct scsi_iopool *iopl = ioh->pool;
+ int rv = 0;
mtx_enter(&iopl->mtx);
switch (ioh->q_state) {
@@ -371,7 +373,7 @@ scsi_ioh_del(struct scsi_iohandler *ioh)
}
mtx_leave(&iopl->mtx);
- return (rv);
+ return rv;
}
/*
@@ -391,7 +393,7 @@ scsi_ioh_deq(struct scsi_iopool *iopl)
}
mtx_leave(&iopl->mtx);
- return (ioh);
+ return ioh;
}
int
@@ -403,14 +405,14 @@ scsi_ioh_pending(struct scsi_iopool *iopl)
rv = !TAILQ_EMPTY(&iopl->queue);
mtx_leave(&iopl->mtx);
- return (rv);
+ return rv;
}
void
scsi_iopool_run(struct scsi_iopool *iopl)
{
- struct scsi_iohandler *ioh;
- void *io;
+ struct scsi_iohandler *ioh;
+ void *io;
if (!scsi_pending_start(&iopl->mtx, &iopl->running))
return;
@@ -463,23 +465,23 @@ scsi_move_done(void *cookie, void *io)
void *
scsi_io_get(struct scsi_iopool *iopl, int flags)
{
- struct scsi_io_mover m = SCSI_IO_MOVER_INITIALIZER;
- struct scsi_iohandler ioh;
- void *io;
+ struct scsi_io_mover m = SCSI_IO_MOVER_INITIALIZER;
+ struct scsi_iohandler ioh;
+ void *io;
/* try and sneak an io off the backend immediately */
io = scsi_iopool_get(iopl);
if (io != NULL)
- return (io);
+ return io;
else if (ISSET(flags, SCSI_NOSLEEP))
- return (NULL);
+ return NULL;
/* otherwise sleep until we get one */
- scsi_ioh_set(&ioh, iopl, scsi_io_get_done, &m);
+scsi_ioh_set(&ioh, iopl, scsi_io_get_done, &m);
scsi_ioh_add(&ioh);
scsi_move(&m);
- return (m.io);
+ return m.io;
}
void
@@ -512,11 +514,11 @@ scsi_xsh_set(struct scsi_xshandler *xsh, struct scsi_link *link,
int
scsi_xsh_add(struct scsi_xshandler *xsh)
{
- struct scsi_link *link = xsh->link;
- int rv = 0;
+ struct scsi_link *link = xsh->link;
+ int rv = 0;
if (ISSET(link->state, SDEV_S_DYING))
- return (0);
+ return 0;
mtx_enter(&link->pool->mtx);
if (xsh->ioh.q_state == RUNQ_IDLE) {
@@ -529,14 +531,14 @@ scsi_xsh_add(struct scsi_xshandler *xsh)
/* lets get some io up in the air */
scsi_xsh_runqueue(link);
- return (rv);
+ return rv;
}
int
scsi_xsh_del(struct scsi_xshandler *xsh)
{
- struct scsi_link *link = xsh->link;
- int rv = 1;
+ struct scsi_link *link = xsh->link;
+ int rv = 1;
mtx_enter(&link->pool->mtx);
switch (xsh->ioh.q_state) {
@@ -558,7 +560,7 @@ scsi_xsh_del(struct scsi_xshandler *xsh)
xsh->ioh.q_state = RUNQ_IDLE;
mtx_leave(&link->pool->mtx);
- return (rv);
+ return rv;
}
/*
@@ -568,8 +570,8 @@ scsi_xsh_del(struct scsi_xshandler *xsh)
void
scsi_xsh_runqueue(struct scsi_link *link)
{
- struct scsi_iohandler *ioh;
- int runq;
+ struct scsi_iohandler *ioh;
+ int runq;
if (!scsi_pending_start(&link->pool->mtx, &link->running))
return;
@@ -598,8 +600,8 @@ scsi_xsh_runqueue(struct scsi_link *link)
void
scsi_xsh_ioh(void *cookie, void *io)
{
- struct scsi_xshandler *xsh = cookie;
- struct scsi_xfer *xs;
+ struct scsi_xshandler *xsh = cookie;
+ struct scsi_xfer *xs;
xs = scsi_xs_io(xsh->link, io, SCSI_NOSLEEP);
if (xs == NULL) {
@@ -625,14 +627,13 @@ scsi_xsh_ioh(void *cookie, void *io)
struct scsi_xfer *
scsi_xs_get(struct scsi_link *link, int flags)
{
- struct scsi_xshandler xsh;
- struct scsi_io_mover m = SCSI_IO_MOVER_INITIALIZER;
-
- struct scsi_iopool *iopl = link->pool;
- void *io;
+ struct scsi_xshandler xsh;
+ struct scsi_io_mover m = SCSI_IO_MOVER_INITIALIZER;
+ struct scsi_iopool *iopl = link->pool;
+ void *io;
if (ISSET(link->state, SDEV_S_DYING))
- return (NULL);
+ return NULL;
/* really custom xs handler to avoid scsi_xsh_ioh */
scsi_ioh_set(&xsh.ioh, iopl, scsi_xs_get_done, &m);
@@ -640,29 +641,29 @@ scsi_xs_get(struct scsi_link *link, int flags)
if (!scsi_link_open(link)) {
if (ISSET(flags, SCSI_NOSLEEP))
- return (NULL);
+ return NULL;
scsi_xsh_add(&xsh);
scsi_move(&m);
if (m.io == NULL)
- return (NULL);
+ return NULL;
io = m.io;
} else if ((io = scsi_iopool_get(iopl)) == NULL) {
if (ISSET(flags, SCSI_NOSLEEP)) {
scsi_link_close(link);
- return (NULL);
+ return NULL;
}
scsi_ioh_add(&xsh.ioh);
scsi_move(&m);
if (m.io == NULL)
- return (NULL);
+ return NULL;
io = m.io;
}
- return (scsi_xs_io(link, io, flags));
+ return scsi_xs_io(link, io, flags);
}
void
@@ -674,10 +675,10 @@ scsi_xs_get_done(void *cookie, void *io)
void
scsi_link_shutdown(struct scsi_link *link)
{
- struct scsi_runq sleepers = TAILQ_HEAD_INITIALIZER(sleepers);
- struct scsi_iopool *iopl = link->pool;
- struct scsi_iohandler *ioh;
- struct scsi_xshandler *xsh;
+ struct scsi_runq sleepers = TAILQ_HEAD_INITIALIZER(sleepers);
+ struct scsi_iopool *iopl = link->pool;
+ struct scsi_iohandler *ioh;
+ struct scsi_xshandler *xsh;
mtx_enter(&iopl->mtx);
while ((ioh = TAILQ_FIRST(&link->queue)) != NULL) {
@@ -736,7 +737,7 @@ scsi_link_open(struct scsi_link *link)
}
mtx_leave(&link->pool->mtx);
- return (open);
+ return open;
}
void
@@ -770,14 +771,14 @@ scsi_xs_io(struct scsi_link *link, void *io, int flags)
xs->io = io;
}
- return (xs);
+ return xs;
}
void
scsi_xs_put(struct scsi_xfer *xs)
{
- struct scsi_link *link = xs->sc_link;
- void *io = xs->io;
+ struct scsi_link *link = xs->sc_link;
+ void *io = xs->io;
pool_put(&scsi_xfer_pool, xs);
@@ -791,13 +792,13 @@ scsi_xs_put(struct scsi_xfer *xs)
int
scsi_test_unit_ready(struct scsi_link *link, int retries, int flags)
{
- struct scsi_test_unit_ready *cmd;
- struct scsi_xfer *xs;
- int error;
+ struct scsi_test_unit_ready *cmd;
+ struct scsi_xfer *xs;
+ int error;
xs = scsi_xs_get(link, flags);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->retries = retries;
xs->timeout = 10000;
@@ -808,7 +809,7 @@ scsi_test_unit_ready(struct scsi_link *link, int retries, int flags)
error = scsi_xs_sync(xs);
scsi_xs_put(xs);
- return (error);
+ return error;
}
void
@@ -838,9 +839,9 @@ int
scsi_inquire(struct scsi_link *link, struct scsi_inquiry_data *inqbuf,
int flags)
{
- struct scsi_xfer *xs;
- size_t bytes;
- int error;
+ struct scsi_xfer *xs;
+ size_t bytes;
+ int error;
/*
* Start by asking for only the basic 36 bytes of SCSI2 inquiry
@@ -854,7 +855,7 @@ again:
#endif /* SCSIDEBUG */
xs = scsi_xs_get(link, flags);
if (xs == NULL)
- return (EBUSY);
+ return EBUSY;
scsi_init_inquiry(xs, 0, 0, inqbuf, bytes);
@@ -882,7 +883,7 @@ again:
goto again;
}
#endif /* SCSIDEBUG */
- return (error);
+ return error;
}
/*
@@ -892,18 +893,18 @@ int
scsi_inquire_vpd(struct scsi_link *link, void *buf, u_int buflen,
u_int8_t page, int flags)
{
- struct scsi_xfer *xs;
- int error;
+ struct scsi_xfer *xs;
+ int error;
#ifdef SCSIDEBUG
- u_int32_t bytes;
+ u_int32_t bytes;
#endif /* SCSIDEBUG */
if (ISSET(link->flags, SDEV_UMASS))
- return (EJUSTRETURN);
+ return EJUSTRETURN;
xs = scsi_xs_get(link, flags | SCSI_DATA_IN | SCSI_SILENT);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->retries = 2;
xs->timeout = 10000;
@@ -920,14 +921,14 @@ scsi_inquire_vpd(struct scsi_link *link, void *buf, u_int buflen,
_2btol(((struct scsi_vpd_hdr *)buf)->page_length);
if (bytes < buflen)
buflen = bytes;
- printf("got %u of %u bytes of VPD inquiry page %u data:\n", buflen,
- bytes, page);
+ printf("got %u of %u bytes of VPD inquiry page %u data:\n",
+ buflen, bytes, page);
scsi_show_mem(buf, buflen);
} else {
printf("VPD inquiry page %u not available\n", page);
}
#endif /* SCSIDEBUG */
- return (error);
+ return error;
}
int
@@ -999,7 +1000,7 @@ scsi_read_cap_16(struct scsi_link *link, struct scsi_read_cap_data_16 *rdcap,
}
#endif /* SCSIDEBUG */
- return (rv);
+ return rv;
}
/*
@@ -1008,16 +1009,16 @@ scsi_read_cap_16(struct scsi_link *link, struct scsi_read_cap_data_16 *rdcap,
int
scsi_prevent(struct scsi_link *link, int type, int flags)
{
- struct scsi_prevent *cmd;
- struct scsi_xfer *xs;
- int error;
+ struct scsi_prevent *cmd;
+ struct scsi_xfer *xs;
+ int error;
if (ISSET(link->quirks, ADEV_NODOORLOCK))
- return (0);
+ return 0;
xs = scsi_xs_get(link, flags);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->retries = 2;
xs->timeout = 5000;
@@ -1029,7 +1030,7 @@ scsi_prevent(struct scsi_link *link, int type, int flags)
error = scsi_xs_sync(xs);
scsi_xs_put(xs);
- return (error);
+ return error;
}
/*
@@ -1038,13 +1039,13 @@ scsi_prevent(struct scsi_link *link, int type, int flags)
int
scsi_start(struct scsi_link *link, int type, int flags)
{
- struct scsi_start_stop *cmd;
- struct scsi_xfer *xs;
- int error;
+ struct scsi_start_stop *cmd;
+ struct scsi_xfer *xs;
+ int error;
xs = scsi_xs_get(link, flags);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->retries = 2;
xs->timeout = (type == SSS_START) ? 30000 : 10000;
@@ -1056,7 +1057,7 @@ scsi_start(struct scsi_link *link, int type, int flags)
error = scsi_xs_sync(xs);
scsi_xs_put(xs);
- return (error);
+ return error;
}
int
@@ -1072,7 +1073,7 @@ scsi_mode_sense(struct scsi_link *link, int pg_code,
xs = scsi_xs_get(link, flags | SCSI_DATA_IN);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->data = (void *)data;
xs->datalen = len;
@@ -1155,8 +1156,8 @@ scsi_mode_sense_big(struct scsi_link *link, int pg_code,
bytes = sizeof(data->data_length) + _2btol(data->data_length);
if (bytes < len)
len = bytes;
- printf("got %zu bytes of %zu bytes of mode sense (10) page %d data:\n",
- len, bytes, pg_code);
+ printf("got %zu bytes of %zu bytes of mode sense (10) page %d "
+ "data:\n", len, bytes, pg_code);
scsi_show_mem((u_char *)data, len);
} else
printf("mode sense (10) page %d not available\n", pg_code);
@@ -1256,7 +1257,7 @@ scsi_do_mode_sense(struct scsi_link *link, int pg_code,
union scsi_mode_sense_buf *buf, void **page_data,
int pg_length, int flags, int *big)
{
- int error = 0;
+ int error = 0;
*page_data = NULL;
*big = 0;
@@ -1301,31 +1302,31 @@ scsi_do_mode_sense(struct scsi_link *link, int pg_code,
error = scsi_mode_sense_big(link, pg_code, &buf->hdr_big,
sizeof(*buf), flags, 20000);
if (error != 0)
- return (error);
+ return error;
if (_2btol(buf->hdr_big.data_length) < 6)
- return (EIO);
+ return EIO;
*big = 1;
*page_data = scsi_mode_sense_big_page(&buf->hdr_big, pg_code,
pg_length);
- return (0);
+ return 0;
}
int
scsi_mode_select(struct scsi_link *link, int byte2,
struct scsi_mode_header *data, int flags, int timeout)
{
- struct scsi_mode_select *cmd;
- struct scsi_xfer *xs;
- u_int32_t len;
- int error;
+ struct scsi_mode_select *cmd;
+ struct scsi_xfer *xs;
+ int error;
+ u_int32_t len;
len = data->data_length + 1; /* 1 == sizeof(data_length) */
xs = scsi_xs_get(link, flags | SCSI_DATA_OUT);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->data = (void *)data;
xs->datalen = len;
@@ -1344,23 +1345,23 @@ scsi_mode_select(struct scsi_link *link, int byte2,
SC_DEBUG(link, SDEV_DB2, ("scsi_mode_select: error = %d\n", error));
- return (error);
+ return error;
}
int
scsi_mode_select_big(struct scsi_link *link, int byte2,
struct scsi_mode_header_big *data, int flags, int timeout)
{
- struct scsi_mode_select_big *cmd;
- struct scsi_xfer *xs;
- u_int32_t len;
- int error;
+ struct scsi_mode_select_big *cmd;
+ struct scsi_xfer *xs;
+ int error;
+ u_int32_t len;
len = _2btol(data->data_length) + 2; /* 2 == sizeof data_length */
xs = scsi_xs_get(link, flags | SCSI_DATA_OUT);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->data = (void *)data;
xs->datalen = len;
@@ -1380,7 +1381,7 @@ scsi_mode_select_big(struct scsi_link *link, int byte2,
SC_DEBUG(link, SDEV_DB2, ("scsi_mode_select_big: error = %d\n",
error));
- return (error);
+ return error;
}
int
@@ -1388,13 +1389,13 @@ scsi_report_luns(struct scsi_link *link, int selectreport,
struct scsi_report_luns_data *data, u_int32_t datalen, int flags,
int timeout)
{
- struct scsi_report_luns *cmd;
- struct scsi_xfer *xs;
- int error;
+ struct scsi_report_luns *cmd;
+ struct scsi_xfer *xs;
+ int error;
xs = scsi_xs_get(link, flags | SCSI_DATA_IN);
if (xs == NULL)
- return (ENOMEM);
+ return ENOMEM;
xs->cmdlen = sizeof(*cmd);
xs->data = (void *)data;
xs->datalen = datalen;
@@ -1412,7 +1413,7 @@ scsi_report_luns(struct scsi_link *link, int selectreport,
SC_DEBUG(link, SDEV_DB2, ("scsi_report_luns: error = %d\n", error));
- return (error);
+ return error;
}
void
@@ -1455,8 +1456,8 @@ scsi_done(struct scsi_xfer *xs)
int
scsi_xs_sync(struct scsi_xfer *xs)
{
- struct mutex cookie = MUTEX_INITIALIZER(IPL_BIO);
- int error;
+ struct mutex cookie = MUTEX_INITIALIZER(IPL_BIO);
+ int error;
#ifdef DIAGNOSTIC
if (xs->cookie != NULL)
@@ -1487,7 +1488,7 @@ scsi_xs_sync(struct scsi_xfer *xs)
error = scsi_xs_error(xs);
} while (error == ERESTART);
- return (error);
+ return error;
}
void
@@ -1514,7 +1515,7 @@ scsi_xs_error(struct scsi_xfer *xs)
xs->error));
if (ISSET(xs->sc_link->state, SDEV_S_DYING))
- return (ENXIO);
+ return ENXIO;
switch (xs->error) {
case XS_NOERROR: /* nearly always hit this one */
@@ -1550,9 +1551,9 @@ scsi_xs_error(struct scsi_xfer *xs)
}
if (error == ERESTART && xs->retries-- < 1)
- return (EIO);
+ return EIO;
else
- return (error);
+ return error;
}
int
@@ -1561,23 +1562,23 @@ scsi_delay(struct scsi_xfer *xs, int seconds)
switch (xs->flags & (SCSI_POLL | SCSI_NOSLEEP)) {
case SCSI_POLL:
delay(1000000 * seconds);
- return (ERESTART);
+ return ERESTART;
case SCSI_NOSLEEP:
/* Retry the command immediately since we can't delay. */
- return (ERESTART);
+ return ERESTART;
case (SCSI_POLL | SCSI_NOSLEEP):
/* Invalid combination! */
- return (EIO);
+ return EIO;
}
while (seconds-- > 0) {
if (tsleep_nsec(&lbolt, PRIBIO|PCATCH, "scbusy", INFSLP)) {
/* Signal == abort xs. */
- return (EIO);
+ return EIO;
}
}
- return (ERESTART);
+ return ERESTART;
}
/*
@@ -1616,7 +1617,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
break;
case SKEY_NOT_READY:
if (ISSET(xs->flags, SCSI_IGNORE_NOT_READY))
- return (0);
+ return 0;
error = EIO;
if (xs->retries) {
switch (ASC_ASCQ(sense)) {
@@ -1631,7 +1632,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
SC_DEBUG(link, SDEV_DB1,
("not ready (ASC_ASCQ == %#x)\n",
ASC_ASCQ(sense)));
- return (scsi_delay(xs, 1));
+ return scsi_delay(xs, 1);
case SENSE_NOMEDIUM:
case SENSE_NOMEDIUM_TCLOSED:
case SENSE_NOMEDIUM_TOPEN:
@@ -1671,9 +1672,9 @@ scsi_interpret_sense(struct scsi_xfer *xs)
break;
case SKEY_ILLEGAL_REQUEST:
if (ISSET(xs->flags, SCSI_IGNORE_ILLEGAL_REQUEST))
- return (0);
+ return 0;
if (ASC_ASCQ(sense) == SENSE_MEDIUM_REMOVAL_PREVENTED)
- return(EBUSY);
+ return EBUSY;
error = EINVAL;
break;
case SKEY_UNIT_ATTENTION:
@@ -1686,7 +1687,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
case SENSE_TSC_CHANGE_SE:
case SENSE_TSC_CHANGE_LVD:
case SENSE_IT_NEXUS_LOSS:
- return (scsi_delay(xs, 1));
+ return scsi_delay(xs, 1);
default:
break;
}
@@ -1695,7 +1696,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
if (ISSET(xs->flags, SCSI_IGNORE_MEDIA_CHANGE) ||
/* XXX Should reupload any transient state. */
!ISSET(link->flags, SDEV_REMOVABLE)) {
- return (scsi_delay(xs, 1));
+ return scsi_delay(xs, 1);
}
error = EIO;
break;
@@ -1710,7 +1711,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
break;
case SKEY_HARDWARE_ERROR:
if (ASC_ASCQ(sense) == SENSE_CARTRIDGE_FAULT)
- return(EMEDIUMTYPE);
+ return EMEDIUMTYPE;
error = EIO;
break;
default:
@@ -1724,7 +1725,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
scsi_print_sense(xs);
#endif /* ~SCSIDEBUG */
- return (error);
+ return error;
}
/*
@@ -1774,8 +1775,8 @@ asc2ascii(u_int8_t asc, u_int8_t ascq, char *result, size_t len)
}
#else
static const struct {
- u_int8_t asc, ascq;
- char *description;
+ u_int8_t asc, ascq;
+ char *description;
} adesc[] = {
/* www.t10.org/lists/asc-num.txt as of 11/15/10. */
{ 0x00, 0x00, "No Additional Sense Information" },
@@ -2427,7 +2428,7 @@ static const struct {
static __inline void
asc2ascii(u_int8_t asc, u_int8_t ascq, char *result, size_t len)
{
- int i;
+ int i;
/* Check for a dynamically built description. */
switch (asc) {
@@ -2467,11 +2468,10 @@ asc2ascii(u_int8_t asc, u_int8_t ascq, char *result, size_t len)
void
scsi_print_sense(struct scsi_xfer *xs)
{
- struct scsi_sense_data *sense = &xs->sense;
- u_int8_t serr = sense->error_code &
- SSD_ERRCODE;
- int32_t info;
- char *sbs;
+ struct scsi_sense_data *sense = &xs->sense;
+ char *sbs;
+ int32_t info;
+ u_int8_t serr = sense->error_code & SSD_ERRCODE;
sc_print_addr(xs->sc_link);
@@ -2589,7 +2589,7 @@ scsi_decode_sense(struct scsi_sense_data *sense, int flag)
break;
}
- return (rqsbuf);
+ return rqsbuf;
}
void
@@ -2715,8 +2715,8 @@ const char *devicetypenames[32] = {
void
scsi_show_sense(struct scsi_xfer *xs)
{
- struct scsi_sense_data *sense = &xs->sense;
- struct scsi_link *link = xs->sc_link;
+ struct scsi_sense_data *sense = &xs->sense;
+ struct scsi_link *link = xs->sc_link;
SC_DEBUG(link, SDEV_DB1,
("code:%#x valid:%d key:%#x ili:%d eom:%d fmark:%d extra:%d\n",
@@ -2740,8 +2740,8 @@ scsi_show_sense(struct scsi_xfer *xs)
void
scsi_show_xs(struct scsi_xfer *xs)
{
- u_char *b = (u_char *)xs->cmd;
- int i = 0;
+ u_char *b = (u_char *)xs->cmd;
+ int i = 0;
if (!ISSET(xs->sc_link->flags, SDEV_DB1))
return;