ioctl_return and ioctl handler type

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 3 08:34:21 UTC 2012


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.



More information about the devel mailing list