Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dkwedge dk(4): ENXIO, not ENODEV, means no such device.
details: https://anonhg.NetBSD.org/src/rev/c858f8bae65a
branches: trunk
changeset: 374377:c858f8bae65a
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Apr 21 18:25:09 2023 +0000
description:
dk(4): ENXIO, not ENODEV, means no such device.
ENXIO is `device not configured', meaning there is no such device.
ENODEV is `operation not supported by device', meaning the device is
there but refuses the operation, like writing to a read-only medium.
Exception: For undefined ioctl commands, it's not ENODEV _or_ ENXIO,
but rather ENOTTY, because why make any of this obvious when you
could make it obscure Unix lore?
diffstat:
sys/dev/dkwedge/dk.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (125 lines):
diff -r d531407ae78f -r c858f8bae65a sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Fri Apr 21 18:24:56 2023 +0000
+++ b/sys/dev/dkwedge/dk.c Fri Apr 21 18:25:09 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.131 2023/04/21 18:24:56 riastradh Exp $ */
+/* $NetBSD: dk.c,v 1.132 2023/04/21 18:25:09 riastradh Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.131 2023/04/21 18:24:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.132 2023/04/21 18:25:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -221,14 +221,14 @@ dkwedge_compute_pdev(const char *pname,
break;
}
if (pmaj == NODEVMAJOR)
- return ENODEV;
+ return ENXIO;
name += strlen(devname);
for (cp = name, punit = 0; *cp >= '0' && *cp <= '9'; cp++)
punit = (punit * 10) + (*cp - '0');
if (cp == name) {
/* Invalid parent disk name. */
- return ENODEV;
+ return ENXIO;
}
*pdevp = MAKEDISKDEV(pmaj, punit, RAW_PART);
@@ -325,7 +325,7 @@ dkwedge_add(struct dkwedge_info *dkw)
dkw->dkw_parent[sizeof(dkw->dkw_parent) - 1] = '\0';
pdk = disk_find(dkw->dkw_parent);
if (pdk == NULL)
- return ENODEV;
+ return ENXIO;
error = dkwedge_compute_pdev(pdk->dk_name, &pdev, VBLK);
if (error)
@@ -989,7 +989,7 @@ dkwedge_discover(struct disk *pdk)
error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
if (error) {
- if (error != ENODEV)
+ if (error != ENXIO)
aprint_error("%s: unable to open device, error = %d\n",
pdk->dk_name, error);
vput(vp);
@@ -1169,7 +1169,7 @@ dkopen(dev_t dev, int flags, int fmt, st
int error = 0;
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
@@ -1285,7 +1285,7 @@ dkclose(dev_t dev, int flags, int fmt, s
struct dkwedge_softc *sc = dkwedge_lookup(dev);
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
@@ -1323,7 +1323,7 @@ dkstrategy(struct buf *bp)
uint64_t p_size, p_offset;
if (sc == NULL) {
- bp->b_error = ENODEV;
+ bp->b_error = ENXIO;
goto done;
}
@@ -1523,7 +1523,7 @@ dkread(dev_t dev, struct uio *uio, int f
struct dkwedge_softc *sc = dkwedge_lookup(dev);
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
@@ -1541,7 +1541,7 @@ dkwrite(dev_t dev, struct uio *uio, int
struct dkwedge_softc *sc = dkwedge_lookup(dev);
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
@@ -1560,7 +1560,7 @@ dkioctl(dev_t dev, u_long cmd, void *dat
int error = 0;
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
if (sc->sc_parent->dk_rawvp == NULL)
@@ -1636,7 +1636,7 @@ dkdiscard(dev_t dev, off_t pos, off_t le
int error;
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
if (sc->sc_parent->dk_rawvp == NULL)
@@ -1717,7 +1717,7 @@ dkdump(dev_t dev, daddr_t blkno, void *v
int rv = 0;
if (sc == NULL)
- return ENODEV;
+ return ENXIO;
if (sc->sc_state != DKW_STATE_RUNNING)
return ENXIO;
Home |
Main Index |
Thread Index |
Old Index