Changeset 7dd2561 in mainline


Ignore:
Timestamp:
2005-12-15T15:24:52Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
80d2bdb
Parents:
dc747e3
Message:

Add LIST_INITIALIZE() macro to declare and initialize statically allocated lists.

Location:
generic
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • generic/include/list.h

    rdc747e3 r7dd2561  
    3333#include <typedefs.h>
    3434
     35/** Doubly linked list head and link type. */
    3536struct link {
    36         link_t *prev;
    37         link_t *next;
     37        link_t *prev;   /**< Pointer to the previous item in the list. */
     38        link_t *next;   /**< Pointer to the next item in the list. */
    3839};
     40
     41/** Declare and initialize statically allocated list.
     42 *
     43 * @param name Name of the new statically allocated list.
     44 */
     45#define LIST_INITIALIZE(name)           link_t name = { .prev = &name, .next = &name }
    3946
    4047/** Initialize doubly-linked circular list link
  • generic/include/mm/frame.h

    rdc747e3 r7dd2561  
    8484extern link_t zone_head;                /**< list of all zones in the system */
    8585
    86 extern void zone_init(void);
    8786extern zone_t *zone_create(__address start, size_t size, int flags);
    8887extern void zone_attach(zone_t *zone);
  • generic/src/console/kconsole.c

    rdc747e3 r7dd2561  
    6767 
    6868SPINLOCK_INITIALIZE(cmd_lock);  /**< Lock protecting command list. */
    69 link_t cmd_head;                /**< Command list. */
     69LIST_INITIALIZE(cmd_head);      /**< Command list. */
    7070
    7171static cmd_info_t *parse_cmdline(char *cmdline, size_t len);
     
    7777{
    7878        int i;
    79 
    80         list_initialize(&cmd_head);
    8179
    8280        cmd_init();
  • generic/src/mm/frame.c

    rdc747e3 r7dd2561  
    4343
    4444SPINLOCK_INITIALIZE(zone_head_lock);    /**< this lock protects zone_head list */
    45 link_t zone_head;                       /**< list of all zones in the system */
     45LIST_INITIALIZE(zone_head);             /**< list of all zones in the system */
    4646
    4747/** Blacklist containing non-available areas of memory.
     
    6969{
    7070        if (config.cpu_active == 1) {
    71                 zone_init();
    7271                frame_region_not_free(KA2PA(config.base), config.kernel_size);
    7372        }
     
    234233        zone_blacklist[index].base = base;
    235234        zone_blacklist[index].size = size;
    236 }
    237 
    238 
    239 /** Initialize zonekeeping
    240  *
    241  * Initialize zonekeeping.
    242  */
    243 void zone_init(void)
    244 {
    245         list_initialize(&zone_head);
    246235}
    247236
  • generic/src/proc/task.c

    rdc747e3 r7dd2561  
    3838
    3939SPINLOCK_INITIALIZE(tasks_lock);
    40 link_t tasks_head;
    41 
     40LIST_INITIALIZE(tasks_head);
    4241
    4342/** Initialize tasks
     
    4948{
    5049        TASK = NULL;
    51         list_initialize(&tasks_head);
    5250}
    5351
  • generic/src/proc/thread.c

    rdc747e3 r7dd2561  
    5656
    5757SPINLOCK_INITIALIZE(threads_lock);      /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */
    58 link_t threads_head;                    /**< List of all threads. */
     58LIST_INITIALIZE(threads_head);          /**< List of all threads. */
    5959
    6060SPINLOCK_INITIALIZE(tidlock);
     
    9797        THREAD = NULL;
    9898        nrdy = 0;
    99         list_initialize(&threads_head);
    10099}
    101100
Note: See TracChangeset for help on using the changeset viewer.