[rtems commit] rfs: Fix major and minor number integer types

Sebastian Huber sebh at rtems.org
Tue May 15 07:59:43 UTC 2012


Module:    rtems
Branch:    master
Commit:    a1c6b96ac7f03b255f6457332afbfbd72ae10ad2
Changeset: http://git.rtems.org/rtems/commit/?id=a1c6b96ac7f03b255f6457332afbfbd72ae10ad2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon May 14 13:13:32 2012 +0200

rfs: Fix major and minor number integer types

---

 cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c |   55 +++++++++++++++-------------
 1 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
index 27d9962..81fdbe3 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
@@ -24,6 +24,15 @@
 #include <rtems/devfs.h>
 #include "rtems-rfs-rtems.h"
 
+static void
+rtems_rfs_rtems_device_get_major_and_minor ( const rtems_libio_t       *iop,
+                                             rtems_device_major_number *major,
+                                             rtems_device_minor_number *minor)
+{
+  *major = iop->data0;
+  *minor = (rtems_device_minor_number) iop->data1;
+}
+
 /**
  * This handler maps an open() operation onto rtems_io_open().
  *
@@ -43,8 +52,8 @@ rtems_rfs_rtems_device_open ( rtems_libio_t *iop,
   rtems_rfs_file_system*        fs = rtems_rfs_rtems_pathloc_dev (&iop->pathinfo);
   rtems_rfs_ino                 ino = rtems_rfs_rtems_get_iop_ino (iop);
   rtems_rfs_inode_handle        inode;
-  int                           major;
-  int                           minor;
+  rtems_device_major_number     major;
+  rtems_device_minor_number     minor;
   rtems_status_code             status;
   int                           rc;
 
@@ -70,7 +79,7 @@ rtems_rfs_rtems_device_open ( rtems_libio_t *iop,
   rtems_rfs_rtems_unlock (fs);
 
   iop->data0 = major;
-  iop->data1 = (void*)((intptr_t) minor);
+  iop->data1 = (void *) minor;
 
   args.iop   = iop;
   args.flags = iop->flags;
@@ -93,11 +102,10 @@ rtems_rfs_rtems_device_close (rtems_libio_t* iop)
 {
   rtems_libio_open_close_args_t args;
   rtems_status_code             status;
-  int                           major;
-  int                           minor;
+  rtems_device_major_number     major;
+  rtems_device_minor_number     minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
   args.iop   = iop;
   args.flags = 0;
@@ -120,13 +128,12 @@ rtems_rfs_rtems_device_close (rtems_libio_t* iop)
 static ssize_t
 rtems_rfs_rtems_device_read (rtems_libio_t* iop, void* buffer, size_t count)
 {
-  rtems_libio_rw_args_t args;
-  rtems_status_code     status;
-  int                   major;
-  int                   minor;
+  rtems_libio_rw_args_t     args;
+  rtems_status_code         status;
+  rtems_device_major_number major;
+  rtems_device_minor_number minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
   args.iop         = iop;
   args.offset      = iop->offset;
@@ -156,13 +163,12 @@ rtems_rfs_rtems_device_write (rtems_libio_t* iop,
                               const void*    buffer,
                               size_t         count)
 {
-  rtems_libio_rw_args_t args;
-  rtems_status_code     status;
-  int                   major;
-  int                   minor;
+  rtems_libio_rw_args_t     args;
+  rtems_status_code         status;
+  rtems_device_major_number major;
+  rtems_device_minor_number minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
   args.iop         = iop;
   args.offset      = iop->offset;
@@ -192,13 +198,12 @@ rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop,
                               uint32_t       command,
                               void*          buffer)
 {
-  rtems_libio_ioctl_args_t args;
-  rtems_status_code        status;
-  int                      major;
-  int                      minor;
+  rtems_libio_ioctl_args_t  args;
+  rtems_status_code         status;
+  rtems_device_major_number major;
+  rtems_device_minor_number minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
   args.iop     = iop;
   args.command = command;




More information about the vc mailing list