cam: add xpt_path_sim_device to return device_t associated with a path
Return the device associated with the sim's bus when it called xpt_bus_register, if any. Most real SIMs in the tree set this device, but some virtual ones do not have a device_t assocaited with them. Reviewed by: scottl@, mav@ (earlier version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30853
This commit is contained in:
parent
9f1e411ae8
commit
1ed4016267
@ -5574,7 +5574,23 @@ camisr_runqueue(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct kv
|
||||
/**
|
||||
* @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_sim_device(const struct cam_path *path)
|
||||
{
|
||||
return (path->bus->parent_dev);
|
||||
}
|
||||
|
||||
struct kv
|
||||
{
|
||||
uint32_t v;
|
||||
const char *name;
|
||||
|
@ -113,6 +113,7 @@ target_id_t xpt_path_target_id(struct cam_path *path);
|
||||
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_sim_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, ...);
|
||||
|
Loading…
x
Reference in New Issue
Block a user