git: dfff37765ce4 - main - Rename struct device to struct _device

Mark Johnston markj at freebsd.org
Mon Apr 12 14:36:36 UTC 2021


On Mon, Apr 12, 2021 at 07:30:30AM -0700, Cy Schubert wrote:
> In message <202104121336.13CDaI5A029079 at gitrepo.freebsd.org>, Mark Johnston 
> wri
> tes:
> > The branch main has been updated by markj:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=dfff37765ce4ea4fd7db4d293b459dc8
> > 4008f411
> >
> > commit dfff37765ce4ea4fd7db4d293b459dc84008f411
> > Author:     Mark Johnston <markj at FreeBSD.org>
> > AuthorDate: 2021-04-12 13:32:30 +0000
> > Commit:     Mark Johnston <markj at FreeBSD.org>
> > CommitDate: 2021-04-12 13:32:30 +0000
> >
> >     Rename struct device to struct _device
> >     
> >     types.h defines device_t as a typedef of struct device *.  struct device
> >     is defined in subr_bus.c and almost all of the kernel uses device_t.
> >     The LinuxKPI also defines a struct device, so type confusion can occur.
> >     
> >     This causes bugs and ambiguity for debugging tools.  Rename the FreeBSD
> >     struct device to struct _device.
> >     
> >     Reviewed by:    gbe (man pages)
> >     Reviewed by:    rpokala, imp, jhb
> >     MFC after:      1 week
> >     Sponsored by:   The FreeBSD Foundation
> >     Differential Revision:  https://reviews.freebsd.org/D29676
> > ---
> >  share/man/man9/device.9       |  2 +-
> >  share/man/man9/rman.9         |  6 +++---
> >  sys/kern/subr_bus.c           | 15 +++++++++------
> >  sys/powerpc/include/bus_dma.h |  4 +---
> >  sys/sys/pcpu.h                |  2 +-
> >  sys/sys/systm.h               |  4 +---
> >  sys/sys/types.h               |  2 +-
> >  7 files changed, 17 insertions(+), 18 deletions(-)
> 
> Not that a name matters much but struct _device gives me a sense that the 
> struct is ancillary.

That's really the intent.  struct _device is the internal name and
device_t should be used by consumers.

> Whereas freebsd_device or fbsd_device is more 
> descriptive and gives the struct the status it deserves.
> 
> Then again, maybe it's just me.
> 
> 
> -- 
> Cheers,
> Cy Schubert <Cy.Schubert at cschubert.com>
> FreeBSD UNIX:  <cy at FreeBSD.org>   Web:  https://FreeBSD.org
> NTP:           <cy at nwtime.org>    Web:  https://nwtime.org
> 
> 	The need of the many outweighs the greed of the few.
> 
> 


More information about the dev-commits-src-all mailing list