Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
FuseFS-0.5
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Greg Millam  
View profile  
(1 user)  More options Oct 29 2005, 3:52 am
Newsgroups: comp.lang.ruby
From: Greg Millam <ruby-t...@lethalcode.net>
Date: Sat, 29 Oct 2005 16:52:26 +0900
Local: Sat, Oct 29 2005 3:52 am
Subject: [ANN] FuseFS-0.5
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/railsfsAfterACoupleMinutesOfToolin...

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kent Sibilev  
View profile  
(1 user)  More options Oct 29 2005, 4:18 pm
Newsgroups: comp.lang.ruby
From: Kent Sibilev <ksr...@gmail.com>
Date: Sun, 30 Oct 2005 05:18:58 +0900
Local: Sat, Oct 29 2005 4:18 pm
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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kent Sibilev  
View profile  
(1 user)  More options Oct 29 2005, 4:37 pm
Newsgroups: comp.lang.ruby
From: Kent Sibilev <ksr...@gmail.com>
Date: Sun, 30 Oct 2005 05:37:07 +0900
Local: Sat, Oct 29 2005 4:37 pm
Subject: Re: [ANN] FuseFS-0.5
Sorry for replying to my previous email. With this patch applied, here
is the simple implementation (less than 100 lines of code) of Ruby
remote filesystem using DRb.

server.rb:
#!/usr/bin/env ruby

require 'drb'

class RemoteDirectory
  def initialize(dir)
    @dir = dir
    @files = {}
  end

  def contents(path)
    Dir[File.join(@dir, path,'*')].map{|fn| File.basename fn}
  end

  %w|file? directory? executable? size delete|.each do |name|
    define_method(name) do |path|
      File.send name, File.join(@dir, path)
    end
  end

  %w|mkdir rmdir|.each do |name|
    define_method(name) do |path|
      Dir.send name, File.join(@dir, path)
    end
  end

  %w|can_write? can_delete? can_mkdir? can_rmdir?|.each do |name|
    define_method(name) do |path|
      true
    end
  end

  def raw_open(path, mode)
    return true if @files.has_key? path
    @files[path] = File.open(File.join(@dir, path), mode)
    return true
  rescue
    puts $!
    false
  end

  def raw_read(path, off, size)
    file = @files[path]
    return unless file
    file.seek(off, File::SEEK_SET)
    file.read(size)
  rescue
    puts $!
    nil
  end

  def raw_write(path, off, sz, buf)
    file = @files[path]
    return unless file
    file.seek(off, File::SEEK_SET)
    file.write(buf[0, sz])
  rescue
    puts $!
  end

  def raw_close(path)
    file = @files[path]
    return unless file
    file.close
    @files.delete path
  rescue
    puts $!
  end
end

if $0 == __FILE__
  dir = RemoteDirectory.new ARGV.shift || '.'
  uri = ARGV.shift || 'druby://0.0.0.0:7777'
  DRb.start_service uri, dir
  puts DRb.uri
  DRb.thread.join
end

rubyfs.rb:
#!/usr/bin/env ruby

require 'drb'
require 'fusefs'

unless (1..2).include? ARGV.size
  puts "Usage: #$0 <directory> <uri>"
  exit(1)
end

dir = ARGV.shift
uri = ARGV.shift || 'druby://0.0.0.0:7777'

DRb.start_service(nil, nil)
root = DRbObject.new_with_uri(uri)

FuseFS.set_root(root)
FuseFS.mount_under(dir)
FuseFS.run

Now I don't have to use samba in order to access files on my Windows
workstation! :)

Cool.
Kent.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ryan Leavengood  
View profile  
 More options Oct 29 2005, 9:48 pm
Newsgroups: comp.lang.ruby
From: Ryan Leavengood <leaveng...@gmail.com>
Date: Sun, 30 Oct 2005 10:48:53 +0900
Local: Sat, Oct 29 2005 9:48 pm
Subject: Re: [ANN] FuseFS-0.5
On 10/29/05, Kent Sibilev wrote:

> Sorry for replying to my previous email. With this patch applied, here
> is the simple implementation (less than 100 lines of code) of Ruby
> remote filesystem using DRb.

That is massively cool. Thanks for this, and thanks to Greg for
providing FuseFS which allows such cool code to be written!

Regards,
Ryan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Millam  
View profile  
 More options Oct 29 2005, 9:56 pm
Newsgroups: comp.lang.ruby
From: Greg Millam <ruby-t...@lethalcode.net>
Date: Sun, 30 Oct 2005 10:56:52 +0900
Local: Sat, Oct 29 2005 9:56 pm
Subject: Re: [ANN] FuseFS-0.5
This is very neat!

I've also applied the bugfixes from Kent, and released 0.5.1 on
rubyforge. 0.5.1 lets Kent's drb filesystem be used.

http://rubyforge.org/projects/fusefs/

Thanks, Kent!

- Greg

Kent Sibilev wrote:

 > Sorry for replying to my previous email. With this patch applied, here
 > is the simple implementation (less than 100 lines of code) of Ruby
 > remote filesystem using DRb.
 >
 > server.rb:
 > #!/usr/bin/env ruby
 >
 > require 'drb'
 >
 > class RemoteDirectory
 >   def initialize(dir)
 >     @dir = dir
 >     @files = {}
 >   end
 >
 >   def contents(path)
 >     Dir[File.join(@dir, path,'*')].map{|fn| File.basename fn}
 >   end
 >
 >   %w|file? directory? executable? size delete|.each do |name|
 >     define_method(name) do |path|
 >       File.send name, File.join(@dir, path)
 >     end
 >   end
 >
 >   %w|mkdir rmdir|.each do |name|
 >     define_method(name) do |path|
 >       Dir.send name, File.join(@dir, path)
 >     end
 >   end
 >
 >   %w|can_write? can_delete? can_mkdir? can_rmdir?|.each do |name|
 >     define_method(name) do |path|
 >       true
 >     end
 >   end
 >
 >   def raw_open(path, mode)
 >     return true if @files.has_key? path
 >     @files[path] = File.open(File.join(@dir, path), mode)
 >     return true
 >   rescue
 >     puts $!
 >     false
 >   end
 >
 >   def raw_read(path, off, size)
 >     file = @files[path]
 >     return unless file
 >     file.seek(off, File::SEEK_SET)
 >     file.read(size)
 >   rescue
 >     puts $!
 >     nil
 >   end
 >
 >   def raw_write(path, off, sz, buf)
 >     file = @files[path]
 >     return unless file
 >     file.seek(off, File::SEEK_SET)
 >     file.write(buf[0, sz])
 >   rescue
 >     puts $!
 >   end
 >
 >   def raw_close(path)
 >     file = @files[path]
 >     return unless file
 >     file.close
 >     @files.delete path
 >   rescue
 >     puts $!
 >   end
 > end
 >
 > if $0 == __FILE__
 >   dir = RemoteDirectory.new ARGV.shift || '.'
 >   uri = ARGV.shift || 'druby://0.0.0.0:7777'
 >   DRb.start_service uri, dir
 >   puts DRb.uri
 >   DRb.thread.join
 > end
 >
 > rubyfs.rb:
 > #!/usr/bin/env ruby
 >
 > require 'drb'
 > require 'fusefs'
 >
 > unless (1..2).include? ARGV.size
 >   puts "Usage: #$0 <directory> <uri>"
 >   exit(1)
 > end
 >
 > dir = ARGV.shift
 > uri = ARGV.shift || 'druby://0.0.0.0:7777'
 >
 > DRb.start_service(nil, nil)
 > root = DRbObject.new_with_uri(uri)
 >
 > FuseFS.set_root(root)
 > FuseFS.mount_under(dir)
 > FuseFS.run
 >
 > Now I don't have to use samba in order to access files on my Windows
 > workstation! :)
 >
 > Cool.
 > Kent.
 >
 > On Sun, 2005-10-30 at 05:18 +0900, Kent Sibilev wrote:
 >
 >> 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/railsfsAfterACoupleMinutesOfToolin...
 >>>
 >>> 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

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dick Davies  
View profile  
(1 user)  More options Oct 30 2005, 2:41 am
Newsgroups: comp.lang.ruby
From: Dick Davies <rasput...@gmail.com>
Date: Sun, 30 Oct 2005 16:41:47 +0900
Local: Sun, Oct 30 2005 2:41 am
Subject: Re: [ANN] FuseFS-0.5
Thanks Greg!

I hear linux 2.6.14 now has FUSE in the base, so this is great timing.

Dick
(who's even more glad he didn't get a powerbook)

On 29/10/05, Greg Millam <ruby-t...@lethalcode.net> wrote:

> Lo, another travesty was visited upon the ruby-talk community ... and
> this one was named ... FuseFS 0.5!

--
Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google