summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2020-07-19 12:25:03 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2020-07-19 12:25:03 +0000
commitaa7541214620fb90fdcf5e3a3491c51a2d49c69e (patch)
treef71e769e789b100959c3574c4ed65742747238e6
parent55ec696d42d080904411163ebece1a489044fc69 (diff)
Notes
-rw-r--r--sys/compat/linux/linux_ioctl.c25
-rw-r--r--sys/compat/linux/linux_ioctl.h3
2 files changed, 25 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 5ec47c30b882..15162490ba44 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -285,9 +285,9 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args)
{
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_args *args)
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);
diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h
index 15fd560e116b..c425a6e721eb 100644
--- a/sys/compat/linux/linux_ioctl.h
+++ b/sys/compat/linux/linux_ioctl.h
@@ -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