The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cad5cfe7507e1b63f8898183da057aa1f0240e39
commit cad5cfe7507e1b63f8898183da057aa1f0240e39 Author: Warner Losh <i...@freebsd.org> AuthorDate: 2025-07-10 15:56:13 +0000 Commit: Warner Losh <i...@freebsd.org> CommitDate: 2025-07-10 16:17:00 +0000 cam: Use less stack space Use less stack space by using the specific type of ccb to do the callback. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D51215 --- sys/cam/cam_periph.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 833df6cfb99b..2cf1ef5f53ef 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -767,27 +767,31 @@ camperiphfree(struct cam_periph *periph) CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { - union ccb ccb; - void *arg; - - memset(&ccb, 0, sizeof(ccb)); switch (periph->deferred_ac) { - case AC_FOUND_DEVICE: - ccb.ccb_h.func_code = XPT_GDEV_TYPE; - xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); - xpt_action(&ccb); - arg = &ccb; + case AC_FOUND_DEVICE: { + struct ccb_getdev cgd; + + memset(&cgd, 0, sizeof(cgd)); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_action((union ccb *)&cgd); + periph->deferred_callback(NULL, periph->deferred_ac, + periph->path, &cgd); break; - case AC_PATH_REGISTERED: - xpt_path_inq(&ccb.cpi, periph->path); - arg = &ccb; + } + case AC_PATH_REGISTERED: { + struct ccb_pathinq cpi; + + xpt_path_inq(&cpi, periph->path); + periph->deferred_callback(NULL, periph->deferred_ac, + periph->path, &cpi); break; + } default: - arg = NULL; + periph->deferred_callback(NULL, periph->deferred_ac, + periph->path, NULL); break; } - periph->deferred_callback(NULL, periph->deferred_ac, - periph->path, arg); } xpt_free_path(periph->path); free(periph, M_CAMPERIPH);