From 7e476f027955dd3b5aafb782c1c7f821925a2d47 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 2 Dec 2002 19:13:26 +0000 Subject: 2002-12-02 Joel Sherrill * include/rtems/libio.h: Internally use a union of an unsigned64 and major/minor device so we don't get into trouble shifting. The h8300 seemed to be impossible to remove warnings otherwise. Eventually the structure definition of a dev_t might be better anyway. * include/sys/ioccom.h: Added casts to remove warnings on 16 bit targets. --- cpukit/libcsupport/ChangeLog | 9 ++++++ cpukit/libcsupport/include/rtems/libio.h | 47 ++++++++++++++++++++++++++++++++ cpukit/libcsupport/include/sys/ioccom.h | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) (limited to 'cpukit/libcsupport') diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog index 3a3125a530..8c2d787efc 100644 --- a/cpukit/libcsupport/ChangeLog +++ b/cpukit/libcsupport/ChangeLog @@ -1,3 +1,12 @@ +2002-12-02 Joel Sherrill + + * include/rtems/libio.h: Internally use a union of an unsigned64 + and major/minor device so we don't get into trouble shifting. + The h8300 seemed to be impossible to remove warnings otherwise. + Eventually the structure definition of a dev_t might be better anyway. + * include/sys/ioccom.h: Added casts to remove warnings on 16 bit + targets. + 2002-11-19 Ralf Corsepius * configure.ac: Cosmetical fixes. diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 595eeb460e..df46f26956 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -455,6 +455,7 @@ typedef int (*rtems_libio_lseek_t)( * Macros */ +#if 0 #define rtems_filesystem_make_dev_t( _major, _minor ) \ ((((dev_t)(_major)) << 32) | (dev_t)(_minor)) @@ -463,6 +464,52 @@ typedef int (*rtems_libio_lseek_t)( #define rtems_filesystem_dev_minor_t( _dev ) \ (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF) +#else + +#include + +union __dev_t { + dev_t device; + struct { + rtems_device_major_number major; + rtems_device_minor_number minor; + } __overlay; +}; + +static inline dev_t rtems_filesystem_make_dev_t( + rtems_device_major_number _major, + rtems_device_minor_number _minor +) +{ + union __dev_t temp; + + temp.__overlay.major = _major; + temp.__overlay.minor = _minor; + return temp.device; +} + +static inline rtems_device_major_number rtems_filesystem_dev_major_t( + dev_t device +) +{ + union __dev_t temp; + + temp.device = device; + return temp.__overlay.major; +} + + +static inline rtems_device_minor_number rtems_filesystem_dev_minor_t( + dev_t device +) +{ + union __dev_t temp; + + temp.device = device; + return temp.__overlay.minor; +} + +#endif #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \ do { \ diff --git a/cpukit/libcsupport/include/sys/ioccom.h b/cpukit/libcsupport/include/sys/ioccom.h index 60e16a6c8a..ed73439f3f 100644 --- a/cpukit/libcsupport/include/sys/ioccom.h +++ b/cpukit/libcsupport/include/sys/ioccom.h @@ -55,7 +55,7 @@ #define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ #define _IOC(inout,group,num,len) \ - (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) + ((unsigned32)inout | (unsigned32) ((unsigned32)((unsigned32)len & IOCPARM_MASK) << 16) | (unsigned32)((group) << 8) | (unsigned32)(num)) #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) -- cgit v1.2.3