Modify *run_ioctl_interruptible* function

Make *run_ioctl_interruptible* a wrapper for new function *run_ioctl_interruptible_retry_option*.
Make new function *run_ioctl_interruptible_retry* - a wrapper for *run_ioctl_interruptible_retry_option*.
*run_ioctl_interruptible_retry_option* is old *run_ioctl_interruptible*
function with one more parameter to decide if call *run_ioctl* or *run_ioctl_retry*.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
Slawomir Jankowski 2020-04-09 09:43:00 +02:00
parent cfca19b024
commit db35d5a299
2 changed files with 32 additions and 2 deletions

View File

@ -433,9 +433,10 @@ void *print_command_progress(void *th_arg)
* Catch SIGINT signal.
* @param friendly_name name of management operation that shall
* be displayed in command prompt
* @param retry decide if ioctl attepmts should retry
*/
int run_ioctl_interruptible(int fd, int command, void *cmd,
char *friendly_name, int cache_id, int core_id)
static int run_ioctl_interruptible_retry_option(int fd, int command, void *cmd,
char *friendly_name, int cache_id, int core_id, bool retry)
{
pthread_t thread;
int ioctl_res;
@ -474,6 +475,33 @@ int run_ioctl_interruptible(int fd, int command, void *cmd,
return ioctl_res;
}
/*
* Run ioctl in a way that displays progressbar (if flushing operation takes longer)
* Catch SIGINT signal.
* @param friendly_name name of management operation that shall
* be displayed in command prompt
*/
int run_ioctl_interruptible(int fd, int command, void *cmd,
char *friendly_name, int cache_id, int core_id)
{
return run_ioctl_interruptible_retry_option(fd, command, cmd, friendly_name,
cache_id, core_id, false);
}
/*
* Run ioctl in a way that displays progressbar (if flushing operation
* takes longer) with retries.
* Catch SIGINT signal.
* @param friendly_name name of management operation that shall
* be displayed in command prompt
*/
int run_ioctl_interruptible_retry(int fd, int command, void *cmd,
char *friendly_name, int cache_id, int core_id)
{
return run_ioctl_interruptible_retry_option(fd, command, cmd, friendly_name,
cache_id, core_id, true);
}
/*
* @brief ioctl wrapper
* @param[in] fd as for IOCTL(2)

View File

@ -31,6 +31,8 @@ int run_ioctl(int fd, int command, void *cmd);
int run_ioctl_retry(int fd, int command, void *cmd);
int run_ioctl_interruptible(int fd, int command, void *cmd,
char *friendly_name, int cache_id, int core_id);
int run_ioctl_interruptible_retry(int fd, int command, void *cmd,
char *friendly_name, int cache_id, int core_id);
int open_ctrl_device();
int was_ioctl_interrupted();
void set_default_sig_handler();