[Haskell-beginners] using HS to writing/managing a selfmade filesystem on a real partition?
sylvain at haskus.fr
Tue May 10 20:06:52 UTC 2016
Yes you can call Haskell code from C:
If you really want to use Haskell, I would go full Haskell to avoid
complications (you can update the FUSE bindings if necessary). On the
other hand, if you plan to distribute your FS implementation to a
non-Haskell audience, maybe it would be better to write it fully in C.
On 10/05/2016 20:56, Silent Leaf wrote:
> Thanks! FUSE seems a perfect way to do what I wanna do.
> Hypothetically, what if I wanted to bypass the Haskell bindings,
> directly use FUSE in C, but write most of the actual operations in
> AKA, is it possible to call haskell functions/programs *from* C code?
> And have all individual calls to the Haskell parts be allowed to share
> private data, rather than being independent, isolated calls?
> It's just an idea, I figured since writing a fuse filesystem in C
> doesn't seem too complicated (i found a tutorial, and it just looks
> like what the Haskell bindings is proposing, except well in theory one
> has to write everything in C) and i figured perhaps it'd be
> better/faster, possibly less buggy (the Haskell bindings are tagged
> experimental, of which i couldn't tell the true interpretation, but
> which doesn't seem terribly appealing at first sight) to write the
> FUSE in C, *except* for, well most of the actual "doing something"
> code, aka the FS operations, which would be written in Haskell.
> AKA, the final program would start with C, but under the hood use
> Haskell for most of the meaningful code. This, of course, if such a
> thing is even possible in the first place! And easily, needless to
> say. Considering for that matter as I said that the Haskell parts
> should be able to save private data of its own without having to
> "start over" the "situation analysis" for each individual call to one
> of the filesystem operations.
> Thanks a lot again!
> Le lundi 9 mai 2016, Sylvain Henry <sylvain at haskus.fr
> <mailto:sylvain at haskus.fr>> a écrit :
> > Hi,
> > You don't have to write a kernel module (which would better be
> written in C), you can do everything in userspace and in Haskell with
> FUSE: https://en.wikipedia.org/wiki/Filesystem_in_Userspace
> > It seems to already have Haskell bindings:
> > To implement the file system operations, you can use binary
> (https://hackage.haskell.org/package/binary), Foreign.Ptr, Data.Bits,
> etc. You can write data on any real partition by using the associated
> block devices (e.g., /dev/sda1).
> > Sylvain
> > On 09/05/2016 20:50, Silent Leaf wrote:
> > Mostly all in the title.
> > I have a project of developing a personal filesystem, possibly at
> first virtual (the file(s) representing a virtual partition formatted
> with my filesystem, would be saved in a host filesys, eg ext4 or
> whatever), but probably in the end not virtual, directly working on
> the contents of a real partition.
> > Can haskell do that kind of thing, aka writing data on a partition
> directly (without using a known filesys), etc? Is it at least more or
> less adapted for this task (not talking about performances, unless the
> consequences be a *really* slow filesys), aka doable, easily doable,
> relatively speaking (aka not worse than with another language)?
> > Incidentally, if i wanted Linux to recognize the filesys, i've heard
> one has to write a module and put it in connection with the kernel or
> something. could haskell do that?
> > if that's a "no" somewhere for one of my questions, which parts
> can't be written in haskell (without horrible performances or code
> very very hard to write), and can they be written in C (or whatever)
> as foreign functions? which parts would that represent for the whole
> > Thanks a lot in advance!
> > PS: just in case, tips on sources of information on how to do any of
> the above will be extremely appreciated! (even if it's in, say C, for
> that matter, providing there's a way to translate the steps into a
> haskell program)
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org <mailto:Beginners at haskell.org>
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners