diff --git a/kernel/include/fs/devices/Console.h b/kernel/include/fs/devices/Console.h index 5474e797..d7ce5d96 100644 --- a/kernel/include/fs/devices/Console.h +++ b/kernel/include/fs/devices/Console.h @@ -3,7 +3,7 @@ namespace ConsoleDevice { - VFS::Node* create_new(); + VFS::Node* create_new(const char* devname); ssize_t write(VFS::Node* node, size_t offset, size_t size, const char* buffer); } \ No newline at end of file diff --git a/kernel/include/fs/devices/Serial.h b/kernel/include/fs/devices/Serial.h index 79963e61..2f9728ca 100644 --- a/kernel/include/fs/devices/Serial.h +++ b/kernel/include/fs/devices/Serial.h @@ -3,7 +3,7 @@ namespace SerialDevice { - VFS::Node* create_new(); + VFS::Node* create_new(const char* devname); ssize_t write(VFS::Node* node, size_t offset, size_t size, const char* buffer); } \ No newline at end of file diff --git a/kernel/include/fs/devices/Version.h b/kernel/include/fs/devices/Version.h index 100f7253..72590515 100644 --- a/kernel/include/fs/devices/Version.h +++ b/kernel/include/fs/devices/Version.h @@ -3,7 +3,7 @@ namespace VersionDevice { - VFS::Node* create_new(); + VFS::Node* create_new(const char* devname); ssize_t read(VFS::Node* node, size_t offset, size_t size, char* buffer); } \ No newline at end of file diff --git a/kernel/src/fs/devices/Console.cpp b/kernel/src/fs/devices/Console.cpp index 60bbd4d4..e94e1f1f 100644 --- a/kernel/src/fs/devices/Console.cpp +++ b/kernel/src/fs/devices/Console.cpp @@ -5,7 +5,7 @@ #include "std/stdlib.h" #include "std/string.h" -VFS::Node* ConsoleDevice::create_new() +VFS::Node* ConsoleDevice::create_new(const char* devname) { VFS::Node* dev = new VFS::Node; dev->write_func = ConsoleDevice::write; @@ -13,7 +13,7 @@ VFS::Node* ConsoleDevice::create_new() dev->length = 0; dev->type = VFS_FILE; dev->flags = 0; - strncpy(dev->name, "console", sizeof(dev->name)); + strncpy(dev->name, devname, sizeof(dev->name)); return dev; } diff --git a/kernel/src/fs/devices/DeviceFS.cpp b/kernel/src/fs/devices/DeviceFS.cpp index e0fe053b..2557bf4f 100644 --- a/kernel/src/fs/devices/DeviceFS.cpp +++ b/kernel/src/fs/devices/DeviceFS.cpp @@ -22,9 +22,9 @@ VFS::Node* DeviceFS::get() devfs_root->find_func = DeviceFS::finddir; strncpy(devfs_root->name, "dev", sizeof(devfs_root->name)); - devfs_files[devfs_file_count++] = VersionDevice::create_new(); - devfs_files[devfs_file_count++] = ConsoleDevice::create_new(); - devfs_files[devfs_file_count++] = SerialDevice::create_new(); + devfs_files[devfs_file_count++] = VersionDevice::create_new("version"); + devfs_files[devfs_file_count++] = ConsoleDevice::create_new("console"); + devfs_files[devfs_file_count++] = SerialDevice::create_new("serial"); return devfs_root; } diff --git a/kernel/src/fs/devices/Serial.cpp b/kernel/src/fs/devices/Serial.cpp index b3b5f729..fe412d5a 100644 --- a/kernel/src/fs/devices/Serial.cpp +++ b/kernel/src/fs/devices/Serial.cpp @@ -5,7 +5,7 @@ #include "std/stdlib.h" #include "std/string.h" -VFS::Node* SerialDevice::create_new() +VFS::Node* SerialDevice::create_new(const char* devname) { VFS::Node* dev = new VFS::Node; dev->write_func = SerialDevice::write; @@ -13,7 +13,7 @@ VFS::Node* SerialDevice::create_new() dev->length = 0; dev->type = VFS_FILE; dev->flags = 0; - strncpy(dev->name, "serial", sizeof(dev->name)); + strncpy(dev->name, devname, sizeof(dev->name)); return dev; } diff --git a/kernel/src/fs/devices/Version.cpp b/kernel/src/fs/devices/Version.cpp index 816684f2..319f8e05 100644 --- a/kernel/src/fs/devices/Version.cpp +++ b/kernel/src/fs/devices/Version.cpp @@ -4,7 +4,7 @@ #include "std/stdlib.h" #include "std/string.h" -VFS::Node* VersionDevice::create_new() +VFS::Node* VersionDevice::create_new(const char* devname) { VFS::Node* dev = new VFS::Node; dev->read_func = VersionDevice::read; @@ -12,7 +12,7 @@ VFS::Node* VersionDevice::create_new() dev->length = strlen(moon_version()) + 5; dev->type = VFS_FILE; dev->flags = 0; - strncpy(dev->name, "version", sizeof(dev->name)); + strncpy(dev->name, devname, sizeof(dev->name)); return dev; }