Erlang filesystem (was: Re: File versioning)

Scott Lystig Fritchie fritchie@REDACTED
Thu May 8 06:01:14 CEST 2003


>>>>> "cp" == Chris Pressey <cpressey@REDACTED> writes:

cp> 3- have some way to painlessly communicate
cp> between external, non-Erlang programs, and a running Erlang node

<reflection mode="greybeard">

Back in the days when I worked at Sendmail...

... we did such a thing.  It used TCP (and UNIX domain sockets, later)
and Sun RPC.  Client applications spoke RPC to an Erlang I/O daemon
(running on the same box).  The Erlang I/O daemon "knew" were files
were really stored: their "real" path(s) on an NFS server(s)
somewhere.  It knew if the file was replicated or not.  Though we
never finished it, we had an icky draft of code that could
transparently migrate files to new paths and/or new NFS servers in the
event that the mapping of files -> {replication-mode, [NFS servers]}
changed.

We stole open(2), read(2), write(2), close(2), chdir(2), unlink(2)
... everything file I/O related.  We could tell the difference between
an I/O-daemon'ified file descriptors (e.g., referring to files with
paths in the namespace below "/bams", "/var/spool/mqueue", or
whatever) and local file system descriptors.

We even stole flock(2) and implemented a leasing scheme that was
*reliable* when talking to an NFSv3 file server.  Heh.

The only thing that we couldn't easily do is mmap(2).  We stole it,
but the implementation was easy: int bams_mmap(...) { return EINVAL; }

BAMS'izing an application:

1. Check its use of mmap() first.
2. Link with BAMS library.
3. Run.

Worked for "sendmail", GNU "tar" and "ls".  I think I did "qmail" or
"postfix", but details are foggy now.  Oh, yeah, "beam" too.  :-)

Then I created an LD_PRELOAD'able shared library, making step #2
optional.

Ah, those were the days when we wrote code in log cabins with
wood-fired generators....

</reflection>

There are several hacks these days that do file system type stuff in
user space.  Gnome VFS and later versions of Tcl come immediately to
mind.  But they and other efforts like them don't have all that much
in common.  Except for perhaps Plastic File System.  It'd be great to
glue them together.  Mebbe I should do that.  {sigh}

-Scott



More information about the erlang-questions mailing list