Bug 268610

Summary: mounting cdevs as regular vnodes
Product: Base System Reporter: Yakov Galka <ybungalobill>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: ybungalobill
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
prototype implementation none

Description Yakov Galka 2022-12-28 06:33:04 UTC
Created attachment 239079 [details]
prototype implementation

FreeBSD does not implement filesystem caching for i/o done on cdevs. This makes i/o slow when done on raw devices, and renders impossible to mmap a cdev (which is supported by some other OSes).

I'm attaching my implementation of a 'rawfs' filesystem:

    mount -t rawfs /dev/xxx /mnt

then i/o on /mnt will be fully buffered, while giving a read-only view of the raw data on the device.

This can be seen as an inverse of `mdconfig`.

If there's an interest in including this functionality in the base system, please review the attached code. As it's evident, I had no prior experience working with FreeBSD kernel code, so any comments are welcome.