Provide support for fdevname(3) on linuxkpi-backed devices.
Reported and tested by: manu Reviewed by: hselasky, manu Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23386
This commit is contained in:
parent
dc13edbc7d
commit
2a3529df1d
@ -1526,7 +1526,9 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
|
||||
struct linux_file *filp;
|
||||
const struct file_operations *fop;
|
||||
struct linux_cdev *ldev;
|
||||
int error;
|
||||
struct fiodgname_arg *fgn;
|
||||
const char *p;
|
||||
int error, i;
|
||||
|
||||
error = 0;
|
||||
filp = (struct linux_file *)fp->f_data;
|
||||
@ -1554,6 +1556,23 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
|
||||
case FIOGETOWN:
|
||||
*(int *)data = fgetown(&filp->f_sigio);
|
||||
break;
|
||||
case FIODGNAME:
|
||||
#ifdef COMPAT_FREEBSD32
|
||||
case FIODGNAME_32:
|
||||
#endif
|
||||
if (filp->f_cdev == NULL || filp->f_cdev->cdev == NULL) {
|
||||
error = ENXIO;
|
||||
break;
|
||||
}
|
||||
fgn = data;
|
||||
p = devtoname(filp->f_cdev->cdev);
|
||||
i = strlen(p) + 1;
|
||||
if (i > fgn->len) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
error = copyout(p, fiodgname_buf_get_ptr(fgn, cmd), i);
|
||||
break;
|
||||
default:
|
||||
error = linux_file_ioctl_sub(fp, filp, fop, cmd, data, td);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user