Submitted by OneOfOne on Mon, 17/01/2005 - 21:37.
( categories: Programming )

Well I was bored and wanted to learn perl then I noticed the sweet fuse while working on 2.6.11-rc1-love1 and it hit me, let's make a mysql filesystem!

Here's my first take at it, it works 100% read-only, of course its not multithreaded (my 2nd perl script ever..) so don't abuse it too much :-p

url : http://www.q2h.com/gentoo/sqlfs-fuse.pl

Depends on:

  • the fuse kernel module!
  • fuse : ACCEPT_KEYWORDS=~x86 emerge fuse (http://fuse.sf.net for other distros).
  • fuse-perl :
  • cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/fuse login cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/fuse co perl cd perl; perl Makefile.PL; make install

  • DBD::mysql : emerge DBD-mysql (cpan -i "DBD::mysql" for other distros) (other SQL backends might work, never tried). usuage is simple :
  • perl sqlfs-fuse.pl /tmp/fuse-test -d database -u database-user [-p password] [-h database-host defaults to localhost] Usage: sqlfs-fuse.pl [mountpoint] --database|-d database-name [--hostname|-h database-host] [--username|-u username] [--password|-p password] [--sql-backend mysql|mssql|pgsql]

    any comments, recommendations, etc are always welcome.

    --example--

    [~/programming/perl] -> perl sqlfs-fuse.pl /tmp/fuse-test -d portage -u portage ; umount /tmp/fuse-test e_getattr (/); e_getattr (/); ---switch to another term-- [~] -> ls /tmp/fuse-test category_table/ items_table/ package_name/ path_table/ [~] -> ls /tmp/fuse-test/path_table/ 0/ 1/ [~] -> ls /tmp/fuse-test/path_table/0 name p_id [~] -> cat /tmp/fuse-test/path_table/0/* /var/cache/edb/dep/usr/local/portage 5

    Why i made it? for fun and learning.

    Love-sources : http://love-sources.q2h.com http://www.love-sources.org #love-sources on irc.freenode.net

    peace


    YoussefAssad's picture
    Submitted by YoussefAssad on Mon, 17/01/2005 - 23:38.

    Holy crap that's cool...

    Stop this mysql nonsense; write a pr0n application.

    cat ~/.pr0n/jessica/boobs/left/ | gqview -

    -- Panem et *burp* circenses


    Comment viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.