I am sponsoring the following fasttrack for myself, requesting patch
binding and a timeout of 06/28/2007.

-Chris

Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
         mod_modname(9F)
    1.2. Name of Document Author/Supplier:
         Author:  Chris Horne
    1.3  Date of This Document:
        13 June, 2008
4. Technical Description

    4.1 Problem

        For maximum flexibility, it is best if a driver does not have
        compiled-in knowledge of its own name.  Existing
        ddi_driver_name(9F) and ddi_driver_major(9F) interfaces
        facilitate this type of independence when a 'dev_info_t' is
        available (attach(9E) do detach(9E) driver scope).

        Some of the interfaces that drivers use during _init(9E), like
        kmem_cache_create(9F) and kstat_create(9F), need to know the
        driver name. There is currently no public interface for them to
        use to determine driver name during _init.

    4.2 Proposal

        This fasttrack requests promotion of mod_modname(9F) - an
        interface that can be used to determine the name of the
        module/driver during _init(9E) time using modlinkage(9S)
        information.  The ddi_modname() interface was added in s10_59
        as part of CR5033382 "sd driver should not depend on hard-coded
        driver name".

        In addition, the definition for DDI_MAJOR_T_NONE is missing.
        This define is mentioned in the ddi_driver_major(9F),
        ddi_prop_create(9f), and ddi_prop_update(9F) man pages. The
        following define will be added to <sys/ddipropdefs.h>

                #define DDI_MAJOR_T_NONE     ((major_t)-1)


    4.4 Interface Table

        ------------------------------------------------------------------------
        Interface                 Level                 Comments
        ------------------------------------------------------------------------

        mod_modname(9F)         Commited                Promotion:
                                                        Given a
                                                        modlinkage(9S),
                                                        return the name
                                                        of the
                                                        module/driver.

        DDI_MAJOR_T_NONE        Commited                Provide definition.

    4.5 References

    4.6 Man page changes

        See below.

    6.  Resources and Schedule
    6.4 Steering Committee requested information
        6.4.1   Consolidation C-team Name:
                ON

    6.5 ARC review type:
        FastTrack


A.1     Proposed mod_modname(9F)/mod_install(9F) changes:

  Kernel Functions for Drivers                      mod_install(9F)
  
  NAME
+      mod_install, mod_remove, mod_info, mod_modname - 
+      add, remove or  query  a loadable module
  
  SYNOPSIS
       #include <sys/modctl.h>
  
       int mod_install(struct modlinkage *modlinkage);
  
       int mod_remove(struct modlinkage *modlinkage);
  
       int mod_info(struct modlinkage *modlinkage,
           struct modinfo *modinfo);

+      char *mod_modname(struct modlinkage *modlinkage);
  
  INTERFACE LEVEL
       Solaris DDI specific (Solaris DDI).
  
  PARAMETERS
       modlinkage   Pointer to  the  loadable  module's  modlinkage
                    structure   which  describes  what  type(s)  of
                    module elements are included in  this  loadable
                    module.
  
       modinfo      Pointer to  the  modinfo  structure  passed  to
                    _info(9E).
  
  DESCRIPTION
       mod_install() must be called from a module's _init(9E)  rou-
       tine.
  
       mod_remove() must be called from a module's  _fini(9E)  rou-
       tine.
  
       mod_info() must be called from a module's _info(9E) routine.

+      mod_modname() can be called from any module routine.
  
       When _init(9E)  is  executing,  its  call  to  mod_install()
       enables  other  threads  to  call  attach(9E)  even prior to
       mod_install() returning and _init(9E)  completion.   From  a
       programming  standpoint  this  means that all _init(9E) ini-
       tialization  must   occur   prior   to   _init(9E)   calling
       mod_install().   If  mod_install()  fails  (non-zero  return
       value), any initialization must be undone.
  
       When  _fini(9E)  is  executing,  another  thread  may   call
       attach(9E)  prior to _fini(9E) calling mod_remove(). If this
       occurs, the mod_remove() fails  (non-zero  return).  From  a
       programming standpoint, this means that _init(9E) initiliza-
       tions should only be undone after a successful  return  from
       mod_remove().

+      To query the name of a module, use mod_modname(). If the module
+      is a driver, the module name is the same as the driver name.
+      This function can be used to avoid compiled-in knowledge of the
+      module name, and is of particular use when _init(9E) needs to
+      call a function like kstat_create(9F).

  RETURN VALUES
       mod_install() and mod_remove() return 0 upon success and
       non-zero on failure.

       mod_info() returns a non-zero value on success and 0 upon
       failure.

+      mod_modname() returns the name of the module. The returned 
+      name remains valid as long as the module remains loaded.
  
  EXAMPLES
       See _init(9E) for an example that uses these functions.
  
  SEE ALSO
       _fini(9E),      _info(9E),      _init(9E),      modldrv(9S),
       modlinkage(9S), modlstrmod(9S)

6. Resources and Schedule
    6.4. Steering Committee requested information
        6.4.1. Consolidation C-team Name:
                ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open


Reply via email to