Changeset 3a5ee6c in mainline
- Timestamp:
- 2011-09-04T14:08:37Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbd4c72
- Parents:
- c699b0c
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.h
rc699b0c r3a5ee6c 155 155 /*mfs_inode.c*/ 156 156 extern int 157 get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,157 mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i, 158 158 fs_index_t index); 159 159 160 160 extern int 161 put_inode(struct mfs_node *mnode);162 163 extern int 164 inode_shrink(struct mfs_node *mnode, size_t size_shrink);161 mfs_put_inode(struct mfs_node *mnode); 162 163 extern int 164 mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink); 165 165 166 166 /*mfs_rw.c*/ 167 167 extern int 168 read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos);169 170 extern int 171 write_map(struct mfs_node *mnode, uint32_t pos, uint32_t new_zone,168 mfs_read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos); 169 170 extern int 171 mfs_write_map(struct mfs_node *mnode, uint32_t pos, uint32_t new_zone, 172 172 uint32_t *old_zone); 173 173 174 174 extern int 175 prune_ind_zones(struct mfs_node *mnode, size_t new_size);175 mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size); 176 176 177 177 /*mfs_dentry.c*/ 178 178 extern int 179 read_dentry(struct mfs_node *mnode,179 mfs_read_dentry(struct mfs_node *mnode, 180 180 struct mfs_dentry_info *d_info, unsigned index); 181 181 182 182 extern int 183 write_dentry(struct mfs_dentry_info *d_info);184 185 extern int 186 remove_dentry(struct mfs_node *mnode, const char *d_name);187 188 extern int 189 insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum);183 mfs_write_dentry(struct mfs_dentry_info *d_info); 184 185 extern int 186 mfs_remove_dentry(struct mfs_node *mnode, const char *d_name); 187 188 extern int 189 mfs_insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum); 190 190 191 191 /*mfs_balloc.c*/ -
uspace/srv/fs/minixfs/mfs_dentry.c
rc699b0c r3a5ee6c 43 43 */ 44 44 int 45 read_dentry(struct mfs_node *mnode,45 mfs_read_dentry(struct mfs_node *mnode, 46 46 struct mfs_dentry_info *d_info, unsigned index) 47 47 { … … 52 52 block_t *b; 53 53 54 int r = read_map(&block, mnode, index * sbi->dirsize);54 int r = mfs_read_map(&block, mnode, index * sbi->dirsize); 55 55 if (r != EOK) 56 56 goto out_err; … … 104 104 */ 105 105 int 106 write_dentry(struct mfs_dentry_info *d_info)106 mfs_write_dentry(struct mfs_dentry_info *d_info) 107 107 { 108 108 struct mfs_node *mnode = d_info->node; … … 114 114 int r; 115 115 116 r = read_map(&block, mnode, d_off_bytes);116 r = mfs_read_map(&block, mnode, d_off_bytes); 117 117 if (r != EOK) 118 118 goto out; … … 155 155 */ 156 156 int 157 remove_dentry(struct mfs_node *mnode, const char *d_name)157 mfs_remove_dentry(struct mfs_node *mnode, const char *d_name) 158 158 { 159 159 struct mfs_sb_info *sbi = mnode->instance->sbi; … … 169 169 unsigned i; 170 170 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize ; ++i) { 171 r = read_dentry(mnode, &d_info, i);171 r = mfs_read_dentry(mnode, &d_info, i); 172 172 if (r != EOK) 173 173 return r; … … 178 178 !bcmp(d_info.d_name, d_name, name_len)) { 179 179 d_info.d_inum = 0; 180 r = write_dentry(&d_info);180 r = mfs_write_dentry(&d_info); 181 181 return r; 182 182 } … … 195 195 */ 196 196 int 197 insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum)197 mfs_insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum) 198 198 { 199 199 int r; … … 210 210 unsigned i; 211 211 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 212 r = read_dentry(mnode, &d_info, i);212 r = mfs_read_dentry(mnode, &d_info, i); 213 213 if (r != EOK) 214 214 return r; … … 224 224 uint32_t b, pos; 225 225 pos = mnode->ino_i->i_size; 226 r = read_map(&b, mnode, pos);226 r = mfs_read_map(&b, mnode, pos); 227 227 if (r != EOK) 228 228 goto out; … … 235 235 if (r != EOK) 236 236 goto out; 237 r = write_map(mnode, pos, b, &dummy);237 r = mfs_write_map(mnode, pos, b, &dummy); 238 238 if (r != EOK) 239 239 goto out; … … 251 251 d_info.d_name[name_len] = 0; 252 252 253 r = write_dentry(&d_info);253 r = mfs_write_dentry(&d_info); 254 254 out: 255 255 return r; -
uspace/srv/fs/minixfs/mfs_inode.c
rc699b0c r3a5ee6c 50 50 51 51 int 52 get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,52 mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i, 53 53 fs_index_t index) 54 54 { … … 186 186 187 187 int 188 put_inode(struct mfs_node *mnode)188 mfs_put_inode(struct mfs_node *mnode) 189 189 { 190 190 int rc = EOK; … … 300 300 301 301 int 302 inode_shrink(struct mfs_node *mnode, size_t size_shrink)302 mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink) 303 303 { 304 304 struct mfs_sb_info *sbi = mnode->instance->sbi; … … 333 333 uint32_t old_zone; 334 334 335 r = write_map(mnode, pos, 0, &old_zone);335 r = mfs_write_map(mnode, pos, 0, &old_zone); 336 336 if (r != EOK) 337 337 goto exit_error; … … 349 349 ino_i->i_size = new_size; 350 350 351 return prune_ind_zones(mnode, new_size);351 return mfs_prune_ind_zones(mnode, new_size); 352 352 353 353 exit_error: -
uspace/srv/fs/minixfs/mfs_ops.c
rc699b0c r3a5ee6c 183 183 sb = malloc(MFS_SUPERBLOCK_SIZE); 184 184 if (!sb) { 185 free(instance); 186 free(sbi); 185 187 block_fini(service_id); 186 188 return ENOMEM; … … 190 192 rc = block_read_direct(service_id, MFS_SUPERBLOCK << 1, 1, sb); 191 193 if (rc != EOK) { 194 free(instance); 195 free(sbi); 196 free(sb); 192 197 block_fini(service_id); 193 198 return rc; … … 204 209 if (!check_magic_number(sb3->s_magic, &native, &version, &longnames)) { 205 210 mfsdebug("magic number not recognized\n"); 211 free(instance); 212 free(sbi); 213 free(sb); 206 214 block_fini(service_id); 207 215 return ENOTSUP; … … 262 270 rc = block_cache_init(service_id, sbi->block_size, 0, cmode); 263 271 if (rc != EOK) { 272 free(instance); 264 273 free(sbi); 265 free( instance);274 free(sb); 266 275 block_cache_fini(service_id); 267 276 block_fini(service_id); … … 433 442 unsigned i; 434 443 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 435 r = read_dentry(mnode, &d_info, i);444 r = mfs_read_dentry(mnode, &d_info, i); 436 445 if (r != EOK) 437 446 return r; … … 504 513 assert(mnode->instance->open_nodes_cnt > 0); 505 514 mnode->instance->open_nodes_cnt--; 506 rc = put_inode(mnode);515 rc = mfs_put_inode(mnode); 507 516 free(mnode->ino_i); 508 517 free(mnode); … … 586 595 struct mfs_ino_info *ino_i; 587 596 588 rc = get_inode(inst, &ino_i, index);597 rc = mfs_get_inode(inst, &ino_i, index); 589 598 if (rc != EOK) 590 599 goto out_err; … … 645 654 return ENAMETOOLONG; 646 655 647 int r = insert_dentry(parent, name, child->ino_i->index);656 int r = mfs_insert_dentry(parent, name, child->ino_i->index); 648 657 if (r != EOK) 649 658 goto exit_error; 650 659 651 660 if (S_ISDIR(child->ino_i->i_mode)) { 652 r = insert_dentry(child, ".", child->ino_i->index);661 r = mfs_insert_dentry(child, ".", child->ino_i->index); 653 662 if (r != EOK) 654 663 goto exit_error; 655 664 //child->ino_i->i_nlinks++; 656 665 //child->ino_i->dirty = true; 657 r = insert_dentry(child, "..", parent->ino_i->index);666 r = mfs_insert_dentry(child, "..", parent->ino_i->index); 658 667 if (r != EOK) 659 668 goto exit_error; … … 686 695 return ENOTEMPTY; 687 696 688 r = remove_dentry(parent, name);697 r = mfs_remove_dentry(parent, name); 689 698 if (r != EOK) 690 699 return r; … … 722 731 unsigned i; 723 732 for (i = 2; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 724 r = read_dentry(mnode, &d_info, i);733 r = mfs_read_dentry(mnode, &d_info, i); 725 734 if (r != EOK) 726 735 return r; … … 774 783 775 784 for (; pos < mnode->ino_i->i_size / sbi->dirsize; ++pos) { 776 rc = read_dentry(mnode, &d_info, pos);785 rc = mfs_read_dentry(mnode, &d_info, pos); 777 786 if (rc != EOK) 778 787 goto out_error; … … 807 816 block_t *b; 808 817 809 rc = read_map(&zone, mnode, pos);818 rc = mfs_read_map(&zone, mnode, pos); 810 819 if (rc != EOK) 811 820 goto out_error; … … 883 892 884 893 if (pos < boundary) { 885 r = read_map(&block, mnode, pos);894 r = mfs_read_map(&block, mnode, pos); 886 895 if (r != EOK) 887 896 goto out_err; … … 901 910 goto out_err; 902 911 903 r = write_map(mnode, pos, block, &dummy);912 r = mfs_write_map(mnode, pos, block, &dummy); 904 913 if (r != EOK) 905 914 goto out_err; … … 972 981 973 982 /*Free the entire inode content*/ 974 r = inode_shrink(mnode, mnode->ino_i->i_size);983 r = mfs_inode_shrink(mnode, mnode->ino_i->i_size); 975 984 if (r != EOK) 976 985 goto out; … … 1000 1009 r = EOK; 1001 1010 else 1002 r = inode_shrink(mnode, ino_i->i_size - size);1011 r = mfs_inode_shrink(mnode, ino_i->i_size - size); 1003 1012 1004 1013 mfs_node_put(fn); -
uspace/srv/fs/minixfs/mfs_rw.c
rc699b0c r3a5ee6c 56 56 */ 57 57 int 58 read_map(uint32_t *b, const struct mfs_node *mnode, uint32_t pos)58 mfs_read_map(uint32_t *b, const struct mfs_node *mnode, uint32_t pos) 59 59 { 60 60 int r; … … 78 78 79 79 int 80 write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone,80 mfs_write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone, 81 81 uint32_t *old_zone) 82 82 { … … 229 229 /*Free unused indirect zones*/ 230 230 int 231 prune_ind_zones(struct mfs_node *mnode, size_t new_size)231 mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size) 232 232 { 233 233 struct mfs_instance *inst = mnode->instance;
Note:
See TracChangeset
for help on using the changeset viewer.