aboutsummaryrefslogtreecommitdiffstats
path: root/com32/include
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-03-08 21:04:24 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-03-08 21:04:24 -0800
commit2a95944f8d7536868ca51ddf09514f78309af52a (patch)
tree0c8558c50f83cf0c646853c8040d4cb04126f773 /com32/include
parentf952343d7b44210dc43938ab2f7804aee95dc51a (diff)
downloadsyslinux-2a95944f8d7536868ca51ddf09514f78309af52a.tar.gz
syslinux-2a95944f8d7536868ca51ddf09514f78309af52a.tar.xz
syslinux-2a95944f8d7536868ca51ddf09514f78309af52a.zip
sys/dirent.h: conversion macros between d_type and st_mode
Conversion macros to change between d_type and st_mode values. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/include')
-rw-r--r--com32/include/sys/dirent.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/com32/include/sys/dirent.h b/com32/include/sys/dirent.h
index 0a27c66e..bb5e52c7 100644
--- a/com32/include/sys/dirent.h
+++ b/com32/include/sys/dirent.h
@@ -6,6 +6,7 @@
#define DIRENT_H
#include <stdint.h>
+#include <sys/types.h>
#ifndef NAME_MAX
#define NAME_MAX 255
@@ -19,7 +20,7 @@ struct dirent {
char d_name[NAME_MAX + 1];
};
-enum dirent_types {
+enum dirent_type {
DT_UNKNOWN = 0,
DT_FIFO = 1,
DT_CHR = 2,
@@ -31,6 +32,13 @@ enum dirent_types {
DT_WHT = 14,
};
+/*
+ * Convert between stat structure mode types and directory types.
+ * The stat structure mode types are the same as in Linux.
+ */
+#define IFTODT(mode) (((mode) & 0170000) >> 12)
+#define DTTOIF(dt) ((dt) << 12)
+
struct _DIR_;
typedef struct _DIR_ DIR;