[Top][All Lists]

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

Separating legacy drivers from device server.

From: Gianluca Guida
Subject: Separating legacy drivers from device server.
Date: Fri, 3 Mar 2006 13:22:42 +0100


I've recently been working on cleaning the drivers-related code.

As you know, the linux glue that we are using at the moment have been
added only "recently" (in Mach time). Coexistance between old drivers
and "new" ones became possible by implementing a device emulation
feature, which basically wrapped the original device servers routines
(device/ds_routines.c) making possilbe to define multiple interfaces
(see i386/i386at/device_emul.h).

While this is quite cool and useful,is at the moment still a bit
messy. Infact, to mantain compatibility with (gone) other
architectures dependant files in GNU Mach, all the emulation code has
been tagged as i386 dependant. The device servers routines itself are
in i386/i386at/i386at_ds_routines.c and there's lot of code in the
device/ section which is affected by #ifdef i386 checks.
This is bad IMHO, since device emulation is perfectly architecture
independant and it makes the device code quite difficult to understand
and keep track of (functions names almost similar, code stored in
confusing directories, etc).

Last week I showed at FOSDEM to interested people my idea of
separating legacy drivers-related code (most of which is *unused*)
from device server stuff.
What I basically did is to create a legacy/ directory, and putting
into it architecture independent files strictly related to legacy
drivers. This includes even the device/ds_routines.c files, which
nowadays contains actually only the emulation routines for the few old
drivers remaining. And, furthermore, I moved
i386/i386at/i386at_ds_routines.c into device/ds_routines.c (they are
the REAL device server routines).
Furthermore, we can get rid of the chips/ directory by moving
busses.[ch] into legacy/.

Here's the ChangeLog. If you want, I can provide you a tarball of the
tree I built.


2006-02-24  GIanluca Guida  <glguida@gmail.com>

       * device/blkio.c: Moved to ...
       * legacy/blkio.c: ... here.

       * device/chario.c: Moved to ...
       * legacy/chario.c: ... here.

       * device/cirbuf.c: Moved to ...
       * legacy/cirbuf.c: ... here.

       * device/cons.c: Moved to ...
       * legacy/cons.c: ... here.

       * device/dev_lookup.c: Moved to ...
       * legacy/dev_lookup.c: ... here.

       * device/dev_name.c: Moved to ...
       * legacy/dev_name.c: ... here.

       * device/dk_label.c: Moved to ...
       * legacy/dk_label.c: ... here.

       * device/subrs.c: Moved to ...
       * legacy/subrs.c: ... here.

       * device/buf.h: Moved to ...
       * legacy/buf.h: ... here. All inclusions changed.

       * device/cirbuf.h: Moved to ...
       * legacy/cirbuf.h: ... here. All inclusions changed.

       * device/conf.h: Moved to ...
       * legacy/conf.h: ... here. All inclusions changed.

       * device/cons.h: Moved to ...
       * legacy/cons.h: ... here. All inclusions changed.

       * device/dev_hdr.h: Moved to ...
       * legacy/dev_hdr.h: ... here. All inclusions changed.

       * device/dev_master.h: Moved to ...
       * legacy/dev_hdr.h: ... here. All inclusions changed.

       * device/ds_routines.h: Moved to ...
       * legacy/ds_routines.h: ... here. All inclusions changed.

       * device/errno.h: Moved to ...
       * legacy/errno.h: ... here. All inclusions changed.

       * device/io_req.h: Moved to ...
       * legacy/io_req.h: ... here. All inclusions changed.

       * device/kmsg.c: Moved to ...
       * legacy/kmsg.c: ... here.

       * device/kmsg.h: Moved to ...
       * legacy/kmsg.h: ... here. All inclusions changed.

       * device/param.h: Moved to ...
       * legacy/param.h: ... here. All inclusions changed.

       * device/tty.h: Moved to ...
       * legacy/tty.h: ... here. All inclusoins changed.

       * chips/busses.c: Moved to ...
       * legacy/busses.c: ... here.

       * chips/busses.h: Moved to ...
       * legacy/busses.h: .. here. All inclusions changed.

       * device/net_io.c: Do not include <device/io_req.h> and
       (net_write): Function removed.
       (net_fwrite)[FIPC]: Likewise.
       * device/net_io.h (net_write): Declaration removed.

       * device/device_init.c (device_service_create): Don't call
       ds_init, dev_lookup_init, net_io_init, chario_init.  Do not create
       io_done_thread and net_thread. Call legacy_init.
       * legacy/legacy_init.c: New file.

       * device/ds_routines.c: Moved to ...
       * legacy/legacy_ds_routines.c: ... here.
       [!i386]: All conditional and code related to the case
       removed. (Drivers emulation layer support not removable anymore).

       * i386/i386at/dev_hdr.h: Moved to ...
       * device/dev_hdr.h: ... here. All inclusions changed.

       * i386/i386at/device_emul.h: Moved to ...
       * device/device_emul.h: ... here. All inclusions changed.

       * i386/i386at/i386at_ds_routines.c: Moved to ...
       * device/ds_routines.c: ... here.

       * legacy/dev_lookup (convert_device_to_port): Function moved to ...
       * device/ds_routines.c (convert_device_to_port): ... here.
       [!i386]: All conditional and code related to the case
       removed. (Drivers emulation layer support not removable anymore).

       * Makefile.in: Added "/legacy" to vpath for %.c's.
       (dist) Don't create the 'chips' directory. Create the 'legacy'
       directory. Copy legacy-files in the legacy subdir.
       (chips-files): Variable removed.
       (legacy-files): New variable.
       (device-files): Variable updated.

       * i386/Makefile.in: Added "/legacy" to vpath for cirbuf.c.

It was a type of people I did not know, I found them very strange and
they did not inspire confidence at all. Later I learned that I had been
introduced to electronic engineers.
                                                  E. W. Dijkstra

reply via email to

[Prev in Thread] Current Thread [Next in Thread]