Changeset c699b0c in mainline
- Timestamp:
- 2011-09-04T13:12:33Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3a5ee6c
- Parents:
- 03bc76a
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.h
r03bc76a rc699b0c 58 58 #endif 59 59 60 #define on_error(r, inst) do { \61 if (r != EOK) inst; \62 }while(0)63 64 60 typedef uint32_t bitchunk_t; 65 61 -
uspace/srv/fs/minixfs/mfs_balloc.c
r03bc76a rc699b0c 151 151 152 152 r = block_get(&b, inst->service_id, block, BLOCK_FLAGS_NONE); 153 on_error(r, goto out_err); 153 if (r != EOK) 154 goto out_err; 154 155 155 156 /*Compute the bit index in the block*/ … … 219 220 BLOCK_FLAGS_NONE); 220 221 221 on_error(r, goto out); 222 if (r != EOK) 223 goto out; 222 224 223 225 unsigned tmp = *search % bits_per_block; … … 228 230 /*No free bit in this block*/ 229 231 r = block_put(b); 230 on_error(r, goto out); 232 if (r != EOK) 233 goto out; 231 234 continue; 232 235 } … … 237 240 /*Index is beyond the limit, it is invalid*/ 238 241 r = block_put(b); 239 on_error(r, goto out); 242 if (r != EOK) 243 goto out; 240 244 break; 241 245 } -
uspace/srv/fs/minixfs/mfs_dentry.c
r03bc76a rc699b0c 53 53 54 54 int r = read_map(&block, mnode, index * sbi->dirsize); 55 on_error(r, goto out_err); 55 if (r != EOK) 56 goto out_err; 56 57 57 58 if (block == 0) { … … 62 63 63 64 r = block_get(&b, inst->service_id, block, BLOCK_FLAGS_NONE); 64 on_error(r, goto out_err); 65 if (r != EOK) 66 goto out_err; 65 67 66 68 unsigned dentries_per_zone = sbi->block_size / sbi->dirsize; … … 113 115 114 116 r = read_map(&block, mnode, d_off_bytes); 115 on_error(r, goto out); 117 if (r != EOK) 118 goto out; 116 119 117 120 r = block_get(&b, mnode->instance->service_id, block, BLOCK_FLAGS_NONE); 118 on_error(r, goto out); 121 if (r != EOK) 122 goto out; 119 123 120 124 const size_t name_len = sbi->max_name_len; … … 166 170 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize ; ++i) { 167 171 r = read_dentry(mnode, &d_info, i); 168 on_error(r, return r); 172 if (r != EOK) 173 return r; 169 174 170 175 const size_t d_name_len = str_size(d_info.d_name); … … 206 211 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 207 212 r = read_dentry(mnode, &d_info, i); 208 on_error(r, return r); 213 if (r != EOK) 214 return r; 209 215 210 216 if (d_info.d_inum == 0) { … … 219 225 pos = mnode->ino_i->i_size; 220 226 r = read_map(&b, mnode, pos); 221 on_error(r, goto out); 227 if (r != EOK) 228 goto out; 222 229 223 230 if (b == 0) { … … 226 233 uint32_t dummy; 227 234 r = mfs_alloc_zone(mnode->instance, &b); 228 on_error(r, goto out); 235 if (r != EOK) 236 goto out; 229 237 r = write_map(mnode, pos, b, &dummy); 230 on_error(r, goto out); 238 if (r != EOK) 239 goto out; 231 240 } 232 241 -
uspace/srv/fs/minixfs/mfs_inode.c
r03bc76a rc699b0c 96 96 itable_off + inum / sbi->ino_per_block, 97 97 BLOCK_FLAGS_NONE); 98 on_error(r, goto out_err); 98 if (r != EOK) 99 goto out_err; 99 100 100 101 ino = b->data + ino_off * sizeof(struct mfs_inode); … … 152 153 itable_off + inum / sbi->ino_per_block, 153 154 BLOCK_FLAGS_NONE); 154 on_error(r, goto out_err); 155 if (r != EOK) 156 goto out_err; 155 157 156 158 ino = b->data + ino_off * sizeof(struct mfs2_inode); … … 225 227 BLOCK_FLAGS_NONE); 226 228 227 on_error(r, goto out); 229 if (r != EOK) 230 goto out; 228 231 229 232 struct mfs_inode *ino = b->data; … … 267 270 BLOCK_FLAGS_NONE); 268 271 269 on_error(r, goto out); 272 if (r != EOK) 273 goto out; 270 274 271 275 struct mfs2_inode *ino2 = b->data; … … 330 334 331 335 r = write_map(mnode, pos, 0, &old_zone); 332 on_error(r, goto exit_error); 336 if (r != EOK) 337 goto exit_error; 333 338 334 339 ino_i->i_size -= bs; … … 338 343 339 344 r = mfs_free_zone(mnode->instance, old_zone); 340 on_error(r, goto exit_error); 345 if (r != EOK) 346 goto exit_error; 341 347 } 342 348 -
uspace/srv/fs/minixfs/mfs_ops.c
r03bc76a rc699b0c 335 335 336 336 r = mfs_instance_get(service_id, &inst); 337 on_error(r, return r); 337 if (r != EOK) 338 return r; 338 339 339 340 /*Alloc a new inode*/ 340 341 r = mfs_alloc_inode(inst, &inum); 341 on_error(r, return r); 342 if (r != EOK) 343 return r; 342 344 343 345 struct mfs_ino_info *ino_i; … … 432 434 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 433 435 r = read_dentry(mnode, &d_info, i); 434 on_error(r, return r); 436 if (r != EOK) 437 return r; 435 438 436 439 if (!d_info.d_inum) { … … 475 478 476 479 rc = mfs_instance_get(service_id, &instance); 477 on_error(rc, return rc); 480 if (rc != EOK) 481 return rc; 478 482 479 483 return mfs_node_core_get(rfn, instance, index); … … 583 587 584 588 rc = get_inode(inst, &ino_i, index); 585 on_error(rc, goto out_err); 589 if (rc != EOK) 590 goto out_err; 586 591 587 592 ino_i->index = index; … … 641 646 642 647 int r = insert_dentry(parent, name, child->ino_i->index); 643 on_error(r, goto exit_error); 648 if (r != EOK) 649 goto exit_error; 644 650 645 651 if (S_ISDIR(child->ino_i->i_mode)) { 646 652 r = insert_dentry(child, ".", child->ino_i->index); 647 on_error(r, goto exit_error); 653 if (r != EOK) 654 goto exit_error; 648 655 //child->ino_i->i_nlinks++; 649 656 //child->ino_i->dirty = true; 650 657 r = insert_dentry(child, "..", parent->ino_i->index); 651 on_error(r, goto exit_error); 658 if (r != EOK) 659 goto exit_error; 652 660 //parent->ino_i->i_nlinks++; 653 661 //parent->ino_i->dirty = true; … … 672 680 673 681 r = mfs_has_children(&has_children, cfn); 674 on_error(r, return r); 682 if (r != EOK) 683 return r; 675 684 676 685 if (has_children) … … 678 687 679 688 r = remove_dentry(parent, name); 680 on_error(r, return r); 689 if (r != EOK) 690 return r; 681 691 682 692 struct mfs_ino_info *chino = child->ino_i; … … 713 723 for (i = 2; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 714 724 r = read_dentry(mnode, &d_info, i); 715 on_error(r, return r); 725 if (r != EOK) 726 return r; 716 727 717 728 if (d_info.d_inum) { … … 764 775 for (; pos < mnode->ino_i->i_size / sbi->dirsize; ++pos) { 765 776 rc = read_dentry(mnode, &d_info, pos); 766 on_error(rc, goto out_error); 777 if (rc != EOK) 778 goto out_error; 767 779 768 780 if (d_info.d_inum) { … … 796 808 797 809 rc = read_map(&zone, mnode, pos); 798 on_error(rc, goto out_error); 810 if (rc != EOK) 811 goto out_error; 799 812 800 813 if (zone == 0) { … … 813 826 814 827 rc = block_get(&b, service_id, zone, BLOCK_FLAGS_NONE); 815 on_error(rc, goto out_error); 828 if (rc != EOK) 829 goto out_error; 816 830 817 831 async_data_read_finalize(callid, b->data + … … 870 884 if (pos < boundary) { 871 885 r = read_map(&block, mnode, pos); 872 on_error(r, goto out_err); 886 if (r != EOK) 887 goto out_err; 873 888 874 889 if (block == 0) { 875 890 /*Writing in a sparse block*/ 876 891 r = mfs_alloc_zone(mnode->instance, &block); 877 on_error(r, goto out_err); 892 if (r != EOK) 893 goto out_err; 878 894 flags = BLOCK_FLAGS_NOREAD; 879 895 } … … 882 898 883 899 r = mfs_alloc_zone(mnode->instance, &block); 884 on_error(r, goto out_err); 900 if (r != EOK) 901 goto out_err; 885 902 886 903 r = write_map(mnode, pos, block, &dummy); 887 on_error(r, goto out_err); 904 if (r != EOK) 905 goto out_err; 888 906 } 889 907 890 908 block_t *b; 891 909 r = block_get(&b, service_id, block, flags); 892 on_error(r, goto out_err); 910 if (r != EOK) 911 goto out_err; 893 912 894 913 async_data_write_finalize(callid, b->data + pos % bs, bytes); … … 941 960 942 961 r = mfs_has_children(&has_children, fn); 943 on_error(r, goto out); 962 if (r != EOK) 963 goto out; 944 964 945 965 assert(!has_children); … … 953 973 /*Free the entire inode content*/ 954 974 r = inode_shrink(mnode, mnode->ino_i->i_size); 955 on_error(r, goto out); 975 if (r != EOK) 976 goto out; 956 977 r = mfs_free_inode(mnode->instance, mnode->ino_i->index); 957 978 -
uspace/srv/fs/minixfs/mfs_rw.c
r03bc76a rc699b0c 135 135 uint32_t zone; 136 136 r = alloc_zone_and_clear(inst, &zone); 137 on_error(r, return r); 137 if (r != EOK) 138 return r; 138 139 139 140 ino_i->i_izone[0] = zone; … … 147 148 148 149 r = read_ind_zone(inst, ino_i->i_izone[0], &ind_zone); 149 on_error(r, return r); 150 if (r != EOK) 151 return r; 150 152 151 153 *b = ind_zone[rblock]; … … 167 169 uint32_t zone; 168 170 r = alloc_zone_and_clear(inst, &zone); 169 on_error(r, return r); 171 if (r != EOK) 172 return r; 170 173 171 174 ino_i->i_izone[1] = zone; … … 179 182 180 183 r = read_ind_zone(inst, ino_i->i_izone[1], &ind_zone); 181 on_error(r, return r); 184 if (r != EOK) 185 return r; 182 186 183 187 /* … … 192 196 uint32_t zone; 193 197 r = alloc_zone_and_clear(inst, &zone); 194 on_error(r, goto out_free_ind1); 198 if (r != EOK) 199 goto out_free_ind1; 195 200 196 201 ind_zone[ind2_off] = zone; … … 205 210 206 211 r = read_ind_zone(inst, ind_zone[ind2_off], &ind2_zone); 207 on_error(r, goto out_free_ind1); 212 if (r != EOK) 213 goto out_free_ind1; 208 214 209 215 *b = ind2_zone[ind2_off % ptrs_per_block]; … … 247 253 if (ino_i->i_izone[0]) { 248 254 r = mfs_free_zone(inst, ino_i->i_izone[0]); 249 on_error(r, return r); 255 if (r != EOK) 256 return r; 250 257 251 258 ino_i->i_izone[0] = 0; … … 270 277 271 278 r = read_ind_zone(inst, ino_i->i_izone[1], &dbl_zone); 272 on_error(r, return r); 279 if (r != EOK) 280 return r; 273 281 274 282 for (i = fzone_to_free; i < ptrs_per_block; ++i) { … … 277 285 278 286 r = mfs_free_zone(inst, dbl_zone[i]); 279 on_error(r, goto out); 287 if (r != EOK) 288 goto out; 280 289 } 281 290 … … 297 306 298 307 r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NOREAD); 299 on_error(r, return r); 308 if (r != EOK) 309 return r; 300 310 301 311 memset(b->data, 0, b->size); … … 311 321 312 322 r = mfs_alloc_zone(inst, zone); 313 on_error(r, return r); 323 if (r != EOK) 324 return r; 314 325 315 326 r = reset_zone_content(inst, *zone); … … 361 372 362 373 r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NONE); 363 on_error(r, return r); 374 if (r != EOK) 375 return r; 364 376 365 377 if (sbi->fs_version == MFS_VERSION_V1) {
Note:
See TracChangeset
for help on using the changeset viewer.