Make linux(4) support the BLKPBSZGET ioctl. Oracle uses it.
MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25694
This commit is contained in:
parent
55ec696d42
commit
aa75412146
@ -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(§orsize, (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)§orsize, 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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user