feat: Vfs and Ext2 support. Code style/attribute improvements
Added VFS and Ext2 support. Optimized attributes of methods to improve code highlighting. Printf attribute, malloc attribute, etc.
This commit is contained in:
@@ -75,15 +75,20 @@ ustar_sector *ustar_next(ustar_sector *current) {
|
||||
return ustar_sector_valid(next) ? next : NULL;
|
||||
}
|
||||
|
||||
uint8_t ustar_check_device(const block_device_t *device, uint8_t *first_sector) {
|
||||
ustar_sector *sector = (ustar_sector *) first_sector;
|
||||
uint8_t ustar_check_device(const block_device_t *device) {
|
||||
ustar_sector *sector = malloc(512); // todo fix leak
|
||||
if (device->access(device, BLOCK_DEV_DIRECTION_READ, 0, 1, sector) != BLOCK_DEV_ACCESS_OK) {
|
||||
free(sector);
|
||||
return BLOCK_DEV_DRIVER_CHECK_NO_MATCH;
|
||||
}
|
||||
if (!ustar_sector_valid(sector)) {
|
||||
free(sector);
|
||||
return BLOCK_DEV_DRIVER_CHECK_NO_MATCH;
|
||||
}
|
||||
|
||||
ustar_fs *fs = malloc(sizeof(ustar_fs));
|
||||
fs->first_inode = malloc(sizeof(ustar_inode));
|
||||
memcpy(&fs->first_inode->sector, first_sector, sizeof(ustar_sector));
|
||||
memcpy(&fs->first_inode->sector, sector, sizeof(ustar_sector));
|
||||
fs->first_inode->lba = 0;
|
||||
fs->device = device;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user