Hi there!
We had need of ms-sys on FreeBSD, so we took the liberty of patching it up to support BSD.
I have no idea if you have any interest in supporting non-Linux platforms, but if you do, you can see the relevant changes at https://github.com/neosmart/ms-sys/commits/master
I’d be happy to close up shop if you wish to take these changes upstream. The patch mainly features two changes, #ifdefs for BLKGETSIZE on Linux and DIOCGFWSECTORS on FreeBSD (plus HDIO_GETGEO/DIOCGFWSECTORS and FDGETPRM), and changes to contains_data and write_data to buffer unaligned writes to physical disks (which aren’t really supported outside of Linux).
I absolutely despise #ifdef, so I’d understand if you’d really rather not.
Cheers,
Mahmoud Al-Qudsi
NeoSmart Technologies
Nice work!
I would not mind to support FreeBSD from the original upstream sources, but as I don't run FreeBSD myself future releases would then perhaps be released without being tested on FreeBSD.
Looking at your identify.c, I think that the #ifdefs are OK. Maybe I will add some comments to avoid that anyone in the future removes code that does not seem to do anything important on their OS.
The changes in file.c seem rather big, even though your current code might be compatible also with Linux I might prefer to use #ifdefs also in that file to keep the behavior as is when compiling on Linux.
It would be nice to support FreeBSD, but I also don't mind if you would prefer to have a forked version. Both soulutions have their advantages and disadvantages. Which would you prefer? To keep your fork as its own project or to have future ms-sys relases with included but untested FreeBSD support?
New releases of ms-sys are rather rare. Mostly some kind of new boot record is added. The important thing is that the different source files for boot records are not affected by the FreeBSD support. This fact will make things easier, both for releasing new ms-sys versions without first testing on both platforms and for keeping two forks in sync when new boot records are added.
It might be worth noting that even if I got myself a FreeBSD system for testing, I can't always test new functionality myself. Usually the person asking for a new boot record has to become the tester as I don't have the OS to boot. This could also mean that future functionality is relased without being tested on Linux.
Lower priority because of inactivity.
Thanks for your thoughts on the matter, and for being open to extending support to FreeBSD. I've created a new (temporary) branch with a tentative change to the code that restricts most of the read/write changes to FreeBSD only, keeping the direct non-page-aligned reads/writes on Linux. This is the current diff with the latest ms-sys: https://github.com/neosmart/ms-sys/compare/upstream...milder-linux?expand=1
I think if you're comfortable with the #ifdefs in identify.c that with these changes to file.c you'll find the patch a good candidate for upstreaming?
Thanks alot for your contribution! The FreeBSD support is now included in version 2.5.0 of ms-sys.
Thanks, Henrik!