1/***************************************************************************** 2 3Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved. 4 5This program is free software; you can redistribute it and/or modify 6it under the terms of the GNU General Public License, version 2.0, 7as published by the Free Software Foundation. 8 9This program is also distributed with certain software (including 10but not limited to OpenSSL) that is licensed under separate terms, 11as designated in a particular file or component or in included license 12documentation. The authors of MySQL hereby grant you an additional 13permission to link the program and your derivative works with the 14separately licensed software that they have included with MySQL. 15 16This program is distributed in the hope that it will be useful, 17but WITHOUT ANY WARRANTY; without even the implied warranty of 18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19GNU General Public License, version 2.0, for more details. 20 21You should have received a copy of the GNU General Public License along with 22this program; if not, write to the Free Software Foundation, Inc., 2351 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 24 25*****************************************************************************/ 26 27/******************************************************************//** 28@file include/fut0fut.ic 29File-based utilities 30 31Created 12/13/1995 Heikki Tuuri 32***********************************************************************/ 33 34#include "srv0srv.h" 35#include "sync0rw.h" 36#include "buf0buf.h" 37 38/********************************************************************//** 39Gets a pointer to a file address and latches the page. 40@return pointer to a byte in a frame; the file page in the frame is 41bufferfixed and latched */ 42UNIV_INLINE 43byte* 44fut_get_ptr( 45/*========*/ 46 ulint space, /*!< in: space id */ 47 ulint zip_size,/*!< in: compressed page size in bytes 48 or 0 for uncompressed pages */ 49 fil_addr_t addr, /*!< in: file address */ 50 ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH */ 51 mtr_t* mtr) /*!< in: mtr handle */ 52{ 53 buf_block_t* block; 54 byte* ptr; 55 56 ut_ad(addr.boffset < UNIV_PAGE_SIZE); 57 ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); 58 59 block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr); 60 61 SRV_CORRUPT_TABLE_CHECK(block, return(0);); 62 63 ptr = buf_block_get_frame(block) + addr.boffset; 64 65 buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); 66 67 return(ptr); 68} 69