From owner-svn-src-head@freebsd.org Thu Dec 6 23:39:55 2018 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 61BDE131A986 for ; Thu, 6 Dec 2018 23:39:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A96346B2CB for ; Thu, 6 Dec 2018 23:39:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x830.google.com with SMTP id n32so2573691qte.11 for ; Thu, 06 Dec 2018 15:39:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q9mofm43l/ZUhLl+pHRX/3HxuCI4x/nzcvLFSjnL/T8=; b=BfPnzuY+zIPf4mZ9wyJQliZh4y50T3kShbXb4uTdOMQZqwY4TpE5PatPnHqV9hP/A5 y6AJEYdnyzN4Z57gklihOeudafl3hTP2LAdOcafVFNCyjxU5AJh3klC6HtNTJDpAUYik tp11z5sksGvwsIiOX949qlbPUPHD//1YdxOBJ0rpZ6W/gX8DQtAq5PMitBPCwigdF0YR 7yaFQ8A0tK1WdJ+t41H/aqvuDROZWhxNwVmmRTXwA+rJY1BG9P1iBKpHUP+SKGglTV3M jNQgge7xSiqWalYTcZk339FDYeO5M73lehFmiD96wzpsD0ky3vDzNfWhXGbLjgNP0UMw zwpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Q9mofm43l/ZUhLl+pHRX/3HxuCI4x/nzcvLFSjnL/T8=; b=PqNNqp89/f+bIO2SyqZxkqPU8w5xABGgYFmrVvbs9f0cYg+7hsQiPhTJ0mtaM3k0su 3u8olbjLps49EzgZjvKotUmZG0GJS9XOHZApQ25ZbRP13Yl+9RRvmgxTItPcs110zuTx tGDXUIta57ynlstDQ1uAO/ksupNTir6BcwUudBUl/VCeSG3dUaCt+NEExV5Fx4L7PT+3 p2B87oDYP5ZZaEouKSqYHsBvQNFeevvWtYFFIqv4kEpTxeBcKJJw871uqq/RhSc6wllI yLoBYR8isCfsrDqzwLrU8SHSlgoEYo1vByynEWYr7ZJIY2ruCQemDrhY7CjRk11jV8eo P5ZQ== X-Gm-Message-State: AA+aEWbn5X3wa5u3QsjJ6S5Cq39NaFiQlF80k81ppLD29/3yzq7ei8r0 uio/teKJ+ycYye0rUvW2FW/BRlMdvCfxkf7pkopKaw== X-Google-Smtp-Source: AFSGD/WEnoVYHkgHqXZrEPIG7bDyuOGojgt7AJw6COnrj1vAEi4rcqpUGn/PBIwQnFbVPj4/RqK/Kil4J3s49b/+RqE= X-Received: by 2002:ac8:3f2d:: with SMTP id c42mr29436467qtk.33.1544139594122; Thu, 06 Dec 2018 15:39:54 -0800 (PST) MIME-Version: 1.0 References: <201812062258.wB6MwQKb026274@repo.freebsd.org> <0b90e8e4-ce69-9caf-21f2-bb76bdfd2635@FreeBSD.org> In-Reply-To: <0b90e8e4-ce69-9caf-21f2-bb76bdfd2635@FreeBSD.org> From: Warner Losh Date: Thu, 6 Dec 2018 16:39:43 -0700 Message-ID: Subject: Re: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7 To: John Baldwin Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: A96346B2CB X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[0.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-1.90)[ip: (-6.55), ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.31), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Thu, 06 Dec 2018 23:39:55 -0000 On Thu, Dec 6, 2018 at 4:23 PM John Baldwin wrote: > On 12/6/18 2:58 PM, Warner Losh wrote: > > Author: imp > > Date: Thu Dec 6 22:58:26 2018 > > New Revision: 341657 > > URL: https://svnweb.freebsd.org/changeset/base/341657 > > > > Log: > > Dynamically load .so modules to expand functionality > > > > o Dynamically load all the .so files found in /libexec/nvmecontrol and > > /usr/local/libexec/nvmecontrol. > > o Link nvmecontrol -rdynamic so that its symbols are visible to the > > libraries we load. > > o Create concatinated linker sets that we dynamically expand. > > o Add the linked-in top and logpage linker sets to the mirrors for them > > and add those sets to the mirrors when we load a new .so. > > o Add some macros to help hide the names of the linker sets. > > o Update the man page. > > > > Sponsored by: Netflix > > Differential Revision: https://reviews.freebsd.org/D18455 > > While linker sets are cool and all (and I used them in mfiutil and mptutil > to build the command tree), it seems like in this case where you want to > deal > with dynamic registration, etc. you would be better served by just using > something like STL C++ containers to maintain the command tree. New > commands can be associated with a static object whose constructor invokes a > "register_command" function or some such. You could also do this in C via > explicit ctor attributes, but just using static constructors in C++ seems > like > a less obscure way to do this. > I thought about doing it that way. I had it mostly coded up, but it turned out to be a bigger pain and required more source changes between modules and non-module builds. I didn't want to make C++ anything. And the ctor stuff runs at 'random times' that I didn't want to deal with. And linker sets aren't that obscure. So in the end, I went with linker sets because it seemed like the right tool for the job. Warner