Ignore:
Timestamp:
Jul 17, 2017, 8:42:59 AM (4 years ago)
Author:
alain
Message:

Bug fix in kernel_init
-This line, and those below, will be ignored--

M params.mk
M kernel_config.h
M Makefile
M hdd/virt_hdd.dmg
M tools/bootloader_tsar/boot.c
M kernel/libk/bits.h
M kernel/libk/elf.c
M kernel/libk/xhtab.c
M kernel/libk/elf.h
M kernel/libk/xhtab.h
M kernel/devices/dev_pic.c
M kernel/mm/vmm.c
M kernel/mm/mapper.c
M kernel/mm/mapper.h
M kernel/vfs/devfs.h
M kernel/vfs/vfs.c
M kernel/vfs/vfs.h
M kernel/vfs/devfs.c
M kernel/kern/chdev.h
M kernel/kern/kernel_init.c
M kernel/kern/process.c
M kernel/kern/process.h
M hal/tsar_mips32/core/hal_remote.c
M hal/tsar_mips32/drivers/soclib_pic.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/xhtab.h

    r188 r204  
    3636// It can be accessed by any thread, running in any cluster.
    3737// It is generic as it can be used to register various types of items.
    38 // The main goal is to speedup search by key for a large number of items of same type.
     38// The main goal is to speedup search by key in a large number of items of same type.
    3939// For this purpose the set of all registered items is split in several subsets.
    4040// Each subset is organised as an embedded double linked lists.
    4141// - an item is uniquely identified by a <key>, that is a single uint32_t value.
    42 // - From the <key> value,the hash table uses an item type specific xhtab_index() function,
    43 //   to compute an <index> value, defining a subset of registered items.
     42// - From the <key> value, the hash table uses an item type specific xhtab_index()
     43//   function, to compute an <index> value, defining a subset of registered items.
    4444// - to discriminate between items that have the same <index>, the hash table makes
    45 //   an associative search in subset.
     45//   an associative search on the key in subset.
    4646// - Each registered item is a structure, that must contain an embedded xlist_entry,
    4747//   that is part of the xlist implementing the subset.
    4848//
    49 // A total order is defined for all registered items by the increasing index values,
    50 // and for each index value by the position in the partial xlist.
     49// For all registered items, a total order is defined by the increasing index values,
     50// and for each index value, by the position in the partial xlist.
    5151// This order is used by the two functions xhtab_get_first() and xhtab_get_next(), that
    5252// are used to scan all registered items. The two "current_index" and "current_xlist_xp"
     
    5454//
    5555// Implementation Note:
    56 // For each supported item type ***, you must define the three item-type-specific
     56// For each supported item type ***, you must define four item-type-specific
    5757// functions specified below, and you must update the xhtab_init() function
    5858// and the xhtab_item_type_t.
    5959///////////////////////////////////////////////////////////////////////////////////////////
    6060
    61 #define XHASHTAB_SIZE    64   // number of subsets
     61#define XHASHTAB_SIZE    8   // number of subsets
    6262
    6363/******************************************************************************************
    64  * This define the three item type specific function prototypes.
     64 * This define the four item_type_specific function prototypes that must be defined
     65 * for each item type.
    6566 *****************************************************************************************/
    6667
    67 typedef  bool_t    xhtab_match_t ( xptr_t item_xp , void * key );
    68 typedef  xptr_t    xhtab_item_t  ( xptr_t xlist_xp );
    69 typedef  uint32_t  xhtab_index_t ( void * key );
     68typedef  bool_t    (item_match_key_t)   ( xptr_t item_xp , void * key );
     69typedef  xptr_t    (item_from_xlist_t)  ( xptr_t xlist_xp );
     70typedef  uint32_t  (index_from_key_t)   ( void * key );
     71typedef  void      (item_print_key_t)   ( xptr_t item_xp );
    7072
    7173/******************************************************************************************
     
    8587typedef struct xhtab_s
    8688{
    87         xlist_entry_t      roots[XHASHTAB_SIZE];  /*! array of roots of xlist                */
    88     xhtab_index_t    * index_from_key;        /*! item specific function                 */
    89     xhtab_match_t    * item_match_key;        /*! item specific function                 */
    90     xhtab_item_t     * item_from_xlist;       /*! item specific function                 */
    91     uint32_t           items;                 /*! number of registered items             */
    92     remote_rwlock_t    lock;                  /*! lock protecting hash table accesses    */
    93     uint32_t           current_index;         /*! current item subset index              */
    94     xptr_t           * current_xlist_xp;      /*! xptr on current item xlist entry       */
     89        xlist_entry_t       roots[XHASHTAB_SIZE];  /*! array of roots of xlist               */
     90    index_from_key_t  * index_from_key;        /*! item specific function pointer        */
     91    item_match_key_t  * item_match_key;        /*! item specific function pointer        */
     92    item_from_xlist_t * item_from_xlist;       /*! item specific function pointer        */
     93    item_print_key_t  * item_print_key;        /*! item specific function pointer        */
     94    uint32_t            items;                 /*! number of registered items            */
     95    remote_rwlock_t     lock;                  /*! lock protecting hash table accesses   */
     96    uint32_t            current_index;         /*! current item subset index             */
     97    xptr_t              current_xlist_xp;      /*! xptr on current item xlist entry      */
    9598}
    9699xhtab_t;
     
    100103 * The initialisation must be done by a thread running in cluster containing the table.
    101104 ******************************************************************************************
    102  * @ xhtab   : local pointer on local xhtab to be initialized.
    103  * @ type    : item type (see above).
     105 * @ xhtab    : local pointer on local xhtab to be initialized.
     106 * @ type     : item type (see above).
    104107 *****************************************************************************************/
    105108void xhtab_init( xhtab_t           * xhtab,
     
    176179xptr_t xhtab_get_next( xptr_t xhtab_xp );
    177180
    178 
     181/******************************************************************************************
     182 * This function displays the full content of an xhtab.
     183 ******************************************************************************************
     184 * @ xhtab_xp  : extended pointer on hash table.
     185 *****************************************************************************************/
     186void xhtab_display( xptr_t  xhtab_xp );
    179187
    180188#endif  /* _XHTAB_H_ */
Note: See TracChangeset for help on using the changeset viewer.