diff --git a/sortix/fs/ramfs.cpp b/sortix/fs/ramfs.cpp index 283a6fe8..5bc6b7bd 100644 --- a/sortix/fs/ramfs.cpp +++ b/sortix/fs/ramfs.cpp @@ -337,17 +337,26 @@ namespace Sortix return true; } + const bool BINDEVHACK = false; + size_t DevRAMFS::GetNumFiles() { - if ( !files ) { return 0; } - return files->Length(); + size_t result = BINDEVHACK ? 2 : 0; + if ( files ) { result += files->Length(); } + return result; } const char* DevRAMFS::GetFilename(size_t index) { + switch ( BINDEVHACK ? index : 2 ) + { + case 0: return "bin"; + case 1: return "dev"; + } + size_t filesindex = BINDEVHACK ? index - 2 : index; if ( !files ) { return NULL; } - if ( files->Length() <= index ) { return NULL; } - DevRAMFSFile* file = files->Get(index); + if ( files->Length() <= filesindex ) { return NULL; } + DevRAMFSFile* file = files->Get(filesindex); return file->name; } } diff --git a/utils/ls.cpp b/utils/ls.cpp index 10702b59..c8975eeb 100644 --- a/utils/ls.cpp +++ b/utils/ls.cpp @@ -36,9 +36,6 @@ int ls(const char* path) DIR* dir = opendir(path); if ( !dir ) { error(2, errno, "%s", path); return 2; } - // TODO: Hack until mountpoints work correctly. - if ( strcmp(path, "/") == 0 ) { printf("bin\ndev\n"); } - struct dirent* entry; while ( (entry = readdir(dir)) ) {