Date: Tue, 28 Jan 2020 11:22:20 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357198 - head/sys/compat/linuxkpi/common/src Message-ID: <202001281122.00SBMKrd061766@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Jan 28 11:22:20 2020 New Revision: 357198 URL: https://svnweb.freebsd.org/changeset/base/357198 Log: 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 Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Jan 28 10:09:05 2020 (r357197) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Jan 28 11:22:20 2020 (r357198) @@ -1526,7 +1526,9 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *da 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; @@ -1553,6 +1555,23 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *da break; 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001281122.00SBMKrd061766>