git: nvmm: Port to DragonFly #14: device & module operations

Aaron LI aly at crater.dragonflybsd.org
Tue Jul 20 16:30:18 PDT 2021


commit 990cf76b2a875d261b5d27ad7653d4779010c1b1
Author: Aaron LI <aly at aaronly.me>
Date:   Tue May 18 14:05:40 2021 +0800

    nvmm: Port to DragonFly #14: device & module operations
    
    Replace NetBSD 'cdevsw' and 'fileops' structs with our 'dev_ops' struct,
    and port NVMM to support both device open/close and module load/unload
    operations.
    
    NetBSD doesn't support cloning device, so it clones the file descriptor
    (fd_clone() function) of the opened device (/dev/nvmm) and reassociates
    it to the current process.  So that each process sees a separate
    instance of the device.  See also NetBSD 'sys/net/if_tap.c' for an
    example with detailed explanation on this mechansim.
    
    DragonFly supports per-file-descriptor data with the devfs cdevpriv API,
    which is much simpler than the method with autoclone device.
    
    Also credit to Jaromír Doleček for his porting work of NVMM to DragonFly.
    See: https://github.com/Moritz-Systems/DragonFlyBSD/commit/b96e5836fd25b448bb54775ac0107917adc2937d

Summary of changes:
 sys/dev/virtual/nvmm/nvmm.c | 244 +++++++++++++++-----------------------------
 1 file changed, 83 insertions(+), 161 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/990cf76b2a875d261b5d27ad7653d4779010c1b1


-- 
DragonFly BSD source repository


More information about the Commits mailing list