fix(kernel): devfs last_slash/file_name 改用裸 str,修复 i8* 赋给 i8** 导致设备注册空名
This commit is contained in:
1 parent
2a03330a9d
commit
333adb090f
1 file changed
+4
-4
@@ -215,13 +215,13 @@ class _DevFSObject:
|
|||||||
string.memset(c.Addr(path_copy), 0, PATH_BUFFER_SIZE)
|
string.memset(c.Addr(path_copy), 0, PATH_BUFFER_SIZE)
|
||||||
string.strcpy(path_copy, path)
|
string.strcpy(path_copy, path)
|
||||||
|
|
||||||
last_slash: str | t.CPtr = string.strrchr(path_copy, '/')
|
last_slash: str = string.strrchr(path_copy, '/')
|
||||||
|
|
||||||
if not last_slash: return -1
|
if not last_slash: return -1
|
||||||
|
|
||||||
last_slash[0] = '\0'
|
last_slash[0] = '\0'
|
||||||
dir_path = path_copy
|
dir_path = path_copy
|
||||||
file_name: str | t.CPtr = last_slash + 1
|
file_name: str = last_slash + 1
|
||||||
|
|
||||||
dir_ptr: devfs_directory | t.CPtr = self.find_or_create_directory(dir_path)
|
dir_ptr: devfs_directory | t.CPtr = self.find_or_create_directory(dir_path)
|
||||||
if not dir_ptr: return -1
|
if not dir_ptr: return -1
|
||||||
@@ -250,13 +250,13 @@ class _DevFSObject:
|
|||||||
string.memset(c.Addr(path_copy), 0, PATH_BUFFER_SIZE)
|
string.memset(c.Addr(path_copy), 0, PATH_BUFFER_SIZE)
|
||||||
string.strcpy(path_copy, path)
|
string.strcpy(path_copy, path)
|
||||||
|
|
||||||
last_slash: str | t.CPtr = string.strrchr(path_copy, '/')
|
last_slash: str = string.strrchr(path_copy, '/')
|
||||||
|
|
||||||
if not last_slash: return -1
|
if not last_slash: return -1
|
||||||
|
|
||||||
last_slash[0] = '\0'
|
last_slash[0] = '\0'
|
||||||
dir_path = path_copy
|
dir_path = path_copy
|
||||||
file_name: str | t.CPtr = last_slash + 1
|
file_name: str = last_slash + 1
|
||||||
|
|
||||||
dir_ptr: devfs_directory | t.CPtr = devfs_directory.find(dir_path, self.root_directory)
|
dir_ptr: devfs_directory | t.CPtr = devfs_directory.find(dir_path, self.root_directory)
|
||||||
if not dir_ptr: return -1
|
if not dir_ptr: return -1
|
||||||
|
|||||||
Reference in new issue
Block a user