Changes in uspace/srv/fs/ext2fs/ext2fs_ops.c [f6fece9:1a86c50] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/ext2fs/ext2fs_ops.c
rf6fece9 r1a86c50 245 245 } 246 246 247 // Find length of component in bytes 248 // TODO: check for library function call that does this 247 /* Find length of component in bytes 248 * TODO: check for library function call that does this 249 */ 249 250 component_size = 0; 250 251 while (*(component+component_size) != 0) { … … 253 254 254 255 while (it.current != NULL) { 255 / / ignore empty directory entries256 /* ignore empty directory entries */ 256 257 if (it.current->inode != 0) { 257 258 name_size = ext2_directory_entry_ll_get_name_length(fs->superblock, … … 481 482 } 482 483 483 / / Find a non-empty directory entry484 /* Find a non-empty directory entry */ 484 485 while (it.current != NULL) { 485 486 if (it.current->inode != 0) { … … 717 718 } 718 719 719 / / Remove the instance from list720 /* Remove the instance from the list */ 720 721 fibril_mutex_lock(&instance_list_mutex); 721 722 list_remove(&inst->link); … … 787 788 } 788 789 else { 789 / / Other inode types not supported790 /* Other inode types not supported */ 790 791 async_answer_0(callid, ENOTSUP); 791 792 async_answer_0(rid, ENOTSUP); … … 828 829 } 829 830 830 // Find the index we want to read 831 // Note that we need to iterate and count as 832 // the underlying structure is a linked list 833 // Moreover, we want to skip . and .. entries 834 // as these are not used in HelenOS 831 /* Find the index we want to read 832 * Note that we need to iterate and count as 833 * the underlying structure is a linked list 834 * Moreover, we want to skip . and .. entries 835 * as these are not used in HelenOS 836 */ 835 837 cur = 0; 836 838 while (it.current != NULL) { … … 842 844 inst->filesystem->superblock, it.current); 843 845 844 / / skip . and ..846 /* skip . and .. */ 845 847 if (ext2fs_is_dots(&it.current->name, name_size)) { 846 848 goto skip; 847 849 } 848 850 849 / / Is this the dir entry we want to read?851 /* Is this the dir entry we want to read? */ 850 852 if (cur == pos) { 851 // The on-disk entry does not contain \0 at the end 852 // end of entry name, so we copy it to new buffer 853 // and add the \0 at the end 853 /* The on-disk entry does not contain \0 at the end 854 * end of entry name, so we copy it to new buffer 855 * and add the \0 at the end 856 */ 854 857 buf = malloc(name_size+1); 855 858 if (buf == NULL) { … … 910 913 911 914 if (pos >= file_size) { 912 / / Read 0 bytes successfully915 /* Read 0 bytes successfully */ 913 916 async_data_read_finalize(callid, NULL, 0); 914 917 async_answer_1(rid, EOK, 0); … … 916 919 } 917 920 918 / / For now, we only read data from one block at a time921 /* For now, we only read data from one block at a time */ 919 922 block_size = ext2_superblock_get_block_size(inst->filesystem->superblock); 920 923 file_block = pos / block_size; … … 922 925 bytes = min(block_size - offset_in_block, size); 923 926 924 / / Handle end of file927 /* Handle end of file */ 925 928 if (pos + bytes > file_size) { 926 929 bytes = file_size - pos; 927 930 } 928 931 932 /* Get the real block number */ 929 933 rc = ext2_filesystem_get_inode_data_block_index(inst->filesystem, 930 934 inode_ref->inode, file_block, &fs_block); … … 935 939 } 936 940 937 // Check for sparse file 938 // If ext2_filesystem_get_inode_data_block_index returned 939 // fs_block == 0, it means that the given block is not allocated for the 940 // file and we need to return a buffer of zeros 941 /* Check for sparse file 942 * If ext2_filesystem_get_inode_data_block_index returned 943 * fs_block == 0, it means that the given block is not allocated for the 944 * file and we need to return a buffer of zeros 945 */ 941 946 if (fs_block == 0) { 942 947 buffer = malloc(bytes); … … 957 962 } 958 963 959 / / Usual case - we need to read a block from device964 /* Usual case - we need to read a block from device */ 960 965 rc = block_get(&block, inst->devmap_handle, fs_block, BLOCK_FLAGS_NONE); 961 966 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.