Changeset 961c0484 in mainline for kernel/generic/include/lib/ra.h


Ignore:
Timestamp:
2011-12-04T22:33:03Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b4e59b3
Parents:
375fc3f
Message:

WIP: Implement ra_alloc().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/lib/ra.h

    r375fc3f r961c0484  
    4545
    4646typedef struct {
    47         link_t span_link;       /**< Link for the arena's list of spans. */
     47        link_t span_link;       /**< Arena's list of spans link. */
    4848
    4949        list_t segments;        /**< List of span's segments. */
     
    5353
    5454        hash_table_t used;
     55
     56        uintptr_t base;         /**< Span base. */
     57        size_t size;            /**< Span size. */
    5558} ra_span_t;
    5659
     60/*
     61 * We would like to achieve a good ratio of the size of one unit of the
     62 * represented resource (e.g. a page) and sizeof(ra_segment_t).  We therefore
     63 * attempt to have as few redundant information in the segment as possible. For
     64 * example, the size of the segment needs to be calculated from the segment
     65 * base and the base of the following segment.
     66 */
    5767typedef struct {
    58         link_t segment_link;    /**< Link for the span's list of segments. */
    59         link_t free_link;       /**< Link for the span's free list. */
    60         link_t used_link;       /**< Link for the span's used hash table. */
     68        link_t segment_link;    /**< Span's segment list link. */
     69        link_t fu_link;         /**< Span's free list or used hash link. */
    6170
    6271        uintptr_t base;         /**< Segment base. */
    63         uintptr_t size;         /**< Segment size. */
    64        
    6572} ra_segment_t;
    6673
    6774extern ra_arena_t *ra_arena_create(uintptr_t, size_t);
    68 extern void ra_span_add(ra_arena_t *, uintptr_t, size_t);
     75extern bool ra_span_add(ra_arena_t *, uintptr_t, size_t);
    6976extern uintptr_t ra_alloc(ra_arena_t *, size_t, size_t);
    7077extern void ra_free(ra_arena_t *, uintptr_t, size_t);
Note: See TracChangeset for help on using the changeset viewer.