ioctl_return and ioctl handler type

Joel Sherrill joel.sherrill at OARcorp.com
Tue Apr 3 11:44:00 UTC 2012


Tradition?

There was a heavy use of unsigned 32 bit integers and as we have moved more and more to POSIX, some are left. 

This makes sense to change but the ripple will be tedious.

--joel

Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:

>Hello,
>
>why is the ioctl_return type uint32_t and not int?
>
>/**
>  * @brief Parameter block for ioctl.
>  */
>typedef struct {
>   rtems_libio_t          *iop;
>   uint32_t                command;
>   void                   *buffer;
>   uint32_t                ioctl_return;
>} rtems_libio_ioctl_args_t;
>
>It is used here:
>
>static int
>rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop,
>                               uint32_t       command,
>                               void*          buffer)
>{
>[...]
>   status = rtems_io_control (major, minor, (void *) &args);
>   if (status)
>     return rtems_deviceio_errno (status);
>
>   return args.ioctl_return;
>}
>
>int device_ioctl(
>   rtems_libio_t *iop,
>   uint32_t       command,
>   void          *buffer
>)
>{
>[...]
>   status = rtems_io_control(
>     the_jnode->info.device.major,
>     the_jnode->info.device.minor,
>     (void *) &args
>   );
>
>   if ( status )
>     return rtems_deviceio_errno(status);
>
>   return args.ioctl_return;
>}
>
>int devFS_ioctl(
>   rtems_libio_t *iop,
>   uint32_t       command,
>   void          *buffer
>)
>{
>[...]
>   status = rtems_io_control(
>     np->major,
>     np->minor,
>     (void *) &args
>   );
>
>   if ( status )
>     return rtems_deviceio_errno(status);
>
>   return args.ioctl_return;
>}
>
>We always have an uint32_t to int conversion, since the function type is
>
>typedef int (*rtems_filesystem_ioctl_t)(
>   rtems_libio_t *iop,
>   uint32_t       request,
>   void          *buffer
>);
>
>-- 
>Sebastian Huber, embedded brains GmbH
>
>Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
>Phone   : +49 89 18 90 80 79-6
>Fax     : +49 89 18 90 80 79-9
>E-Mail  : sebastian.huber at embedded-brains.de
>PGP     : Public key available on request.
>
>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>_______________________________________________
>rtems-devel mailing list
>rtems-devel at rtems.org
>http://www.rtems.org/mailman/listinfo/rtems-devel




More information about the devel mailing list