From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 13:01:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9A731065674; Mon, 31 Oct 2011 13:01:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 6A0058FC16; Mon, 31 Oct 2011 13:01:21 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p9VD1GY0025647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 1 Nov 2011 00:01:18 +1100 Date: Tue, 1 Nov 2011 00:01:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev In-Reply-To: <20111031042526.GA57014@FreeBSD.org> Message-ID: <20111031233854.Y1523@besplex.bde.org> References: <201110302117.p9ULHgLD085245@svn.freebsd.org> <20111031042526.GA57014@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Marius Strobl , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r226947 - in head/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2011 13:01:22 -0000 On Mon, 31 Oct 2011, Alexey Dokuchaev wrote: > On Sun, Oct 30, 2011 at 09:17:42PM +0000, Marius Strobl wrote: >> Log: >> - Use device_t rather than the NetBSDish struct device. > > Hmm, I though that style(9) advises against this practice: > > Avoid using typedefs for structure types. Typedefs are problematic > because they do not properly hide their underlying type; [...] > > When convention requires a typedef, make its name match the struct tag. > Avoid typedefs ending in _t, except as specified in Standard C or by > POSIX. > > Does these rules not apply for struct device for some reason? Yes (they don't apply here). device_t is one of a few properly opaque typedefs for struct pointers. 'struct device' is only (completely) declared in kern/subr_bus.c. Thus the implementation details of it obviously cannot escape to drivers. Most of the APIs in are supposed to be like this. But `typedef struct kobj_class driver_t' and `#define driver_method_t kobj_method_t' are gross exceptions. has to include for dereferencing these, and kobj.h breaks the rule by providing both typedefs for struct pointers and complete struct declarations. Bruce