diff options
author | pjd <pjd@FreeBSD.org> | 2011-01-31 18:32:17 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-01-31 18:32:17 +0000 |
commit | d916d2edb510181e3ab25256b84c439c5e1b8498 (patch) | |
tree | f3795a28e12aabbbc327a4d51170b148a1f2dbb2 /sbin/hastd/secondary.c | |
parent | 34c6c0a73948c51ae253cd9f5821beeee63cb4ca (diff) | |
download | FreeBSD-src-d916d2edb510181e3ab25256b84c439c5e1b8498.zip FreeBSD-src-d916d2edb510181e3ab25256b84c439c5e1b8498.tar.gz |
- Use pjdlog for assertions and aborts as this will log assert/abort message
to syslog if we run in background.
- Asserts in proto.c that method we want to call is implemented and remove
dummy methods from protocols implementation that are only there to abort
the program with nice message.
MFC after: 1 week
Diffstat (limited to 'sbin/hastd/secondary.c')
-rw-r--r-- | sbin/hastd/secondary.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c index 21b54be..b19bb95 100644 --- a/sbin/hastd/secondary.c +++ b/sbin/hastd/secondary.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <sys/disk.h> #include <sys/stat.h> -#include <assert.h> #include <err.h> #include <errno.h> #include <fcntl.h> @@ -248,7 +247,7 @@ init_remote(struct hast_resource *res, struct nv *nvin) * there is no need to synchronize anything. If primary node * done any writes already we have to synchronize everything. */ - assert(res->hr_secondary_localcnt == 0); + PJDLOG_ASSERT(res->hr_secondary_localcnt == 0); res->hr_resuid = resuid; if (metadata_write(res) < 0) exit(EX_NOINPUT); @@ -307,7 +306,7 @@ init_remote(struct hast_resource *res, struct nv *nvin) * This should never happen in practise, but we will perform * full synchronization. */ - assert(res->hr_secondary_localcnt < res->hr_primary_remotecnt || + PJDLOG_ASSERT(res->hr_secondary_localcnt < res->hr_primary_remotecnt || res->hr_primary_localcnt < res->hr_secondary_remotecnt); mapsize = activemap_calc_ondisk_size(res->hr_local_mediasize - METADATA_SIZE, res->hr_extentsize, @@ -425,15 +424,15 @@ hastd_secondary(struct hast_resource *res, struct nv *nvin) * request response. */ error = pthread_create(&td, NULL, ctrl_thread, res); - assert(error == 0); + PJDLOG_ASSERT(error == 0); init_remote(res, nvin); event_send(res, EVENT_CONNECT); error = pthread_create(&td, NULL, recv_thread, res); - assert(error == 0); + PJDLOG_ASSERT(error == 0); error = pthread_create(&td, NULL, disk_thread, res); - assert(error == 0); + PJDLOG_ASSERT(error == 0); (void)send_thread(res); } @@ -555,7 +554,7 @@ secondary_exit(int exitcode, const char *fmt, ...) { va_list ap; - assert(exitcode != EX_OK); + PJDLOG_ASSERT(exitcode != EX_OK); va_start(ap, fmt); pjdlogv_errno(LOG_ERR, fmt, ap); va_end(ap); |