Page MenuHomeFreeBSD

fix kernel linking without FFS
ClosedPublic

Authored by glebius on Jun 15 2020, 6:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 22 2024, 1:44 PM
Unknown Object (File)
Dec 20 2023, 4:14 AM
Unknown Object (File)
Oct 14 2023, 9:11 AM
Unknown Object (File)
Oct 12 2023, 11:16 AM
Unknown Object (File)
Sep 9 2023, 2:03 AM
Unknown Object (File)
Jul 20 2023, 6:54 AM
Unknown Object (File)
Jul 3 2023, 5:46 AM
Unknown Object (File)
Jul 1 2023, 2:52 AM
Subscribers

Details

Summary

In r361491 regression was introduced: a kernel without optios FFS,
but with GEOM_LABEL would not link. The reason is that ffs_subr.c
might be used outside of FFS module.

This patch moves several functions from ffs_subr.c to ffs_vfsops.c.
There are no functional changes inside.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

chs added a reviewer: mckusick.

Gleb asked me to commit this so that git blame will still blame me. :-)
The diff looks fine to me, adding kirk as a reviewer also.

This revision is now accepted and ready to land.Jun 16 2020, 4:46 PM

Rather than moving all these functions from a file in which they logically belong to one in which they do not, how about we just put #ifdef FFS around the _KERNEL part. This produces minimal changes, leaves things where they logically belong, and reduces the size of the extra copy of ffs_subr.o.

Why do these functions logically belong to ffs_subr? The ffs_load_inode() definitely belongs to ffs_vfsops since it is used only there and with the change it becomes static. Other moved functions are associated with unmounting, which IMHO also belongs to vfsops rather than to subr. What else outside of real FFS code is going to use them? AFAIU, the code that is ffs_subr is something that is shared between real FFS, non-kernel code and GEOM_LABEL.

On further though, I agree with you that ffs_subr.c should only be shared functions.

My new proposal is to move all of the _KERNEL functions in ffs_subr.c to ffs_vfsops.c. My new rationale is that they are either used only in ffs_vfsops.c (ffs_blkatoff, ffs_load_inode, ffs_check_blkno) or they are the new functions that have to do with forcible unmounting which is in the purview of ffs_vfsops.c. It would let you declare ffs_blkatoff, ffs_load_inode, and ffs_check_blkno as static and drop them from ffs_extern.h.