* include/cygwin/types.h: Move #include <sys/sysmacros.h> to

end of header so that it gets the dev_t typedef.
* include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev): Prototype and define as inline functions.
(major, minor, makedev): Redefine in terms of gnu_dev_*.
This commit is contained in:
Yaakov Selkowitz 2011-04-05 00:53:17 +00:00
parent 8b09538c94
commit ddebf19a2a
3 changed files with 37 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2011-04-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/cygwin/types.h: Move #include <sys/sysmacros.h> to
end of header so that it gets the dev_t typedef.
* include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev): Prototype and define as inline functions.
(major, minor, makedev): Redefine in terms of gnu_dev_*.
2011-04-04 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/cygwin/types.h: Move multiple inclusion guards to

View File

@ -17,7 +17,6 @@ extern "C"
{
#endif
#include <sys/sysmacros.h>
#include <stdint.h>
#include <endian.h>
@ -219,6 +218,9 @@ typedef class pthread_rwlockattr *pthread_rwlockattr_t;
typedef class semaphore *sem_t;
#endif /* __INSIDE_CYGWIN__ */
/* this header needs the dev_t typedef */
#include <sys/sysmacros.h>
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,6 @@
/* sys/sysmacros.h
Copyright 1998, 2001, 2010 Red Hat, Inc.
Copyright 1998, 2001, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin.
@ -11,8 +11,30 @@ details. */
#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H
#define major(dev) ((int)(((dev) >> 16) & 0xffff))
#define minor(dev) ((int)((dev) & 0xffff))
#define makedev(major, minor) (((major) << 16) | ((minor) & 0xffff))
_ELIDABLE_INLINE int gnu_dev_major(dev_t);
_ELIDABLE_INLINE int gnu_dev_minor(dev_t);
_ELIDABLE_INLINE dev_t gnu_dev_makedev(int, int);
_ELIDABLE_INLINE int
gnu_dev_major(dev_t dev)
{
return (int)(((dev) >> 16) & 0xffff);
}
_ELIDABLE_INLINE int
gnu_dev_minor(dev_t dev)
{
return (int)((dev) & 0xffff);
}
_ELIDABLE_INLINE dev_t
gnu_dev_makedev(int maj, int min)
{
return (((maj) << 16) | ((min) & 0xffff));
}
#define major(dev) gnu_dev_major(dev)
#define minor(dev) gnu_dev_minor(dev)
#define makedev(maj, min) gnu_dev_makedev(maj, min)
#endif /* _SYS_SYSMACROS_H */