summaryrefslogtreecommitdiff
path: root/klibc/include/sys/sysmacros.h
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2004-10-05 18:51:53 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:37:02 -0700
commit60d1e263f0da2976938fa54efec88ab777a6b3c3 (patch)
tree94bfcc4279827a68f90f8b63c0d458ddc753c69b /klibc/include/sys/sysmacros.h
parenta0622777688ad84ef3d789e0171cfb0ca3dc21d2 (diff)
[PATCH] oops forgot to add the new klibc/include directory
Diffstat (limited to 'klibc/include/sys/sysmacros.h')
-rw-r--r--klibc/include/sys/sysmacros.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/klibc/include/sys/sysmacros.h b/klibc/include/sys/sysmacros.h
new file mode 100644
index 0000000000..7f1e0822b3
--- /dev/null
+++ b/klibc/include/sys/sysmacros.h
@@ -0,0 +1,31 @@
+/*
+ * sys/sysmacros.h
+ *
+ * Constructs to create and pick apart dev_t. This applies to the Linux 2.6
+ * 32-bit dev_t format.
+ */
+
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#ifndef _SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+static __inline__ int major(dev_t __d)
+{
+ return (__d >> 8) & 0xfff;
+}
+
+static __inline__ int minor(dev_t __d)
+{
+ return (__d & 0xff) | ((__d >> 12) & 0xfff00);
+}
+
+static __inline__ dev_t makedev(int __ma, int __mi)
+{
+ return ((__ma & 0xfff) << 8) | (__mi & 0xff) | ((__mi & 0xfff00) << 12);
+}
+
+#endif /* _SYS_SYSMACROS_H */
+