Changeset 44c6091f in mainline
- Timestamp:
- 2011-04-30T12:24:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fdc05ca
- Parents:
- 8a49fed
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.c
r8a49fed r44c6091f 52 52 .name = NAME, 53 53 .concurrent_read_write = false, 54 .write_retains_size = false, 54 .write_retains_size = false, 55 55 }; 56 56 … … 70 70 * phone for more serialized requests. Similarily, MinixFS can refuse to duplicate 71 71 * the connection. VFS should then just make use of already existing phones and 72 * route its requests through them. To avoid paying the fibril creation price 72 * route its requests through them. To avoid paying the fibril creation price 73 73 * upon each request, MinixFS might want to keep the connections open after the 74 74 * request has been completed. … … 85 85 async_answer_0(iid, EOK); 86 86 } 87 87 88 88 printf(NAME ": connection opened\n"); 89 89 while (1) { 90 90 ipc_callid_t callid; 91 91 ipc_call_t call; 92 92 93 93 callid = async_get_call(&call); 94 94 int method = IPC_GET_IMETHOD(call); … … 150 150 if (rc != EOK) 151 151 goto err; 152 152 153 153 printf(NAME ": Accepting connections\n"); 154 154 task_retval(0); … … 164 164 /** 165 165 * @} 166 */ 166 */ 167 167 -
uspace/srv/fs/minixfs/mfs_balloc.c
r8a49fed r44c6091f 37 37 static int 38 38 find_free_bit_and_set(bitchunk_t *b, const int bsize, 39 39 const bool native, unsigned start_bit); 40 40 41 41 int … … 55 55 if (idx > sbi->nzones) { 56 56 printf(NAME ": Error! Trying to free beyond the" \ 57 57 "bitmap max size\n"); 58 58 return -1; 59 59 } … … 63 63 if (idx > sbi->ninodes) { 64 64 printf(NAME ": Error! Trying to free beyond the" \ 65 65 "bitmap max size\n"); 66 66 return -1; 67 67 } … … 124 124 for (i = *search / bits_per_block; i < nblocks; ++i) { 125 125 r = block_get(&b, inst->handle, i + start_block, 126 126 BLOCK_FLAGS_NONE); 127 127 128 128 on_error(r, goto out); … … 168 168 static int 169 169 find_free_bit_and_set(bitchunk_t *b, const int bsize, 170 170 const bool native, unsigned start_bit) 171 171 { 172 172 int r = -1; … … 176 176 177 177 for (i = start_bit / sizeof(uint32_t); 178 178 i < bsize / sizeof(uint32_t); ++i) { 179 179 if (!(~b[i])) { 180 180 /*No free bit in this chunk*/ … … 200 200 /** 201 201 * @} 202 */ 203 202 */ 203 -
uspace/srv/fs/minixfs/mfs_dentry.c
r8a49fed r44c6091f 36 36 int 37 37 read_directory_entry(struct mfs_node *mnode, 38 38 struct mfs_dentry_info **d_info, unsigned index) 39 39 { 40 40 const struct mfs_instance *inst = mnode->instance; … … 76 76 } else { 77 77 const int namelen = longnames ? MFS_L_MAX_NAME_LEN : 78 78 MFS_MAX_NAME_LEN; 79 79 80 80 struct mfs_dentry *d; 81 81 82 82 d = b->data + dentry_off * (longnames ? MFSL_DIRSIZE : 83 83 MFS_DIRSIZE); 84 84 (*d_info)->d_inum = conv16(sbi->native, d->d_inum); 85 85 memcpy((*d_info)->d_name, d->d_name, namelen); … … 202 202 /** 203 203 * @} 204 */ 205 204 */ 205 -
uspace/srv/fs/minixfs/mfs_inode.c
r8a49fed r44c6091f 50 50 int 51 51 get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i, 52 52 fs_index_t index) 53 53 { 54 54 struct mfs_sb_info *sbi = inst->sbi; … … 69 69 70 70 static struct mfs_ino_info * 71 mfs_read_inode_raw(const struct mfs_instance *instance, uint16_t inum) 72 { 71 mfs_read_inode_raw(const struct mfs_instance *instance, uint16_t inum) { 73 72 struct mfs_inode *ino = NULL; 74 73 struct mfs_ino_info *ino_i = NULL; … … 95 94 96 95 if (block_get(&b, instance->handle, 97 98 96 itable_off + inum / sbi->ino_per_block, 97 BLOCK_FLAGS_NONE) != EOK) 99 98 goto out_err; 100 99 … … 128 127 129 128 static struct mfs_ino_info * 130 mfs2_read_inode_raw(const struct mfs_instance *instance, uint32_t inum) 131 { 129 mfs2_read_inode_raw(const struct mfs_instance *instance, uint32_t inum) { 132 130 struct mfs2_inode *ino = NULL; 133 131 struct mfs_ino_info *ino_i = NULL; … … 153 151 const int ino_off = inum % sbi->ino_per_block; 154 152 155 if (block_get(&b, instance->handle, 156 itable_off + inum / sbi->ino_per_block,157 153 if (block_get(&b, instance->handle, 154 itable_off + inum / sbi->ino_per_block, 155 BLOCK_FLAGS_NONE) != EOK) 158 156 goto out_err; 159 157 … … 228 226 229 227 r = block_get(&b, mnode->instance->handle, 230 231 228 itable_off + inum / sbi->ino_per_block, 229 BLOCK_FLAGS_NONE); 232 230 233 231 on_error(r, goto out); … … 268 266 const int ino_off = inum % sbi->ino_per_block; 269 267 const bool native = sbi->native; 270 268 271 269 r = block_get(&b, mnode->instance->handle, 272 273 270 itable_off + inum / sbi->ino_per_block, 271 BLOCK_FLAGS_NONE); 274 272 275 273 on_error(r, goto out); … … 282 280 ino2->i_uid = conv16(native, ino_i->i_uid); 283 281 ino2->i_gid = conv16(native, ino_i->i_gid); 284 ino2->i_size = conv32(native, ino_i->i_size); 282 ino2->i_size = conv32(native, ino_i->i_size); 285 283 ino2->i_atime = conv32(native, ino_i->i_atime); 286 284 ino2->i_mtime = conv32(native, ino_i->i_mtime); … … 389 387 block_t *b; 390 388 r = block_get(&b, mnode->instance->handle, new_zone, 391 389 BLOCK_FLAGS_NOREAD); 392 390 on_error(r, return r); 393 391 … … 397 395 398 396 r = write_map(mnode, (start_zone + i) * bs, 399 397 new_zone, &dummy); 400 398 401 399 on_error(r, return r); … … 413 411 /** 414 412 * @} 415 */ 416 413 */ 414 -
uspace/srv/fs/minixfs/mfs_ops.c
r8a49fed r44c6091f 38 38 39 39 static bool check_magic_number(uint16_t magic, bool *native, 40 40 mfs_version_t *version, bool *longfilenames); 41 41 static int mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst, 42 fs_index_t index);42 fs_index_t index); 43 43 44 44 static int mfs_node_put(fs_node_t *fsnode); … … 85 85 { 86 86 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 87 enum cache_mode cmode; 87 enum cache_mode cmode; 88 88 struct mfs_superblock *sb; 89 89 struct mfs3_superblock *sb3; … … 97 97 char *opts; 98 98 int rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL); 99 99 100 100 if (rc != EOK) { 101 101 mfsdebug("Can't accept async data write\n"); … … 212 212 sbi->dirsize = longnames ? MFSL_DIRSIZE : MFS_DIRSIZE; 213 213 sbi->max_name_len = longnames ? MFS_L_MAX_NAME_LEN : 214 MFS_MAX_NAME_LEN;214 MFS_MAX_NAME_LEN; 215 215 } 216 216 sbi->itable_off = 2 + sbi->ibmap_blocks + sbi->zbmap_blocks; 217 217 218 218 free(sb); 219 219 … … 259 259 fs_node_t *fsnode; 260 260 uint32_t inum; 261 261 262 262 mfsdebug("create_node()\n"); 263 263 … … 287 287 goto out_err_1; 288 288 } 289 289 290 290 fsnode = malloc(sizeof(fs_node_t)); 291 291 if (!fsnode) { … … 365 365 /*Hit!*/ 366 366 mfs_node_core_get(rfn, mnode->instance, 367 d_info->d_inum);367 d_info->d_inum); 368 368 free(d_info); 369 369 goto found; … … 445 445 446 446 static int mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst, 447 fs_index_t index)447 fs_index_t index) 448 448 { 449 449 fs_node_t *node = NULL; … … 546 546 547 547 struct mfs_dentry_info *d_info; 548 548 549 549 /* The first two dentries are always . and .. */ 550 550 int i = 2; … … 586 586 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 587 587 aoff64_t pos = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), 588 IPC_GET_ARG4(*request));588 IPC_GET_ARG4(*request)); 589 589 fs_node_t *fn; 590 590 … … 643 643 found: 644 644 async_data_read_finalize(callid, d_info->d_name, 645 str_size(d_info->d_name) + 1);645 str_size(d_info->d_name) + 1); 646 646 bytes = ((pos - spos) + 1); 647 647 } else { … … 673 673 memset(buf, 0, sizeof(sbi->block_size)); 674 674 async_data_read_finalize(callid, 675 675 buf + pos % sbi->block_size, bytes); 676 676 free(buf); 677 677 goto out_success; … … 682 682 683 683 async_data_read_finalize(callid, b->data + 684 pos % sbi->block_size, bytes);684 pos % sbi->block_size, bytes); 685 685 686 686 rc = block_put(b); … … 695 695 async_answer_1(rid, rc, (sysarg_t)bytes); 696 696 return; 697 out_error: ; 697 out_error: 698 ; 698 699 int tmp = mfs_node_put(fn); 699 700 async_answer_0(callid, tmp != EOK ? tmp : rc); … … 709 710 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 710 711 aoff64_t pos = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), 711 712 IPC_GET_ARG4(*request)); 712 713 713 714 fs_node_t *fn; … … 835 836 for (link = inst_list.next; link != &inst_list; link = link->next) { 836 837 instance_ptr = list_get_instance(link, struct mfs_instance, 837 link);838 838 link); 839 839 840 if (instance_ptr->handle == handle) { 840 841 *instance = instance_ptr; … … 851 852 852 853 static bool check_magic_number(uint16_t magic, bool *native, 853 854 mfs_version_t *version, bool *longfilenames) 854 855 { 855 856 bool rc = true; … … 893 894 /** 894 895 * @} 895 */ 896 896 */ 897 -
uspace/srv/fs/minixfs/mfs_rw.c
r8a49fed r44c6091f 36 36 static int 37 37 rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock, 38 38 bool write_mode, uint32_t w_block); 39 39 40 40 static int … … 79 79 80 80 int 81 write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone, 82 81 write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone, 82 uint32_t *old_zone) 83 83 { 84 84 const struct mfs_sb_info *sbi = mnode->instance->sbi; … … 108 108 static int 109 109 rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock, 110 110 bool write_mode, uint32_t w_block) 111 111 { 112 112 int r, nr_direct; … … 276 276 block_t *b; 277 277 const int max_ind_zone_ptrs = (MFS_MAX_BLOCKSIZE / sizeof(uint16_t)) * 278 sizeof(uint32_t);278 sizeof(uint32_t); 279 279 280 280 *ind_zone = malloc(max_ind_zone_ptrs); … … 301 301 302 302 block_put(b); 303 303 304 304 return EOK; 305 305 } … … 337 337 /** 338 338 * @} 339 */ 340 339 */ 340 -
uspace/srv/fs/minixfs/mfs_utils.c
r8a49fed r44c6091f 61 61 /** 62 62 * @} 63 */ 63 */ 64 64 -
uspace/srv/fs/minixfs/mfs_utils.h
r8a49fed r44c6091f 51 51 /** 52 52 * @} 53 */ 53 */ 54 54
Note:
See TracChangeset
for help on using the changeset viewer.