Page MenuHomeFreeBSD

special-case getvfsbyname(3) for fusefs(5)
ClosedPublic

Authored by asomers on Jul 23 2019, 10:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 12:10 AM
Unknown Object (File)
Thu, May 2, 12:10 AM
Unknown Object (File)
Wed, May 1, 11:18 PM
Unknown Object (File)
Wed, May 1, 10:30 PM
Unknown Object (File)
Mon, Apr 29, 11:45 PM
Unknown Object (File)
Jan 14 2024, 5:21 PM
Unknown Object (File)
Dec 21 2023, 6:14 PM
Unknown Object (File)
Dec 20 2023, 1:41 PM
Subscribers

Details

Summary

special-case getvfsbyname(3) for fusefs(5)

fusefs file systems may have a fsname subtype (set by mount_fusefs's "-o
subtype" option) that gets appended to the fsname as returned by statfs(2).
The subtype is set on a per-mount basis so it isn't part of the struct
vfsconf. Special-case getvfsbyname to match either the full "fusefs.foobar"
or short "fusefs" fsname.

This is a merge of r348007, r348054, and r350093 from projects/fuse2

Test Plan
  1. Mount a subtyped fusefs by doing:

fuse-ext2 /dev/vtbd2 /mnt -o subtype=ext2

  1. List it with:

lsvfs -t fusefs
lsvfs -t fusefs.ext2

Both commands should succeed

Diff Detail

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

Event Timeline

lib/libc/gen/getvfsbyname.c
55 ↗(On Diff #60067)

I would say that strcmp() success excludes a possibility to match e.g. "fusefs.foo" string. Did you mean '||' instead of '&&' ?

82 ↗(On Diff #60067)

I do not like this change. I suggest you to add a new flag to vfsflag e.g. VFCF_FUSE, and only match using are_fusefs() when the VFCF_FUSE flag is set on xvfsconf.

As it is implemented, it is too open-ended IMO.

lib/libc/gen/getvfsbyname.c
55 ↗(On Diff #60067)

No, && is correct because strncmp and strcmp are validating different arguments. The purpose of the loop at line 81 is to match an actual file system's name with the name in a static list. But when using -o subtype, the filesystem's name won't be in the list. So are_fusefs matches something like fusefs.ext2 with the fusefs in the static list.

82 ↗(On Diff #60067)

I don't understand your objection. Are you concerned that there's some scenario where are_fusefs will wrongly match?

kib added inline comments.
lib/libc/gen/getvfsbyname.c
55 ↗(On Diff #60067)

I see, thank you for the explanation.

82 ↗(On Diff #60067)

I am concerned that we add matching of vfc by regexp, while we can instead do it precisely without introducing a fuzzy logic.

But in fact getvfsbyname(3) has very limited usage. so ignore me.

This revision is now accepted and ready to land.Jul 24 2019, 4:11 PM
This revision was automatically updated to reflect the committed changes.