9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Gary Wright <gwtmp01@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] Easiest way to make a filesystem
Date: Mon, 14 Jan 2008 16:23:42 -0500	[thread overview]
Message-ID: <3DD6ABDB-0089-4E61-9BA8-01F206BF39EA@mac.com> (raw)
In-Reply-To: <df49a7370801141310g56875dc5o4050095e91c8e24c@mail.gmail.com>


On Jan 14, 2008, at 4:10 PM, roger peppe wrote:

> On Jan 14, 2008 9:00 PM, Gary Wright <gwtmp01@mac.com> wrote:
>> I've been playing around with my own implementation of 9P in Ruby in
>> an effort to explore this problem space and to better understand 9P.
> [...]
>> I'd appreciate comments/feedback.
>
> how do you deal with filesystems where the name space is dynamically
> constructed? for instance, how would you go about specifying the #I
> (/net) namespace
> with your system?


The filesystem is just a data structure.  It can be manipulated
from the 9P side via create/remove (subject to all the regular
access rules) or it can be manipulated on the internal side:

# assume that 'd' is a reference to an instance of Directory

d['newfile'] = Resource.new

The default behavior of a resource is to just map file I/O to
an in memory string but you can define new resources that
intercept and interpret 9P ops at will:

class TimeOfDay < Resource
   def read(fid, offset, count)
     Time.now.to_s[0,count]
   end
   undef_method write
end

d['time'] = TimeOfDay.new

now every read attempt on 'time' will return  the time of day
and write requests will generate an error.


Gary Wright


  reply	other threads:[~2008-01-14 21:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14  9:11 Tom Lieber
2008-01-14  9:20 ` Christopher Nielsen
2008-01-14 13:42 ` Eric Van Hensbergen
2008-01-14 20:10   ` roger peppe
2008-01-14 20:30     ` Tom Lieber
2008-01-14 20:40     ` hiro
2008-01-14 21:00     ` Gary Wright
2008-01-14 21:10       ` roger peppe
2008-01-14 21:23         ` Gary Wright [this message]
2008-01-14 21:29     ` Roman Shaposhnik
2008-01-15 12:22       ` roger peppe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DD6ABDB-0089-4E61-9BA8-01F206BF39EA@mac.com \
    --to=gwtmp01@mac.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).