| 1 | /*********************************************************************** |
| 2 | |
| 3 | Copyright (c) 2017, MariaDB Corporation. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it |
| 6 | under the terms of the GNU General Public License as published by the |
| 7 | Free Software Foundation; version 2 of the License. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, but |
| 10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 12 | Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License along with |
| 15 | this program; if not, write to the Free Software Foundation, Inc., |
| 16 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 17 | |
| 18 | ***********************************************************************/ |
| 19 | |
| 20 | /**************************************************//** |
| 21 | @file os0api.h |
| 22 | The interface to the helper functions. |
| 23 | These functions are used on os0file.h where |
| 24 | including full full header is not feasible and |
| 25 | implemented on buf0buf.cc and fil0fil.cc. |
| 26 | *******************************************************/ |
| 27 | |
| 28 | #ifndef OS_API_H |
| 29 | #define OS_API_H 1 |
| 30 | |
| 31 | /** Page control block */ |
| 32 | class buf_page_t; |
| 33 | |
| 34 | /** File Node */ |
| 35 | struct fil_node_t; |
| 36 | |
| 37 | /** |
| 38 | Should we punch hole to deallocate unused portion of the page. |
| 39 | @param[in] bpage Page control block |
| 40 | @return true if punch hole should be used, false if not */ |
| 41 | bool |
| 42 | buf_page_should_punch_hole( |
| 43 | const buf_page_t* bpage) |
| 44 | MY_ATTRIBUTE((warn_unused_result)); |
| 45 | |
| 46 | /** |
| 47 | Calculate the length of trim (punch_hole) operation. |
| 48 | @param[in] bpage Page control block |
| 49 | @param[in] write_length Write length |
| 50 | @return length of the trim or zero. */ |
| 51 | ulint |
| 52 | buf_page_get_trim_length( |
| 53 | const buf_page_t* bpage, |
| 54 | ulint write_length) |
| 55 | MY_ATTRIBUTE((warn_unused_result)); |
| 56 | |
| 57 | /** |
| 58 | Get should we punch hole to tablespace. |
| 59 | @param[in] space Tablespace |
| 60 | @return true, if punch hole should be tried, false if not. */ |
| 61 | bool |
| 62 | fil_node_should_punch_hole( |
| 63 | const fil_node_t* node) |
| 64 | MY_ATTRIBUTE((warn_unused_result)); |
| 65 | |
| 66 | /** |
| 67 | Set punch hole to tablespace to given value. |
| 68 | @param[in] space Tablespace |
| 69 | @param[in] val value to be set. */ |
| 70 | void |
| 71 | fil_space_set_punch_hole( |
| 72 | fil_node_t* node, |
| 73 | bool val); |
| 74 | |
| 75 | #endif /* OS_API_H */ |
| 76 | |