Changeset 038b289 in mainline
- Timestamp:
- 2011-09-06T23:34:35Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 888207c9, c05642d, c0e53ff
- Parents:
- 7e9fce6 (diff), fb7e5a9a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 2 edited
- 11 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r7e9fce6 r038b289 102 102 $(USPACE_PATH)/srv/fs/tmpfs/tmpfs \ 103 103 $(USPACE_PATH)/srv/fs/fat/fat \ 104 $(USPACE_PATH)/srv/fs/mfs/mfs \ 104 105 $(USPACE_PATH)/srv/fs/cdfs/cdfs \ 105 $(USPACE_PATH)/srv/fs/minixfs/mfs \106 106 $(USPACE_PATH)/srv/fs/exfat/exfat \ 107 107 $(USPACE_PATH)/srv/fs/ext2fs/ext2fs \ … … 156 156 $(USPACE_PATH)/app/locinfo/locinfo \ 157 157 $(USPACE_PATH)/app/mkfat/mkfat \ 158 $(USPACE_PATH)/app/mkm inix/mkminix\158 $(USPACE_PATH)/app/mkmfs/mkmfs \ 159 159 $(USPACE_PATH)/app/lsusb/lsusb \ 160 160 $(USPACE_PATH)/app/sbi/sbi \ -
uspace/Makefile
r7e9fce6 r038b289 48 48 app/lsusb \ 49 49 app/mkfat \ 50 app/mkm inix\50 app/mkmfs \ 51 51 app/redir \ 52 52 app/sbi \ … … 84 84 srv/fs/cdfs \ 85 85 srv/fs/tmpfs \ 86 srv/fs/m inixfs \86 srv/fs/mfs \ 87 87 srv/fs/locfs \ 88 88 srv/fs/ext2fs \ -
uspace/app/mkmfs/Makefile
r7e9fce6 r038b289 31 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 32 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBMINIX_PREFIX) 33 BINARY = mkm inix33 BINARY = mkmfs 34 34 35 35 SOURCES = \ 36 mkm inix.c36 mkmfs.c 37 37 38 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/mkmfs/mkmfs.c
r7e9fce6 r038b289 33 33 34 34 /** 35 * @file mkm inix.c35 * @file mkmfs.c 36 36 * @brief Tool for creating new Minix file systems. 37 37 * … … 51 51 #include <minix.h> 52 52 53 #define NAME "mkm inix"53 #define NAME "mkmfs" 54 54 55 55 #define FREE 0 … … 83 83 }; 84 84 85 static void help_cmd_mkm inix(help_level_t level);85 static void help_cmd_mkmfs(help_level_t level); 86 86 static int num_of_set_bits(uint32_t n); 87 87 static int init_superblock(struct mfs_sb_info *sb); … … 130 130 131 131 if (argc == 1) { 132 help_cmd_mkm inix(HELP_SHORT);133 printf("Incorrect number of arguments, try `mkm inix--help'\n");132 help_cmd_mkmfs(HELP_SHORT); 133 printf("Incorrect number of arguments, try `mkmfs --help'\n"); 134 134 exit(0); 135 135 } … … 139 139 switch (c) { 140 140 case 'h': 141 help_cmd_mkm inix(HELP_LONG);141 help_cmd_mkmfs(HELP_LONG); 142 142 exit(0); 143 143 case '1': … … 197 197 198 198 if (!device_name) { 199 help_cmd_mkm inix(HELP_LONG);199 help_cmd_mkmfs(HELP_LONG); 200 200 exit(0); 201 201 } … … 705 705 } 706 706 707 static void help_cmd_mkm inix(help_level_t level)707 static void help_cmd_mkmfs(help_level_t level) 708 708 { 709 709 if (level == HELP_SHORT) { -
uspace/srv/fs/mfs/mfs_balloc.c
r7e9fce6 r038b289 56 56 { 57 57 int r = mfs_alloc_bit(inst, inum, BMAP_INODE); 58 59 *inum += 1;60 58 return r; 61 59 } … … 71 69 mfs_free_inode(struct mfs_instance *inst, uint32_t inum) 72 70 { 73 return mfs_free_bit(inst, inum - 1, BMAP_INODE);71 return mfs_free_bit(inst, inum, BMAP_INODE); 74 72 } 75 73 … … 202 200 start_block = 2 + sbi->ibmap_blocks; 203 201 nblocks = sbi->zbmap_blocks; 204 limit = sbi->nzones ;202 limit = sbi->nzones - sbi->firstdatazone - 1; 205 203 } else { 206 204 /*bid == BMAP_INODE*/ -
uspace/srv/fs/mfs/mfs_rw.c
r7e9fce6 r038b289 83 83 const struct mfs_sb_info *sbi = mnode->instance->sbi; 84 84 85 if (pos >= sbi->max_file_size) { 86 /*Can't write beyond the maximum file size*/ 87 return EINVAL; 88 } 89 85 90 /*Compute the relative block number in file*/ 86 91 int rblock = pos / sbi->block_size; … … 97 102 uint32_t *ind_zone, *ind2_zone; 98 103 99 assert(mnode);100 104 struct mfs_ino_info *ino_i = mnode->ino_i; 101 102 assert(ino_i);103 assert(mnode->instance);104 105 105 struct mfs_instance *inst = mnode->instance; 106 106 struct mfs_sb_info *sbi = inst->sbi; 107 assert(sbi);108 107 109 108 const mfs_version_t fs_version = sbi->fs_version; 109 const bool deleting = write_mode && (w_block == 0); 110 110 111 111 if (fs_version == MFS_VERSION_V1) { … … 132 132 /*The wanted block is in the single indirect zone chain*/ 133 133 if (ino_i->i_izone[0] == 0) { 134 if (write_mode ) {134 if (write_mode && !deleting) { 135 135 uint32_t zone; 136 136 r = alloc_zone_and_clear(inst, &zone); … … 166 166 /*read the first indirect zone of the chain*/ 167 167 if (ino_i->i_izone[1] == 0) { 168 if (write_mode ) {168 if (write_mode && !deleting) { 169 169 uint32_t zone; 170 170 r = alloc_zone_and_clear(inst, &zone); … … 193 193 /*read the second indirect zone of the chain*/ 194 194 if (ind_zone[ind2_off] == 0) { 195 if (write_mode ) {195 if (write_mode && !deleting) { 196 196 uint32_t zone; 197 197 r = alloc_zone_and_clear(inst, &zone); … … 213 213 goto out_free_ind1; 214 214 215 *b = ind2_zone[ ind2_off % ptrs_per_block];215 *b = ind2_zone[rblock - (ind2_off * ptrs_per_block)]; 216 216 if (write_mode) { 217 ind2_zone[ ind2_off % ptrs_per_block] = w_block;217 ind2_zone[rblock - (ind2_off * ptrs_per_block)] = w_block; 218 218 write_ind_zone(inst, ind_zone[ind2_off], ind2_zone); 219 219 } … … 371 371 block_t *b; 372 372 373 r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NO NE);373 r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NOREAD); 374 374 if (r != EOK) 375 375 return r;
Note:
See TracChangeset
for help on using the changeset viewer.