From owner-svn-src-all@FreeBSD.ORG Thu May 7 19:57:14 2009 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 5851D1065674; Thu, 7 May 2009 19:57:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46AF18FC15; Thu, 7 May 2009 19:57:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n47JvEBo066532; Thu, 7 May 2009 19:57:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n47JvEWe066531; Thu, 7 May 2009 19:57:14 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905071957.n47JvEWe066531@svn.freebsd.org> From: Kip Macy Date: Thu, 7 May 2009 19:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191899 - head/sys/sys 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, 07 May 2009 19:57:14 -0000 Author: kmacy Date: Thu May 7 19:57:14 2009 New Revision: 191899 URL: http://svn.freebsd.org/changeset/base/191899 Log: No man page currently exists so comment the two uncommented non-trivial functions Modified: head/sys/sys/buf_ring.h Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Thu May 7 19:46:29 2009 (r191898) +++ head/sys/sys/buf_ring.h Thu May 7 19:57:14 2009 (r191899) @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright (c) 2007,2008 Kip Macy kmacy@freebsd.org + * Copyright (c) 2007-2009 Kip Macy kmacy@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,7 +69,10 @@ struct buf_ring { void *br_ring[0]; }; - +/* + * multi-producer safe lock-free ring buffer enqueue + * + */ static __inline int buf_ring_enqueue(struct buf_ring *br, void *buf) { @@ -169,8 +172,9 @@ buf_ring_dequeue_mc(struct buf_ring *br) } /* - * Single-Consumer dequeue for uses where dequeue - * is protected by a lock + * single-consumer dequeue + * use where dequeue is protected by a lock + * e.g. a network driver's tx queue lock */ static __inline void * buf_ring_dequeue_sc(struct buf_ring *br) @@ -208,6 +212,11 @@ buf_ring_dequeue_sc(struct buf_ring *br) return (buf); } +/* + * return a pointer to the first entry in the ring + * without modifying it, or NULL if the ring is empty + * race-prone if not protected by a lock + */ static __inline void * buf_ring_peek(struct buf_ring *br) {