From 220826af27a1f78cab0f36119f717dfc0bf8cb99 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 25 Sep 2009 20:22:17 +0800 Subject: [PATCH] Added support for skipping to VFS_ReadDir --- Kernel/include/vfs.h | 1 + Kernel/syscalls.c | 2 +- Kernel/vfs/dir.c | 10 +++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Kernel/include/vfs.h b/Kernel/include/vfs.h index 209889cb..99250e12 100644 --- a/Kernel/include/vfs.h +++ b/Kernel/include/vfs.h @@ -85,6 +85,7 @@ typedef struct sVFS_Driver { } tVFS_Driver; // === GLOBALS === +#define VFS_MAXSKIP ((void*)1024) #define VFS_SKIP ((void*)1) #define VFS_SKIPN(n) ((void*)(n)) extern tVFS_Node NULLNode; diff --git a/Kernel/syscalls.c b/Kernel/syscalls.c index 90422cee..f1e08904 100644 --- a/Kernel/syscalls.c +++ b/Kernel/syscalls.c @@ -2,7 +2,7 @@ * AcessOS Microkernel Version * syscalls.c */ -#define DEBUG 1 +#define DEBUG 0 #include #include diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index b7af755b..d3214a4b 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -153,7 +153,13 @@ int VFS_ReadDir(int FD, char *Dest) return 0; } - tmp = h->Node->ReadDir(h->Node, h->Position); + do { + tmp = h->Node->ReadDir(h->Node, h->Position); + if((Uint)tmp < (Uint)VFS_MAXSKIP) + h->Position += (Uint)tmp; + else + h->Position ++; + } while((Uint)tmp < (Uint)VFS_MAXSKIP); LOG("tmp = '%s'", tmp); if(!tmp) { @@ -161,8 +167,6 @@ int VFS_ReadDir(int FD, char *Dest) return 0; } - h->Position ++; - strcpy(Dest, tmp); if(IsHeap(tmp)) free(tmp); -- 2.20.1