Merge more Thomas contributions related to ticket #125.
This commit is contained in:
commit
e5f1cfca40
@ -272,6 +272,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 +290,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 +329,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,
|
||||
|
@ -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:42:52 CET 2008)
|
||||
Message handling facility of libisofs.
|
||||
Copyright (C) 2006 - 2008 Thomas Schmitt <scdbackup@gmx.net>,
|
||||
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",7)==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 {
|
||||
|
@ -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:42:52 CET 2008)
|
||||
Message handling facility of libisofs.
|
||||
Copyright (C) 2006-2008 Thomas Schmitt <scdbackup@gmx.net>,
|
||||
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
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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_*/
|
||||
|
Loading…
Reference in New Issue
Block a user