Changeset e03a733 in mainline
- Timestamp:
- 2011-03-06T22:30:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2267e82
- Parents:
- ae1ae27
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkminix/mkminix.c
rae1ae27 re03a733 215 215 } 216 216 setup_superblock_v3(sb3, &opt); 217 block_write_direct(handle, MFS_SUPERBLOCK, 1, sb3); 217 218 setup_bitmaps(handle, sb3->s_ninodes, 218 sb3->s_ total_zones, sb3->s_block_size);219 sb3->s_nzones, sb3->s_block_size); 219 220 } else { 220 221 sb = (struct mfs_superblock *) malloc(sizeof(struct mfs_superblock)); … … 244 245 } else { 245 246 fs_version = 2; 246 ino_per_block = V 1_INODES_PER_BLOCK;247 ino_per_block = V2_INODES_PER_BLOCK; 247 248 if (opt->fs_longnames) 248 249 opt->fs_magic = MFS_MAGIC_V2L; … … 250 251 251 252 sb->s_magic = opt->fs_magic; 253 254 /*Compute the number of zones on disk*/ 252 255 253 256 /*Valid only for MFS V1*/ … … 259 262 UINT32_MAX : opt->dev_nblocks; 260 263 264 /*Round up the number of inodes to fill block size*/ 261 265 if (opt->n_inodes == 0) 262 266 tmp = opt->dev_nblocks / 3; … … 264 268 tmp = opt->n_inodes; 265 269 266 /*Round up the number of inodes to fill block size*/267 270 if (tmp % ino_per_block) 268 271 tmp = ((tmp / ino_per_block) + 1) * ino_per_block; … … 278 281 sb->s_zbmap_blocks = UPPER(sb->s_nzones2, MFS_BLOCKSIZE * 8); 279 282 283 /*Compute inode table size*/ 284 unsigned long ninodes_blocks = sb->s_ninodes / ino_per_block; 285 280 286 /*Compute first data zone position*/ 281 unsigned long ninodes_blocks = sb->s_ninodes / (fs_version == 1 ?282 V1_INODES_PER_BLOCK :283 V2_INODES_PER_BLOCK);284 287 sb->s_first_data_zone = 2 + ninodes_blocks + 285 288 sb->s_zbmap_blocks + sb->s_ibmap_blocks; … … 293 296 printf(NAME ": inode table blocks = %ld\n", ninodes_blocks); 294 297 printf(NAME ": first data zone = %d\n", sb->s_first_data_zone); 298 printf(NAME ": long fnames = %s\n", opt->fs_longnames ? "Yes" : "No"); 295 299 } 296 300 297 301 static void setup_superblock_v3(struct mfs3_superblock *sb, mfs_params_t *opt) 298 302 { 303 int ino_per_block; 304 int bs; 305 aoff64_t tmp; 306 307 sb->s_magic = opt->fs_magic; 308 bs = opt->block_size; 309 310 if (opt->n_inodes == 0) 311 tmp = opt->dev_nblocks / 3; 312 else 313 tmp = opt->n_inodes; 314 315 /*Compute the number of zones on disk*/ 316 sb->s_nzones = opt->dev_nblocks > UINT32_MAX ? 317 UINT32_MAX : opt->dev_nblocks; 318 sb->s_nzones /= (bs / MFS_MIN_BLOCKSIZE); 319 320 /*Round up the number of inodes to fill block size*/ 321 ino_per_block = V3_INODES_PER_BLOCK(bs); 322 if (tmp % ino_per_block) 323 tmp = ((tmp / ino_per_block) + 1) * ino_per_block; 324 sb->s_ninodes = tmp > UINT32_MAX ? UINT32_MAX : tmp; 325 326 /*Compute inode bitmap size in blocks*/ 327 sb->s_ibmap_blocks = UPPER(sb->s_ninodes, bs * 8); 328 329 /*Compute zone bitmap size in blocks*/ 330 sb->s_zbmap_blocks = UPPER(sb->s_nzones, bs * 8); 331 332 /*Compute inode table size*/ 333 unsigned long ninodes_blocks = sb->s_ninodes / ino_per_block; 334 335 /*Compute first data zone position*/ 336 sb->s_first_data_zone = 2 + ninodes_blocks + 337 sb->s_zbmap_blocks + sb->s_ibmap_blocks; 338 339 /*Set log2 of zone to block ratio to zero*/ 340 sb->s_log2_zone_size = 0; 341 sb->s_disk_version = 3; 342 sb->s_block_size = bs; 343 344 /*Superblock is now ready to be written on disk*/ 345 printf(NAME ": %d inodes\n", sb->s_ninodes); 346 printf(NAME ": %d zones\n", sb->s_nzones); 347 printf(NAME ": block size = %d\n", sb->s_block_size); 348 printf(NAME ": inode table blocks = %ld\n", ninodes_blocks); 349 printf(NAME ": first data zone = %d\n", sb->s_first_data_zone); 299 350 } 300 351 -
uspace/lib/minix/minix.h
rae1ae27 re03a733 119 119 int32_t s_max_file_size; 120 120 /*Total number of zones on the device*/ 121 uint32_t s_ total_zones;121 uint32_t s_nzones; 122 122 /* 123 123 *Magic number used to recognize MinixFS
Note:
See TracChangeset
for help on using the changeset viewer.