Date: Sat, 24 Apr 2021 00:15:37 +0000 From: "Michael Lorenz" <macal...@netbsd.org> Message-ID: <20210424001537.c5c83f...@cvs.netbsd.org>
| add an ioctl() to get a list of fonts currently available via wsfont It seems to me it would be useful for that ioctl to copyout() the fi_numentries field of the struct (if addr != NULL) from wsdisplayio_listfonts() just before the ENOMEM check (so it is updated, even if ENOMEM is returned). (Does it make any sense for addr to be NULL, or should that be an error? EINVAL or something.) Otherwise, there doesn't seem to be any easy way for the user of the ioctl to know how many fonts were returned (checking which elements of the array were modified is not "easy") or how big the buffer would need to be to fetch all of them in the ENOMEM case. It might also be worth allowing fi_numentries to also be an input parameter, to indicate where in the set of fonts the fetch should start, to provide a mechanism to cope should the list size ever grow so big that it ends up bigger than a single ioctl can handle (that is, skip the first fi_numentries fonts, and then continue from there). That would mean a slightly more complex piece of internal code though. And this last bit is just style, but I'd change the struct wsdisplayio_fontdesc to be uint32_t fd_len; uint16_t fd_height; unit16_t fd_width; char fd_name[]; and then make the entries returned be (rounded up) just big enough for the actual font names. But that's just me, and not important. kre