~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/**********************************************************************
2
File-based utilities
3
4
(c) 1995 Innobase Oy
5
6
Created 12/13/1995 Heikki Tuuri
7
***********************************************************************/
8
9
#include "sync0rw.h"
10
#include "buf0buf.h"
11
12
/************************************************************************
13
Gets a pointer to a file address and latches the page. */
14
UNIV_INLINE
15
byte*
16
fut_get_ptr(
17
/*========*/
18
				/* out: pointer to a byte in a frame; the file
19
				page in the frame is bufferfixed and latched */
20
	ulint		space,	/* in: space id */
21
	fil_addr_t	addr,	/* in: file address */
22
	ulint		rw_latch, /* in: RW_S_LATCH, RW_X_LATCH */
23
	mtr_t*		mtr)	/* in: mtr handle */
24
{
25
	byte*	ptr;
26
27
	ut_ad(mtr);
28
	ut_ad(addr.boffset < UNIV_PAGE_SIZE);
29
	ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
30
31
	ptr = buf_page_get(space, addr.page, rw_latch, mtr) + addr.boffset;
32
33
#ifdef UNIV_SYNC_DEBUG
34
	buf_page_dbg_add_level(ptr, SYNC_NO_ORDER_CHECK);
35
#endif /* UNIV_SYNC_DEBUG */
36
37
	return(ptr);
38
}