svn commit: r356170 - head/sys/compat/linux

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Dec 29 12:22:12 UTC 2019


Author: trasz
Date: Sun Dec 29 12:22:11 2019
New Revision: 356170
URL: https://svnweb.freebsd.org/changeset/base/356170

Log:
  Implement Linux BLKGETSIZE64 ioctl.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_ioctl.h

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Sun Dec 29 06:59:09 2019	(r356169)
+++ head/sys/compat/linux/linux_ioctl.c	Sun Dec 29 12:22:11 2019	(r356170)
@@ -278,6 +278,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);
@@ -300,6 +301,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: head/sys/compat/linux/linux_ioctl.h
==============================================================================
--- head/sys/compat/linux/linux_ioctl.h	Sun Dec 29 06:59:09 2019	(r356169)
+++ head/sys/compat/linux/linux_ioctl.h	Sun Dec 29 12:22:11 2019	(r356170)
@@ -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


More information about the svn-src-all mailing list