From 6c0e8c14be9546b49c097f5e6e8307bda3e7f5ac Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sun, 30 May 2010 15:29:05 +0100 Subject: [libc] Enable automated extraction of error usage reports Add preprocessor magic to the error definitions to enable every error usage to be tracked. Signed-off-by: Michael Brown --- src/image/segment.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/image') diff --git a/src/image/segment.c b/src/image/segment.c index 9099c8fed..c3f0b8d5c 100644 --- a/src/image/segment.c +++ b/src/image/segment.c @@ -31,6 +31,19 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include +/** + * Segment-specific error messages + * + * This error happens sufficiently often to merit a user-friendly + * description. + */ +#define ERANGE_SEGMENT __einfo_error ( EINFO_ERANGE_SEGMENT ) +#define EINFO_ERANGE_SEGMENT \ + __einfo_uniqify ( EINFO_ERANGE, 0x01, "Requested memory not available" ) +struct errortab segment_errors[] __errortab = { + __einfo_errortab ( EINFO_ERANGE_SEGMENT ), +}; + /** * Prepare segment for loading * @@ -73,15 +86,5 @@ int prep_segment ( userptr_t segment, size_t filesz, size_t memsz ) { /* No suitable memory region found */ DBG ( "Segment [%lx,%lx,%lx) does not fit into available memory\n", start, mid, end ); - return -ERANGE; + return -ERANGE_SEGMENT; } - -/** - * Segment-specific error messages - * - * This error happens sufficiently often to merit a user-friendly - * description. - */ -struct errortab segment_errors[] __errortab = { - { ERANGE, "Requested memory not available" }, -}; -- cgit v1.2.3-55-g7522