diff options
author | Miles Bader <miles@gnu.org> | 1995-05-12 00:18:25 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-05-12 00:18:25 +0000 |
commit | e4ae66f1e304fe10dc6f2092483db2b5158c197b (patch) | |
tree | fba41aca241deb291861a8d6913ec5f14f6983f8 /ext2fs | |
parent | e0813ea8d9797b6cf3316fc2cb6ec555e381d753 (diff) |
(ext2_error, ext2_warning, ext2_panic): Rename to add the underline prefix
(the previous names are now macros that call the renamed functions). Also
rearrange a bit to hold the lock around the use of the global message buffer.
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/ext2fs.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c index a0d6a64c..2e1dd9e0 100644 --- a/ext2fs/ext2fs.c +++ b/ext2fs/ext2fs.c @@ -80,44 +80,50 @@ int printf (const char *fmt, ...) static char error_buf[1024]; -void ext2_error (const char * function, const char * fmt, ...) +void _ext2_error (const char * function, const char * fmt, ...) { va_list args; + mutex_lock(&printf_lock); + va_start (args, fmt); vsprintf (error_buf, fmt, args); va_end (args); - mutex_lock(&printf_lock); fprintf (stderr, "ext2fs: %s: %s: %s\n", device_name, function, error_buf); + mutex_unlock(&printf_lock); } -void ext2_panic (const char * function, const char * fmt, ...) +void _ext2_panic (const char * function, const char * fmt, ...) { va_list args; + mutex_lock(&printf_lock); + va_start (args, fmt); vsprintf (error_buf, fmt, args); va_end (args); - mutex_lock(&printf_lock); fprintf(stderr, "ext2fs: %s: panic: %s: %s\n", device_name, function, error_buf); + mutex_unlock(&printf_lock); - exit (0); + exit (1); } -void ext2_warning (const char * function, const char * fmt, ...) +void _ext2_warning (const char * function, const char * fmt, ...) { va_list args; + mutex_lock(&printf_lock); + va_start (args, fmt); vsprintf (error_buf, fmt, args); va_end (args); - mutex_lock(&printf_lock); fprintf (stderr, "ext2fs: %s: %s: %s\n", device_name, function, error_buf); + mutex_unlock(&printf_lock); } @@ -277,10 +283,9 @@ main (int argc, char **argv) error (3, err, "get_hypermetadata"); if (device_size < sblock->s_blocks_count * block_size) - ext2_panic("main", - "Disk size (%d) too small (superblock says we need %ld)", - sizes[DEV_GET_SIZE_DEVICE_SIZE], - sblock->s_blocks_count * block_size); + ext2_panic ("disk size (%d) too small (superblock says we need %ld)", + sizes[DEV_GET_SIZE_DEVICE_SIZE], + sblock->s_blocks_count * block_size); /* A handy source of page-aligned zeros. */ vm_allocate (mach_task_self (), &zeroblock, block_size, 1); |