Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Sam Ravnborg <sam@ravnborg.org>,
	Boaz Harrosh <bharrosh@panasas.com>,
	Benny Halevy <bhalevy@panasas.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Matthew Wilcox <matthew@wil.cx>
Subject: Re: [PATCH] SCSI: userspace cannot use scsi_command_size_tbl, COMMAND_SIZE and scsi_device_type
Date: Sat, 27 Jun 2009 23:26:28 +0530	[thread overview]
Message-ID: <1246125388.32198.14.camel@hpdv5.satnam> (raw)
In-Reply-To: <1246123628.3990.19.camel@mulgrave.site>

On Sat, 2009-06-27 at 12:27 -0500, James Bottomley wrote:
> All SCSI patches should be cc'd to the SCSI list
> 
> On Sat, 2009-06-27 at 22:35 +0530, Jaswinder Singh Rajput wrote:
> > userspace cannot use scsi_command_size_tbl, COMMAND_SIZE
> > and scsi_device_type defined in kernel
> > 
> > fix the following 'make headers_check' warnings:
> > 
> >   usr/include/scsi/scsi.h:159: userspace cannot call function or variable defined in the kernel
> >   usr/include/scsi/scsi.h:285: userspace cannot call function or variable defined in the kernel
> > 
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > ---
> >  include/scsi/scsi.h |   13 +++++++------
> >  1 files changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
> > index 084478e..7ba5acf 100644
> > --- a/include/scsi/scsi.h
> > +++ b/include/scsi/scsi.h
> > @@ -156,9 +156,6 @@ scsi_varlen_cdb_length(const void *hdr)
> >  	return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
> >  }
> >  
> > -extern const unsigned char scsi_command_size_tbl[8];
> > -#define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
> > -
> >  static inline unsigned
> >  scsi_command_size(const unsigned char *cmnd)
> >  {
> > @@ -166,6 +163,13 @@ scsi_command_size(const unsigned char *cmnd)
> >  		scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
> 
> Even a simple eyeball inspection of this patch shows that the removal of
> COMMAND_SIZE above causes this inline function to fail to compile.
> 
> If you can't be bothered even to read your own patches or at the very
> least compile test them, what makes you think I should bother reading
> anything you send in?
> 

oops I am sorry, actually it should be RFC I want to check whether I
need to cover more member under __KERNEL__

[RFC][PATCH] SCSI: userspace cannot use scsi_command_size_tbl, scsi_device_type and friends

userspace cannot use scsi_command_size_tbl and scsi_device_type defined in kernel
as well as its friends :

- SCSI_MAX_VARLEN_CDB_SIZE
- COMMAND_SIZE
- struct scsi_varlen_cdb_hdr
- scsi_varlen_cdb_length()
- scsi_command_size()

fix the following 'make headers_check' warnings:

  usr/include/scsi/scsi.h:159: userspace cannot call function or variable defined in the kernel
  usr/include/scsi/scsi.h:285: userspace cannot call function or variable defined in the kernel

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 include/scsi/scsi.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 084478e..5ac0157 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -134,6 +134,7 @@ struct scsi_cmnd;
 #define	ATA_16		      0x85	/* 16-byte pass-thru */
 #define	ATA_12		      0xa1	/* 12-byte pass-thru */
 
+#ifdef __KERNEL__
 /*
  *	SCSI command lengths
  */
@@ -166,6 +167,9 @@ scsi_command_size(const unsigned char *cmnd)
 		scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
 }
 
+/* Returns a human-readable name for the device */
+extern const char * scsi_device_type(unsigned type);
+#endif
 /*
  *  SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
  *  T10/1561-D Revision 4 Draft dated 7th November 2002.
@@ -281,9 +285,6 @@ enum scsi_protocol {
 	SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
 };
 
-/* Returns a human-readable name for the device */
-extern const char * scsi_device_type(unsigned type);
-
 /*
  * standard mode-select header prepended to all mode-select commands
  */
-- 
1.6.0.6




  reply	other threads:[~2009-06-27 17:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1246122359.32198.7.camel@hpdv5.satnam>
2009-06-27 17:27 ` [PATCH] SCSI: userspace cannot use scsi_command_size_tbl, COMMAND_SIZE and scsi_device_type James Bottomley
2009-06-27 17:56   ` Jaswinder Singh Rajput [this message]
2009-06-27 18:28     ` Matthew Wilcox
2009-06-27 18:40       ` Jaswinder Singh Rajput
2009-06-28 13:52         ` James Bottomley
2009-06-28 14:09           ` Boaz Harrosh
2009-07-02 14:41     ` Jaswinder Singh Rajput
     [not found] ` <4A47222B.5020702@panasas.com>
     [not found]   ` <4A477F00.70305@emulex.com>
2009-06-28 14:44     ` James Bottomley

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=1246125388.32198.14.camel@hpdv5.satnam \
    --to=jaswinder@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bhalevy@panasas.com \
    --cc=bharrosh@panasas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=sam@ravnborg.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