newlib/winsup/cygwin/include/sys/sysmacros.h
Yaakov Selkowitz ddebf19a2a * 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-05 00:53:17 +00:00

41 lines
869 B
C

/* sys/sysmacros.h
Copyright 1998, 2001, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H
_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 */