Changeset 5d853bd in mainline


Ignore:
Timestamp:
2011-01-14T19:33:01Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1433f93e
Parents:
08abd81
Message:

Small cleanup in frame.[ch].

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/frame.h

    r08abd81 r5d853bd  
    6262
    6363/** Convert the frame address to kernel VA. */
    64 #define FRAME_KA          0x01
     64#define FRAME_KA          0x1
    6565/** Do not panic and do not sleep on failure. */
    66 #define FRAME_ATOMIC      0x02
     66#define FRAME_ATOMIC      0x2
    6767/** Do not start reclaiming when no free memory. */
    68 #define FRAME_NO_RECLAIM  0x04
     68#define FRAME_NO_RECLAIM  0x4
    6969
    7070typedef uint8_t zone_flags_t;
    7171
    7272/** Available zone (free for allocation) */
    73 #define ZONE_AVAILABLE  0x00
     73#define ZONE_AVAILABLE  0x0
    7474/** Zone is reserved (not available for allocation) */
    75 #define ZONE_RESERVED   0x08
     75#define ZONE_RESERVED   0x8
    7676/** Zone is used by firmware (not available for allocation) */
    7777#define ZONE_FIRMWARE   0x10
     
    8585        uint8_t buddy_order;  /**< Buddy system block order */
    8686        link_t buddy_link;    /**< Link to the next free block inside
    87                                one order */
     87                                   one order */
    8888        void *parent;         /**< If allocated by slab, this points there */
    8989} frame_t;
     
    9191typedef struct {
    9292        pfn_t base;                    /**< Frame_no of the first frame
    93                                         in the frames array */
     93                                            in the frames array */
    9494        size_t count;                  /**< Size of zone */
    9595        size_t free_count;             /**< Number of free frame_t
    96                                         structures */
     96                                            structures */
    9797        size_t busy_count;             /**< Number of busy frame_t
    98                                         structures */
     98                                            structures */
    9999        zone_flags_t flags;            /**< Type of the zone */
    100100       
    101101        frame_t *frames;               /**< Array of frame_t structures
    102                                         in this zone */
     102                                            in this zone */
    103103        buddy_system_t *buddy_system;  /**< Buddy system for the zone */
    104104} zone_t;
     
    146146    ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
    147147#define IS_BUDDY_LEFT_BLOCK(zone, frame) \
    148     (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
     148    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
    149149#define IS_BUDDY_RIGHT_BLOCK(zone, frame) \
    150     (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 1)
     150    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
    151151#define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) \
    152     (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
     152    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
    153153#define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) \
    154     (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 1)
     154    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
    155155
    156156#define frame_alloc(order, flags) \
    157     frame_alloc_generic(order, flags, NULL)
     157    frame_alloc_generic((order), (flags), NULL)
    158158
    159159extern void frame_init(void);
     
    162162extern void frame_reference_add(pfn_t);
    163163
    164 extern size_t find_zone(pfn_t frame, size_t count, size_t hint);
     164extern size_t find_zone(pfn_t, size_t, size_t);
    165165extern size_t zone_create(pfn_t, size_t, pfn_t, zone_flags_t);
    166166extern void *frame_get_parent(pfn_t, size_t);
  • kernel/generic/src/mm/frame.c

    r08abd81 r5d853bd  
    695695 * not to be 2^order size. Once the allocator is running it is no longer
    696696 * possible, merged configuration data occupies more space :-/
    697  *
    698  * The function uses
    699697 *
    700698 */
Note: See TracChangeset for help on using the changeset viewer.