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 incorrect fsid in 9P2000.L statfs response #119

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

garlick
Copy link
Member

@garlick garlick commented Jan 12, 2025

Problem: the remote fsid returned in Rstatfs is incorrect.

I botched the construction of fsid from fsid_t f_fsid (an array of two integers whose size can vary across platforms) when building Rstatfs.

Just use statvfs(3) instead, which returns f_fsid as a single integer. It's more portable than statfs(2) so some ifdefs that cover BSD/linux differences can go away.

Note that statfs(2) still has to be called to get the file system type if the statfs-passthrough option is configured, but f_type seems to be portable across platforms.

@garlick garlick changed the title fix incorrect fsid in 9P statfs response fix incorrect fsid in 9P2000.L statfs response Jan 12, 2025
Copy link
Member

@grondo grondo left a comment

Choose a reason for hiding this comment

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

👍

Problem: the description of Rstatfs suggests that an implementation
should call statfs(2), but it can now be satisfied with statvfs(3) in
a more portable manner.

Just refer to statvfs(3).  Don't quote structs as that's available
elsewhere.
Problem: the remote fsid returned by Tstatfs is incorrect.

I botched the construction of fsid from fsid_t (an array of two variable
size integers) when building the response to Tstatfs.

Just use statvfs(3) instead, which returns the fsid as a single number.
It's more portable than statfs(2) so some ifdefs that cover BSD/linux
differences can go away.

Note that statfs(2) still has to be called to get the file system type
if the "statfs-passthrough" option is configured, but f_type seems to be
portable across platforms.

Fixes chaos#32
Fixes chaos#115
@mergify mergify bot merged commit 4e59170 into chaos:master Jan 13, 2025
5 checks passed
@garlick garlick deleted the issue#115 branch January 13, 2025 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants