Cosmetic changes, free root in tools/diskwrite.c

This commit is contained in:
notsomeidiot123 2026-02-02 02:58:55 -05:00
parent f507134706
commit fb4dae6356
5 changed files with 6 additions and 4 deletions

View File

@ -5,6 +5,8 @@
#define MODULE_NAME "KVFS" #define MODULE_NAME "KVFS"
vfile_t root_dir = {"/", VFILE_DIRECTORY}; vfile_t root_dir = {"/", VFILE_DIRECTORY};
// !TODO: Modify code to become thread-safe
struct mount_handler{ struct mount_handler{
int (*callback)(vfile_t *device, MOUNT_OPERATION op, ...); int (*callback)(vfile_t *device, MOUNT_OPERATION op, ...);
uint32_t key; uint32_t key;

View File

@ -584,7 +584,7 @@ void init(KOS_MAPI_FP module_api, uint32_t api_version){
api(MODULE_API_ADDINT, 15, module_data.key, int_handler); api(MODULE_API_ADDINT, 15, module_data.key, int_handler);
api(MODULE_API_ADDINT, 14, module_data.key, int_handler); api(MODULE_API_ADDINT, 14, module_data.key, int_handler);
// api(MODULE_API_ADDINT, 0, module_data.key, int_handler); // api(MODULE_API_ADDINT, 0, module_data.key, int_handler);
vfile_t *pci_drive_dir = fopen(api, "/dev/pci/disk/"); vfile_t *pci_drive_dir = fget_file(api, "/dev/pci/disk/");
vfile_t **dir_data = (pci_drive_dir->access.data.ptr); vfile_t **dir_data = (pci_drive_dir->access.data.ptr);
for(uint32_t i = 0; dir_data[i]; i++){ for(uint32_t i = 0; dir_data[i]; i++){
vfile_t *current_file = dir_data[i]; vfile_t *current_file = dir_data[i];

View File

@ -38,7 +38,7 @@ int mount(vfile_t *file, char *buffer, uint32_t offset, uint32_t count){
destination_buffer[i] = buffer[i]; destination_buffer[i] = buffer[i];
} }
destination_buffer[i] = 0; destination_buffer[i] = 0;
vfile_t *src = fopen(api, filename_buffer); vfile_t *src = fget_file(api, filename_buffer);
if(!src){ if(!src){
puts(api, MODULE_NAME, "src does not exist\n"); puts(api, MODULE_NAME, "src does not exist\n");
} }

View File

@ -89,7 +89,7 @@ inline void *free(KOS_MAPI_FP api, void *ptr){
api(MODULE_API_FREE, ptr); api(MODULE_API_FREE, ptr);
return 0; return 0;
} }
inline vfile_t *fopen(KOS_MAPI_FP api, char *filename){ inline vfile_t *fget_file(KOS_MAPI_FP api, char *filename){
// vfile_t *file = malloc(api, 1); // vfile_t *file = malloc(api, 1);
return (void *)api(MODULE_API_OPEN, filename); return (void *)api(MODULE_API_OPEN, filename);
} }

View File

@ -309,7 +309,7 @@ int main(int argc, char **argv){
printf(".%s\n", root[index].ext); printf(".%s\n", root[index].ext);
index++; index++;
} }
// free(root); free(root);
} }
fat_write_back(output_file, &info); fat_write_back(output_file, &info);
verbose && printf("Finished. Exiting...\n"); verbose && printf("Finished. Exiting...\n");