aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c15
-rw-r--r--lib/lib.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 43db2e37..1c1f2248 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -1043,3 +1043,18 @@ char *strnstr(char *line, char *str)
return *s ? s : 0;
}
+
+int dev_minor(int dev)
+{
+ return ((dev&0xfff00000)>>12)|(dev&0xff);
+}
+
+int dev_major(int dev)
+{
+ return (dev&0xfff00)>>8;
+}
+
+int dev_makedev(int major, int minor)
+{
+ return (minor&0xff)|((major&0xfff)<<8)|((minor&0xfff00)<<12);
+}
diff --git a/lib/lib.h b/lib/lib.h
index dac3b67f..c8cff6ef 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -200,6 +200,9 @@ void create_uuid(char *uuid);
char *show_uuid(char *uuid);
char *next_printf(char *s, char **start);
char *strnstr(char *line, char *str);
+int dev_minor(int dev);
+int dev_major(int dev);
+int dev_makedev(int major, int minor);
#define HR_SPACE 1 // Space between number and units
#define HR_B 2 // Use "B" for single byte units