Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Robert Elz
I agree with some of what you are proposing, but disagree with much of it. Certainly simplifying our header file mess is important, but that's not going to happen overnight. One particular example of that below. And using opaque etruct definitions where possible, rather than void * in

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Jason Thorpe
> On Jul 11, 2023, at 2:56 PM, Taylor R Campbell > wrote: > > I agree the keyword is ugly, and it's unfortunate that in order to > omit it we would have to use C++, but the ugliness gives us practical > benefits of better type-checking, reduced header file maintenance > burden, and reduced

Re: config system question

2023-07-11 Thread Taylor R Campbell
> Date: Tue, 11 Jul 2023 15:36:08 -0700 > From: Phil Nelson > > I'm working on getting the iwlwifi driver for intel devices into > the new wifi framework. In going over the files as named I see > that there are multiple different files "xxx/tx.c" and "yyy/tx.c". > Those names would both

config system question

2023-07-11 Thread Phil Nelson
Hi all, I'm working on getting the iwlwifi driver for intel devices into the new wifi framework. In going over the files as named I see that there are multiple different files "xxx/tx.c" and "yyy/tx.c". Those names would both compile to tx.o in a kernel compile directory. I haven't seen any

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Andrew Cagney
On Tue, 11 Jul 2023 at 06:17, Taylor R Campbell wrote: > > I propose the attached change to KNF style(5) to advise against > typedefs for structs or unions, or pointers to them. Perhaps be positive? Add a section encouraging the use of struct, union and enum forward declarations when the

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Taylor R Campbell
I'm revising the patch to say `avoid' rather than `do not use'. Style rules can always be broken if there's a sufficiently compelling reason to do so. (For example, pthread_t is not going to go away no matter how much I convince NetBSD's /usr/share/misc/style to hop and scream at it.) > Date:

Re: kcmp(2)

2023-07-11 Thread Taylor R Campbell
> Date: Tue, 11 Jul 2023 22:00:25 +0100 > From: Robert Swindells > > Linux has the kcmp(2) syscall, Mesa makes use of it. > > Do we want a version of the syscall? Can you give any more details? What is kcmp(2) useful for? Is kcmp(2) a good design for that goal? What does Mesa use kcmp(2)

kcmp(2)

2023-07-11 Thread Robert Swindells
Linux has the kcmp(2) syscall, Mesa makes use of it. Do we want a version of the syscall?

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Jason Thorpe
> On Jul 11, 2023, at 6:43 AM, Johnny Billquist wrote: > > typedefs in C don't really create new types. They are all just derivatives. > Sometimes I even wonder why typedef exists in C. Feels like I could > accomplish the same with a #define Because #define generates pollution in unrelated

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Johnny Billquist
On 2023-07-11 15:28, Mouse wrote: I don't get it. Why the "void *" stuff? That is where I think the real badness lies, and I agree we should not have that. But defining something like typedef struct bus_dma_tag *bus_dma_tag_t; would mean we could easily change what bus_dma_tag_t

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Johnny Billquist
On 2023-07-11 15:28, Mouse wrote: I don't get it. Why the "void *" stuff? That is where I think the real badness lies, and I agree we should not have that. But defining something like typedef struct bus_dma_tag *bus_dma_tag_t; would mean we could easily change what bus_dma_tag_t

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Mouse
> Sometimes I even wonder why typedef exists in C. Feels like I could > accomplish the same with a #define For `typedef struct foo Something', yes, you could (well, except for their different scopes, and possibly some other corner cases). For `typedef void (*callback_t)(void *, status_t, int)',

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Valery Ushakov
On Tue, Jul 11, 2023 at 05:56:27 -0700, Jason Thorpe wrote: > > On Jul 11, 2023, at 3:17 AM, Taylor R Campbell wrote: > > > > If we used `struct bus_dma_tag *' instead, the forward declaration > > could be `struct bus_dma_tag;' instead of having to pull in all of > > sys/bus.h, _and_ the C

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Mouse
> I don't get it. Why the "void *" stuff? That is where I think the > real badness lies, and I agree we should not have that. > But defining something like > typedef struct bus_dma_tag *bus_dma_tag_t; > would mean we could easily change what bus_dma_tag_t actually is, > keeping it opaque,

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Johnny Billquist
On 2023-07-11 12:17, Taylor R Campbell wrote: I propose the attached change to KNF style(5) to advise against typedefs for structs or unions, or pointers to them. Passing around pointers to structs and unions doesn't require the definition, only a forward declaration: struct vnode; int

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Mouse
[riastradh@] > I propose the attached change to KNF style(5) to advise against > typedefs for structs or unions, or pointers to them. Pointers to them, I agree. I don't like typedefs for pointers to structs, except possibly for a few special cases. I think it should be pellucid from the

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Jason Thorpe
> On Jul 11, 2023, at 3:17 AM, Taylor R Campbell wrote: > > If we used `struct bus_dma_tag *' instead, the forward declaration > could be `struct bus_dma_tag;' instead of having to pull in all of > sys/bus.h, _and_ the C compiler would actually check types. In the original design, it’s not

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Paul Goyette
Objections? No objections here, just concurrences. ++--+--+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses:| | (Retired) | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com| | Software Developer |

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Valery Ushakov
On Tue, Jul 11, 2023 at 10:17:24 +, Taylor R Campbell wrote: > I propose the attached change to KNF style(5) to advise against > typedefs for structs or unions, or pointers to them. [...] > (Typedefs for integer, function, and function pointer types are not > covered by this advice.) Yes,

Re: [PATCH] style(5): No struct typedefs

2023-07-11 Thread Martin Husemann
On Tue, Jul 11, 2023 at 10:17:24AM +, Taylor R Campbell wrote: > Objections? This is a very good change. Martin

[PATCH] style(5): No struct typedefs

2023-07-11 Thread Taylor R Campbell
I propose the attached change to KNF style(5) to advise against typedefs for structs or unions, or pointers to them. Passing around pointers to structs and unions doesn't require the definition, only a forward declaration: struct vnode; int frobnitz(struct vnode *); This can dramatically cut