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