added required fixes to make ntfs work again

This commit is contained in:
Itay Almog 2022-01-21 16:39:18 +02:00
parent 48d8b59986
commit 35d522d388
3 changed files with 10 additions and 5 deletions

View File

@ -114,7 +114,7 @@ struct file_handle *fopen(struct volume *part, const char *filename) {
ret->fd = (void *)fd;
ret->read = (void *)ntfs_read;
//ret->close = (void *)ntfs_close;
ret->close = (void *)ntfs_close;
ret->size = fd->size_bytes;
return ret;

View File

@ -54,7 +54,8 @@ struct ntfs_file_handle {
int ntfs_check_signature(struct volume *part);
int ntfs_open(struct ntfs_file_handle *ret, struct volume *part, const char *path);
bool ntfs_open(struct ntfs_file_handle *ret, struct volume *part, const char *path);
int ntfs_read(struct ntfs_file_handle *file, void *buf, uint64_t loc, uint64_t count);
void ntfs_close(struct ntfs_file_handle *file);
#endif

View File

@ -514,7 +514,7 @@ static bool ntfs_find_file_in_directory(struct ntfs_file_handle *handle, const c
return false;
}
int ntfs_open(struct ntfs_file_handle *ret, struct volume *part, const char *path) {
bool ntfs_open(struct ntfs_file_handle *ret, struct volume *part, const char *path) {
// save the part
ret->part = part;
@ -553,7 +553,7 @@ int ntfs_open(struct ntfs_file_handle *ret, struct volume *part, const char *pat
// find the file in the directory
entry = NULL;
if (!ntfs_find_file_in_directory(ret, current_path, &entry))
return 1;
return false;
size_t filename_len = entry->name_length;
@ -582,7 +582,7 @@ int ntfs_open(struct ntfs_file_handle *ret, struct volume *part, const char *pat
// save the run list
memcpy(ret->run_list, (uint8_t *)attr + attr->run_offset, sizeof(ret->run_list));
return 0;
return true;
} else {
// read the directory
@ -652,3 +652,7 @@ int ntfs_read(struct ntfs_file_handle *file, void *buf, uint64_t loc, uint64_t c
// if we didn't read it all then we got a problem
return count != 0;
}
void ntfs_close(struct ntfs_file_handle *file) {
pmm_free(file, sizeof(struct ntfs_file_handle));
}