Changeset 70ac0af in mainline
- Timestamp:
- 2011-07-06T19:26:06Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e80c2ff
- Parents:
- efa5fa1
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.h
refa5fa1 r70ac0af 221 221 /*mfs_balloc.c*/ 222 222 extern int 223 mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid); 224 225 extern int 226 mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid); 223 mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum); 224 225 extern int 226 mfs_free_inode(struct mfs_instance *inst, uint32_t inum); 227 228 extern int 229 mfs_alloc_zone(struct mfs_instance *inst, uint32_t *zone); 230 231 extern int 232 mfs_free_zone(struct mfs_instance *inst, uint32_t zone); 227 233 228 234 #endif -
uspace/srv/fs/minixfs/mfs_balloc.c
refa5fa1 r70ac0af 39 39 const bool native, unsigned start_bit); 40 40 41 int 41 static int 42 mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid); 43 44 static int 45 mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid); 46 47 48 int 49 mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum) 50 { 51 return mfs_alloc_bit(inst, inum, BMAP_INODE); 52 } 53 54 int 55 mfs_free_inode(struct mfs_instance *inst, uint32_t inum) 56 { 57 return mfs_free_bit(inst, inum, BMAP_INODE); 58 } 59 60 int 61 mfs_alloc_zone(struct mfs_instance *inst, uint32_t *zone) 62 { 63 int r = mfs_alloc_bit(inst, zone, BMAP_ZONE); 64 65 *zone += inst->sbi->firstdatazone; 66 return r; 67 } 68 69 int 70 mfs_free_zone(struct mfs_instance *inst, uint32_t zone) 71 { 72 zone -= inst->sbi->firstdatazone; 73 74 return mfs_free_bit(inst, zone, BMAP_ZONE); 75 } 76 77 static int 42 78 mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid) 43 79 { … … 52 88 53 89 if (bid == BMAP_ZONE) { 54 idx -= sbi->firstdatazone;55 90 start_block = 2 + sbi->ibmap_blocks; 56 91 if (idx > sbi->nzones) { … … 92 127 } 93 128 94 int129 static int 95 130 mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid) 96 131 { … … 152 187 153 188 *search = *idx; 154 155 if (bid == BMAP_ZONE)156 *idx += sbi->firstdatazone;157 158 189 b->dirty = true; 159 190 r = block_put(b); -
uspace/srv/fs/minixfs/mfs_inode.c
refa5fa1 r70ac0af 338 338 continue; /*Sparse block*/ 339 339 340 r = mfs_free_ bit(mnode->instance, old_zone, BMAP_ZONE);340 r = mfs_free_zone(mnode->instance, old_zone); 341 341 on_error(r, goto exit_error); 342 342 } … … 379 379 uint32_t dummy; 380 380 381 r = mfs_alloc_ bit(mnode->instance, &new_zone, BMAP_ZONE);381 r = mfs_alloc_zone(mnode->instance, &new_zone); 382 382 on_error(r, return r); 383 383 -
uspace/srv/fs/minixfs/mfs_ops.c
refa5fa1 r70ac0af 268 268 269 269 /*Alloc a new inode*/ 270 r = mfs_alloc_ bit(inst, &inum, BMAP_INODE);270 r = mfs_alloc_inode(inst, &inum); 271 271 on_error(r, return r); 272 272 … … 769 769 if (block == 0) { 770 770 /*Writing in a sparse block*/ 771 r = mfs_alloc_ bit(mnode->instance, &block, BMAP_ZONE);771 r = mfs_alloc_zone(mnode->instance, &block); 772 772 on_error(r, goto out_err); 773 773 flags = BLOCK_FLAGS_NOREAD; … … 776 776 uint32_t dummy; 777 777 778 r = mfs_alloc_ bit(mnode->instance, &block, BMAP_ZONE);778 r = mfs_alloc_zone(mnode->instance, &block); 779 779 on_error(r, goto out_err); 780 780 … … 849 849 r = inode_shrink(mnode, mnode->ino_i->i_size); 850 850 on_error(r, return r); 851 r = mfs_free_ bit(mnode->instance, mnode->ino_i->index, BMAP_INODE);851 r = mfs_free_inode(mnode->instance, mnode->ino_i->index); 852 852 on_error(r, return r); 853 853 -
uspace/srv/fs/minixfs/mfs_rw.c
refa5fa1 r70ac0af 100 100 101 101 if (old_zone > 0) 102 r = mfs_free_ bit(mnode->instance, old_zone, BMAP_ZONE);102 r = mfs_free_zone(mnode->instance, old_zone); 103 103 104 104 return r; … … 256 256 /*free the single indirect zone*/ 257 257 if (ino_i->i_izone[0]) { 258 r = mfs_free_ bit(inst, ino_i->i_izone[0], BMAP_ZONE);258 r = mfs_free_zone(inst, ino_i->i_izone[0]); 259 259 on_error(r, return r); 260 260 … … 286 286 continue; 287 287 288 r = mfs_free_ bit(inst, dbl_zone[i], BMAP_ZONE);288 r = mfs_free_zone(inst, dbl_zone[i]); 289 289 on_error(r, return r); 290 290 } 291 291 292 292 if (fzone_to_free == 0) { 293 r = mfs_free_ bit(inst, ino_i->i_izone[1], BMAP_ZONE);293 r = mfs_free_zone(inst, ino_i->i_izone[1]); 294 294 ino_i->i_izone[1] = 0; 295 295 ino_i->dirty = true; … … 321 321 int r; 322 322 323 r = mfs_alloc_ bit(inst, zone, BMAP_ZONE);323 r = mfs_alloc_zone(inst, zone); 324 324 on_error(r, return r); 325 325
Note:
See TracChangeset
for help on using the changeset viewer.