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.
This commit is contained in:
Alexander Motin
2023-11-22 15:10:57 -05:00
parent 7fa08d4152
commit 6332e0f1a4
2 changed files with 6 additions and 9 deletions
+4 -7
View File
@@ -3743,19 +3743,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)
{
@@ -3786,8 +3785,6 @@ xpt_path_sbuf(struct cam_path *path, struct sbuf *sb)
else
sbuf_printf(sb, "X): ");
}
return(sbuf_len(sb));
}
path_id_t
+2 -2
View File
@@ -102,9 +102,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);