public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] aacraid changes for 2.4.24 kernel to add support of AMD64 (part 2)
Date: Fri, 13 Feb 2004 21:58:59 +0000	[thread overview]
Message-ID: <20040213215859.B20911@infradead.org> (raw)
In-Reply-To: <547AF3BD0F3F0B4CBDC379BAC7E4189F2552A2@otce2k03.adaptec.com>; from mark_salyzyn@adaptec.com on Fri, Feb 13, 2004 at 04:16:14PM -0500

 struct fib_ioctl
 {
-	char	*fibctx;
-	int	wait;
-	char	*fib;
+	u32	fibctx;
+	s32	wait;
+#if (defined(__x86_64__))
+	u64	fib;
+#else
+	u32	fib;
+#endif

	This is broken.   If you really mean what you wrote just use
	unsigned long, but if you want this API to actually work as
	expected use the same value on all architectures.

+	if (!dev || !dev->scsi_host_ptr) {
+		return;
+	}
+	for (device = dev->scsi_host_ptr->host_queue;
+	  device != (Scsi_Device *)NULL;
+	  device = device->next)
+	{
+		dprintk((KERN_INFO "aifd: device (%d,%d,%d,%d)?\n",
+		  dev->scsi_host_ptr->host_no,
+		  device->channel,
+		  device->id,
+		  device->lun));
+		if ((device->channel == CONTAINER_TO_CHANNEL(container))
+		 && (device->id == CONTAINER_TO_ID(container))
+		 && (device->lun == CONTAINER_TO_LUN(container))) {
+			busy |= device->access_count || dev->scsi_host_ptr->in_recovery;
+			if (busy == 0) {
+				device->removable = TRUE;
+			}
+		}
+	}

	This gives you nice races again.

+		dprintk((KERN_INFO "proc_scsi=%p ", proc_scsi));
+		for (entry = proc_scsi->subdir;
+		  entry != (struct proc_dir_entry *)NULL;
+		  entry = entry->next) {
+			dprintk(("\"%.*s\"[%d]=%x ", entry->namelen,
+			  entry->name, entry->namelen, entry->low_ino));
+			if ((entry->low_ino != 0)
+			 && (entry->namelen == 4)
+			 && (memcmp ("scsi", entry->name, 4) == 0)) {
+				dprintk(("%p->write_proc=%p ", entry, entry->write_proc));
+				if (entry->write_proc != (int (*)(struct file *, const char *, unsigned long, void *))NULL) {
+					char buffer[80];
+					int length;
+					mm_segment_t fs;
+
+					sprintf (buffer,
+					  "scsi %s-single-device %d %d %d %d\n",
+					  ((DeviceConfigNeeded == DELETE)
+					   ? "remove"
+					   : "add"),
+					  dev->scsi_host_ptr->host_no,
+					  CONTAINER_TO_CHANNEL(container),
+					  CONTAINER_TO_ID(container),
+					  CONTAINER_TO_LUN(container));
+					length = strlen (buffer);
+					dprintk((KERN_INFO
+					  "echo %.*s > /proc/scsi/scsi\n",
+					  length-1,
+					  buffer));
+//printk("echo %.*s > /proc/scsi/scsi\n", length-1, buffer);
+					fs = get_fs();
+					set_fs(get_ds());
+					length = entry->write_proc(
+					  NULL, buffer, length, NULL);
+					set_fs(fs);
+					dprintk((KERN_INFO
+					  "returns %d\n", length));

	Stop it.  The code is bogus that I wonder how you even dare to post it.

+#if (defined(__x86_64__))
+# include <asm-x86_64/ioctl32.h>
+  /* Cast the function, since sys_ioctl does not match */
+# define aac_ioctl32(x,y) register_ioctl32_conversion((x), \
+    (int(*)(unsigned int,unsigned int,unsigned long,struct file*))(y))
+# include <asm/uaccess.h>
+#endif

	So why do the other drivers not need this?

 

  reply	other threads:[~2004-02-13 21:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-13 21:16 [PATCH] aacraid changes for 2.4.24 kernel to add support of AMD64 (part 2) Salyzyn, Mark
2004-02-13 21:58 ` Christoph Hellwig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-02-13 22:37 Salyzyn, Mark
2004-02-13 23:04 ` Christoph Hellwig

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=20040213215859.B20911@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mark_salyzyn@adaptec.com \
    /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