git: 50aa1daf1468 - main - cam: change xpt_clone_path to return int

Warner Losh imp at FreeBSD.org
Mon Jun 28 22:24:12 UTC 2021


The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=50aa1daf14688a6f85f324a8efa8708a25b46a86

commit 50aa1daf14688a6f85f324a8efa8708a25b46a86
Author:     Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-06-28 22:04:02 +0000
Commit:     Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-06-28 22:13:03 +0000

    cam: change xpt_clone_path to return int
    
    xpt_clone_path originally returned a cam_status, but it doesn't do I/O
    and should return an errno instead. I added it last year and it's only
    used in one place. It's not yet documented, so no doc changes are
    nneeded.
    
    Reviewed by:            scottl@, mav@
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D30884
---
 sys/cam/cam_xpt.c | 8 ++++----
 sys/cam/cam_xpt.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 016f0e6a38be..b76d6f5adde7 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -3669,14 +3669,14 @@ xpt_compile_path(struct cam_path *new_path, struct cam_periph *perph,
 	return (status);
 }
 
-cam_status
+int
 xpt_clone_path(struct cam_path **new_path_ptr, struct cam_path *path)
 {
 	struct	   cam_path *new_path;
 
 	new_path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_NOWAIT);
 	if (new_path == NULL)
-		return(CAM_RESRC_UNAVAIL);
+		return (ENOMEM);
 	*new_path = *path;
 	if (path->bus != NULL)
 		xpt_acquire_bus(path->bus);
@@ -3685,7 +3685,7 @@ xpt_clone_path(struct cam_path **new_path_ptr, struct cam_path *path)
 	if (path->device != NULL)
 		xpt_acquire_device(path->device);
 	*new_path_ptr = new_path;
-	return (CAM_REQ_CMP);
+	return (0);
 }
 
 void
@@ -4397,7 +4397,7 @@ xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg)
 		return;
 	}
 
-	if (xpt_clone_path(&ccb->ccb_h.path, path) != CAM_REQ_CMP) {
+	if (xpt_clone_path(&ccb->ccb_h.path, path) != 0) {
 		xpt_print(path, "Can't allocate path to send %s\n",
 		    xpt_async_string(async_code));
 		xpt_free_ccb(ccb);
diff --git a/sys/cam/cam_xpt.h b/sys/cam/cam_xpt.h
index c8494d04234a..b75025dbd4d3 100644
--- a/sys/cam/cam_xpt.h
+++ b/sys/cam/cam_xpt.h
@@ -138,7 +138,7 @@ cam_status		xpt_compile_path(struct cam_path *new_path,
 					 path_id_t path_id,
 					 target_id_t target_id,
 					 lun_id_t lun_id);
-cam_status		xpt_clone_path(struct cam_path **new_path,
+int			xpt_clone_path(struct cam_path **new_path,
 				      struct cam_path *path);
 
 void			xpt_release_path(struct cam_path *path);


More information about the dev-commits-src-all mailing list