Added support for skipping to VFS_ReadDir
authorJohn Hodge <[email protected]>
Fri, 25 Sep 2009 12:22:17 +0000 (20:22 +0800)
committerJohn Hodge <[email protected]>
Fri, 25 Sep 2009 12:22:17 +0000 (20:22 +0800)
Kernel/include/vfs.h
Kernel/syscalls.c
Kernel/vfs/dir.c

index 209889c..99250e1 100644 (file)
@@ -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;
index 90422ce..f1e0890 100644 (file)
@@ -2,7 +2,7 @@
  * AcessOS Microkernel Version
  * syscalls.c
  */
-#define DEBUG  1
+#define DEBUG  0
 
 #include <common.h>
 #include <syscalls.h>
index b7af755..d3214a4 100644 (file)
@@ -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);

UCC git Repository :: git.ucc.asn.au