Beispiel #1
0
        /// <summary>
        /// Reads a directory entry
        /// </summary>
        /// <param name="descriptor">The descriptor</param>
        /// <param name="entry">The directory entry</param>
        /// <param name="index">The index</param>
        /// <returns>Errorcode</returns>
        public static unsafe ErrorCode Readdir(int descriptor, DirEntry *entry, uint index)
        {
            FileDescriptors descriptors = Tasking.CurrentTask.FileDescriptors;

            Node node = descriptors.GetNode(descriptor);

            if (node == null)
            {
                return(ErrorCode.EBADF);
            }

            DirEntry *gotEntry = VFS.ReadDir(node, index);

            if (gotEntry == null)
            {
                return(ErrorCode.ENOENT);
            }

            Memory.Memcpy(entry, gotEntry, sizeof(DirEntry));
            Heap.Free(gotEntry);

            return(ErrorCode.SUCCESS);
        }