On Mon, Dec 1, 2008 at 8:00 AM, iDeveloper <[EMAIL PROTECTED]> wrote: > > Hi Ted > > I got the read to work along with copying files from the FS to the > local file system, both through Finder and the command line.
Great. > I have implemented the setAttributes:ofItemAtPath method, but I > noticed it is only called once or twice and that too for files created > by finder. Yes, this won't be called that often. It is called when something is updating an attribute of your file, for example 'chmod', 'chown', 'utimes', etc. If you are using the developer release of MacFUSE then you will see that it is also called when the file is 'truncated'. > What should I have in setAttributes? Aren't we setting the attributes > for files in attributesOfItemAtPath. At present I'm just returning a > YES in setAttributes Think of it this way. In attributesOfItemAtPath you are reporting on the attributes of a file or directory. This is a "read" operation. The system is reading what the current attributes for the file are. With setAttributes you are setting the attirbutes of a file or directory in your file system. This is a "write" operation. The system is setting something about your file, and so your file system needs to update the file accordingly. Returning YES without doing anything else is claiming that you are updating the file when you actually aren't. It is recommended that you actually see what attributes are being set and update your files as necessary. In some cases it does work to satisfy the Finder to just return YES, but this can lead to strange issues down the road that are hard to debug. Think of it as 'chmod' claiming success but not actually chmod'ing the file. > > What should be my next step for implementing the write function? It would be a good idea to implement setAttributes fully, as described above. What version of MacFUSE are you targeting? ted > > Thanks. > > On Nov 19, 10:48 pm, "ted bonkenburg" <[EMAIL PROTECTED]> wrote: >> On Wed, Nov 19, 2008 at 5:53 AM, iDeveloper <[EMAIL PROTECTED]> wrote: >> >> > Hi >> >> > Thanks for the tips Ted. Was successfully able to create a read-only >> > file system with all the files opening and showing up properly. >> > Now I'm trying to make it a read-write. For starters, I'm setting a >> > 511 posix permission for all files and have implemented the >> > createDirectoryAtPath, createFileAtPath and copyItemAtPath methods. >> >> There is no copyItemAtPath: delegate method. You should be looking in >> the GMUserFileSystem.h header file that is installed as part of >> MacFUSE.framework to see what delegate methods are supported. Many of >> the methods are similar to the NSFileManager methods to make it a bit >> easier to understand what they are supposed to do, but they don't >> correspond exactly. In particular, the delegate methods that you >> implement should return errors in the posix domain and should behave >> more like their BSD equivalent calls than the NSFileManager ones. If >> you read the GMUserFileSystem.h header file carefully it should >> explain things. >> >> For write support you'll need to implementsetAttributes:ofItemAtPath: >> as well as writeFileAtPath: and probably other delegate methods that >> I'm forgetting. >> >> > But when I try to copy a file in another directory of the same file >> > system it gives a prompt for insufficient permissions and copying a >> > file from the FS to a local directory does a copy operation after >> > which the copied file just disappears! >> > Do I need to do anything more than setting permission as 511 and >> > implementing the above said methods for doing a copy? >> >> It sounds like you are testing through the Finder. Again, I recommend >> you get things working on the command line first. Try to get these >> commands working from the command-line first: >> >> touch <path_to_file_on_fs> >> echo "blah" > <path_to_file_on_fs> >> echo "blahblah" >> <path_to_file_on_fs> >> rm <path_to_file_on_fs> >> rmdir <path_to_dir_on_fs> >> >> ted >> >> >> >> > On Nov 18, 10:22 pm, "ted bonkenburg" <[EMAIL PROTECTED]> wrote: >> >> On Tue, Nov 18, 2008 at 5:00 AM, iDeveloper <[EMAIL PROTECTED]> wrote: >> >> >> > Hi. >> >> >> > I was finally able to display the contents in the root. Can someone >> >> > please tell me if contentsOfDirectoryAtPath is/should be called >> >> > everytime a user clicks on an item marked as a Directory? Or rather, >> >> > when is it called? >> >> > If I have multiple directories and I want to get their contents only >> >> > after the user double-clicks on one of them, how should I implement >> >> > contentsOfDirectoryAtPath and attributesOfItemAtPath? What is the >> >> > order in which they are called? >> >> >> MacFUSE is not a Finder plugin; you are implementing a real file >> >> system, so you need to think beyond the Finder. Your >> >> contentsOfDirectoryAtPath: will be called frequently. You may see >> >> accesses to files in a directory when there was no >> >> contentsOfDirectoryAtPath: call. There is no strict order on when >> >> these will be called. The Finder, other applications, and even parts >> >> of the OS that would would not expect may be requesting directory >> >> contents or file attributes on your file system at any time. They will >> >> even do this for files and directories that don't exist. >> >> >> If you mount your file system with the "debug" option then the fuse >> >> library will spit out messages that correspond with file system >> >> operations as they occur. That can be somewhat useful. >> >> >> When writing a file system, I typically start off by avoiding the >> >> Finder and using the Terminal to navigate my file system until I get >> >> that working perfectly. Basically, you want to start off by getting >> >> simple commands like: >> >> >> ls <path_on_your_fs> >> >> ls -l <path_on_your_fs> >> >> stat <path_on_your_fs> >> >> cat <path_to_file_on_your_fs> >> >> >> If you debug and get these basic operations working well then you can >> >> start trying to work well with the Finder. Working well with the >> >> Finder is not an easy task; the Finder has all sorts of interesting >> >> file access patterns and is very picky that your file system is >> >> returning the proper errors and behaving as much like a "standard" >> >> file system as possible. This is much easier to do for a read-only >> >> file system, so that is usually the best way to start. >> >> >> Best of luck! >> >> >> ted >> >> >> > On Nov 18, 2:01 pm, iDeveloper <[EMAIL PROTECTED]> wrote: >> >> >> Hi Ted >> >> >> >> I added the ro option back. The ytfs example creates an empty >> >> >> dictionary for nodes that exist in the videos_ dictionary. Shouldn't >> >> >> we be returning attributes specified in the .h file (File type, size >> >> >> etc) >> >> >> Can you please point me to an example/documentation which explains the >> >> >> methods and their implementation in detail. >> >> >> The GMUserFIleSystem specifies pretty much all the documentation. But >> >> >> an example implementing this might be helpful. I tried running the >> >> >> LoopbackFS example. But as soon as I select a directory, it gives an >> >> >> alert saying >> >> >> >> Internal fuse error (rc=1) while attempting to mount the file system. >> >> >> For now, the best way to diagnose is to look for error messages using >> >> >> Console. >> >> >> mount_fusefs: failed to mount /Volumes/loop@/dev/fuse0: Socket is not >> >> >> connected >> >> >> >> And thats where I'm stuck! >> >> >> >> On Nov 18, 1:12 pm, "ted bonkenburg" <[EMAIL PROTECTED]> wrote: >> >> >> >> > On Mon, Nov 17, 2008 at 10:44 PM, iDeveloper <[EMAIL PROTECTED]> >> >> >> > wrote: >> >> >> >> > > Hi Ted >> >> >> >> > > Thanks for the quick response. YTFS works fine. There is no problem >> >> >> > > with running that example. I've just modified it at some places, >> >> >> > > like >> >> >> > > removing the ro option, returning my icns file from iconDataAtPath >> >> >> > > and >> >> >> > > returning an array with the folder names in my directory. I've not >> >> >> > > made any other changes to the code. >> >> >> >> > It is good to hear that ytfs is working for you. >> >> >> >> > > Removed the ro option as I wanted it to be a read-write system. >> >> >> >> > If you want to create a write-able file system then you really need >> >> >> > to >> >> >> > properly implement almost all of the GMUserFileSystemOperations >> >> >> > informal protocol methods. In addition, you'll need to be thorough >> >> >> > and >> >> >> > make sure that your operations behave properly by returning proper >> >> >> > errors, filling in a complete set of attributes in >> >> >> > attributesOfItemAtPath:, etc. >> >> >> >> > For this reason, I suggest you get your file system working well in >> >> >> > read-only mode before you tackle write support. >> >> >> >> > ted >> >> >> >> > > Thanks again >> >> >> >> > > On Nov 18, 9:12 am, "ted bonkenburg" <[EMAIL PROTECTED]> wrote: >> >> >> > >> On Mon, Nov 17, 2008 at 8:13 AM, iDeveloper <[EMAIL PROTECTED]> >> >> >> > >> wrote: >> >> >> >> > >> > Hi >> >> >> >> > >> > I'm trying to create a file system using the ytfs example as >> >> >> > >> > the base. >> >> >> > >> > But nothing seems to be working with my code! The icns file >> >> >> > >> > doesn't >> >> >> >> > >> Did you get ytfs working? If not, did you follow the tutorial >> >> >> > >> exactly? >> >> >> > >> Specifically, did you follow the part that recommended that you >> >> >> > >> check >> >> >> > >> out the 1.5 tag for the YTFS example? >> >> >> >> > >> svn >> >> >> > >> checkouthttp://macfuse.googlecode.com/svn/tags/macfuse-1.5/filesystems-objc/y... >> >> >> > >> ytfs >> >> >> >> > >> The head ytfs-tutorial is updated to reflect changes to the >> >> >> > >> Objective-C API that may be in the next MacFUSE release. >> >> >> >> > >> > show up, the file system doesn't dismount on stopping the >> >> >> > >> > project and >> >> >> > >> > I can't see any of the files in my directory :( >> >> >> >> > >> Ok, these are a lot of problems at once. I'll wait until I hear >> >> >> > >> if you >> >> >> > >> got ytfs working as it is supposed to work first. >> >> >> >> > >> > I am getting files from a web-service, have removed the ro >> >> >> > >> > option and >> >> >> > >> > returning attribute dictionary for both root dir and files. But >> >> >> > >> > I >> >> >> >> > >> Removing the "ro" option is not a good idea until >> >> >> >> > >> > still don;t see anything in the root dir! And if I try to import >> >> >> > >> > MacFUSE.h instead of GMUserFileSystem.h, I get an error "No >> >> >> > >> > such file >> >> >> > >> > or directory" >> >> >> > >> > I am using MacFUSE 1.7. I've included the MacFUSE.framework >> >> >> > >> > file in >> >> >> > >> > the project but I don't see a MacFUSE.h in the headers! >> >> >> >> > >> MacFUSE.h is not present in 1.7. It is new and should be present >> >> >> > >> in >> >> >> > >> the next release of MacFUSE. >> >> >> >> > >> It sounds to me like maybe you have checked out the current >> >> >> > >> development tree rather than a 1.5 or 1.7 tag, which will work >> >> >> > >> better >> >> >> > >> when working off one of the example Objective-C file systems. >> >> >> >> > >> If you want to be forward-thinking in your work, then you can >> >> >> > >> develop >> >> >> > >> against (and help test) the developer releases. If so, then please >> >> >> > >> read: >> >> >> >> > >>http://code.google.com/p/macfuse/wiki/AUTOINSTALL >> >> >> >> > >> ted >> >> >> >> > >> > Please help! > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
