/usr/include/blockdev/exec.h is in libblockdev-utils-dev 2.16-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #include <glib.h>
#include "extra_arg.h"
#ifndef BD_UTILS_EXEC
#define BD_UTILS_EXEC
/**
* BDUtilsLogFunc:
* @level: log level (as understood by syslog(3))
* @msg: log message
*
* Function type for logging function used by the libblockdev's exec utils to
* log the information about program executing.
*/
typedef void (*BDUtilsLogFunc) (gint level, const gchar *msg);
typedef enum {
BD_UTILS_PROG_STARTED,
BD_UTILS_PROG_PROGRESS,
BD_UTILS_PROG_FINISHED,
} BDUtilsProgStatus;
/**
* BDUtilsProgFunc:
* @task_id: ID of the task/action the progress is reported for
* @status: progress status
* @completion: percentage of completion
* @msg: (allow-none): arbitrary progress message (for the user)
*/
typedef void (*BDUtilsProgFunc) (guint64 task_id, BDUtilsProgStatus status, guint8 completion, gchar *msg);
/**
* BDUtilsProgExtract:
* @line: line from extract progress from
* @completion: (out): percentage of completion
*
* Returns: whether the line was a progress reporting line or not
*/
typedef gboolean (*BDUtilsProgExtract) (const gchar *line, guint8 *completion);
GQuark bd_utils_exec_error_quark (void);
#define BD_UTILS_EXEC_ERROR bd_utils_exec_error_quark ()
typedef enum {
BD_UTILS_EXEC_ERROR_FAILED,
BD_UTILS_EXEC_ERROR_NOOUT,
BD_UTILS_EXEC_ERROR_INVAL_VER,
BD_UTILS_EXEC_ERROR_UTIL_UNAVAILABLE,
BD_UTILS_EXEC_ERROR_UTIL_UNKNOWN_VER,
BD_UTILS_EXEC_ERROR_UTIL_LOW_VER,
BD_UTILS_EXEC_ERROR_UTIL_CHECK_ERROR,
} BDUtilsExecError;
gboolean bd_utils_exec_and_report_error (const gchar **argv, const BDExtraArg **extra, GError **error);
gboolean bd_utils_exec_and_report_error_no_progress (const gchar **argv, const BDExtraArg **extra, GError **error);
gboolean bd_utils_exec_and_report_status_error (const gchar **argv, const BDExtraArg **extra, gint *status, GError **error);
gboolean bd_utils_exec_and_capture_output (const gchar **argv, const BDExtraArg **extra, gchar **output, GError **error);
gboolean bd_utils_exec_and_report_progress (const gchar **argv, const BDExtraArg **extra, BDUtilsProgExtract prog_extract, gint *proc_status, GError **error);
gboolean bd_utils_init_logging (BDUtilsLogFunc new_log_func, GError **error);
gint bd_utils_version_cmp (const gchar *ver_string1, const gchar *ver_string2, GError **error);
gboolean bd_utils_check_util_version (const gchar *util, const gchar *version, const gchar *version_arg, const gchar *version_regexp, GError **error);
gboolean bd_utils_init_prog_reporting (BDUtilsProgFunc new_prog_func, GError **error);
gboolean bd_utils_prog_reporting_initialized ();
guint64 bd_utils_report_started (gchar *msg);
void bd_utils_report_progress (guint64 task_id, guint64 completion, gchar *msg);
void bd_utils_report_finished (guint64 task_id, gchar *msg);
gboolean bd_utils_echo_str_to_file (const gchar *str, const gchar *file_path, GError **error);
#endif /* BD_UTILS_EXEC */
|