On Wed, Dec 10, 2008 at 8:18 AM, Jason8 <[EMAIL PROTECTED]> wrote:
>
> Hi:
>
> Hi: Did I miss something in my implementation of a read-write file
> system? From the command line I can not overwrite a file. The finder
> works fine because it deletes the file first. My delegate calls are
> openFileAtPath (O_WRONLY) then releaseFileAtPath; no writeFileAtPath
> to fill in the data.
>
> yukon:~ Jason8$ echo "Moo" >/Volumes/myfs/j1
> yukon:~ Jason8$ echo "Moo" >/Volumes/myfs/j1
> -bash: /Volumes/myfs/j1: Operation not supported by device

I used the LoopbackFS reference file system and the new dtrace support
found in MacFUSE 2.0 to see what happens when you echo non-append to a
file. It looks like this:

-[GMUserFileSystem openFileAtPath:mode:userData:error:]: /bar, mode=0x1
-[GMUserFileSystem setAttributes:ofItemAtPath:userData:error:]: /bar,
userData=0x11a3d0, attributes={     NSFileSize = 0; }
-[GMUserFileSystem attributesOfItemAtPath:userData:error:]: /bar, userData=0x0
-[GMUserFileSystem attributesOfItemAtPath:userData:error:]: /bar, userData=0x0
-[GMUserFileSystem
writeFileAtPath:userData:buffer:size:offset:error:]: /bar,
userData=0x11a3d0, offset=0, size=4
-[GMUserFileSystem attributesOfItemAtPath:userData:error:]: /bar, userData=0x0
-[GMUserFileSystem releaseFileAtPath:userData:]: /bar, userData=0x11a3d0

You can see that the second operation is setting NSFileSize to 0. This
is essentially a truncate operation. If you are targeting MacFUSE 1.7
then you'll need to have implemented truncateFileAtPath:. However, at
this point I'd recommend using and targeting MacFUSE 2.0, in which
case you can get rid of truncateFileAtPath: and handle an NSFileSize
key in setAttributes:ofItemAtPath: as is happening above. I suspect an
error return from setAttributes:ofItemAtPath: might be what is messing
causing the problem?

In general, it is a good idea to recreate the scenario in the
reference LoopbackFS file system and use dtrace to see what is going
on in a working implementation. Here's what I did to do that.

mkdir /tmp/t
open LoopbackFS/build/Release/LoopbackFS.app
<select /tmp/t as the directory in the dialog that pops up>
echo "blah" > /Volumes/loop/bar
<from a terminal window, attach dtrace>
sudo dtrace LoopbackFS/loop.d > /tmp/dtrace.out
echo "blah" > /Volumes/loop/bar
<ctr-c the dtrace script and then sort by timestamp and dump output>
sort -n /tmp/dtrace.out

ted

>
> Append seems to work fine:
>
> yukon:~ Jason8 $ echo "Moo" >/Volumes/myfs/j1
> yukon:~ Jason8 $ echo "Moo" >>/Volumes/myfs/j1
> yukon:~ Jason8 $
>
>
> Permissions look good:
>
> yukon:~ Jason8 $ ls -la /Volumes/myfs/j1
> -rw-r--r--  1 Jason8  staff  8  9 Dec 22:58 /Volumes/myfs/j1
> yukon:~ Jason8 $
>
>
>
> >
>

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

Reply via email to