@@ -83,7 +83,7 @@ typedef struct {
8383 char device[VFS_PATH_LENGTH];
8484 char mountpoint[VFS_PATH_LENGTH];
8585
86- fs_operations_t operations;
86+ fs_operations_t * operations;
8787
8888} mountpoint_t;
8989```
@@ -314,7 +314,7 @@ int open(const char *path, int flags){
314314
315315 if (mountpoint != NULL) {
316316 char *rel_path = get_rel_path(mountpoint, path);
317- int fs_specific_id = mountpoint->operations. open(rel_path, flags);
317+ int fs_specific_id = mountpoint->operations-> open(rel_path, flags);
318318 if (fs_specific_id != ERROR) {
319319 /* IMPLEMENTATION LEFT AS EXERCISE */
320320 // Get a new vfs descriptor id vfs_id
@@ -344,13 +344,13 @@ int close(int fildes) {
344344 mountpoint_id = vfs_opened_files[ fildes] .mountpoint_id;
345345 mountpoint_t * mountpoint = get_mountpoint_by_id(mountpoint_id);
346346 fs_file_id = vfs_opened_files[ fildes] .fs_file_id;
347- fs_close_result = mountpoint->operations. close(fs_file_id);
347+ fs_close_result = mountpoint->operations-> close(fs_file_id);
348348 if(fs_close_result == 0) {
349349 vfs_opened_files[ fildes] .fs_file_id = -1;
350350 return 0;
351351 }
352- return -1;
353352 }
353+ return -1;
354354}
355355```
356356
@@ -399,7 +399,7 @@ ssize_t read(int fildes, void *buf, size_t nbytes) {
399399 int mountpoint_id = vfs_opened_files[ fildes] .mountpoint_id;
400400 mountpoint_t * mountpoint = get_mountpoint_by_id(mountpoint_id);
401401 int fs_file_id = vfs_opened_files[ fildes] .fs_file_id;
402- int bytes_read = mountpoints->operations. read(fs_file_id, buf, nbytes);
402+ int bytes_read = mountpoints->operations-> read(fs_file_id, buf, nbytes);
403403 if (opened_files[ fildes] .buf_read_pos + nbytes < opened_files[ fildes] .file_size) {
404404 opened_files[ fildes] .buf_read_pos += nbytes;
405405 } else {
0 commit comments