From owner-freebsd-arch@FreeBSD.ORG Wed Sep 8 23:15:00 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB91610656E4 for ; Wed, 8 Sep 2010 23:15:00 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4D79F8FC15 for ; Wed, 8 Sep 2010 23:14:59 +0000 (UTC) Received: by gyg4 with SMTP id 4so434863gyg.13 for ; Wed, 08 Sep 2010 16:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=/GOavMFT9YXSqRRfRHTF8CaGPU8TJLskbnrajVWJpBw=; b=N3xXxENfDoOcu5V3/iboGYWgdXo02q876UJY0N2X/qYZMUZRezLkw3HUVIhVZ1vWGX 3Ehp+Hv1XmhzymhUnp04IViNJsgvJPYz2UmPRd5Eq/996sjg7gHAfmzxctsDhFbVgIuk kz8wKnDGI+SuoJi5qjPV/cH6Ufkmodkdae9mM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=n3dnnX8TcCOqwJAWZ1fNESDDYHcNMNNjjKCgx/6Gy1BNHnhtjTbiWpcQg8bqZ9TzAx Yrl84Tp/SWZ1dqygEZ8qsvGGKxXHlb8k7LhkPqsYBXvE+HN+pfQPDjteqPN2hENBMJHL XACpiRV+svzRzqMXcScjoNmgk8BELnO+bI0EQ= MIME-Version: 1.0 Received: by 10.101.193.17 with SMTP id v17mr1017942anp.206.1283987699328; Wed, 08 Sep 2010 16:14:59 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.100.126.20 with HTTP; Wed, 8 Sep 2010 16:14:59 -0700 (PDT) Date: Wed, 8 Sep 2010 16:14:59 -0700 X-Google-Sender-Auth: A6aXJGpQ046wRrmUzBOKMBamPnA Message-ID: From: mdf@FreeBSD.org To: FreeBSD Arch , Poul-Henning Kamp Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: Extending sbufs with a drain, take 2 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 23:15:00 -0000 After the discussion here with phk, I have reworked my patches. If I've misunderstood the intent, I welcome corrections. Do these patches seem reasonable? --- Refactor sbuf code so that most uses of sbuf_extend() are in a new sbuf_put_byte(). This makes it easier to add drain functionality when a buffer would overflow as there are fewer code points. http://people.freebsd.org/~mdf/0001-Refactor-sbuf-code-so-that-most-uses-of-sbuf_extend-.patch --- Fix small errors in the sbuf(9) man page. http://people.freebsd.org/~mdf/0002-Fix-small-errors-in-the-sbuf-9-man-page.patch --- Add drain functionality to sbufs. The drain is a function that is called when the sbuf internal buffer is filled. For kernel sbufs with a drain, the internal buffer will never be expanded. For userland sbufs with a drain, the internal buffer may still be expanded by sbuf_[v]printf(3). http://people.freebsd.org/~mdf/0003-Add-drain-functionality-to-sbufs.-The-drain-is-a-fun.patch --- Add a drain function for struct sysctl_req, and use it for a variety of handlers that had to do awkward things to get a large enough FIXEDLEN buffer. http://people.freebsd.org/~mdf/0004-Add-a-drain-function-for-struct-sysctl_req-and-use-i.patch --- Fix an incorrect use of sbuf_overflowed() after a call to sbuf_finish(). http://people.freebsd.org/~mdf/0005-Fix-an-incorrect-use-of-sbuf_overflowed-after-a-call.patch --- Replace sbuf_overflowed() with sbuf_error(), which returns any error code associated with overflow or with the drain function. http://people.freebsd.org/~mdf/0006-Replace-sbuf_overflowed-with-sbuf_error-which-return.patch Thanks, matthew