From 3fa32925645e2c8901d02e1f39e0acb6dd5a8837 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 22 Feb 2008 19:39:09 +0100 Subject: [PATCH 1/3] message enhancements 2nd edition --- libisofs/filesrc.c | 4 ++++ libisofs/libiso_msgs.c | 10 +++++++--- libisofs/libiso_msgs.h | 18 ++++++++++++++++-- libisofs/messages.c | 12 +++++++++++- libisofs/messages.h | 9 +++++++++ 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/libisofs/filesrc.c b/libisofs/filesrc.c index 36df2c5..cd3b61a 100644 --- a/libisofs/filesrc.c +++ b/libisofs/filesrc.c @@ -16,6 +16,7 @@ #include #include + int iso_file_src_cmp(const void *n1, const void *n2) { const IsoFileSrc *f1, *f2; @@ -272,6 +273,7 @@ int filesrc_writer_write_data(IsoImageWriter *writer) * 0's to image */ name = iso_stream_get_name(file->stream); + iso_report_errfile(name, ISO_FILE_CANT_WRITE, 0, 0); res = iso_msg_submit(t->image->id, ISO_FILE_CANT_WRITE, res, "File \"%s\" can't be opened. Filling with 0s.", name); free(name); @@ -289,6 +291,7 @@ int filesrc_writer_write_data(IsoImageWriter *writer) continue; } else if (res > 1) { name = iso_stream_get_name(file->stream); + iso_report_errfile(name, ISO_FILE_CANT_WRITE, 0, 0); res = iso_msg_submit(t->image->id, ISO_FILE_CANT_WRITE, 0, "Size of file \"%s\" has changed. It will be %s", name, (res == 2 ? "truncated" : "padded with 0's")); @@ -327,6 +330,7 @@ int filesrc_writer_write_data(IsoImageWriter *writer) if (b < nblocks) { /* premature end of file, due to error or eof */ char *name = iso_stream_get_name(file->stream); + iso_report_errfile(name, ISO_FILE_CANT_WRITE, 0, 0); if (res < 0) { /* error */ res = iso_msg_submit(t->image->id, ISO_FILE_CANT_WRITE, res, diff --git a/libisofs/libiso_msgs.c b/libisofs/libiso_msgs.c index b777cf6..73eeb5b 100644 --- a/libisofs/libiso_msgs.c +++ b/libisofs/libiso_msgs.c @@ -1,5 +1,5 @@ -/* libiso_msgs (generated from libdax_msgs : Qua Fev 13 14:58:12 CET 2008) +/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:35:41 CET 2008) Message handling facility of libisofs. Copyright (C) 2006 - 2008 Thomas Schmitt , provided under GPL version 2 @@ -268,10 +268,12 @@ int libiso_msgs__text_to_sev(char *severity_name, int *severity, *severity= LIBISO_MSGS_SEV_UPDATE; else if(strncmp(severity_name,"DEBUG",5)==0) *severity= LIBISO_MSGS_SEV_DEBUG; + else if(strncmp(severity_name,"ERRFILE",8)==0) + *severity= LIBISO_MSGS_SEV_ERRFILE; else if(strncmp(severity_name,"ALL",3)==0) *severity= LIBISO_MSGS_SEV_ALL; else { - *severity= LIBISO_MSGS_SEV_NEVER; + *severity= LIBISO_MSGS_SEV_ALL; return(0); } return(1); @@ -282,7 +284,7 @@ int libiso_msgs__sev_to_text(int severity, char **severity_name, int flag) { if(flag&1) { - *severity_name= "NEVER\nABORT\nFATAL\nFAILURE\nMISHAP\nSORRY\nWARNING\nHINT\nNOTE\nUPDATE\nDEBUG\nALL"; + *severity_name= "NEVER\nABORT\nFATAL\nFAILURE\nMISHAP\nSORRY\nWARNING\nHINT\nNOTE\nUPDATE\nDEBUG\nERRFILE\nALL"; return(1); } *severity_name= ""; @@ -308,6 +310,8 @@ int libiso_msgs__sev_to_text(int severity, char **severity_name, *severity_name= "UPDATE"; else if(severity>=LIBISO_MSGS_SEV_DEBUG) *severity_name= "DEBUG"; + else if(severity>=LIBISO_MSGS_SEV_ERRFILE) + *severity_name= "ERRFILE"; else if(severity>=LIBISO_MSGS_SEV_ALL) *severity_name= "ALL"; else { diff --git a/libisofs/libiso_msgs.h b/libisofs/libiso_msgs.h index 74029fb..f20910c 100644 --- a/libisofs/libiso_msgs.h +++ b/libisofs/libiso_msgs.h @@ -1,5 +1,5 @@ -/* libiso_msgs (generated from libdax_msgs : Qua Fev 13 14:58:12 CET 2008) +/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:35:41 CET 2008) Message handling facility of libisofs. Copyright (C) 2006-2008 Thomas Schmitt , provided under GPL version 2 @@ -120,6 +120,19 @@ struct libiso_msgs_item; */ #define LIBISO_MSGS_SEV_ALL 0x00000000 + +/** Messages of this severity shall transport plain disk file paths + whenever an event of severity SORRY or above is related with an + individual disk file. + No message text shall be added to the file path. The ERRFILE message + shall be issued before the human readable message which carries the + true event severity. That message should contain the file path so it + can be found by strstr(message, path)!=NULL. + The error code shall be the same as with the human readable message. +*/ +#define LIBISO_MSGS_SEV_ERRFILE 0x08000000 + + /** Debugging messages not to be visible to normal users by default */ #define LIBISO_MSGS_SEV_DEBUG 0x10000000 @@ -149,7 +162,7 @@ struct libiso_msgs_item; like ISO image generation. A precondition for such a severity ease is that the action can be continued after the incident. See below MISHAP for what xorriso would need instead of this kind of SORRY - an generates for itself in case of libisofs image generation. + and generates for itself in case of libisofs image generation. E.g.: A pattern yields no result. A speed setting cannot be made. @@ -610,6 +623,7 @@ Range "application" : 0x00040000 to 0x0004ffff 0x00040005 (NOTE,HIGH) : Application supplied message 0x00040006 (UPDATE,HIGH) : Application supplied message 0x00040007 (DEBUG,HIGH) : Application supplied message + 0x00040008 (*,HIGH) : Application supplied message ------------------------------------------------------------------------------ diff --git a/libisofs/messages.c b/libisofs/messages.c index b9724df..4097f12 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -341,7 +341,7 @@ int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid, int iso_msgs_submit(int error_code, char msg_text[], int os_errno, char severity[], int origin) { - int ret, sevno, global_index = -1; + int ret, sevno; ret = libiso_msgs__text_to_sev(severity, &sevno, 0); if (ret <= 0) @@ -416,3 +416,13 @@ int iso_error_get_code(int e) { return ISO_ERR_CODE(e); } + + +/* ts A80222 */ +int iso_report_errfile(char *path, int error_code, int os_errno, int flag) +{ + libiso_msgs_submit(libiso_msgr, 0, error_code, + LIBISO_MSGS_SEV_ERRFILE, LIBISO_MSGS_PRIO_HIGH, + path, os_errno, 0); + return(1); +} diff --git a/libisofs/messages.h b/libisofs/messages.h index 29c221b..dc8b98c 100644 --- a/libisofs/messages.h +++ b/libisofs/messages.h @@ -37,4 +37,13 @@ void iso_msg_debug(int imgid, const char *fmt, ...); */ int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...); + +/* ts A80222 */ +/* To be called with events which report incidents with individual input + files from the local filesystem. Not with image nodes, files containing an + image or similar file-like objects. +*/ +int iso_report_errfile(char *path, int error_code, int os_errno, int flag); + + #endif /*MESSAGES_H_*/ From 25ab8631e4f6d21f235251692f2ac8e02215d2f6 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 22 Feb 2008 19:43:09 +0100 Subject: [PATCH 2/3] bundle_A80222_2 --- libisofs/filesrc.c | 1 - libisofs/libiso_msgs.c | 4 ++-- libisofs/libiso_msgs.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libisofs/filesrc.c b/libisofs/filesrc.c index cd3b61a..a4a2bfc 100644 --- a/libisofs/filesrc.c +++ b/libisofs/filesrc.c @@ -16,7 +16,6 @@ #include #include - int iso_file_src_cmp(const void *n1, const void *n2) { const IsoFileSrc *f1, *f2; diff --git a/libisofs/libiso_msgs.c b/libisofs/libiso_msgs.c index 73eeb5b..6a60429 100644 --- a/libisofs/libiso_msgs.c +++ b/libisofs/libiso_msgs.c @@ -1,5 +1,5 @@ -/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:35:41 CET 2008) +/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:42:52 CET 2008) Message handling facility of libisofs. Copyright (C) 2006 - 2008 Thomas Schmitt , provided under GPL version 2 @@ -268,7 +268,7 @@ int libiso_msgs__text_to_sev(char *severity_name, int *severity, *severity= LIBISO_MSGS_SEV_UPDATE; else if(strncmp(severity_name,"DEBUG",5)==0) *severity= LIBISO_MSGS_SEV_DEBUG; - else if(strncmp(severity_name,"ERRFILE",8)==0) + else if(strncmp(severity_name,"ERRFILE",7)==0) *severity= LIBISO_MSGS_SEV_ERRFILE; else if(strncmp(severity_name,"ALL",3)==0) *severity= LIBISO_MSGS_SEV_ALL; diff --git a/libisofs/libiso_msgs.h b/libisofs/libiso_msgs.h index f20910c..17e8f9e 100644 --- a/libisofs/libiso_msgs.h +++ b/libisofs/libiso_msgs.h @@ -1,5 +1,5 @@ -/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:35:41 CET 2008) +/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:42:52 CET 2008) Message handling facility of libisofs. Copyright (C) 2006-2008 Thomas Schmitt , provided under GPL version 2 From 353ed64d77f65bc94fc01e22d9cf41cc33041951 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 22 Feb 2008 22:43:30 +0100 Subject: [PATCH 3/3] bundle_A80222_3 --- configure.ac | 4 ++-- libisofs/libisofs.h | 2 +- libisofs/messages.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a449340..69b7dc5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libisofs], [0.6.2], [http://libburnia-project.org]) +AC_INIT([libisofs], [0.6.3], [http://libburnia-project.org]) AC_PREREQ([2.50]) dnl AC_CONFIG_HEADER([config.h]) @@ -44,7 +44,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match. dnl LIBISOFS_MAJOR_VERSION=0 LIBISOFS_MINOR_VERSION=6 -LIBISOFS_MICRO_VERSION=2 +LIBISOFS_MICRO_VERSION=3 LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION AC_SUBST(LIBISOFS_MAJOR_VERSION) diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 4e4e8ec..2cbc37f 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -713,7 +713,7 @@ int iso_lib_is_compatible(int major, int minor, int micro); */ #define iso_lib_header_version_major 0 #define iso_lib_header_version_minor 6 -#define iso_lib_header_version_micro 2 +#define iso_lib_header_version_micro 3 /** * Usage discussion: diff --git a/libisofs/messages.c b/libisofs/messages.c index 4097f12..064c441 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -345,7 +345,7 @@ int iso_msgs_submit(int error_code, char msg_text[], int os_errno, ret = libiso_msgs__text_to_sev(severity, &sevno, 0); if (ret <= 0) - sevno = LIBISO_MSGS_SEV_FATAL; + sevno = LIBISO_MSGS_SEV_ALL; if (error_code <= 0) { switch(sevno) { case LIBISO_MSGS_SEV_ABORT: error_code = 0x00040000;