From patchwork Mon Jul 13 18:01:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 6780951 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F2C9C05AC for ; Mon, 13 Jul 2015 18:08:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5324720549 for ; Mon, 13 Jul 2015 18:08:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 643A320547 for ; Mon, 13 Jul 2015 18:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751595AbbGMSIa (ORCPT ); Mon, 13 Jul 2015 14:08:30 -0400 Received: from mx141.netapp.com ([216.240.21.12]:12344 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbbGMSIa (ORCPT ); Mon, 13 Jul 2015 14:08:30 -0400 X-IronPort-AV: E=Sophos;i="5.15,464,1432623600"; d="scan'208";a="56425580" Received: from vmwexchts04-prd.hq.netapp.com ([10.122.105.32]) by mx141-out.netapp.com with ESMTP; 13 Jul 2015 11:08:30 -0700 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) with Microsoft SMTP Server id 15.0.1076.9; Mon, 13 Jul 2015 11:08:28 -0700 Received: from davros.com ([10.63.224.225]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id t6DI1u3x011875; Mon, 13 Jul 2015 11:02:06 -0700 (PDT) From: Anna Schumaker To: , CC: Subject: [PATCH v2 04/10] SUNRPC: Add an rpc_cmp_addr_port() function Date: Mon, 13 Jul 2015 14:01:27 -0400 Message-ID: <1436810493-22806-5-git-send-email-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1436810493-22806-1-git-send-email-Anna.Schumaker@Netapp.com> References: <1436810493-22806-1-git-send-email-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This function is to help determine if two sockaddrs are really the same socket. Signed-off-by: Anna Schumaker --- include/linux/sunrpc/addr.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/sunrpc/addr.h b/include/linux/sunrpc/addr.h index 772faef..9bc3538 100644 --- a/include/linux/sunrpc/addr.h +++ b/include/linux/sunrpc/addr.h @@ -131,6 +131,19 @@ static inline bool rpc_cmp_addr(const struct sockaddr *sap1, } /** + * rpc_cmp_addr_port - compare the address and port number of two sockaddrs. + * @sap1: first sockaddr + * @sap2: second sockaddr + */ +static inline bool rpc_cmp_addr_port(const struct sockaddr *sap1, + const struct sockaddr *sap2) +{ + if (!rpc_cmp_addr(sap1, sap2)) + return false; + return rpc_get_port(sap1) == rpc_get_port(sap2); +} + +/** * rpc_copy_addr - copy the address portion of one sockaddr to another * @dst: destination sockaddr * @src: source sockaddr