summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/include/rtems/libio.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-12-02 19:13:26 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-12-02 19:13:26 +0000
commit7e476f027955dd3b5aafb782c1c7f821925a2d47 (patch)
tree9d04c1f460376dd85635727c4bb73917dbaf60b4 /cpukit/libcsupport/include/rtems/libio.h
parent2002-12-02 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-7e476f027955dd3b5aafb782c1c7f821925a2d47.tar.bz2
2002-12-02 Joel Sherrill <joel@OARcorp.com>
* 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.
Diffstat (limited to 'cpukit/libcsupport/include/rtems/libio.h')
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h47
1 files changed, 47 insertions, 0 deletions
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 <unistd.h>
+
+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 { \