hail-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [hail patch 2/7] Cleanup some in tdb.c
Date: Thu, 29 Jul 2010 20:49:55 -0600	[thread overview]
Message-ID: <20100729204955.5c9010b1@lembas.zaitcev.lan> (raw)

Some syntax sugar, but also make messages consistent.
I removed dbenv-> prefix because it looked pretty goofy in logs.
Plus, make all messages so that they are unique and correspond
exactly to the failed function, for grepping.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>

---
 lib/tdb.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

commit 55dbc1f81b0c40b8d274adb5a24f96616f9dee00
Author: Pete Zaitcev <zaitcev@yahoo.com>
Date:   Thu Jul 29 19:20:53 2010 -0600

    Cleanups: newlines, messages.

diff --git a/lib/tdb.c b/lib/tdb.c
index 12ff231..bc5e50a 100644
--- a/lib/tdb.c
+++ b/lib/tdb.c
@@ -75,7 +75,6 @@ retry:
 		env->err(env, rc, "db_create");
 		return -EIO;
 	}
-
 	db = *db_out;
 
 	if (page_size) {
@@ -218,9 +217,9 @@ int tdb_init(struct tabledb *tdb, const char *db_home, const char *db_password,
 	rc = db_env_create(&tdb->env, 0);
 	if (rc) {
 		if (do_syslog)
-			syslog(LOG_WARNING, "tdb->env_create failed: %d", rc);
+			syslog(LOG_WARNING, "db_env_create failed: %d", rc);
 		else
-			fprintf(stderr, "tdb->env_create failed: %d\n", rc);
+			fprintf(stderr, "db_env_create failed: %d\n", rc);
 		return rc;
 	}
 
@@ -228,7 +227,6 @@ int tdb_init(struct tabledb *tdb, const char *db_home, const char *db_password,
 	dbenv->app_private = tdb;
 
 	dbenv->set_errpfx(dbenv, errpfx);
-
 	if (do_syslog)
 		dbenv->set_errcall(dbenv, db4syslog);
 	else
@@ -247,14 +245,14 @@ int tdb_init(struct tabledb *tdb, const char *db_home, const char *db_password,
 	 */
 	rc = dbenv->log_set_config(dbenv, DB_LOG_AUTO_REMOVE, 1);
 	if (rc) {
-		dbenv->err(dbenv, rc, "log_set_config");
+		dbenv->err(dbenv, rc, "log_set_config(AUTO_REMOVE)");
 		goto err_out;
 	}
 
 	if (db_password) {
 		rc = dbenv->set_encrypt(dbenv, db_password, DB_ENCRYPT_AES);
 		if (rc) {
-			dbenv->err(dbenv, rc, "dbenv->set_encrypt");
+			dbenv->err(dbenv, rc, "set_encrypt");
 			goto err_out;
 		}
 		tdb->keyed = true;
@@ -262,32 +260,32 @@ int tdb_init(struct tabledb *tdb, const char *db_home, const char *db_password,
 
 	rc = dbenv->repmgr_set_local_site(dbenv, rep_host, rep_port, 0);
 	if (rc) {
-		dbenv->err(dbenv, rc, "dbenv->set_local_site");
+		dbenv->err(dbenv, rc, "repmgr_set_local_site");
 		goto err_out;
 	}
 
 	rc = dbenv->set_event_notify(dbenv, db4_event);
 	if (rc) {
-		dbenv->err(dbenv, rc, "dbenv->set_event_notify");
+		dbenv->err(dbenv, rc, "set_event_notify");
 		goto err_out;
 	}
 
 	// rc = dbenv->rep_set_timeout(dbenv, DB_REP_LEASE_TIMEOUT, 17000000);
 	// if (rc) {
-	// 	dbenv->err(dbenv, rc, "dbenv->rep_set_timeout(LEASE)");
+	// 	dbenv->err(dbenv, rc, "rep_set_timeout(LEASE)");
 	// 	goto err_out;
 	// }
 
 	// Comment this out due to "nsites must be zero if leases configured"
 	// rc = dbenv->rep_set_config(dbenv, DB_REP_CONF_LEASE, 1);
 	// if (rc) {
-	// 	dbenv->err(dbenv, rc, "dbenv->rep_set_config");
+	// 	dbenv->err(dbenv, rc, "rep_set_config(LEASE)");
 	// 	goto err_out;
 	// }
 
 	rc = dbenv->rep_set_priority(dbenv, 100);
 	if (rc) {
-		dbenv->err(dbenv, rc, "dbenv->rep_set_priority");
+		dbenv->err(dbenv, rc, "rep_set_priority");
 		goto err_out;
 	}
 
@@ -296,7 +294,7 @@ int tdb_init(struct tabledb *tdb, const char *db_home, const char *db_password,
 	env_flags |= DB_INIT_TXN | DB_INIT_REP;
 	rc = dbenv->open(dbenv, db_home, env_flags, S_IRUSR | S_IWUSR);
 	if (rc) {
-		dbenv->err(dbenv, rc, "dbenv->open");
+		dbenv->err(dbenv, rc, "open(dbenv)");
 		goto err_out;
 	}
 
@@ -306,13 +304,13 @@ int tdb_init(struct tabledb *tdb, const char *db_home, const char *db_password,
 
 	// rc = dbenv->rep_set_nsites(dbenv, nsites + 1);
 	// if (rc) {
-	// 	dbenv->err(dbenv, rc, "dbenv->repmgr_set_nsites");
+	// 	dbenv->err(dbenv, rc, "rep_set_nsites");
 	// 	goto err_out;
 	// }
 
 	rc = dbenv->repmgr_start(dbenv, 2, DB_REP_ELECTION);
 	if (rc) {
-		dbenv->err(dbenv, rc, "dbenv->repmgr_start");
+		dbenv->err(dbenv, rc, "repmgr_start");
 		goto err_out;
 	}
 
@@ -416,3 +414,4 @@ void tdb_fini(struct tabledb *tdb)
 	tdb->env->close(tdb->env, 0);
 	tdb->env = NULL;
 }
+

                 reply	other threads:[~2010-07-30  2:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100729204955.5c9010b1@lembas.zaitcev.lan \
    --to=zaitcev@redhat.com \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).