From patchwork Wed Oct 24 15:25:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1639121 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BD0C1DF2AB for ; Wed, 24 Oct 2012 15:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934910Ab2JXP0O (ORCPT ); Wed, 24 Oct 2012 11:26:14 -0400 Received: from mail-vc0-f174.google.com ([209.85.220.174]:62426 "EHLO mail-vc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934911Ab2JXP0M (ORCPT ); Wed, 24 Oct 2012 11:26:12 -0400 Received: by mail-vc0-f174.google.com with SMTP id fk26so666919vcb.19 for ; Wed, 24 Oct 2012 08:26:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=d6khH+EOhcxUvaYqmenzEutkDuq9BSIhR7JR4OvvozI=; b=pnkyFBzaDgEf1SFZpIAc+mGeUfZVGbDM79aGigzGQNrzEteGh4TIgjTqNEoeg6InGt dzMVg2rojCTK158r9YTm+VI5owywiNITkH3hZyu7HTi8kTzVpZus4Jj9GZNAM00CaiRs QCVOE6TIGrTT542sWpYcoVrjH7zAhI9YGB+Tc/EVSujNSVzRJEh5KgXgsPLzi74W2Pag G3VZCkfrWRlyFiH1HdMbPTY1J89LUghrMsSL48pRbiPX03gI9S2IKUujJmzspriZBbPv 7z+68ptbApjQlxMSa1n2p0g7LdCKvzLEtDeZHZScIsD99wilP7rZ05E6uHt/DFHQu+sA hutA== Received: by 10.52.98.200 with SMTP id ek8mr22373233vdb.90.1351092369270; Wed, 24 Oct 2012 08:26:09 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id y15sm16388744vdt.9.2012.10.24.08.26.07 (version=SSLv3 cipher=OTHER); Wed, 24 Oct 2012 08:26:08 -0700 (PDT) From: Jeff Layton To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 03/10] nfsdcltrack: remove pointless sqlite_topdir variable Date: Wed, 24 Oct 2012 11:25:52 -0400 Message-Id: <1351092359-25842-4-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351092359-25842-1-git-send-email-jlayton@redhat.com> References: <1351092359-25842-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQlgAKvil2BVFvYAUoqil8A3cY776K5LVA0Yw3i3CxkbEgs7rmRmHcW4jRuTL2Eqp53h+zOl Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This is holdover from an earlier version of the code and doesn't really provide any benefit. Also, mark the topdir and dirname arguments const since they should never be changed. Signed-off-by: Jeff Layton --- utils/nfsdcltrack/sqlite.c | 13 ++++--------- utils/nfsdcltrack/sqlite.h | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c index fc882c6..c19af7e 100644 --- a/utils/nfsdcltrack/sqlite.c +++ b/utils/nfsdcltrack/sqlite.c @@ -61,9 +61,6 @@ /* global variables */ -/* top level DB directory */ -static char *sqlite_topdir; - /* reusable pathname and sql command buffer */ static char buf[PATH_MAX]; @@ -74,7 +71,7 @@ static sqlite3 *dbh; /* make a directory, ignoring EEXIST errors unless it's not a directory */ static int -mkdir_if_not_exist(char *dirname) +mkdir_if_not_exist(const char *dirname) { int ret; struct stat statbuf; @@ -102,19 +99,17 @@ mkdir_if_not_exist(char *dirname) * the "clients" table. */ int -sqlite_maindb_init(char *topdir) +sqlite_maindb_init(const char *topdir) { int ret; char *err = NULL; sqlite3_stmt *stmt = NULL; - sqlite_topdir = topdir; - - ret = mkdir_if_not_exist(sqlite_topdir); + ret = mkdir_if_not_exist(topdir); if (ret) return ret; - ret = snprintf(buf, PATH_MAX - 1, "%s/main.sqlite", sqlite_topdir); + ret = snprintf(buf, PATH_MAX - 1, "%s/main.sqlite", topdir); if (ret < 0) return ret; diff --git a/utils/nfsdcltrack/sqlite.h b/utils/nfsdcltrack/sqlite.h index c85e7d6..8748948 100644 --- a/utils/nfsdcltrack/sqlite.h +++ b/utils/nfsdcltrack/sqlite.h @@ -20,7 +20,7 @@ #ifndef _SQLITE_H_ #define _SQLITE_H_ -int sqlite_maindb_init(char *topdir); +int sqlite_maindb_init(const char *topdir); int sqlite_insert_client(const unsigned char *clname, const size_t namelen); int sqlite_remove_client(const unsigned char *clname, const size_t namelen); int sqlite_check_client(const unsigned char *clname, const size_t namelen);