All of lore.kernel.org
 help / color / mirror / Atom feed
* Does anybody want to create a new "man 2 ioctl_list"?
@ 2021-09-26  2:12 Rob Landley
  0 siblings, 0 replies; only message in thread
From: Rob Landley @ 2021-09-26  2:12 UTC (permalink / raw)
  To: toybox, linux-doc, Jonathan Corbet

Michael Kerrisk deleted the old ioctl_list man page last year because nobody was
maintaining it:

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man2?id=3de87d46840d

But it's not actually that _hard_, just time consuming. There are about 3500
interesting ioctl macro definitions in the current kernel source:

  $ egrep --include '*.[ch]' -r '[^A-Z]_IO(|C|W|R|WR)[(]' * | \
    grep -v 'drivers/staging' | grep -v 'tools/' | wc -l
  3533

Each of which boils down to some entry point handling it and handing it off to a
function that does a thing. Random example, the symbol SPI_IOC_RD_MODE from the
above list (without the wc -l) greps to drivers/spi/spidev.c in function
spidev_ioctl which winds up being:

        case SPI_IOC_RD_MODE:
                retval = put_user(spi->mode & SPI_MODE_MASK,
                                        (__u8 __user *)arg);

which is struct spi_device *spi; which is defined in include/linux/spi/spi.h
(Trick: grep spi_device include/ -r | grep '{' ) and then there's a comment
block before the header which has:

 * @mode: The spi mode defines how data is clocked out and in.
 *      This may be changed by the device's driver.
 *      The "active low" default for chipselect mode can be overridden
 *      (by specifying SPI_CS_HIGH) as can the "MSB first" default for
 *      each word in a transfer (by specifying SPI_LSB_FIRST).

So that ioctl reads that info into the supplied field.

It would be really nice if there was an automated way to do this, but so far...

Rob

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-26  1:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26  2:12 Does anybody want to create a new "man 2 ioctl_list"? Rob Landley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.