/* Creates a new free map file on disk and writes the free map to it. */ void free_map_create (void) { /* Create inode. */ printf("free_map_create(): free_map_file_size: %d\n", bitmap_file_size (free_map)); if (!inode_create (FREE_MAP_SECTOR, bitmap_file_size (free_map))) PANIC ("free map creation failed"); struct inode_disk* buff = (struct inode_disk*)malloc(BLOCK_SECTOR_SIZE); block_read(fs_device, FREE_MAP_SECTOR, buff); ASSERT (buff->direct[0] != 0); /* Write bitmap to file. */ free_map_file = file_open (inode_open (FREE_MAP_SECTOR)); if (free_map_file == NULL) PANIC ("can't open free map"); if (!bitmap_write (free_map, free_map_file)) PANIC ("can't write free map"); }
/* Creates a new free map file on disk and writes the free map to it. */ void free_map_create (void) { /* Create inode. */ if (!inode_create (FREE_MAP_SECTOR, bitmap_file_size (free_map),0,1)) PANIC ("free map creation failed"); /* Write bitmap to file. */ free_map_file = file_open (inode_open (FREE_MAP_SECTOR)); if (free_map_file == NULL) PANIC ("can't open free map"); if (!bitmap_write (free_map, free_map_file)) PANIC ("can't write free map"); }