A (Somewhat) Simple Example
Now that you’re familiar with the CAM subsystem, let’s work through some code. After that, I’ll detail the different CAM-related functions.
Example 14-1 is a SIM for a pseudo-HBA (taken from the mfi(4)
code base).
Note
Take a quick look at this code and try to discern some of its structure. If you don’t understand all of it, don’t worry; an explanation follows.
Example 14-1. mfi_cam.c
#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/selinfo.h> #include <sys/bus.h> #include <sys/conf.h> #include <sys/bio.h> #include <sys/malloc.h> #include <sys/uio.h> #include <cam/cam.h> #include <cam/cam_ccb.h> #include <cam/cam_debug.h> #include <cam/cam_sim.h> #include <cam/cam_xpt_sim.h> ...
Get FreeBSD Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.