From patchwork Fri Feb 22 17:21:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2176681 Return-Path: X-Original-To: patchwork-ceph-devel@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 3D31DDFABD for ; Fri, 22 Feb 2013 17:21:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758384Ab3BVRVv (ORCPT ); Fri, 22 Feb 2013 12:21:51 -0500 Received: from mail-ia0-f177.google.com ([209.85.210.177]:36357 "EHLO mail-ia0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757765Ab3BVRVv (ORCPT ); Fri, 22 Feb 2013 12:21:51 -0500 Received: by mail-ia0-f177.google.com with SMTP id o25so738988iad.36 for ; Fri, 22 Feb 2013 09:21:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=MoA2G5tXnUJ7Ra0ZofVtxerhuaaMsiR2MLNOYc2kVjA=; b=E4pV2bIHIAqXaWyBpBBbqiulht6HIqEUNc//d2VTa+GHgcf+R4gm/xpLBa9vbQD1w9 Uhl8/Zp8E7sz1WqbtTw12dvpNjuHeRPVc6D5T2/I1YTy3uWcCM1tbY1Tv/x8jZLUSwiR Y9tZUqhZzcfnO6huVG9UcCagIceRzqbtEsZ54lEM+Xo80uVKs3Ud0vmOWBfVR88APBKO GoIqPg5baTPqaFZcazszhHN2KojkPfoaMUk7l90GQeOJgZOqKWAayHhcNszYHOOUkvZC G1QJuU1eaF+f0hFc5r5Ms6VRSZHWXtWUS812wIqVRjvwfQVrfsJM0VyDKbs4zSFc9Oj3 kikg== X-Received: by 10.50.153.198 with SMTP id vi6mr15449857igb.112.1361553710746; Fri, 22 Feb 2013 09:21:50 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id ip8sm2230308igc.4.2013.02.22.09.21.48 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Feb 2013 09:21:49 -0800 (PST) Message-ID: <5127A92C.1050009@inktank.com> Date: Fri, 22 Feb 2013 11:21:48 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org >> ceph-devel" Subject: [PATCH, v2] libceph: eliminate sparse warnings References: <5127A85D.1070000@inktank.com> In-Reply-To: <5127A85D.1070000@inktank.com> X-Gm-Message-State: ALoCoQm1jxl+QY1QoEswuolD2aXnKwu9xXklJuIJ+okj6WrlkErjCdGCHhNmCZoewqGkonYMtVRC Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Eliminate most of the problems in the libceph code that cause sparse to issue warnings. - Convert functions that are never referenced externally to have static scope. - Pass NULL rather than 0 for a pointer argument in one spot in ceph_monc_delete_snapid() This partially resolves: http://tracker.ceph.com/issues/4184 Reported-by: Fengguang Wu Signed-off-by: Alex Elder --- v2: rebased net/ceph/crypto.c | 7 ++++--- net/ceph/messenger.c | 2 +- net/ceph/mon_client.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index af14cb4..6e7a236 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c @@ -423,7 +423,8 @@ int ceph_encrypt2(struct ceph_crypto_key *secret, void *dst, size_t *dst_len, } } -int ceph_key_instantiate(struct key *key, struct key_preparsed_payload *prep) +static int ceph_key_instantiate(struct key *key, + struct key_preparsed_payload *prep) { struct ceph_crypto_key *ckey; size_t datalen = prep->datalen; @@ -458,12 +459,12 @@ err: return ret; } -int ceph_key_match(const struct key *key, const void *description) +static int ceph_key_match(const struct key *key, const void *description) { return strcmp(key->description, description) == 0; } -void ceph_key_destroy(struct key *key) { +static void ceph_key_destroy(struct key *key) { struct ceph_crypto_key *ckey = key->payload.data; ceph_crypto_key_destroy(ckey); diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 771d4c9..ed9e237 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -223,7 +223,7 @@ static void encode_my_addr(struct ceph_messenger *msgr) */ static struct workqueue_struct *ceph_msgr_wq; -void _ceph_msgr_exit(void) +static void _ceph_msgr_exit(void) { if (ceph_msgr_wq) { destroy_workqueue(ceph_msgr_wq); diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 812eb3b..aef5b10 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -697,7 +697,7 @@ int ceph_monc_delete_snapid(struct ceph_mon_client *monc, u32 pool, u64 snapid) { return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, - pool, snapid, 0, 0); + pool, snapid, NULL, 0); }