public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new
@ 2014-11-17 18:32 Jeff Layton
  2014-11-17 18:32 ` [PATCH RFC 1/2] nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2 Jeff Layton
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeff Layton @ 2014-11-17 18:32 UTC (permalink / raw)
  To: chuck.lever; +Cc: linux-nfs

Chuck was having a problem building nfsdcltrack on a RHEL6 era box, due
to the fact that the libsqlite3 library there was too old. While we
could play games with autoconf, it's just easier to use older library
functions in these places so that we don't have to.

Jeff Layton (2):
  nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2
  nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr

 utils/nfsdcltrack/sqlite.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH RFC 1/2] nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2
  2014-11-17 18:32 [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Jeff Layton
@ 2014-11-17 18:32 ` Jeff Layton
  2014-11-17 18:32 ` [PATCH RFC 2/2] nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr Jeff Layton
  2014-11-17 19:04 ` [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Steve Dickson
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2014-11-17 18:32 UTC (permalink / raw)
  To: chuck.lever; +Cc: linux-nfs

sqlite3_close_v2 wasn't added until v3.7.14 of libsqlite3 so this causes
the build to fail vs. very old sqlite3 libs. Also, Chuck points out that
the documentation says that sqlite3_close_v2 is intended for use with
host languages that are garbage collected, and C isn't.

In practice, we shouldn't ever see sqlite3_close return SQLITE_BUSY here
anyway since the program is single-threaded, so sqlite3_close should be
fine.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
 utils/nfsdcltrack/sqlite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
index fb45c4af5edb..7cac89ef459f 100644
--- a/utils/nfsdcltrack/sqlite.c
+++ b/utils/nfsdcltrack/sqlite.c
@@ -357,7 +357,7 @@ sqlite_prepare_dbh(const char *topdir)
 
 	return ret;
 out_close:
-	sqlite3_close_v2(dbh);
+	sqlite3_close(dbh);
 	dbh = NULL;
 	return ret;
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH RFC 2/2] nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr
  2014-11-17 18:32 [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Jeff Layton
  2014-11-17 18:32 ` [PATCH RFC 1/2] nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2 Jeff Layton
@ 2014-11-17 18:32 ` Jeff Layton
  2014-11-17 19:04 ` [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Steve Dickson
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2014-11-17 18:32 UTC (permalink / raw)
  To: chuck.lever; +Cc: linux-nfs

sqlite3_errstr was only added in v3.7.15 of libsqlite3, which makes it
difficult to build against earlier releases. Switch the code over to
use sqlite3_errmsg instead.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
 utils/nfsdcltrack/sqlite.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
index 7cac89ef459f..54cd7487920b 100644
--- a/utils/nfsdcltrack/sqlite.c
+++ b/utils/nfsdcltrack/sqlite.c
@@ -102,7 +102,7 @@ sqlite_query_schema_version(void)
 		 -1, &stmt, NULL);
 	if (ret != SQLITE_OK) {
 		xlog(L_ERROR, "Unable to prepare select statement: %s",
-			sqlite3_errstr(ret));
+			sqlite3_errmsg(dbh));
 		ret = 0;
 		goto out;
 	}
@@ -111,7 +111,7 @@ sqlite_query_schema_version(void)
 	ret = sqlite3_step(stmt);
 	if (ret != SQLITE_ROW) {
 		xlog(L_ERROR, "Select statement execution failed: %s",
-				sqlite3_errstr(ret));
+				sqlite3_errmsg(dbh));
 		ret = 0;
 		goto out;
 	}
@@ -324,7 +324,7 @@ sqlite_prepare_dbh(const char *topdir)
 	ret = sqlite3_busy_timeout(dbh, CLTRACK_SQLITE_BUSY_TIMEOUT);
 	if (ret != SQLITE_OK) {
 		xlog(L_ERROR, "Unable to set sqlite busy timeout: %s",
-				sqlite3_errstr(ret));
+				sqlite3_errmsg(dbh));
 		goto out_close;
 	}
 
@@ -574,21 +574,21 @@ sqlite_query_reclaiming(const time_t grace_start)
 				      "time < ? OR has_session != 1", -1, &stmt, NULL);
 	if (ret != SQLITE_OK) {
 		xlog(L_ERROR, "%s: unable to prepare select statement: %s",
-				__func__, sqlite3_errstr(ret));
+				__func__, sqlite3_errmsg(dbh));
 		return ret;
 	}
 
 	ret = sqlite3_bind_int64(stmt, 1, (sqlite3_int64)grace_start);
 	if (ret != SQLITE_OK) {
 		xlog(L_ERROR, "%s: bind int64 failed: %s",
-				__func__, sqlite3_errstr(ret));
+				__func__, sqlite3_errmsg(dbh));
 		return ret;
 	}
 
 	ret = sqlite3_step(stmt);
 	if (ret != SQLITE_ROW) {
 		xlog(L_ERROR, "%s: unexpected return code from select: %s",
-				__func__, sqlite3_errstr(ret));
+				__func__, sqlite3_errmsg(dbh));
 		return ret;
 	}
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new
  2014-11-17 18:32 [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Jeff Layton
  2014-11-17 18:32 ` [PATCH RFC 1/2] nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2 Jeff Layton
  2014-11-17 18:32 ` [PATCH RFC 2/2] nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr Jeff Layton
@ 2014-11-17 19:04 ` Steve Dickson
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2014-11-17 19:04 UTC (permalink / raw)
  To: Jeff Layton, chuck.lever; +Cc: linux-nfs



On 11/17/2014 01:32 PM, Jeff Layton wrote:
> Chuck was having a problem building nfsdcltrack on a RHEL6 era box, due
> to the fact that the libsqlite3 library there was too old. While we
> could play games with autoconf, it's just easier to use older library
> functions in these places so that we don't have to.
> 
> Jeff Layton (2):
>   nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2
>   nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr
> 
>  utils/nfsdcltrack/sqlite.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
Both have been committed! Happy Compiles! ;-) 

steved.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-17 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 18:32 [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Jeff Layton
2014-11-17 18:32 ` [PATCH RFC 1/2] nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2 Jeff Layton
2014-11-17 18:32 ` [PATCH RFC 2/2] nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr Jeff Layton
2014-11-17 19:04 ` [PATCH RFC 0/2] nfsdcltrack: don't use libsqlite3 functions that are too new Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox