~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/buf0buddy.h

  • Committer: lbieber
  • Date: 2010-10-02 19:48:35 UTC
  • mfrom: (1730.6.19 drizzle-make-lcov)
  • Revision ID: lbieber@orisndriz08-20101002194835-q5zd9qc4lvx1xnfo
Merge Hartmut - clean up lex, now require flex to build, also "make lcov" improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/buf0buddy.h
21
 
Binary buddy allocator for compressed pages
22
 
 
23
 
Created December 2006 by Marko Makela
24
 
*******************************************************/
25
 
 
26
 
#ifndef buf0buddy_h
27
 
#define buf0buddy_h
28
 
 
29
 
#ifdef UNIV_MATERIALIZE
30
 
# undef UNIV_INLINE
31
 
# define UNIV_INLINE
32
 
#endif
33
 
 
34
 
#include "univ.i"
35
 
#include "buf0types.h"
36
 
 
37
 
/**********************************************************************//**
38
 
Allocate a block.  The thread calling this function must hold
39
 
buf_pool->mutex and must not hold buf_pool->zip_mutex or any
40
 
block->mutex.  The buf_pool->mutex may only be released and reacquired
41
 
if lru != NULL.  This function should only be used for allocating
42
 
compressed page frames or control blocks (buf_page_t).  Allocated
43
 
control blocks must be properly initialized immediately after
44
 
buf_buddy_alloc() has returned the memory, before releasing
45
 
buf_pool->mutex.
46
 
@return allocated block, possibly NULL if lru == NULL */
47
 
UNIV_INLINE
48
 
void*
49
 
buf_buddy_alloc(
50
 
/*============*/
51
 
        buf_pool_t*     buf_pool,
52
 
                        /*!< buffer pool in which the block resides */
53
 
        ulint   size,   /*!< in: block size, up to UNIV_PAGE_SIZE */
54
 
        ibool*  lru)    /*!< in: pointer to a variable that will be assigned
55
 
                        TRUE if storage was allocated from the LRU list
56
 
                        and buf_pool->mutex was temporarily released,
57
 
                        or NULL if the LRU list should not be used */
58
 
        __attribute__((malloc));
59
 
 
60
 
/**********************************************************************//**
61
 
Release a block. */
62
 
UNIV_INLINE
63
 
void
64
 
buf_buddy_free(
65
 
/*===========*/
66
 
        buf_pool_t*     buf_pool,
67
 
                        /*!< buffer pool in which the block resides */
68
 
        void*   buf,    /*!< in: block to be freed, must not be
69
 
                        pointed to by the buffer pool */
70
 
        ulint   size)   /*!< in: block size, up to UNIV_PAGE_SIZE */
71
 
        __attribute__((nonnull));
72
 
 
73
 
#ifndef UNIV_NONINL
74
 
# include "buf0buddy.ic"
75
 
#endif
76
 
 
77
 
#endif /* buf0buddy_h */