Changeset 594a468 in mainline for generic/include


Ignore:
Timestamp:
2005-11-15T16:00:24Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db79676
Parents:
93354b0
Message:

Make the buddy system more general.
Store implementation defined pointer in buddy_system_t.
Pass buddy system pointer to implementation defined buddy system operations.

Location:
generic/include/mm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/include/mm/buddy.h

    r93354b0 r594a468  
    3535#define BUDDY_SYSTEM_INNER_BLOCK        0xff
    3636
     37/** Buddy system operations to be implemented by each implementations. */
    3738struct buddy_system_operations {
    38         link_t *(* find_buddy)(link_t *);                               /**< Return pointer to left-side or right-side buddy for block passed as argument. */
    39         link_t *(* bisect)(link_t *);                                   /**< Bisect the block passed as argument and return pointer to the new right-side buddy. */
    40         link_t *(* coalesce)(link_t *, link_t *);                       /**< Coalesce two buddies into a bigger block. */
    41         void (*set_order)(link_t *, __u8);                              /**< Set order of block passed as argument. */
    42         __u8 (*get_order)(link_t *);                                    /**< Return order of block passed as argument. */
     39        link_t *(* find_buddy)(buddy_system_t *, link_t *);             /**< Return pointer to left-side or right-side buddy for block passed as argument. */
     40        link_t *(* bisect)(buddy_system_t *, link_t *);                 /**< Bisect the block passed as argument and return pointer to the new right-side buddy. */
     41        link_t *(* coalesce)(buddy_system_t *, link_t *, link_t *);     /**< Coalesce two buddies into a bigger block. */
     42        void (*set_order)(buddy_system_t *, link_t *, __u8);            /**< Set order of block passed as argument. */
     43        __u8 (*get_order)(buddy_system_t *, link_t *);                  /**< Return order of block passed as argument. */
    4344};
    4445
     
    4748        link_t *order;
    4849        buddy_system_operations_t *op;
     50        void *data;                             /**< Pointer to be used by the implementation. */
    4951};
    5052
    51 extern buddy_system_t *buddy_system_create(__u8 max_order, buddy_system_operations_t *op);
     53extern buddy_system_t *buddy_system_create(__u8 max_order, buddy_system_operations_t *op, void *data);
    5254extern link_t *buddy_system_alloc(buddy_system_t *b, __u8 i);
    5355extern void buddy_system_free(buddy_system_t *b, link_t *block);
  • generic/include/mm/frame.h

    r93354b0 r594a468  
    8787 * Buddy system operations
    8888 */
    89 link_t * zone_buddy_find_buddy(link_t * buddy);
    90 link_t * zone_buddy_bisect(link_t * block);
    91 link_t * zone_buddy_coalesce(link_t * buddy_l, link_t * buddy_r);
    92 void zone_buddy_set_order(link_t * block, __u8 order);
    93 __u8 zone_buddy_get_order(link_t * block);
     89link_t * zone_buddy_find_buddy(buddy_system_t *b, link_t * buddy);
     90link_t * zone_buddy_bisect(buddy_system_t *b, link_t * block);
     91link_t * zone_buddy_coalesce(buddy_system_t *b, link_t * buddy_l, link_t * buddy_r);
     92void zone_buddy_set_order(buddy_system_t *b, link_t * block, __u8 order);
     93__u8 zone_buddy_get_order(buddy_system_t *b, link_t * block);
    9494
    9595__address zone_buddy_frame_alloc(int flags, __u8 order);
Note: See TracChangeset for help on using the changeset viewer.