summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2009-06-06 19:44:17 +0000
committerroot <root>2009-06-06 19:44:17 +0000
commitb7b35d77a0bd68366dae48d86554f9c58b644e69 (patch)
treeeb16ab6bb18ffa2c45b8a35c84e451e0be738182
parent1a01097f12bd9cd363a2c3831c3d6ac328816523 (diff)
*** empty log message ***
-rw-r--r--eio.c36
-rw-r--r--eio.h7
2 files changed, 38 insertions, 5 deletions
diff --git a/eio.c b/eio.c
index f4516d1..bc73493 100644
--- a/eio.c
+++ b/eio.c
@@ -82,12 +82,18 @@
/* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
-# define D_INO(de) (de)->d_fileno
# define _DIRENT_HAVE_D_TYPE /* sigh */
+# define D_INO(de) (de)->d_fileno
+# define D_NAMLEN(de) (de)->d_namlen
# elif defined(__linux) || defined(d_ino) || _XOPEN_SOURCE >= 600
# define D_INO(de) (de)->d_ino
# endif
+#ifdef _D_EXACT_NAMLEN
+# undef D_NAMLEN
+# define D_NAMLEN(de) _D_EXACT_NAMLEN (de)
+#endif
+
# ifdef _DIRENT_HAVE_D_TYPE
# define D_TYPE(de) (de)->d_type
# endif
@@ -116,10 +122,12 @@
#ifndef D_TYPE
# define D_TYPE(de) 0
#endif
-
#ifndef D_INO
# define D_INO(de) 0
#endif
+#ifndef D_NAMLEN
+# define D_NAMLEN(de) strlen ((de)->d_name)
+#endif
/* number of seconds after which an idle threads exit */
#define IDLE_TIMEOUT 10
@@ -1097,7 +1105,7 @@ eio__scandir (eio_req *req, etp_worker *self)
/* skip . and .. entries */
if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2])))
{
- int len = strlen (name) + 1;
+ int len = D_NAMLEN (entp) + 1;
while (expect_false (namesoffs + len > namesalloc))
{
@@ -1146,21 +1154,39 @@ eio__scandir (eio_req *req, etp_worker *self)
#ifdef DT_CHR
case DT_CHR: ent->type = EIO_DT_CHR; break;
#endif
+ #ifdef DT_MPC
+ case DT_MPC: ent->type = EIO_DT_MPC; break;
+ #endif
#ifdef DT_DIR
case DT_DIR: ent->type = EIO_DT_DIR; break;
#endif
+ #ifdef DT_NAM
+ case DT_NAM: ent->type = EIO_DT_NAM; break;
+ #endif
#ifdef DT_BLK
case DT_BLK: ent->type = EIO_DT_BLK; break;
#endif
+ #ifdef DT_MPB
+ case DT_MPB: ent->type = EIO_DT_MPB; break;
+ #endif
#ifdef DT_REG
case DT_REG: ent->type = EIO_DT_REG; break;
#endif
+ #ifdef DT_NWK
+ case DT_NWK: ent->type = EIO_DT_NWK; break;
+ #endif
+ #ifdef DT_CMP
+ case DT_CMP: ent->type = EIO_DT_CMP; break;
+ #endif
#ifdef DT_LNK
case DT_LNK: ent->type = EIO_DT_LNK; break;
#endif
#ifdef DT_SOCK
case DT_SOCK: ent->type = EIO_DT_SOCK; break;
#endif
+ #ifdef DT_DOOR
+ case DT_DOOR: ent->type = EIO_DT_DOOR; break;
+ #endif
#ifdef DT_WHT
case DT_WHT: ent->type = EIO_DT_WHT; break;
#endif
@@ -1175,9 +1201,9 @@ eio__scandir (eio_req *req, etp_worker *self)
if (*name == '.') /* leading dots are likely directories, and, in any case, rare */
ent->score = 98;
else if (!strchr (name, '.')) /* absense of dots indicate likely dirs */
- ent->score = len <= 4 ? 5 : len <= 7 ? 4 : 1; /* shorter == more likely dir, but avoid too many classes */
+ ent->score = len <= 2 ? len + 60 : len <= 4 ? 50 : len <= 7 ? 40 : 10; /* shorter == more likely dir, but avoid too many classes */
}
- else if (ent->type == DT_DIR)
+ else if (ent->type == EIO_DT_DIR)
ent->score = 100;
}
}
diff --git a/eio.h b/eio.h
index c6ca312..33a4fbb 100644
--- a/eio.h
+++ b/eio.h
@@ -78,11 +78,18 @@ enum eio_dtype {
EIO_DT_UNKNOWN = 0,
EIO_DT_FIFO = 1,
EIO_DT_CHR = 2,
+ EIO_DT_MPC = 3, /* multiplexed char device (v7+Coherent) */
EIO_DT_DIR = 4,
+ EIO_DT_NAM = 5, /* xenix special named file */
EIO_DT_BLK = 6,
+ EIO_DT_MPB = 7, /* multiplexed block device (v7+coherent) */
EIO_DT_REG = 8,
+ EIO_DT_NWK = 9, /* HP-UX network special */
+ EIO_DT_CMP = 9, /* VxFS compressed */
EIO_DT_LNK = 10,
+ /* DT_SHAD = 11,*/
EIO_DT_SOCK = 12,
+ EIO_DT_DOOR = 13, /* solaris door */
EIO_DT_WHT = 14,
EIO_DT_MAX = 15 /* highest DT_VALUE ever, hopefully */
};