Changeset fd282ad in mainline
- Timestamp:
- 2011-03-08T18:10:20Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c64506b
- Parents:
- 3c616f6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkminix/mkminix.c
r3c616f6 rfd282ad 48 48 #include <getopt.h> 49 49 #include <mem.h> 50 #include <str.h> 50 51 #include <minix.h> 51 52 … … 56 57 57 58 #define UPPER(n, size) (((n) / (size)) + (((n) % (size)) != 0)) 59 #define NEXT_DENTRY(p, dirsize) (p += dirsize) 58 60 59 61 typedef enum { … … 75 77 int log2_zone_size; 76 78 int ino_per_block; 79 int dirsize; 77 80 uint32_t max_file_size; 78 81 uint16_t magic; … … 92 95 static void make_root_ino3(struct mfs_sb_info *sb); 93 96 static void mark_bmap(uint32_t *bmap, int idx, int v); 97 static void insert_dentries(struct mfs_sb_info *sb); 94 98 95 99 static struct option const long_options[] = { … … 137 141 sb.fs_version = 1; 138 142 sb.ino_per_block = V1_INODES_PER_BLOCK; 143 sb.dirsize = MFS_DIRSIZE; 139 144 break; 140 145 case '2': … … 143 148 sb.fs_version = 2; 144 149 sb.ino_per_block = V2_INODES_PER_BLOCK; 150 sb.dirsize = MFS_DIRSIZE; 145 151 break; 146 152 case '3': … … 148 154 sb.fs_version = 3; 149 155 sb.block_size = MFS_MAX_BLOCKSIZE; 156 sb.dirsize = MFS3_DIRSIZE; 150 157 break; 151 158 case 'b': … … 157 164 case 'l': 158 165 sb.longnames = true; 166 sb.dirsize = MFSL_DIRSIZE; 159 167 break; 160 168 } … … 232 240 init_inode_table(&sb); 233 241 242 /*Insert directory entries . and ..*/ 243 insert_dentries(&sb); 244 234 245 return 0; 246 } 247 248 static void insert_dentries(struct mfs_sb_info *sb) 249 { 250 void *root_block; 251 const long root_dblock = sb->first_data_zone * (sb->block_size / MFS_MIN_BLOCKSIZE); 252 253 root_block = (void *) malloc(MFS_MIN_BLOCKSIZE); 254 255 if (sb->fs_version != 3) { 256 /*Directories entry for V1/V2 filesystem*/ 257 struct mfs_dentry *dentry = root_block; 258 259 dentry->d_inum = MFS_ROOT_INO; 260 str_cpy(dentry->d_name, 1, "."); 261 262 NEXT_DENTRY(dentry, sb->dirsize); 263 264 dentry->d_inum = MFS_ROOT_INO; 265 str_cpy(dentry->d_name, 2, ".."); 266 } else { 267 /*Directories entry for V1/V2 filesystem*/ 268 struct mfs3_dentry *dentry = root_block; 269 270 dentry->d_inum = MFS_ROOT_INO; 271 str_cpy(dentry->d_name, 1, "."); 272 273 NEXT_DENTRY(dentry, sb->dirsize); 274 275 dentry->d_inum = MFS_ROOT_INO; 276 str_cpy(dentry->d_name, 2, ".."); 277 } 278 279 block_write_direct(sb->handle, root_dblock, 1, root_block); 280 281 free(root_block); 235 282 } 236 283
Note:
See TracChangeset
for help on using the changeset viewer.