Device layering work patch #2

Matthew Dillon dillon at apollo.backplane.com
Sun May 16 15:09:47 PDT 2004


    Here is the next rev of the device layering patch.

    This patch is of 'beta' quality, I expect to commit it (with further
    work) in a bit less then a week.  I would appreciate testing so I can
    be confident that I'm not going to blow up the system when I commit
    this stage, but nobody should install this patch on a production
    machine.  Please report any device related console warnings *after* booting
    is complete.

	fetch http://apollo.backplane.com/DFlyMisc/dev02.patch

    Changes from the last patch:

    * Removed all dev_port_*() wrapper functions.  These were used so old
      style device switch routines could forward requests without
      manually constructing a message wrapper.

      The wrapper code was used in the DISK (partition management) layer,
      the /dev/console layer, and the conslidated frame buffer device
      layer.  All three layers now either use LWKT message ports directly,
      or use the dev_d*() calls instead.

    * Total revamp of the reference counting scheme.  All device structure
      creation calls now creates 'adhoc' device entries, meaning that no matter
      how many times you make the call only one reference count will be 
      associated with the structure.  This way devices created indirectly
      by users calling open() (via udev2dev()), via make_dev(), make_sub_dev(),
      and other device creation routines, can still be trivially closed at
      detach time.

      Those subsystems in the kernel that need to store dev_t's long term,
      such as the VNODE subsystem (v_rdev), will obtain additional references
      on the dev_t using reference_dev().  Additional references do not
      prevent the device from being destroyed, but they do prevent the
      structure from being freed and reused too early.

      cdevs_remove() now calls destroy_dev() on all associated devices.  This
      basically removes the ad-hoc reference and means that we do not have
      to track make_dev() calls in the device code or other places.

    * Rewrote the /dev/console interface to be a pure new-style LWKT message
      port based device.  This makes the forwarding of requests much easier
      to deal with.

    * Additional cleanups of the DISK (partition management) subsystem.

    * Added required cdevsw_add() calls to nearly all devices in the source
      tree, and cdevsw_remove() calls to many of the devices in the source
      tree.

    STILL TODO:	 actually freeing a dev_t structure that is being detached.

							-Matt






More information about the Kernel mailing list