From 7284e7e47fdb035b53f5295db77ccf14025b4d16 Mon Sep 17 00:00:00 2001 From: jmallett Date: Sat, 18 Jan 2003 04:22:14 +0000 Subject: Nuke dumb error reporting code, people can just use disk::d_error. Unify the DEBUG and d_error initialisation into an ERROR macro, which can both trace and set the d_error field. Much a more meaningful thing, I should say. --- lib/libufs/libufs.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/libufs/libufs.h') diff --git a/lib/libufs/libufs.h b/lib/libufs/libufs.h index 6f7dc7e..e0c7ece 100644 --- a/lib/libufs/libufs.h +++ b/lib/libufs/libufs.h @@ -38,7 +38,7 @@ /* * Trace steps through libufs, to be used at entry and erroneous return. */ -#define DEBUG(str) \ +#define ERROR(uufsd, str) \ do { \ fprintf(stderr, "libufs in %s", __func__); \ if (str != NULL) \ @@ -46,9 +46,15 @@ do { \ if (errno) \ fprintf(stderr, ": %s", strerror(errno)); \ fprintf(stderr, "\n"); \ + if ((uufsd) != NULL) \ + (uufsd)->d_error = str; \ } while (0) #else /* _LIBUFS_DEBUGGING */ -#define DEBUG(str) /* nil */ +#define DEBUG(uufsd, str) \ +do { \ + if ((uufsd) != NULL) \ + (uufsd)->d_error = str; \ +} while (0) #endif /* _LIBUFS_DEBUGGING */ #endif /* _LIBUFS */ @@ -91,11 +97,6 @@ ssize_t bread(struct uufsd *, ufs2_daddr_t, void *, size_t); ssize_t bwrite(struct uufsd *, ufs2_daddr_t, const void *, size_t); /* - * error.c - */ -void libufs_printerror(struct uufsd *); - -/* * inode.c */ int getino(struct uufsd *, void **, ino_t, int *); -- cgit v1.1