Freebsd server support
Hola! Here's a first pass at FreeBSD support for the server. I see much of your fs.cpp code (in particular) is borrowed from ethersrv, so my changes here are lifted from the ethersrv-linux-866 fork, which very recently also merged FreeBSD support.
The very last function in fs.cpp is particularly ugly, I think - please take a look to see if it makes sense.
The code builds and runs; I'll be testing with an actual DOS machine tomorrow (I can't get DOSBox to talk to it, but that's very certainly a DOSBox problem since SLIRP only supports TCP (I think)).
Thank you. I'll look into it.
I also don't like the feature containing a Linux specific ioctl to test if it is a FAT fs. And I'm thinking how to store FAT attributes on a non FAT filesystem. I'm considering using extended attributes (or somehow mapping FAT attributes to existing POSIX - if that makes sense).
But right now, robustness of data transfer is a higher priority for me. Therefore, I am preparing modifications to the DOS client to better utilize the network and survive more network problems. Attribute mapping will come later.
Cool, yeah. I am not sure how important attribute mapping would be, but others may be using this very differently than I am :)
How are you handling long filenames? etherdfs (the fork I'm using) has some conversion but it's over-simplifying, resulting in duplicate 8.3-filenames when the first 8 chars are the same. This in turn means I can only ever access the first of them.
I suggested (on that project's GH) to look at dosbox or even FreeBSD's long-to-short translation code, which is pretty much as close to win95/98 as you can get - at least enough to be compatible.
See https://cgit.freebsd.org/src/tree/sys/fs/msdosfs/msdosfs_conv.c?id=ef777be98543f7daae90bd123d4fc1ec4a54efc2#n287, for example.
I'm considering using extended attributes (or somehow mapping FAT attributes to existing POSIX - if that makes sense).
Dosemu2 reused the Samba projects idea of using xattrs to store them (Simple hex not the NDR encoded version that appeared later). See https://linux.samba.narkive.com/Fp5PRGtD/samba-meaning-of-user-dosattrib.
Tempting as it may be, and others have tried (including original Dosemu), mapping DOS attrs to POSIX file attrs always seems to end up with undesirable effects when trying to manage files back on the Unix system.
I have released a new version of the NetMount server, version 1.5.0: https://github.com/jrohel/NetMount/releases/tag/client-v1.5.0%2Cserver-v1.5.0. It supports storing DOS attributes on Linux, FreeBSD, and Windows. DOS attributes can now be stored using either native file system support or extended attributes. This allows DOS attributes to be stored even on file systems that do not natively support them, as long as they support extended attributes.
Originally, I wanted to be compatible with other programs - WINE, SAMBA. Unfortunately, even though they store DOS attributes in the same extended attribute, each of them does it differently. So I chose a different attribute name to avoid conflicts.
@ltning I'm sorry, but I’m going to close this PR. As I mentioned earlier, I released a new version of the NetMount server with significantly improved support for DOS attributes - including the ability to store them on FreeBSD. This now works not only on the native msdosfs file system, but also via extended attributes on other file systems that support them.