Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
JingWangTW committed Jun 17, 2020
1 parent 93ed288 commit 7bbff69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/fs/fat32.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ int fat32_write ( file_t * file, const void * buf, size_t len )
}
}

file_node->size = len;

writeblock ( ( dir_node->cluster - 2 ) * sd_root_bst->logic_sector_per_cluster + sd_root_partition->starting_sector + sd_root_partition->root_sector_abs, dir_entrty );

uart_printf ( "Write to file: %s, size: %d\n", file_node->name, len );
Expand Down
4 changes: 3 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ int main ( )
vfs_read ( b, buf, 100 );
uart_printf ( ">> %s\n", buf );

vfs_write ( b, "Hello World\n", 12 );
vfs_write ( b, "Hello World.\n", 12 );
// vfs_write ( b, "Sample text in sample file.\n", 28 );
vfs_close ( b );

b = vfs_open ( "test.txt", 0 );
vfs_read ( b, buf, 100 );
uart_printf ( ">> %s\n", buf );
vfs_close ( b );

// start shell
shell_start ( );
Expand Down

0 comments on commit 7bbff69

Please sign in to comment.