Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107235648
D30860.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D30860.diff
View Options
diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h
--- a/sys/cam/cam_ccb.h
+++ b/sys/cam/cam_ccb.h
@@ -1299,7 +1299,6 @@
#define CAM_TIME_INFINITY 0xFFFFFFFF /* Infinite timeout */
#define CAM_SUCCESS 0 /* For signaling general success */
-#define CAM_FAILURE 1 /* For signaling general failure */
#define CAM_FALSE 0
#define CAM_TRUE 1
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -930,9 +930,9 @@
if (xpt_sim == NULL)
return (ENOMEM);
- if ((status = xpt_bus_register(xpt_sim, NULL, 0)) != CAM_SUCCESS) {
- printf("xpt_init: xpt_bus_register failed with status %#x,"
- " failing attach\n", status);
+ if ((error = xpt_bus_register(xpt_sim, NULL, 0)) != CAM_SUCCESS) {
+ printf("xpt_init: xpt_bus_register failed with errno %d,"
+ " failing attach\n", error);
return (EINVAL);
}
@@ -3999,8 +3999,8 @@
* information specified by the user. Once interrupt services are
* available, the bus will be probed.
*/
-int32_t
-xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus)
+int
+xpt_bus_register(struct cam_sim *sim, device_t parent, uint32_t bus)
{
struct cam_eb *new_bus;
struct cam_eb *old_bus;
@@ -4013,7 +4013,7 @@
M_CAMXPT, M_NOWAIT|M_ZERO);
if (new_bus == NULL) {
/* Couldn't satisfy request */
- return (CAM_RESRC_UNAVAIL);
+ return (ENOMEM);
}
mtx_init(&new_bus->eb_mtx, "CAM bus lock", NULL, MTX_DEF);
@@ -4051,7 +4051,7 @@
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (status != CAM_REQ_CMP) {
xpt_release_bus(new_bus);
- return (CAM_RESRC_UNAVAIL);
+ return (ENOMEM);
}
xpt_path_inq(&cpi, path);
@@ -4070,7 +4070,7 @@
"No transport found for %d\n", cpi.transport);
xpt_release_bus(new_bus);
free(path, M_CAMXPT);
- return (CAM_RESRC_UNAVAIL);
+ return (EINVAL);
}
}
@@ -4099,7 +4099,7 @@
return (CAM_SUCCESS);
}
-int32_t
+int
xpt_bus_deregister(path_id_t pathid)
{
struct cam_path bus_path;
@@ -4108,7 +4108,7 @@
status = xpt_compile_path(&bus_path, NULL, pathid,
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (status != CAM_REQ_CMP)
- return (status);
+ return (ENOMEM);
xpt_async(AC_LOST_DEVICE, &bus_path, NULL);
xpt_async(AC_PATH_DEREGISTERED, &bus_path, NULL);
@@ -4117,7 +4117,7 @@
xpt_release_bus(bus_path.bus);
xpt_release_path(&bus_path);
- return (CAM_REQ_CMP);
+ return (CAM_SUCCESS);
}
static path_id_t
diff --git a/sys/cam/cam_xpt_sim.h b/sys/cam/cam_xpt_sim.h
--- a/sys/cam/cam_xpt_sim.h
+++ b/sys/cam/cam_xpt_sim.h
@@ -39,9 +39,9 @@
/* Functions accessed by SIM drivers */
#ifdef _KERNEL
-int32_t xpt_bus_register(struct cam_sim *sim, device_t parent,
- u_int32_t bus);
-int32_t xpt_bus_deregister(path_id_t path_id);
+int xpt_bus_register(struct cam_sim *sim, device_t parent,
+ uint32_t bus);
+int xpt_bus_deregister(path_id_t path_id);
u_int32_t xpt_freeze_simq(struct cam_sim *sim, u_int count);
void xpt_release_simq(struct cam_sim *sim, int run_queue);
u_int32_t xpt_freeze_devq(struct cam_path *path, u_int count);
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1506,8 +1506,7 @@
return (ENOMEM);
}
- error = xpt_bus_register(is->is_sim, NULL, 0);
- if (error != 0) {
+ if (xpt_bus_register(is->is_sim, NULL, 0) != 0) {
ISCSI_SESSION_UNLOCK(is);
ISCSI_SESSION_WARN(is, "failed to register bus");
iscsi_session_terminate(is);
diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c
--- a/sys/dev/smartpqi/smartpqi_cam.c
+++ b/sys/dev/smartpqi/smartpqi_cam.c
@@ -1204,7 +1204,7 @@
{
int max_transactions;
union ccb *ccb = NULL;
- cam_status status = 0;
+ int error;
struct ccb_setasync csa;
struct cam_sim *sim;
@@ -1231,9 +1231,9 @@
softs->os_specific.sim = sim;
mtx_lock(&softs->os_specific.cam_lock);
- status = xpt_bus_register(sim, softs->os_specific.pqi_dev, 0);
- if (status != CAM_SUCCESS) {
- DBG_ERR("xpt_bus_register failed status=%d\n", status);
+ error = xpt_bus_register(sim, softs->os_specific.pqi_dev, 0);
+ if (error != CAM_SUCCESS) {
+ DBG_ERR("xpt_bus_register failed errno %d\n", error);
cam_sim_free(softs->os_specific.sim, FALSE);
cam_simq_free(softs->os_specific.devq);
mtx_unlock(&softs->os_specific.cam_lock);
diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2129,11 +2129,11 @@
static void
umass_cam_detach_sim(struct umass_softc *sc)
{
- cam_status status;
+ int error;
if (sc->sc_sim != NULL) {
- status = xpt_bus_deregister(cam_sim_path(sc->sc_sim));
- if (status == CAM_REQ_CMP) {
+ error = xpt_bus_deregister(cam_sim_path(sc->sc_sim));
+ if (error == 0) {
/* accessing the softc is not possible after this */
sc->sc_sim->softc = NULL;
DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling "
@@ -2143,8 +2143,8 @@
sc->sc_sim->refcount, sc->sc_sim->mtx);
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
} else {
- panic("%s: %s: CAM layer is busy: %#x\n",
- __func__, sc->sc_name, status);
+ panic("%s: %s: CAM layer is busy: errno %d\n",
+ __func__, sc->sc_name, error);
}
sc->sc_sim = NULL;
}
diff --git a/sys/dev/vmware/pvscsi/pvscsi.c b/sys/dev/vmware/pvscsi/pvscsi.c
--- a/sys/dev/vmware/pvscsi/pvscsi.c
+++ b/sys/dev/vmware/pvscsi/pvscsi.c
@@ -1548,16 +1548,16 @@
{
if (sc->sim) {
- int32_t status;
+ int error;
if (sc->bus_path) {
xpt_free_path(sc->bus_path);
}
- status = xpt_bus_deregister(cam_sim_path(sc->sim));
- if (status != CAM_REQ_CMP) {
+ error = xpt_bus_deregister(cam_sim_path(sc->sim));
+ if (error != 0) {
device_printf(sc->dev,
- "Error deregistering bus, status=%d\n", status);
+ "Error deregistering bus, error %d\n", error);
}
cam_sim_free(sc->sim, TRUE);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 5:17 PM (21 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15771566
Default Alt Text
D30860.diff (5 KB)
Attached To
Mode
D30860: cam: fix xpt_bus_register and xpt_bus_deregister return errno
Attached
Detach File
Event Timeline
Log In to Comment