From owner-svn-src-all@FreeBSD.ORG Thu Oct 27 20:35:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F9D11065672 for ; Thu, 27 Oct 2011 20:35:26 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out1.tiscali.nl (smtp-out1.tiscali.nl [195.241.79.176]) by mx1.freebsd.org (Postfix) with ESMTP id C960B8FC1A for ; Thu, 27 Oct 2011 20:35:25 +0000 (UTC) Received: from [212.182.167.131] (helo=sjakie.klop.ws) by smtp-out1.tiscali.nl with esmtp (Exim) (envelope-from ) id 1RJWfc-00048u-Mb; Thu, 27 Oct 2011 22:35:24 +0200 Received: from 212-182-167-131.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id EB7F793CF; Thu, 27 Oct 2011 22:35:16 +0200 (CEST) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Hiroki Sato" References: <201110260211.p9Q2BStn027230@svn.freebsd.org> Date: Thu, 27 Oct 2011 22:35:15 +0200 MIME-Version: 1.0 From: "Ronald Klop" Message-ID: In-Reply-To: <201110260211.p9Q2BStn027230@svn.freebsd.org> User-Agent: Opera Mail/11.52 (FreeBSD) Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r226775 - in head: etc sbin/devd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 27 Oct 2011 20:35:26 -0000 Hi, I like this. Do you have plans the commit it on stable/9? Ronald. On Wed, 26 Oct 2011 04:11:28 +0200, Hiroki Sato wrote: > Author: hrs > Date: Wed Oct 26 02:11:28 2011 > New Revision: 226775 > URL: http://svn.freebsd.org/changeset/base/226775 > > Log: > - Add support for a "!" character in regex matching in devd(8). It =20 > inverts > the logic (true/false) of the matching. > - Add "!usbus[0-9]+" to IFNET ATTACH notification handler in the defau= lt > devd.conf to prevent rc.d/netif from running when usbus[0-9]+ is =20 > attached. > Reviewed by: imp > > Modified: > head/etc/devd.conf > head/sbin/devd/devd.cc > head/sbin/devd/devd.conf.5 > head/sbin/devd/devd.hh > > Modified: head/etc/devd.conf > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/devd.conf Wed Oct 26 01:58:36 2011 (r226774) > +++ head/etc/devd.conf Wed Oct 26 02:11:28 2011 (r226775) > @@ -38,6 +38,7 @@ options { > # > notify 0 { > match "system" "IFNET"; > + match "subsystem" "!usbus[0-9]+"; > match "type" "ATTACH"; > action "/etc/pccard_ether $subsystem start"; > }; > > Modified: head/sbin/devd/devd.cc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/devd/devd.cc Wed Oct 26 01:58:36 2011 (r226774) > +++ head/sbin/devd/devd.cc Wed Oct 26 02:11:28 2011 (r226775) > @@ -251,7 +251,14 @@ match::match(config &c, const char *var, > : _var(var) > { > _re =3D "^"; > - _re.append(c.expand_string(string(re))); > + if (!c.expand_string(string(re)).empty() && > + c.expand_string(string(re)).at(0) =3D=3D '!') { > + _re.append(c.expand_string(string(re)).substr(1)); > + _inv =3D 1; > + } else { > + _re.append(c.expand_string(string(re))); > + _inv =3D 0; > + } > _re.append("$"); > regcomp(&_regex, _re.c_str(), REG_EXTENDED | REG_NOSUB | REG_ICASE); > } > @@ -268,10 +275,13 @@ match::do_match(config &c) > bool retval; > if (Dflag) > - fprintf(stderr, "Testing %s=3D%s against %s\n", _var.c_str(), > - value.c_str(), _re.c_str()); > + fprintf(stderr, "Testing %s=3D%s against %s, invert=3D%d\n", > + _var.c_str(), value.c_str(), _re.c_str(), _inv); > retval =3D (regexec(&_regex, value.c_str(), 0, NULL, 0) =3D=3D 0); > + if (_inv =3D=3D 1) > + retval =3D (retval =3D=3D 0) ? 1 : 0; > + > return retval; > } > > Modified: head/sbin/devd/devd.conf.5 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/devd/devd.conf.5 Wed Oct 26 01:58:36 2011 (r226774) > +++ head/sbin/devd/devd.conf.5 Wed Oct 26 02:11:28 2011 (r226775) > @@ -41,7 +41,7 @@ > .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANC= E =20 > OF THIS > .\" SOFTWARE. > .\" > -.Dd March 8, 2009 > +.Dd October 25, 2011 > .Dt DEVD.CONF 5 > .Os > .Sh NAME > @@ -121,6 +121,10 @@ Creates a regular expression and assigns > .Ar regexp-name . > The variable is available throughout the rest of > the configuration file. > +If the string begins with > +.Ql \&! , > +it matches if the regular expression formed by the rest of the string > +does not match. > All regular expressions have an implicit > .Ql ^$ > around them. > > Modified: head/sbin/devd/devd.hh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/devd/devd.hh Wed Oct 26 01:58:36 2011 (r226774) > +++ head/sbin/devd/devd.hh Wed Oct 26 02:11:28 2011 (r226775) > @@ -92,6 +92,7 @@ public: > private: > std::string _var; > std::string _re; > + bool _inv; > regex_t _regex; > }; > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"