LinuxKPI: Finalize move of lindebugfs from ports to base.

The source file was moved to base earlier and also improved upon,
but never compiled in. This patch will:
- Make a module in sys/modules
- Make lindebugfs depend on linuxkpi (for seq_file)
- Check if read/write functions are set before calling, DRM drivers
  don't always set both of them.

Reviewed by:	hps
Approved by:	imp (mentor), hps
MFC after:	1 week
This commit is contained in:
Johannes Lundberg 2019-05-19 15:44:21 +00:00
parent c5c8916278
commit 03f1cf9f32
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347973
3 changed files with 25 additions and 4 deletions

View File

@ -143,10 +143,17 @@ debugfs_fill(PFS_FILL_ARGS)
}
sf = lf.private_data;
sf->buf = sb;
if (uio->uio_rw == UIO_READ)
rc = d->dm_fops->read(&lf, NULL, len, &off);
else
rc = d->dm_fops->write(&lf, buf, len, &off);
if (uio->uio_rw == UIO_READ) {
if (d->dm_fops->read)
rc = d->dm_fops->read(&lf, NULL, len, &off);
else
rc = ENODEV;
} else {
if (d->dm_fops->write)
rc = d->dm_fops->write(&lf, buf, len, &off);
else
rc = ENODEV;
}
if (d->dm_fops->release)
d->dm_fops->release(&vn, &lf);
else
@ -307,3 +314,4 @@ PSEUDOFS(debugfs, 1, PR_ALLOW_MOUNT_LINSYSFS);
#else
PSEUDOFS(debugfs, 1, VFCF_JAIL);
#endif
MODULE_DEPEND(lindebugfs, linuxkpi, 1, 1, 1);

View File

@ -205,6 +205,7 @@ SUBDIR= \
libalias \
libiconv \
libmchain \
lindebugfs \
${_linux} \
${_linux_common} \
${_linux64} \

View File

@ -0,0 +1,12 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/compat/lindebugfs
KMOD= lindebugfs
SRCS= vnode_if.h \
device_if.h bus_if.h pci_if.h \
lindebugfs.c
CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
.include <bsd.kmod.mk>