ACK: [PATCH 1/2] lib: fwts_klog: Add ability to write message to kernel log

Alex Hung alex.hung at canonical.com
Thu Oct 24 04:57:11 UTC 2013


On 10/21/2013 10:12 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/include/fwts_klog.h |  1 +
>   src/lib/src/fwts_klog.c     | 19 +++++++++++++++++++
>   2 files changed, 20 insertions(+)
>
> diff --git a/src/lib/include/fwts_klog.h b/src/lib/include/fwts_klog.h
> index df37265..ef23750 100644
> --- a/src/lib/include/fwts_klog.h
> +++ b/src/lib/include/fwts_klog.h
> @@ -62,5 +62,6 @@ int        fwts_klog_firmware_check(fwts_framework *fw, fwts_klog_progress_func
>   int        fwts_klog_pm_check(fwts_framework *fw, fwts_klog_progress_func progress, fwts_list *klog, int *errors);
>   int	   fwts_klog_regex_find(fwts_framework *fw, fwts_list *klog, char *pattern);
>   char      *fwts_klog_remove_timestamp(char *text);
> +int        fwts_klog_write(fwts_framework *fw, const char *msg);
>
>   #endif
> diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c
> index 0472136..8d3d874 100644
> --- a/src/lib/src/fwts_klog.c
> +++ b/src/lib/src/fwts_klog.c
> @@ -489,3 +489,22 @@ int fwts_klog_regex_find(fwts_framework *fw, fwts_list *klog, char *pattern)
>
>   	return found;
>   }
> +
> +/*
> + * fwts_klog_write()
> + *	write a message to the kernel log
> + */
> +int fwts_klog_write(fwts_framework *fw, const char *msg)
> +{
> +	FILE *fp;
> +
> +	if ((fp = fopen("/dev/kmsg", "w")) == NULL) {
> +		fwts_log_info(fw, "Cannot write to kernel log /dev/kmsg.");
> +		return FWTS_ERROR;
> +	}
> +
> +	fprintf(fp, "%s", msg);
> +	fclose(fp);
> +
> +	return FWTS_OK;
> +}
>

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list