From owner-svn-src-all@freebsd.org Thu Dec 6 23:39:55 2018 Return-Path: Delivered-To: svn-src-all@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 86B82131A987 for ; Thu, 6 Dec 2018 23:39:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 A69C36B2C9 for ; Thu, 6 Dec 2018 23:39:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id d19so2585617qtq.9 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=qpNz4Wecz1PehJGFoBhVZ7twdaLkkuJjm3qCKhno3vfFgjAhqaj6u0CTRWYyhycq1O w6NsqUrbGhUBkrsXAbppLzVmQHwGoeO1t0k9Pe4n19w5dzSuYB0uWN1qTd7e0fJNZXLN cN9Y0ajndPO9UWwTmFAvb3Og0BLDSYJFwjlBPwBxBCUQv/n7MYSp8v3C8p4lsBoeWB8f 3k9Um4cFHIM1z7P5lGUmFLyt7NTytpgMQHI6tHDODNslE5hVJY2nOOAqV5CTDseRxPiR ENiNoXmiNfIUEE5IfS3iDbfkWLyoSvoU+F+y6CCJrHErJgV0aUWqpgLTtlsJ1t590+Hp 5sEA== X-Gm-Message-State: AA+aEWaAlLgHqMmGdBtfZDNe3rYeK9K4N1WVojxcEXQPYEo4hQccgUem /pkVls3a1CE3uSpHEBuRpHr36pos8KncsToY0pLAJg== 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: A69C36B2C9 X-Spamd-Result: default: False [-3.42 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.995,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@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)[d.2.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.84)[-0.836,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.59)[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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" 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