Page MenuHomeFreeBSD

Move mntopts(3) suppport into libutil
ClosedPublic

Authored by brooks on Apr 21 2025, 10:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 29, 7:39 AM
Unknown Object (File)
Mon, Jul 28, 1:06 PM
Unknown Object (File)
Mon, Jul 28, 11:27 AM
Unknown Object (File)
Sun, Jul 27, 10:23 AM
Unknown Object (File)
Fri, Jul 25, 11:17 PM
Unknown Object (File)
Thu, Jul 24, 11:50 PM
Unknown Object (File)
Thu, Jul 24, 10:37 AM
Unknown Object (File)
Mon, Jul 21, 11:27 AM

Details

Summary

Many programs use this functionality so it should be available centrally
rather than compiled into each program independently. This has the
modest downside of adding libutil dependencies to some mount_<foo>
programs, but many (plus mount(8)) already have those depndencies so
this shouldn't be a major imposition.

In commit 906c312bbf74, Kirk said this could be done once the change was
merged to FreeBSD 13. That happened in commit 668dfa016698 in January 2023.

While here perform related tidying including removing SRCS where the
only entry is ${PROG}.c rendering it unnecessary.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 63640
Build 60524: arc lint + arc unit

Event Timeline

Apart from the nits, LGTM!

lib/libutil/Makefile
51

Somewhere above here, you should also add mntopts.3 to MAN ?

sbin/mount_nfs/Makefile
3

In D49958 I also moved mounttab.c to a common location, but we may want to do that in a follow-up review. I guess it could go into libutil as well.

This revision is now accepted and ready to land.Apr 22 2025, 5:25 PM

Another minor remark, in D49958 I added include guards to mntopts.h. Since the header is now actually installed, I think it would be proper to do so here too.

  • actually install the manpage
  • add guards to header
This revision now requires review to proceed.Apr 22 2025, 5:58 PM
emaste added inline comments.
lib/libutil/mntopts.3
376

IMO either "part of the libutil library." or "part of libutil."

sbin/mksnap_ffs/Makefile
5

Perhaps note "Related tidying" or such in the commit message (the outright removal of SRCS gave me very momentary pause).

This revision is now accepted and ready to land.Apr 22 2025, 6:05 PM
brooks marked an inline comment as done.
brooks added inline comments.
lib/libutil/mntopts.3
376

I'm on the fence here. I agree a plain reading of the source doesn't want the "the", but .Lb refers this as:

As of FreeBSD 15.0 they are part of the System Utilities Library (libutil, -lutil).

which I find awkward without the "the".

sbin/mksnap_ffs/Makefile
5

Updated the review description and local commit message.

lib/libutil/mntopts.3
376

Isn't that really just because Lb isn't intended for this kind of use, it's for the synopsis? AFAICT we normally use Nm for this kind of inline library naming.

brooks marked an inline comment as done.

getmntopts.c -> mntopts.c to match header and manpage.

This revision now requires review to proceed.Apr 22 2025, 6:26 PM

Use Nm to render libutil in HISTORY

emaste added inline comments.
lib/libutil/mntopts.3
376

Oh, I didn't notice the .Lb and agree that with .Lb, it belongs.

Using .Lb like this could be awkward or beneficial, e.g. src.conf(5) has

WITHOUT_GOOGLETEST
        Neither build nor install GoogleMock library (libgmock, -lgmock),
        GoogleTest library (libgtest, -lgtest), and dependent tests.

IMO having -lgmock and -lgtest in that sentence is a negative, but mentioning both "GoogleMock library" and "libgmock", and both "GoogleTest library" and "libgtest" seems valuable.

In this sort of context (library/function history) we seem to have instances of both .Nm libfoo and .Lb libfoo e.g. "the ... interface was added to .Nm libarchive 2.6" (archive_read_disk.3) or "reimplemented ... using the .Lb libarchive and the .Lb libelf" (ar.1).

I'm fine with it either way.

This revision is now accepted and ready to land.Apr 22 2025, 6:40 PM
This revision was automatically updated to reflect the committed changes.