aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2023-11-22 20:10:57 +0000
committerAlexander Motin <mav@FreeBSD.org>2023-12-06 15:34:38 +0000
commit3a8271dc1d77990861d30eaac0aa626de1c53053 (patch)
tree42cd6173f955ff41e952ec35770fae12df5addcc
parent285b505a4ee0ab2fdc8f970e7d23a6d3091dc686 (diff)
downloadsrc-3a8271dc1d77990861d30eaac0aa626de1c53053.tar.gz
src-3a8271dc1d77990861d30eaac0aa626de1c53053.zip
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)
-rw-r--r--sys/cam/cam_xpt.c11
-rw-r--r--sys/cam/cam_xpt.h4
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);