Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jun 2014 12:05:48 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267051 - in head/sys: cam/scsi compat/linux
Message-ID:  <201406041205.s54C5mIp063927@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Jun  4 12:05:47 2014
New Revision: 267051
URL: http://svnweb.freebsd.org/changeset/base/267051

Log:
  - Add support for SG_GET_SG_TABLESIZE IOCTL to report that we don't support
  scatter/gather lists.
  - Return error for still unsupported SG 3.x API read/write calls.
  
  MFC after:	1 month

Modified:
  head/sys/cam/scsi/scsi_sg.c
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/cam/scsi/scsi_sg.c
==============================================================================
--- head/sys/cam/scsi/scsi_sg.c	Wed Jun  4 12:03:51 2014	(r267050)
+++ head/sys/cam/scsi/scsi_sg.c	Wed Jun  4 12:05:47 2014	(r267051)
@@ -627,6 +627,13 @@ sgioctl(struct cdev *dev, u_long cmd, ca
 		break;
 	}
 
+	case SG_GET_SG_TABLESIZE:
+	{
+		int *size = (int *)arg;
+		*size = 0;
+		break;
+	}
+
 	case SG_EMULATED_HOST:
 	case SG_SET_TRANSFORM:
 	case SG_GET_TRANSFORM:
@@ -638,7 +645,6 @@ sgioctl(struct cdev *dev, u_long cmd, ca
 	case SG_GET_ACCESS_COUNT:
 	case SG_SET_FORCE_LOW_DMA:
 	case SG_GET_LOW_DMA:
-	case SG_GET_SG_TABLESIZE:
 	case SG_SET_FORCE_PACK_ID:
 	case SG_GET_PACK_ID:
 	case SG_SET_RESERVED_SIZE:
@@ -684,6 +690,12 @@ sgwrite(struct cdev *dev, struct uio *ui
 	if (error)
 		goto out_hdr;
 
+	/* XXX: We don't support SG 3.x read/write API. */
+	if (hdr->reply_len < 0) {
+		error = ENODEV;
+		goto out_hdr;
+	}
+
 	ccb = xpt_alloc_ccb();
 	if (ccb == NULL) {
 		error = ENOMEM;

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Wed Jun  4 12:03:51 2014	(r267050)
+++ head/sys/compat/linux/linux_ioctl.c	Wed Jun  4 12:05:47 2014	(r267051)
@@ -2751,6 +2751,9 @@ linux_ioctl_sg(struct thread *td, struct
 	case LINUX_SG_GET_SCSI_ID:
 		args->cmd = SG_GET_SCSI_ID;
 		break;
+	case LINUX_SG_GET_SG_TABLESIZE:
+		args->cmd = SG_GET_SG_TABLESIZE;
+		break;
 	default:
 		return (ENODEV);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406041205.s54C5mIp063927>