From owner-svn-src-head@freebsd.org Tue Sep 3 14:07:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74C86DD7AE; Tue, 3 Sep 2019 14:07:16 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N80M4vrNz4QQf; Tue, 3 Sep 2019 14:07:15 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 61DB51B39F; Tue, 3 Sep 2019 14:06:34 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 22E1969D6; Mon, 22 Apr 2019 03:25:56 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A34076EBA8; Mon, 22 Apr 2019 03:25:54 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1CCCC6965; Mon, 22 Apr 2019 03:25:54 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 823706963 for ; Mon, 22 Apr 2019 03:25:51 +0000 (UTC) (envelope-from cem@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 E3D2B6EBA0; Mon, 22 Apr 2019 03:25:49 +0000 (UTC) (envelope-from cem@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 B70BE711D; Mon, 22 Apr 2019 03:25:49 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3M3PnUM083804; Mon, 22 Apr 2019 03:25:49 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3M3Pnu0083803; Mon, 22 Apr 2019 03:25:49 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201904220325.x3M3Pnu0083803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346516 - head/sys/geom/nop X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/geom/nop X-SVN-Commit-Revision: 346516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: A34076EBA8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:07:38 -0000 X-Original-Date: Mon, 22 Apr 2019 03:25:49 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:07:38 -0000 Author: cem Date: Mon Apr 22 03:25:49 2019 New Revision: 346516 URL: https://svnweb.freebsd.org/changeset/base/346516 Log: gnop(8): Nopify configuration as a kernel dump device As a dummy / no-op dump device, to facilitate dumpon(8) testing. Reviewed by: markj (earlier version) Differential Revision: https://reviews.freebsd.org/D19991 Modified: head/sys/geom/nop/g_nop.c Modified: head/sys/geom/nop/g_nop.c ============================================================================== --- head/sys/geom/nop/g_nop.c Mon Apr 22 03:19:40 2019 (r346515) +++ head/sys/geom/nop/g_nop.c Mon Apr 22 03:25:49 2019 (r346516) @@ -97,7 +97,43 @@ g_nop_resize(struct g_consumer *cp) g_resize_provider(pp, size); } +static int +g_nop_dumper(void *priv, void *virtual, vm_offset_t physical, off_t offset, + size_t length) +{ + return (0); +} + static void +g_nop_kerneldump(struct bio *bp, struct g_nop_softc *sc) +{ + struct g_kerneldump *gkd; + struct g_geom *gp; + struct g_provider *pp; + + gkd = (struct g_kerneldump *)bp->bio_data; + gp = bp->bio_to->geom; + g_trace(G_T_TOPOLOGY, "%s(%s, %jd, %jd)", __func__, gp->name, + (intmax_t)gkd->offset, (intmax_t)gkd->length); + + pp = LIST_FIRST(&gp->provider); + + gkd->di.dumper = g_nop_dumper; + gkd->di.priv = sc; + gkd->di.blocksize = pp->sectorsize; + gkd->di.maxiosize = DFLTPHYS; + gkd->di.mediaoffset = sc->sc_offset + gkd->offset; + if (gkd->offset > sc->sc_explicitsize) { + g_io_deliver(bp, ENODEV); + return; + } + if (gkd->offset + gkd->length > sc->sc_explicitsize) + gkd->length = sc->sc_explicitsize - gkd->offset; + gkd->di.mediasize = gkd->length; + g_io_deliver(bp, 0); +} + +static void g_nop_start(struct bio *bp) { struct g_nop_softc *sc; @@ -127,11 +163,18 @@ g_nop_start(struct bio *bp) case BIO_GETATTR: sc->sc_getattrs++; if (sc->sc_physpath && - g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath)) { - mtx_unlock(&sc->sc_lock); - return; - } - break; + g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath)) + ; + else if (strcmp(bp->bio_attribute, "GEOM::kerneldump") == 0) + g_nop_kerneldump(bp, sc); + else + /* + * Fallthrough to forwarding the GETATTR down to the + * lower level device. + */ + break; + mtx_unlock(&sc->sc_lock); + return; case BIO_FLUSH: sc->sc_flushes++; break;