From owner-svn-src-head@freebsd.org Sun May 19 15:44:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 435E515B0EC6; Sun, 19 May 2019 15:44:23 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D91BE69B47; Sun, 19 May 2019 15:44:22 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9812A9146; Sun, 19 May 2019 15:44:22 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4JFiMjV039224; Sun, 19 May 2019 15:44:22 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4JFiLSd039221; Sun, 19 May 2019 15:44:21 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905191544.x4JFiLSd039221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sun, 19 May 2019 15:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347973 - in head/sys: compat/lindebugfs modules modules/lindebugfs X-SVN-Group: head X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in head/sys: compat/lindebugfs modules modules/lindebugfs X-SVN-Commit-Revision: 347973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D91BE69B47 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 15:44:23 -0000 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