Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NFS detection on the BSDs #411

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

seanm
Copy link
Contributor

@seanm seanm commented Oct 16, 2023

  • on the BSDs, look at the f_fstypename field to determine file system type, as this is the documented way to do that. The sqlite codebase also does so for macOS notably.
  • removed dead code in the Windows case

@github-actions
Copy link
Contributor

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

Copy link
Contributor

@mathstuf mathstuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. Though I'll note that it looks like Windows does support NFS: https://learn.microsoft.com/en-us/windows-server/storage/nfs/nfs-overview

Something for the future where someone cares enough about it to add detection here.

- on the BSDs, look at the f_fstypename field to determine file system type, as this is the documented way to do that. The sqlite codebase also does so for macOS notably.
- removed dead code in the Windows case
@seanm seanm force-pushed the statfs-improvements branch from c64b639 to d0c14d7 Compare October 16, 2023 13:46
@seanm
Copy link
Contributor Author

seanm commented Oct 16, 2023

I have read the CLA Document and I hereby sign the CLA

return (0 == ::strcmp("nfs", stat_fs.f_fstypename));
#else
/* linux statfs defines that 0x6969 is NFS filesystem */
return (stat_fs.f_type == 0x6969);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that the #define NFS_FS be used here. Many static analyzers complain about magic numbers. I realize that the define would be used in exactly one place and that there are many other magic numbers throughout the code base, but ...

@gsjaardema
Copy link
Member

Seems fine. Though I'll note that it looks like Windows does support NFS: https://learn.microsoft.com/en-us/windows-server/storage/nfs/nfs-overview

Something for the future where someone cares enough about it to add detection here.

Agreed. There seem to be many more uses on Windows systems, so code should be added instead of just "punting..."

@gsjaardema gsjaardema merged commit 0369822 into sandialabs:master Oct 16, 2023
50 of 51 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants