Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp861185imu; Tue, 20 Nov 2018 08:04:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9eRI1dWeRho54E0ZwUMbdj+E2ZaXvVq4DnyUMpaBMANkqIqTRyqGAMtUOoRdcYMCWGJeG X-Received: by 2002:a63:5518:: with SMTP id j24mr2378449pgb.208.1542729845278; Tue, 20 Nov 2018 08:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729845; cv=none; d=google.com; s=arc-20160816; b=bVua/idlNu31jBTzda/OOHmbVFwEQ79fZ+4Qzb2D1rvaRCZFKU28W2Rkhuacsj2yUG W5OyPzqtkbqUB3q886+5B6rZDXYEyVF6Q1C8ZHfjKzoj9W7/ThqvNaAxN8hCGdIGoDU6 yU9fgDUjg7y6aelZJ2BU8HPJN6jaSUxUmtPRzWq2j9gwOeueNowiKOOdTFNYCszpjIcQ noDBLFkhvGJ6tb4gu92X5NxaSskthkm73zS/awN3h3+/sTQxajNVTwb4yLy9rkY/Bwjh M4Hx5u4dqotjn/ngUjwZaev5DMSzk3Ir7qQSS9fKYO4NbRn2/j1cnV7Dp2nrH48yF2+l RuGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Nsta1J9HbcsL0HyUYBXdFY297gVUM8Va/oT0xtOtpX8=; b=QE0npog/4f6mMRCieIbxswHYasHxm6bYWOJ/J27o5Z+E1xeIesfK5+80h6bEj7yDfM e3bUosxB9D867vDe4wIWkAxzt4rR1MeCrov/IhkCvF1juwwa22kIimMjv3nX4tsJYm2g rKCSS4fLK8QQLVKtZWilOzTpc+U8TJvSXOazZnXabeXSUv5slCiFLDyW1E1QoiBJxIOq tx42LnxTOIomAlyTizGY1htSeP6m+aWHV9i+cQ3GPyLje0k+2wvBQGUvcUdANzTESSgH uVHvhCShYB/Zv7iTDZZxzuoUZrzAXWW6rkx+pp9iHSL3pUe6BUjmKlFXsArozaJTpikP NNJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y27si40012418pga.459.2018.11.20.08.03.48; Tue, 20 Nov 2018 08:04:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726149AbeKUB16 (ORCPT + 99 others); Tue, 20 Nov 2018 20:27:58 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15565 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725999AbeKUB16 (ORCPT ); Tue, 20 Nov 2018 20:27:58 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 513A3A5693F9E; Tue, 20 Nov 2018 22:58:21 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 20 Nov 2018 22:58:12 +0800 From: John Garry To: , CC: , , , John Garry Subject: [PATCH 1/4] scsi: Add scsi_prot_op_normal() Date: Tue, 20 Nov 2018 22:59:01 +0800 Message-ID: <1542725944-244183-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1542725944-244183-1-git-send-email-john.garry@huawei.com> References: <1542725944-244183-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is a common pattern to check if a Scsi command protection option is "normal", i.e. regular IO. Add a common simple wrapper for this. Signed-off-by: John Garry --- include/scsi/scsi_cmnd.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index c891ada..3b26ea1 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -271,6 +271,11 @@ static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd) return scmd->prot_op; } +static inline bool scsi_prot_op_normal(struct scsi_cmnd *scmd) +{ + return scmd->prot_op == SCSI_PROT_NORMAL; +} + enum scsi_prot_flags { SCSI_PROT_TRANSFER_PI = 1 << 0, SCSI_PROT_GUARD_CHECK = 1 << 1, -- 1.9.1