Changeset f3272e98 in mainline


Ignore:
Timestamp:
2006-10-22T17:42:49Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2191541
Parents:
78595d6
Message:

Indentation changes and coding style fixes in slab.c and slab.h.

Location:
kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/doc/mm

    r78595d6 rf3272e98  
    8181   does not have to check the return value.
    8282
    83 3) The maximum size that can be allocated using malloc is 128K
     833) The maximum size that can be allocated using malloc is 256K
    8484
    8585Rules 1) and 2) apply to slab_alloc as well. Using SLAB allocator
  • kernel/generic/include/mm/slab.h

    r78595d6 rf3272e98  
    6969        count_t size;  /**< Number of slots in magazine */
    7070        void *objs[0]; /**< Slots in magazine */
    71 }slab_magazine_t;
     71} slab_magazine_t;
    7272
    7373typedef struct {
     
    7575        slab_magazine_t *last;
    7676        SPINLOCK_DECLARE(lock);
    77 }slab_mag_cache_t;
     77} slab_mag_cache_t;
    7878
    7979
     
    8383        link_t link;
    8484        /* Configuration */
    85         size_t size;      /**< Size of slab position - align_up(sizeof(obj)) */
     85        size_t size;            /**< Size of slab position - align_up(sizeof(obj)) */
    8686        int (*constructor)(void *obj, int kmflag);
    8787        int (*destructor)(void *obj);
    88         int flags;        /**< Flags changing behaviour of cache */
     88        int flags;              /**< Flags changing behaviour of cache */
    8989
    9090        /* Computed values */
    91         uint8_t order;        /**< Order of frames to be allocated */
    92         int objects;      /**< Number of objects that fit in */
     91        uint8_t order;          /**< Order of frames to be allocated */
     92        int objects;            /**< Number of objects that fit in */
    9393
    9494        /* Statistics */
     
    9999
    100100        /* Slabs */
    101         link_t full_slabs;     /**< List of full slabs */
    102         link_t partial_slabs;  /**< List of partial slabs */
     101        link_t full_slabs;      /**< List of full slabs */
     102        link_t partial_slabs;   /**< List of partial slabs */
    103103        SPINLOCK_DECLARE(slablock);
    104104        /* Magazines  */
    105         link_t magazines;      /**< List o full magazines */
     105        link_t magazines        /**< List o full magazines */
    106106        SPINLOCK_DECLARE(maglock);
    107107
    108108        /** CPU cache */
    109109        slab_mag_cache_t *mag_cache;
    110 }slab_cache_t;
     110} slab_cache_t;
    111111
    112112extern slab_cache_t * slab_cache_create(char *name,
  • kernel/generic/src/mm/slab.c

    r78595d6 rf3272e98  
    138138/** Slab descriptor */
    139139typedef struct {
    140         slab_cache_t *cache; /**< Pointer to parent cache */
    141         link_t link;       /* List of full/partial slabs */
    142         void *start;       /**< Start address of first available item */
    143         count_t available; /**< Count of available items in this slab */
    144         index_t nextavail; /**< The index of next available item */
     140        slab_cache_t *cache;    /**< Pointer to parent cache. */
     141        link_t link;            /**< List of full/partial slabs. */
     142        void *start;            /**< Start address of first available item. */
     143        count_t available;      /**< Count of available items in this slab. */
     144        index_t nextavail;      /**< The index of next available item. */
    145145}slab_t;
    146146
     
    290290                spinlock_lock(&cache->slablock);
    291291        } else {
    292                 slab = list_get_instance(cache->partial_slabs.next,
    293                                          slab_t,
    294                                          link);
     292                slab = list_get_instance(cache->partial_slabs.next, slab_t, link);
    295293                list_remove(&slab->link);
    296294        }
     
    299297        slab->available--;
    300298
    301         if (! slab->available)
     299        if (!slab->available)
    302300                list_prepend(&slab->link, &cache->full_slabs);
    303301        else
     
    900898        slab_t *slab;
    901899
    902         if (!obj) return;
     900        if (!obj)
     901                return;
    903902
    904903        slab = obj2slab(obj);
Note: See TracChangeset for help on using the changeset viewer.