From patchwork Wed Jul 29 18:20:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 501788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (unknown [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 4ECFF14030C for ; Thu, 30 Jul 2015 04:20:58 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 066CA6E02; Wed, 29 Jul 2015 18:20:57 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from hylle06.itea.ntnu.no (hylle06.itea.ntnu.no [129.241.56.235]) by lists.osmocom.org (Postfix) with ESMTP id 3B72F6DF2 for ; Wed, 29 Jul 2015 18:20:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id B9C2366381D for ; Wed, 29 Jul 2015 20:20:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle06.itea.ntnu.no Received: from alumnimail01.it.ntnu.no (alumnimail01.it.ntnu.no [129.241.18.54]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hylle06.itea.ntnu.no (Postfix) with ESMTPS id DB55666132E for ; Wed, 29 Jul 2015 20:20:51 +0200 (CEST) Received: from localhost (nat.sec.t-labs.tu-berlin.de [130.149.230.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: suraev) by alumnimail01.it.ntnu.no (Postfix) with ESMTPSA id AB0415E9CF for ; Wed, 29 Jul 2015 20:20:51 +0200 (CEST) From: Max To: openbsc@lists.osmocom.org Subject: [PATCH 2/3] use thread-safe DBI interface instead of deprecated one Date: Wed, 29 Jul 2015 20:20:29 +0200 Message-Id: <1438194030-6423-2-git-send-email-max.suraev@fairwaves.co> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438194030-6423-1-git-send-email-max.suraev@fairwaves.co> References: <1438194030-6423-1-git-send-email-max.suraev@fairwaves.co> X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Signed-off-by: Max --- debian/control | 2 +- openbsc/configure.ac | 1 + openbsc/src/libmsc/db.c | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index ad0cc89..af305f9 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: openbsc Section: net Priority: optional Maintainer: Harald Welte -Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev, dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev +Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp0-dev, libosmocore-dev, libosmo-sccp-dev, libdbi-dev (>= 0.9.0), dh-autoreconf, libosmo-abis-dev, libosmo-netif-dev, libdbd-sqlite3, libpcap-dev Standards-Version: 3.8.4 Homepage: http://openbsc.osmocom.org/ Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git diff --git a/openbsc/configure.ac b/openbsc/configure.ac index 0ebb041..c07467e 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -27,6 +27,7 @@ PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0) PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) +PKG_CHECK_MODULES(LIBDBI, dbi >= 0.9.0) # Enabke/disable the NAT? AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])], diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 035202d..9b0ce43 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -44,6 +44,7 @@ void subscr_direct_free(struct gsm_subscriber *subscr); static char *db_basename = NULL; static char *db_dirname = NULL; static dbi_conn conn; +static dbi_inst dbi_instance = 0; #define SCHEMA_REVISION "4" @@ -425,9 +426,9 @@ static int db_configure(void) int db_init(const char *name) { - dbi_initialize(NULL); + dbi_initialize_r(NULL, &dbi_instance); - conn = dbi_conn_new("sqlite3"); + conn = dbi_conn_new_r("sqlite3", dbi_instance); if (conn == NULL) { LOGP(DDB, LOGL_FATAL, "Failed to create connection.\n"); return 1; @@ -491,7 +492,7 @@ int db_prepare(void) int db_fini(void) { dbi_conn_close(conn); - dbi_shutdown(); + dbi_shutdown_r(dbi_instance); free(db_dirname); free(db_basename);