svn commit: r347973 - in head/sys: compat/lindebugfs modules modules/lindebugfs

Johannes Lundberg johalun at FreeBSD.org
Sun May 19 15:44:23 UTC 2019


Author: johalun
Date: Sun May 19 15:44:21 2019
New Revision: 347973
URL: https://svnweb.freebsd.org/changeset/base/347973

Log:
  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

Added:
  head/sys/modules/lindebugfs/
  head/sys/modules/lindebugfs/Makefile   (contents, props changed)
Modified:
  head/sys/compat/lindebugfs/lindebugfs.c
  head/sys/modules/Makefile

Modified: head/sys/compat/lindebugfs/lindebugfs.c
==============================================================================
--- head/sys/compat/lindebugfs/lindebugfs.c	Sun May 19 15:07:14 2019	(r347972)
+++ head/sys/compat/lindebugfs/lindebugfs.c	Sun May 19 15:44:21 2019	(r347973)
@@ -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);

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Sun May 19 15:07:14 2019	(r347972)
+++ head/sys/modules/Makefile	Sun May 19 15:44:21 2019	(r347973)
@@ -205,6 +205,7 @@ SUBDIR=	\
 	libalias \
 	libiconv \
 	libmchain \
+	lindebugfs \
 	${_linux} \
 	${_linux_common} \
 	${_linux64} \

Added: head/sys/modules/lindebugfs/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/lindebugfs/Makefile	Sun May 19 15:44:21 2019	(r347973)
@@ -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>


More information about the svn-src-all mailing list