[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024041027-overload-striking-c9a5@gregkh>
Date: Wed, 10 Apr 2024 19:11:03 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Alexey Gladkov <legion@...nel.org>
Cc: Jiri Slaby <jirislaby@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
kbd@...ts.linux.dev, linux-api@...r.kernel.org,
linux-fbdev@...r.kernel.org, linux-serial@...r.kernel.org,
Helge Deller <deller@....de>
Subject: Re: [RESEND PATCH v3 1/2] VT: Add KDFONTINFO ioctl
On Wed, Apr 10, 2024 at 06:29:19PM +0200, Alexey Gladkov wrote:
> On Wed, Apr 03, 2024 at 07:27:55AM +0200, Jiri Slaby wrote:
> > On 02. 04. 24, 15:19, Alexey Gladkov wrote:
> > >>> --- a/include/uapi/linux/kd.h
> > >>> +++ b/include/uapi/linux/kd.h
> > ...
> > >>> +struct console_font_info {
> > >>> + unsigned int min_width, min_height; /* minimal font size */
> > >>> + unsigned int max_width, max_height; /* maximum font size */
> > >>> + unsigned int flags; /* KD_FONT_INFO_FLAG_* */
> > >>
> > >> This does not look like a well-defined™ and extendable uapi structure.
> > >> While it won't change anything here, still use fixed-length __u32.
> > >>
> > >> And you should perhaps add some reserved fields. Do not repeat the same
> > >> mistakes as your predecessors with the current kd uapi.
> > >
> > > I thought about it, but I thought it would be overengineering.
> >
> > It would not. UAPI structs are set in stone once released.
> >
> > And in this case, it's likely you would want to know more info about
> > fonts in the future.
> >
> > > Can you suggest how best to do this?
> >
> > Given you have flags in there already (to state that the structure
> > contains more), just add an array of u32 reserved[] space. 3 or 5, I
> > would say (to align the struct to 64bit).
>
> struct console_font_info {
> __u32 min_width, min_height; /* minimal font size */
> __u32 max_width, max_height; /* maximum font size */
> __u32 flags; /* KD_FONT_INFO_FLAG_* */
> __u32 reserved[5]; /* This field is reserved forfuture use. Must be 0. */
> };
>
> So, struct should be like this ?
>
> I wouldn't add the version to the flags. Maybe it would be better to add a
> separate field with the version?
Versions do not work for ioctls, just use flags for stuff. And you
might want to put flags first?
thanks,
greg k-h
Powered by blists - more mailing lists