Code Analysis
Example 6-1 provides a terse, source-level overview of nmdm(4)
.
Example 6-1. nmdm.c
#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/tty.h> #include <sys/conf.h> #include <sys/eventhandler.h> #include <sys/limits.h> #include <sys/serial.h> #include <sys/malloc.h> #include <sys/queue.h> #include <sys/taskqueue.h> #include <sys/lock.h> #include <sys/mutex.h> MALLOC_DEFINE(M_NMDM, "nullmodem", "nullmodem data structures"); struct nmdm_part { struct tty *np_tty; struct nmdm_part *np_other; struct task np_task; struct callout np_callout; int np_dcd; int np_rate; u_long np_quota; int np_credits; u_long np_accumulator; #define QS 8 /* Quota shift. */ }; struct nmdm_softc { struct ...
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.