From: Kent Sibilev Date: 2005-10-30T05:18:58+09:00 Subject: Re: [ANN] FuseFS-0.5 Thank you. I've been playing with new raw API and I've found it somewhat broken. Please consider this diff: RCS file: /var/cvs/fusefs/fusefs/ext/fusefs_lib.c,v retrieving revision 1.9 diff -u -r1.9 fusefs_lib.c --- fusefs_lib.c 15 Oct 2005 21:48:03 -0000 1.9 +++ fusefs_lib.c 29 Oct 2005 20:07:03 -0000 @@ -637,7 +637,7 @@ newfile->next = opened_head; opened_head = newfile; - return 1; + return 0; } debug(" no.\n"); @@ -845,7 +845,7 @@ /* raw read */ debug(" yes.\n"); rf_call(path,id_raw_close,Qnil); - return 0; + goto out; } debug(" no.\n"); @@ -867,6 +867,8 @@ } } +out: + /* Free the file contents. */ if (!is_editor) { if (prev == NULL) { @@ -1246,7 +1248,13 @@ VALUE args = rb_ary_new(); rb_ary_push(args,INT2NUM(offset)); rb_ary_push(args,INT2NUM(size)); - rf_call(path,id_raw_read,args); + VALUE ret = rf_call(path,id_raw_read,args); + if(ret == Qnil) + return 0; + StringValue(ret); + if(RSTRING(ret)->len < size) + size = RSTRING(ret)->len; + memcpy(buf, RSTRING(ret)->ptr, size); return size; } Cheers, Kent. On Sat, 2005-10-29 at 16:52 +0900, Greg Millam wrote: > Lo, another travesty was visited upon the ruby-talk community ... and > this one was named ... FuseFS 0.5! > > -------------- > > FuseFS is a ruby module that lets you define Filesystems in ruby, so you > can navigate a database. Browse virtual filesystems with ls and cd! Or > even, with _why_the_lucky_stiff's railsfs.rb (included in FuseFS 0.5!) > view your Ruby On Rails data on your filesystem! Do you want to know more? > > http://redhanded.hobix.com/inspect/railsfsAfterACoupleMinutesOfToolingWithFuseWhoa.html > > Aside from the awesome railsfs.rb and the FUSE-2.4 change, what else is > included? > > Well, remember how you couldn't get some apps to recognize a file as > being anything other than empty? Well now you can correct that assumption! > > fuseroot#size will be called on files, so when xmms tries to load your > ruby-offered mp3, it'll be able to! > > And a treat for those working with big (and I mean BIG) files that they > don't want all loaded into ram: > > "raw_open" and associated methods will allow fuseroot to receive the > actual, individual read and write requests for each file, so that you > can return portions of a file at a time! > > http://rubyforge.org/projects/fusefs/ > > Happy coding! > > - Greg >