Index: sys/cam/cam_xpt.h =================================================================== --- sys/cam/cam_xpt.h +++ sys/cam/cam_xpt.h @@ -113,6 +113,7 @@ lun_id_t xpt_path_lun_id(struct cam_path *path); struct cam_sim *xpt_path_sim(struct cam_path *path); struct cam_periph *xpt_path_periph(struct cam_path *path); +device_t xpt_path_device(const struct cam_path *path); void xpt_print_path(struct cam_path *path); void xpt_print_device(struct cam_ed *device); void xpt_print(struct cam_path *path, const char *fmt, ...); Index: sys/cam/cam_xpt.c =================================================================== --- sys/cam/cam_xpt.c +++ sys/cam/cam_xpt.c @@ -5574,6 +5574,22 @@ } } +/** + * @brief Return the device_t associated with the path + * + * When a SIM is created, it registers a bus with a NEWBUS device_t. This is + * stored in the internal cam_eb bus structure. There is no guarnatee any given + * path will have a @c device_t associated with it (it's legal to call @c + * xpt_bus_register with a @c NULL @c device_t. + * + * @param path Path to return the device_t for. + */ +device_t +xpt_path_device(const struct cam_path *path) +{ + return (path->bus->parent_dev); +} + struct kv { uint32_t v;