Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 22:47:09 +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: r364581 - stable/12/sys/compat/linux
Message-ID:  <202008232247.07NMl9ao011570@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Aug 23 22:47:08 2020
New Revision: 364581
URL: https://svnweb.freebsd.org/changeset/base/364581

Log:
  MFC r356170:
  
  Implement Linux BLKGETSIZE64 ioctl.
  
  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	Sun Aug 23 22:40:38 2020	(r364580)
+++ stable/12/sys/compat/linux/linux_ioctl.c	Sun Aug 23 22:47:08 2020	(r364581)
@@ -286,6 +286,7 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl
 	struct file *fp;
 	int error;
 	u_int sectorsize;
+	uint64_t blksize64;
 	off_t mediasize;
 
 	error = fget(td, args->fd, &cap_ioctl_rights, &fp);
@@ -308,6 +309,15 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl
 		return (copyout(&sectorsize, (void *)args->arg,
 		    sizeof(sectorsize)));
 		break;
+	case LINUX_BLKGETSIZE64:
+		error = fo_ioctl(fp, DIOCGMEDIASIZE,
+		    (caddr_t)&mediasize, td->td_ucred, td);
+		fdrop(fp, td);
+		if (error)
+			return (error);
+		blksize64 = mediasize;;
+		return (copyout(&blksize64, (void *)args->arg,
+		    sizeof(blksize64)));
 	case LINUX_BLKSSZGET:
 		error = fo_ioctl(fp, DIOCGSECTORSIZE,
 		    (caddr_t)&sectorsize, td->td_ucred, td);

Modified: stable/12/sys/compat/linux/linux_ioctl.h
==============================================================================
--- stable/12/sys/compat/linux/linux_ioctl.h	Sun Aug 23 22:40:38 2020	(r364580)
+++ stable/12/sys/compat/linux/linux_ioctl.h	Sun Aug 23 22:47:08 2020	(r364581)
@@ -57,9 +57,10 @@
 #define	LINUX_BLKSECTSET	0x1266
 #define	LINUX_BLKSECTGET	0x1267
 #define	LINUX_BLKSSZGET		0x1268
+#define	LINUX_BLKGETSIZE64	0x1272
 
 #define LINUX_IOCTL_DISK_MIN    LINUX_BLKROSET
-#define LINUX_IOCTL_DISK_MAX    LINUX_BLKSSZGET
+#define LINUX_IOCTL_DISK_MAX    LINUX_BLKGETSIZE64
 
 /*
  * hdio



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