Closed GoogleCodeExporter closed 9 years ago
Sorry about not responding earlier, but I've only recently managed to look at
this as a priority issue.
Also see:
http://groups.google.com/group/macfuse-devel/browse_thread/thread/b62bd1b823b94c
82/749bd5e87c43430b
I considered John Brisbin's solution. Although his implementation is nice, I
find the solution much too complex for the task at hand. It rewrites files on
the fly and also
requires the mount utility to be setuid root.
shadowofged: Your suggestion is simpler, but what it does is ugly and
potentially dangerous. There are parts of the kernel that do look at
f_fstypename of mount points,
although mostly they are checking to see if something is "hfs", "ufs", etc. So,
at the very least, one would have to police incoming file systems so that they
don't take over
"important" fstypenames. The implications might change in the future
too--there's no implicit or explicit understanding that one can overwrite this
field and nothing bad
will ever happen. Observing the current behavior is no guarantee. It's also
semantically incorrect: the vfs type *is* fusefs--just because a portion of the
file system stays in
user space doesn't mean it's not fusefs from the kernel's standpoint. If a
kernel-space or user-space program wants to do things to, say, all file systems
of type "xyz", that
program will use f_fstypename to figure things out. Since I don't control all
such programs (some of them come from Apple), I can't predict what might break,
if anything.
I thought of another approach--that of "simulating" the personality plist. The
per-file-system content within fusefs.fs's Info.plist will be dynamically
adjustable because
the file itself would be served by macfuse. At kext load time, macfuse will
"mount" an in-kernel auxiliary file system (nice to be in kernel so we don't
have to worry about
daemons dying) that would serve the Info.plist, and could possibly serve other
things such as mount status info, etc. ... somewhat akin to a proc file system.
The content of
this file could/would change dynamically as mounts/unmounts happen. So, for
example, a new FSName/FSSubType combination would just automagically appear in
this file
when a new user-space file system is mounted. I did implement this and it works
nicely, but the implementation is even more complex than John Brisbin's
solution above,
which I just said was "too complex". Therefore, I can't justify incorporating
this into macfuse.
As a compromise, I'll go with a slight variation of f_fstypename overwriting.
MacFUSE will have a '-o fstypename=<name>" argument. <name> can be at most 7
characters and at least 1 character. (I'm talking about the *type* name
here--not the
description string, which can be longer, like "PassThrough File System
(MacFUSE)".) This would cause the in-kernel f_fstypename to be "fusefs_<name>".
That is, the
"fusefs_" prefix will be implied and automatically added by the kernel. This
means a user-space file system that uses this option, say, to set its typename
to "foo", must
name its bundle "fusefs_foo.fs". The "-o fssubtype=<number>" option will
continue to exist and work--as expected, the system would look in fusefs_foo.fs
for subtypes.
The limit is 7 characters (and not 8) because the Finder is unhappy otherwise.
File systems that use this option will be subject to a general "this might
break things you
don't know about" warning.
A user-space file system that does not use this option will continue to see
"fusefs" as its f_fstypename. The current set of subtypes in the "main"
Info.plist will likely
continue to be there.
Original comment by si...@gmail.com
on 27 Sep 2007 at 7:48
I actually did read that thread before filing this bug. After grepping through
the publicly-available 10.4.9 xnu
sources, I see that my original proposal wouldn't work as expected. They use
strncpy() for syscalls, which
would (of course) fail to copy the hidden constant at the end of the
`f_fstypename` buffer. Given it's a small
buffer, I'm surprised the kernel didn't just do memcpy() on the whole buffer,
but that's immaterial now.
The only in-kernel uses of `f_fstypename` that I can find are checks for HFS
and UFS volumes, like you
mentioned. I understand the general "might break things warning," but it looks
pretty safe for now, yes? I
assume, from your comments, that changing this field had the desired effect
upon properly locating
filesystem bundles?
If so, that's good to know; thanks for the update and for considering/making
the changes.
Original comment by shadowof...@gmail.com
on 28 Sep 2007 at 5:27
Will be in the next release.
Original comment by si...@gmail.com
on 28 Sep 2007 at 6:20
Original issue reported on code.google.com by
shadowof...@gmail.com
on 19 Jul 2007 at 5:17