Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 12:20:56 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364657 - stable/12/sys/compat/linux
Message-ID:  <202008241220.07OCKubX016495@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Aug 24 12:20:55 2020
New Revision: 364657
URL: https://svnweb.freebsd.org/changeset/base/364657

Log:
  MFC r363322:
  
  Make linux(4) support the BLKPBSZGET ioctl.  Oracle uses it.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/sys/compat/linux/linux_ioctl.c
  stable/12/sys/compat/linux/linux_ioctl.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linux/linux_ioctl.c
==============================================================================
--- stable/12/sys/compat/linux/linux_ioctl.c	Mon Aug 24 11:49:49 2020	(r364656)
+++ stable/12/sys/compat/linux/linux_ioctl.c	Mon Aug 24 12:20:55 2020	(r364657)
@@ -285,9 +285,9 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl
 {
 	struct file *fp;
 	int error;
-	u_int sectorsize;
+	u_int sectorsize, psectorsize;
 	uint64_t blksize64;
-	off_t mediasize;
+	off_t mediasize, stripesize;
 
 	error = fget(td, args->fd, &cap_ioctl_rights, &fp);
 	if (error != 0)
@@ -327,6 +327,27 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl
 		return (copyout(&sectorsize, (void *)args->arg,
 		    sizeof(sectorsize)));
 		break;
+	case LINUX_BLKPBSZGET:
+		error = fo_ioctl(fp, DIOCGSTRIPESIZE,
+		    (caddr_t)&stripesize, td->td_ucred, td);
+		if (error != 0) {
+			fdrop(fp, td);
+			return (error);
+		}
+		if (stripesize > 0 && stripesize <= 4096) {
+			psectorsize = stripesize;
+		} else  {
+			error = fo_ioctl(fp, DIOCGSECTORSIZE,
+			    (caddr_t)&sectorsize, td->td_ucred, td);
+			if (error != 0) {
+				fdrop(fp, td);
+				return (error);
+			}
+			psectorsize = sectorsize;
+		}
+		fdrop(fp, td);
+		return (copyout(&psectorsize, (void *)args->arg,
+		    sizeof(psectorsize)));
 	}
 	fdrop(fp, td);
 	return (ENOIOCTL);

Modified: stable/12/sys/compat/linux/linux_ioctl.h
==============================================================================
--- stable/12/sys/compat/linux/linux_ioctl.h	Mon Aug 24 11:49:49 2020	(r364656)
+++ stable/12/sys/compat/linux/linux_ioctl.h	Mon Aug 24 12:20:55 2020	(r364657)
@@ -58,9 +58,10 @@
 #define	LINUX_BLKSECTGET	0x1267
 #define	LINUX_BLKSSZGET		0x1268
 #define	LINUX_BLKGETSIZE64	0x1272
+#define	LINUX_BLKPBSZGET	0x127b
 
 #define LINUX_IOCTL_DISK_MIN    LINUX_BLKROSET
-#define LINUX_IOCTL_DISK_MAX    LINUX_BLKGETSIZE64
+#define LINUX_IOCTL_DISK_MAX    LINUX_BLKPBSZGET
 
 /*
  * hdio



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