git: 3a8271dc1d77 - stable/14 - CAM: Remove return value from xpt_path_sbuf()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Dec 2023 15:36:38 UTC
The branch stable/14 has been updated by mav:
URL: https://cgit.FreeBSD.org/src/commit/?id=3a8271dc1d77990861d30eaac0aa626de1c53053
commit 3a8271dc1d77990861d30eaac0aa626de1c53053
Author: Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2023-11-22 20:10:57 +0000
Commit: Alexander Motin <mav@FreeBSD.org>
CommitDate: 2023-12-06 15:34:38 +0000
CAM: Remove return value from xpt_path_sbuf()
It is wrong to call sbuf_len() on third-party sbuf. If that sbuf
has a drain function, it ends up in assertion. But even would it
work, it would return not newly written length, but the full one.
Searching through the sources I don't see this value used.
(cherry picked from commit 6332e0f1a4b34707654d6ae2cd3c1e8799970d0b)
---
sys/cam/cam_xpt.c | 11 ++++-------
sys/cam/cam_xpt.h | 4 ++--
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index c32cad2433b1..26e656fc5ff2 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -3746,19 +3746,18 @@ xpt_print(struct cam_path *path, const char *fmt, ...)
sbuf_delete(&sb);
}
-int
+char *
xpt_path_string(struct cam_path *path, char *str, size_t str_len)
{
struct sbuf sb;
- int len;
sbuf_new(&sb, str, str_len, 0);
- len = xpt_path_sbuf(path, &sb);
+ xpt_path_sbuf(path, &sb);
sbuf_finish(&sb);
- return (len);
+ return (str);
}
-int
+void
xpt_path_sbuf(struct cam_path *path, struct sbuf *sb)
{
@@ -3789,8 +3788,6 @@ xpt_path_sbuf(struct cam_path *path, struct sbuf *sb)
else
sbuf_printf(sb, "X): ");
}
-
- return(sbuf_len(sb));
}
path_id_t
diff --git a/sys/cam/cam_xpt.h b/sys/cam/cam_xpt.h
index 1276dd7b9b2e..dfedc1157e51 100644
--- a/sys/cam/cam_xpt.h
+++ b/sys/cam/cam_xpt.h
@@ -103,9 +103,9 @@ int xpt_path_comp(struct cam_path *path1,
struct cam_path *path2);
int xpt_path_comp_dev(struct cam_path *path,
struct cam_ed *dev);
-int xpt_path_string(struct cam_path *path, char *str,
+char * xpt_path_string(struct cam_path *path, char *str,
size_t str_len);
-int xpt_path_sbuf(struct cam_path *path, struct sbuf *sb);
+void xpt_path_sbuf(struct cam_path *path, struct sbuf *sb);
path_id_t xpt_path_path_id(struct cam_path *path);
target_id_t xpt_path_target_id(struct cam_path *path);
lun_id_t xpt_path_lun_id(struct cam_path *path);