2003-07-05 02:34:56 +04:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2011-02-18 17:16:11 +03:00
* Copyright ( C ) 2004 - 2011 Red Hat , Inc . All rights reserved .
2003-07-05 02:34:56 +04:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 23:35:44 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 13:49:46 +03:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2003-07-05 02:34:56 +04:00
*/
# ifndef LVM_MEMLOCK_H
# define LVM_MEMLOCK_H
2004-03-27 00:11:34 +03:00
struct cmd_context ;
2003-07-05 02:34:56 +04:00
2011-04-29 00:29:59 +04:00
/*
* Inside a critical section , memory is always locked .
*
* After leaving the critical section , memory stays locked until
* memlock_unlock ( ) is called . This happens with
* sync_local_dev_names ( ) and sync_dev_names ( ) .
*
* This allows critical sections to be entered and exited repeatedly without
* incurring the expense of locking memory every time .
*
* memlock_reset ( ) is necessary to clear the state after forking ( polldaemon ) .
*/
2011-06-11 04:03:06 +04:00
void critical_section_inc ( struct cmd_context * cmd , const char * reason ) ;
void critical_section_dec ( struct cmd_context * cmd , const char * reason ) ;
2011-02-18 17:16:11 +03:00
int critical_section ( void ) ;
2018-03-15 11:07:24 +03:00
int prioritized_section ( void ) ;
2010-03-05 17:48:33 +03:00
void memlock_inc_daemon ( struct cmd_context * cmd ) ;
void memlock_dec_daemon ( struct cmd_context * cmd ) ;
2015-10-22 11:43:58 +03:00
int memlock_count_daemon ( void ) ;
2003-07-05 02:34:56 +04:00
void memlock_init ( struct cmd_context * cmd ) ;
2011-02-18 17:16:11 +03:00
void memlock_reset ( void ) ;
void memlock_unlock ( struct cmd_context * cmd ) ;
2003-07-05 02:34:56 +04:00
# endif