Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_ioctl.c
Show First 20 Lines • Show All 279 Lines • ▼ Show 20 Lines | linux_ioctl_hdio(struct thread *td, struct linux_ioctl_args *args) | ||||
return (ENOIOCTL); | return (ENOIOCTL); | ||||
} | } | ||||
static int | static int | ||||
linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args) | linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args) | ||||
{ | { | ||||
struct file *fp; | struct file *fp; | ||||
int error; | int error; | ||||
u_int sectorsize; | u_int sectorsize, psectorsize; | ||||
uint64_t blksize64; | uint64_t blksize64; | ||||
off_t mediasize; | off_t mediasize, stripesize; | ||||
error = fget(td, args->fd, &cap_ioctl_rights, &fp); | error = fget(td, args->fd, &cap_ioctl_rights, &fp); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
switch (args->cmd & 0xffff) { | switch (args->cmd & 0xffff) { | ||||
case LINUX_BLKGETSIZE: | case LINUX_BLKGETSIZE: | ||||
error = fo_ioctl(fp, DIOCGSECTORSIZE, | error = fo_ioctl(fp, DIOCGSECTORSIZE, | ||||
(caddr_t)§orsize, td->td_ucred, td); | (caddr_t)§orsize, td->td_ucred, td); | ||||
Show All 23 Lines | case LINUX_BLKSSZGET: | ||||
error = fo_ioctl(fp, DIOCGSECTORSIZE, | error = fo_ioctl(fp, DIOCGSECTORSIZE, | ||||
(caddr_t)§orsize, td->td_ucred, td); | (caddr_t)§orsize, td->td_ucred, td); | ||||
fdrop(fp, td); | fdrop(fp, td); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
return (copyout(§orsize, (void *)args->arg, | return (copyout(§orsize, (void *)args->arg, | ||||
sizeof(sectorsize))); | sizeof(sectorsize))); | ||||
break; | 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); | fdrop(fp, td); | ||||
return (ENOIOCTL); | return (ENOIOCTL); | ||||
} | } | ||||
/* | /* | ||||
* termio related ioctls | * termio related ioctls | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 3,449 Lines • Show Last 20 Lines |