[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Oct 09, 2000 at 11:57:07AM +0530, Ramakrishnan M wrote:
> Marcus Brinkmann wrote:
> > 
> > You should make yourself familiar with libtrivfs and pfinet first.
> Hi Marcus 
>           can you please put up a document explaining the various concepts and
> real examples from say your implementation of tun device, on how to use the
> various interfaces like trivfs etc etc (or update these on the Hurd Reference
> Guide)?

No, I can't. It would be an enormous effort to do it right, and I
can't consider this right now.

> Programmers coming from Unix, who want to contribute to hurd, will
> benifit greatly from this.

An equally great benefit (or greater) would be an afternoon spent reading
the source code :) All I know I learned from the source code and asking
specific questions on the list.

> A Unix to Mach/Hurd migration guide sort of this
> should be very helpful also.

This doesn't make sense, as you don't migrate, but use both at the same
time. The Mach port concept is fundamental to the current way it works.

> Experienced Hurd hackers like you or Roland should
> do that so as to help out people like me who are coming from Unix programming.

We can help you, but it would not be the best way to help you by writing
lengthy manuals. In the free software world, manuals are written by people
like you, who are new to it and learn it from the beginning. It's best if
you ask specific questions which we will answer in detail.

For example, you ask above how to use libtrivfs. That's a good, specific
question, and I will answer it.

First, look at libdiskfs, which is used by ext2fs and fatfs and ufs.
It's a support library to make it easy to write translators that use a
backing store (a range of memory on disk or similar). There are some
specific problems with using backing stores (paging for example).
libtreefs (defunct) was intended to provide support for filesystems which
provide a directory hierarchy, but without backing store (like a tar
translator for example, or maybe procfs). libtrivfs is for very simple
translators, usually a simple file, but it can be a directory, too
(for example /dev/fd/).

All these hide a lot of complexity involved in writing translators. Writing
translators is almost an impossible task, but with all the Hurd libraries
(libports, libfshelp, libiohelp etc) it becomes quite easy.

All you have to do is to implement the various callbacks and variables
expected by libtrivfs. They are documented in the hurd reference manual, but
it is better to start off with an example and modify it until it does what
you do. The hello-mt.c file is best. It contains almost nothing that is
specific to hello-mt! The only thing is the hello message and the file
pointer counting for seek() and successive reads.

Communication happens with Mach ports, and most callbacks are the result of
a message appearing on a port. The open hook helps to seperate messages by
the user (you can store your private data here). There are also buckets and
classes, but in simple cases you have one bucket, one class, so nothing
funny here (pfinet is different). The messages that can be sent over a port
are listed in the various hurd/*.defs files, but a lot of them are catched
at some lower level, and you only have to care about the trivfs callbacks
(unless you really want to so very special things).

Please ask your specific questions on the bug-hurd list, as so other people
can respond, too.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
Marcus.Brinkmann@ruhr-uni-bochum.de,     marcus@gnu.org    PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       brinkmd@debian.org

Reply to: