> Has a bug about this been filed with Apple yet?  I'm not sure if I'm qualified
> to file it myself, as I don't know the kernel interface well enough to even
> express what the correct behavior would be (although I know what consequences
> I'd like as an FS developer).
>
> Apple isn't exactly known for being willing to take suggestions.

No, I haven't filed a bug on this myself, but here's some background:

One of the file system vnode operations (vnops) on Mac OS X is
vnop_mmap(). If a kernel file system (like the kernel part of MacFUSE)
implements this operation, the kernel will call it. The issue is that
Mac OS X doesn't expect (or allow) the file system to ever fail this
operation. In "regular" file systems, this isn't ever an issue (mmap
itself is not expected to fail at the file system level, although
pageins or pageouts may later fail if there are hardware errors and
such), so nobody runs into this. With user-space file systems, it can
be an issue, as you seem to well understand.

The kernel function that calls the file system's mmap operation can be
found in xnu/bsd/kern/ubc_subr.c:

__private_extern__ int
ubc_map(vnode_t vp, int flags)
{
    ...
    /* call the underlying file system's mmap operation */
    error = VNOP_MMAP(vp, flags, ...);
    if (error != EPERM)
        error = 0;
    ...
}

So we see that all errors except EPERM are turned into "no errors".
This might give you hope that if I returned EPERM from MacFUSE's mmap
operation, it'll work, but no. That's because ubc_map() itself is
called by the mmap system call handler in xnu/bsd/kern/kern_mman.c in
the following way:

int
mmap(proc_t p, ...)
{
    ...
    (void)ubc_map(vp, file_prot);
    ...
}

That is, the error is ignored. Therein lies the issue.

As for Apple taking suggestions, yeah, they could well argue that Mac
OS X simply doesn't allow this, period.

You should also realize that direct_io isn't a fundamental feature of
Mac OS X--just because it's implemented in MacFUSE doesn't mean Apple
will gladly provide plumbing in the kernel to make it work in your
case. If MacFUSE were part of core Mac OS X, extending the kernel
would be more justifiable for Apple.

Amit
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"macfuse-devel" group.
To post to this group, send email to macfuse-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/macfuse-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to