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

sys/mnttab.h: include sys/stat.h for stat64 #10195

Merged
merged 1 commit into from
Apr 14, 2020
Merged

Conversation

alaviss
Copy link
Contributor

@alaviss alaviss commented Apr 11, 2020

Motivation and Context

Currently building ZFS on a musl-libc based system yield this error:

os/linux/getmntany.c:106:1: error: conflicting types for 'getextmntent'
getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
^
../../lib/libspl/include/os/linux/sys/mnttab.h:75:12: note: previous declaration is here
extern int getextmntent(const char *path, struct extmnttab *mp,
           ^
1 error generated.

This is due to musl <sys/stat.h> defines stat64 as a macro.

Description

Includes <sys/stat.h> directly from linux/sys/mnttab.h to get the correct struct stat64.

How Has This Been Tested?

Successfully built and run on my system.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

Musl libc defined `stat64` as a macro, which causes the build to fail
upon compiling os/linux/getmntany.c due to conflicts between the forward
declaration and the implementation.

This commit fixes that by including <sys/stat.h> in "sys/mnttab.h"
directly.

Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
@codecov-io
Copy link

Codecov Report

Merging #10195 into master will decrease coverage by 14.16%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10195       +/-   ##
===========================================
- Coverage   79.48%   65.32%   -14.17%     
===========================================
  Files         387      306       -81     
  Lines      123388   106101    -17287     
===========================================
- Hits        98079    69312    -28767     
- Misses      25309    36789    +11480     
Flag Coverage Δ
#kernel ?
#user 65.32% <ø> (-0.79%) ⬇️
Impacted Files Coverage Δ
lib/libspl/include/os/linux/sys/mnttab.h 100.00% <ø> (ø)
module/zfs/objlist.c 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/pathname.c 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_redact.h 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_traverse.h 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/zfs_rlock.c 0.00% <0.00%> (-96.36%) ⬇️
module/lua/ltablib.c 2.34% <0.00%> (-95.32%) ⬇️
module/zfs/bqueue.c 0.00% <0.00%> (-94.45%) ⬇️
module/zcommon/zfs_deleg.c 0.00% <0.00%> (-92.46%) ⬇️
module/zfs/dmu_diff.c 0.00% <0.00%> (-87.88%) ⬇️
... and 238 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20f2878...0e52d3b. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) Type: Building Indicates an issue related to building binaries labels Apr 13, 2020
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Thanks!

@behlendorf behlendorf merged commit 6b1139e into openzfs:master Apr 14, 2020
@alaviss alaviss deleted the musl branch April 16, 2020 18:41
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
Musl libc defined `stat64` as a macro, which causes the build to fail
upon compiling os/linux/getmntany.c due to conflicts between the forward
declaration and the implementation.

This commit fixes that by including <sys/stat.h> in "sys/mnttab.h"
directly.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
Closes openzfs#10195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested) Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants