From patchwork Tue Nov 20 14:59:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 151591 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp700908ljp; Tue, 20 Nov 2018 06:58:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ub3EdflJmSTwoLcTB/5C9Fw6drw/TNkdHtkagrtCQmi30SH6Yah+rdx1tWkHySL2RvCY6t X-Received: by 2002:a65:40c5:: with SMTP id u5mr2150024pgp.46.1542725906076; Tue, 20 Nov 2018 06:58:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542725906; cv=none; d=google.com; s=arc-20160816; b=Ijva4WpTGVzivNW8h/dcYQnRko04G8eHmjtTTwpicKpxbGsxZQ9YMsbDqNRPWcIJFf 5TegLo/5UiG9jAlt/naY611M6gY7ZXciauC6aRIEA7mW8lmhsnHG2Ym8MQvo+Eq7pLud PliG1t8QTo9BeoYbpIGQPiteg6Ai4hHjfaU9VasP7Mcwg0gHmQs98Gu78d1PAG/mqSlg lrvA1o8RHM3C10H1keTlSnqu1bOwpLIsGfkiU1G0m7Icd6dT9aS2CmbYcjBjdaTEIKgq 2XBIM1enADrEzkdH1iUsvBtFepVaxUOnhBEdFzlo+wW8uWDQksQipxNKHO2RHHEati6G hAqQ== 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=BHPLNLf+CW7gUeUA9MNcD2/IWEK7GsyuU/LqYQ2ml+g98KV9aA5LaxeUekOrpIxYVz iWlDWwz7b0GkaEDi8MILkpXoGfPDNh7jfB71gYpSnsaP25k+p+YUpMH88NYMT34Kg3XG KhQOYHDSFjqRyuWH3DNgMC4dIxM36fuBGfDutpnulgaKloUO+kYt9HtWqKClqkojxsfS 9kUFkOmWG3Mbx3xY3Ky2e3Zpy4L7BzQn3/kdfQfcqn0B9uplC2rLOSaldK3yzNFybAr/ 1kipygbMP0GV2/aq+wgFYfU1i+ErBl1f1HlN4LJ7Hx1XEWRVmTqF4a14fUW8AQVU/Mdc Jf2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 b131si41870024pga.51.2018.11.20.06.58.25; Tue, 20 Nov 2018 06:58:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726066AbeKUB16 (ORCPT + 1 other); 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 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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(+) -- 1.9.1 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,