2005-10-17 21:56:27 +04:00
/*
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2011-01-13 17:51:32 +03:00
* Copyright ( C ) 2004 - 2011 Red Hat , Inc . All rights reserved .
2005-10-17 21:56:27 +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 .
2005-10-17 21:56:27 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2005-10-17 21:56:27 +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
2005-10-17 21:56:27 +04:00
*/
2006-05-10 01:23:51 +04:00
# ifndef _LVM_EXEC_H
# define _LVM_EXEC_H
2018-05-14 12:30:20 +03:00
# include "lib/misc/lib.h"
2005-10-17 21:56:27 +04:00
2009-02-28 03:54:06 +03:00
struct cmd_context ;
2011-01-13 17:51:32 +03:00
/**
2024-08-30 00:05:41 +03:00
* Execute command with parameters and return status
2011-01-13 17:51:32 +03:00
*
* \ param rstatus
* Returns command ' s exit status code .
*
* \ param sync_needed
* Bool specifying whether local devices needs to be synchronized
* before executing command .
* Note : You cannot synchronize devices within activation context .
*
* \ return
2013-08-06 16:26:00 +04:00
* 1 ( success ) or 0 ( failure ) .
2011-01-13 17:51:32 +03:00
*/
int exec_cmd ( struct cmd_context * cmd , const char * const argv [ ] ,
int * rstatus , int sync_needed ) ;
2009-02-24 18:48:00 +03:00
2013-08-06 16:27:37 +04:00
struct FILE ;
struct pipe_data {
FILE * fp ;
pid_t pid ;
} ;
/**
* popen ( ) like function to read - only output from executed command
* without running shell .
*
* \ param argv
* Arguments for execvp .
*
* \ param sync_needed
* Bool specifying whether local devices needs to be synchronized
* before executing command .
* Note : You cannot synchronize devices within activation context .
*
* \ param pdata
* Arguments to store data needed for pclose_exec ( ) .
*
* \ return
* 1 ( success ) or 0 ( failure ) .
*/
FILE * pipe_open ( struct cmd_context * cmd , const char * const argv [ ] ,
int sync_needed , struct pipe_data * pdata ) ;
int pipe_close ( struct pipe_data * pdata ) ;
2023-07-16 18:35:20 +03:00
/* Prepare argv options list */
int prepare_exec_args ( struct cmd_context * cmd ,
const char * argv [ ] , int * argc , int options_id ) ;
2006-05-10 01:23:51 +04:00
# endif