You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

  1. /*****************************************************************************
  2. Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free Software
  5. Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along with
  10. this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  11. Place, Suite 330, Boston, MA 02111-1307 USA
  12. *****************************************************************************/
  13. /******************************************************************//**
  14. @file include/fut0fut.ic
  15. File-based utilities
  16. Created 12/13/1995 Heikki Tuuri
  17. ***********************************************************************/
  18. #include "sync0rw.h"
  19. #include "buf0buf.h"
  20. /********************************************************************//**
  21. Gets a pointer to a file address and latches the page.
  22. @return pointer to a byte in a frame; the file page in the frame is
  23. bufferfixed and latched */
  24. UNIV_INLINE
  25. byte*
  26. fut_get_ptr(
  27. /*========*/
  28. ulint space, /*!< in: space id */
  29. ulint zip_size,/*!< in: compressed page size in bytes
  30. or 0 for uncompressed pages */
  31. fil_addr_t addr, /*!< in: file address */
  32. ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH */
  33. mtr_t* mtr) /*!< in: mtr handle */
  34. {
  35. buf_block_t* block;
  36. byte* ptr;
  37. ut_ad(addr.boffset < UNIV_PAGE_SIZE);
  38. ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
  39. block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr);
  40. ptr = buf_block_get_frame(block) + addr.boffset;
  41. buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
  42. return(ptr);
  43. }