From: Boaz Harrosh <bharrosh@panasas.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Ed Lin <ed.lin@promise.com>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/3] Restrict scsi accessors access to read-only
Date: Thu, 14 Jun 2007 19:33:23 +0300 [thread overview]
Message-ID: <46716DD3.1030501@panasas.com> (raw)
In-Reply-To: <46716C45.1090107@panasas.com>
>From 33dff41f5aaa05efd4aca80e12be4aaf4692a113 Mon Sep 17 00:00:00 2001
From: Boaz Harrosh <bharrosh@bh-buildlin2.(none)>
Date: Thu, 14 Jun 2007 18:55:18 +0300
Subject: [PATCH] Restrict scsi accessors access to read-only
- Users of scsi_cmnd might not change sg_count bufflen or sglist.
So reflect that in code.
---
include/scsi/scsi_cmnd.h | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 53e1705..aaf8282 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -138,9 +138,20 @@ extern void scsi_free_sgtable(struct scatterlist *, int);
extern int scsi_dma_map(struct scsi_cmnd *cmd);
extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
-#define scsi_sg_count(cmd) ((cmd)->use_sg)
-#define scsi_sglist(cmd) ((struct scatterlist *)(cmd)->request_buffer)
-#define scsi_bufflen(cmd) ((cmd)->request_bufflen)
+static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)
+{
+ return cmd->use_sg;
+}
+
+static inline struct scatterlist *scsi_sglist(struct scsi_cmnd *cmd)
+{
+ return (struct scatterlist *)cmd->request_buffer;
+}
+
+static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd)
+{
+ return cmd->request_bufflen;
+}
static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
{
--
1.5.0.4.402.g8035
next prev parent reply other threads:[~2007-06-14 16:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-12 18:02 scsi_cmnd accessors issues Boaz Harrosh
2007-06-12 18:46 ` Boaz Harrosh
2007-06-12 23:51 ` FUJITA Tomonori
2007-06-13 10:32 ` Harrosh, Boaz
2007-06-13 10:45 ` FUJITA Tomonori
2007-06-14 16:26 ` [PATCH 0/0] " Boaz Harrosh
2007-06-14 16:33 ` Boaz Harrosh [this message]
2007-06-14 18:50 ` [PATCH 1/3] Restrict scsi accessors access to read-only Jeff Garzik
2007-06-14 16:33 ` [PATCH 2/3] Farther clean-up of tmscsim driver Boaz Harrosh
2007-06-17 18:15 ` Guennadi Liakhovetski
2007-06-14 16:33 ` [PATCH 3/3] Farther clean up of stex.c driver Boaz Harrosh
2007-06-17 9:45 ` [PATCH 0/0] scsi_cmnd accessors issues Boaz Harrosh
2007-06-18 14:24 ` FUJITA Tomonori
2007-06-18 15:24 ` Harrosh, Boaz
2007-06-13 11:24 ` FUJITA Tomonori
2007-06-13 15:41 ` FUJITA Tomonori
2007-06-16 8:45 ` Guennadi Liakhovetski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46716DD3.1030501@panasas.com \
--to=bharrosh@panasas.com \
--cc=ed.lin@promise.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=g.liakhovetski@gmx.de \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).