From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 27 23:26:32 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BF56576F for ; Sun, 27 Oct 2013 23:26:32 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5BE4A240E for ; Sun, 27 Oct 2013 23:26:32 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id hn9so3207515wib.11 for ; Sun, 27 Oct 2013 16:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=x7EbJAaACR0WWB45ylRzdWB4j1s452FPcvxWbFhIyfs=; b=hbxpPABI6ZJnHpvGt77N+ToB1CTQDiBM2hGI6QXL6MYwVyO/4u9rgLPAezIBaBRmYA JEGDpueVU671+zw5bjGVUIhpJiSMTfGbZ2hL0rw27WVTztvdHWzo0YOzC4dNE88mQRGN 0e+dwqAyDS0DiwbaKagiPUHTeomsZeAdbZ9zIwj3xtAyK+M6tpe0vecG3VEZU0ojDVvc sYStouapPzqm3OBUR8gVGsR5KGMj5SPdmn4JQo0dJ5sLookldM01pYMEV6rURkl9OpBr jhX+sK4uj0bvFdy3247GQQLQdAitN+oT90UMhGtc/dZcnHbIT/fkAjCkv0Ur8f29Ix/u 9LVQ== X-Received: by 10.194.109.68 with SMTP id hq4mr15979381wjb.12.1382916390782; Sun, 27 Oct 2013 16:26:30 -0700 (PDT) Received: from ithaqua.etoilebsd.net (ithaqua.etoilebsd.net. [37.59.37.188]) by mx.google.com with ESMTPSA id pi6sm30090051wic.3.2013.10.27.16.26.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 27 Oct 2013 16:26:30 -0700 (PDT) Sender: Baptiste Daroussin Date: Mon, 28 Oct 2013 00:26:28 +0100 From: Baptiste Daroussin To: hackers@FreeBSD.org Subject: Importing netbsd cdb Message-ID: <20131027232628.GB74512@ithaqua.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2013 23:26:32 -0000 --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all Here is a code that imports the cdbrw from netbsd into a new lib/libcdbrw library, the read part is also added to libc but not exposed. As an example of using that library I also got the service_mkdb patches from netbsd that makes it by default emit a cdb database and add a switch to all= ow it to still create the old .db database format. in the libc, getservent has been modified to first try to read the .cdb fil= es and fallback on reading the old .db file. (I'm not sure if it is worth keep= ing reading the old db format.) http://people.freebsd.org/~bapt/cdbrw.diff The plan after that is to get pw_util(3) directly generating a cdb file for pwd.db and spwd.db and modifiy pwd_mkdb(8) so that by default it uses the A= PI =66rom pw_util(3) and have a switch to fallback on creating in bdb format. I also plan to do the same for cap_mkdb(1) and getcap(3). With cdb querying is way faster (I don't have number but I can get some it needed) the size of the db is also way smaller: 64K /var/db/services.cdb 2,1M /var/db/services.db Any objection? regards, Bapt --EuxKj2iCbKjpUGkD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlJtoSQACgkQ8kTtMUmk6EzdcQCeJ0SyBOm02FcjNbq1cOUsyBjF NgsAn3V5SaFiFsgMKlnK+qczJt5Dq2Rw =zemp -----END PGP SIGNATURE----- --EuxKj2iCbKjpUGkD--