ref: a2ebe5c79a45a0f9ed35bbb690f5070cdfded3ad
parent: 4a83ce37c649dbcfb5a87c022aad626226904363
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Mar 31 13:49:10 EDT 2021
devfs: fix locking and ignore undocumented "fsdev:\n" configuration signature The confstr was shared between readers so seprintconf() could write concurrently to that buffer which is not safe. This replaces the shared static confstr[Maxconf] buffer with a pointer that is initially nil and a buffer that is alloced on demand. The new confstr pointer (and buffer) is now only updated while wlock()ed from the new setconfstr() function. This is now done by mconfig() / mdelctl() just before releasing the wlock. Now, rdconf() will check if confstr has been initialized, and test for it again while wlock()ed; making sure the configuration is read only once. Also, rdconf() used to check for a undocumented "fsdev:\n" string at the beginning of config data tho that was never documented. This changes mconfig() to ignore that particular signature so the example from the manpage will work as documented.