2006-12-07 14:29:04 +01:00
|
|
|
/******************************************************
|
|
|
|
Binary buddy allocator for compressed pages
|
|
|
|
|
|
|
|
(c) 2006 Innobase Oy
|
|
|
|
|
|
|
|
Created December 2006 by Marko Makela
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#ifndef buf0buddy_h
|
|
|
|
#define buf0buddy_h
|
|
|
|
|
|
|
|
#ifdef UNIV_MATERIALIZE
|
|
|
|
# undef UNIV_INLINE
|
|
|
|
# define UNIV_INLINE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
#include "buf0types.h"
|
|
|
|
|
|
|
|
/**************************************************************************
|
2006-12-11 15:27:43 +01:00
|
|
|
Allocate a block. */
|
2006-12-07 14:29:04 +01:00
|
|
|
UNIV_INLINE
|
|
|
|
void*
|
2006-12-07 16:05:06 +01:00
|
|
|
buf_buddy_alloc(
|
|
|
|
/*============*/
|
2006-12-11 15:27:43 +01:00
|
|
|
/* out: pointer to the start of the block */
|
2006-12-20 16:56:58 +01:00
|
|
|
ulint size, /* in: block size, up to UNIV_PAGE_SIZE */
|
2006-12-12 13:14:58 +01:00
|
|
|
ibool lru) /* in: TRUE=allocate from the LRU list if needed */
|
2006-12-07 14:29:04 +01:00
|
|
|
__attribute__((malloc));
|
|
|
|
|
2006-12-07 16:22:44 +01:00
|
|
|
/**************************************************************************
|
2006-12-11 10:54:13 +01:00
|
|
|
Release a block. */
|
2006-12-07 16:22:44 +01:00
|
|
|
UNIV_INLINE
|
2006-12-11 10:54:13 +01:00
|
|
|
void
|
2006-12-07 16:22:44 +01:00
|
|
|
buf_buddy_free(
|
|
|
|
/*===========*/
|
2006-12-20 12:38:19 +01:00
|
|
|
void* buf, /* in: block to be freed, must not be
|
|
|
|
pointed to by the buffer pool */
|
2006-12-20 16:56:58 +01:00
|
|
|
ulint size) /* in: block size, up to UNIV_PAGE_SIZE */
|
2006-12-07 16:22:44 +01:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2006-12-07 14:29:04 +01:00
|
|
|
#ifndef UNIV_NONINL
|
|
|
|
# include "buf0buddy.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* buf0buddy_h */
|