Changeset a46e56b in mainline for uspace/lib/ext4/src/ops.c


Ignore:
Timestamp:
2018-03-22T06:49:35Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77f0a1d
Parents:
3e242d2
git-author:
Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
git-committer:
Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
Message:

Prefer handle over ID in naming handle variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/src/ops.c

    r3e242d2 ra46e56b  
    10211021         * Receive the read request.
    10221022         */
    1023         cap_call_handle_t callid;
     1023        cap_call_handle_t chandle;
    10241024        size_t size;
    1025         if (!async_data_read_receive(&callid, &size)) {
    1026                 async_answer_0(callid, EINVAL);
     1025        if (!async_data_read_receive(&chandle, &size)) {
     1026                async_answer_0(chandle, EINVAL);
    10271027                return EINVAL;
    10281028        }
     
    10311031        errno_t rc = ext4_instance_get(service_id, &inst);
    10321032        if (rc != EOK) {
    1033                 async_answer_0(callid, rc);
     1033                async_answer_0(chandle, rc);
    10341034                return rc;
    10351035        }
     
    10391039        rc = ext4_filesystem_get_inode_ref(inst->filesystem, index, &inode_ref);
    10401040        if (rc != EOK) {
    1041                 async_answer_0(callid, rc);
     1041                async_answer_0(chandle, rc);
    10421042                return rc;
    10431043        }
     
    10461046        if (ext4_inode_is_type(inst->filesystem->superblock, inode_ref->inode,
    10471047            EXT4_INODE_MODE_FILE)) {
    1048                 rc = ext4_read_file(callid, pos, size, inst, inode_ref,
     1048                rc = ext4_read_file(chandle, pos, size, inst, inode_ref,
    10491049                    rbytes);
    10501050        } else if (ext4_inode_is_type(inst->filesystem->superblock,
    10511051            inode_ref->inode, EXT4_INODE_MODE_DIRECTORY)) {
    1052                 rc = ext4_read_directory(callid, pos, size, inst, inode_ref,
     1052                rc = ext4_read_directory(chandle, pos, size, inst, inode_ref,
    10531053                    rbytes);
    10541054        } else {
    10551055                /* Other inode types not supported */
    1056                 async_answer_0(callid, ENOTSUP);
     1056                async_answer_0(chandle, ENOTSUP);
    10571057                rc = ENOTSUP;
    10581058        }
     
    10841084/** Read data from directory.
    10851085 *
    1086  * @param callid    IPC id of call (for communication)
     1086 * @param chandle    IPC id of call (for communication)
    10871087 * @param pos       Position to start reading from
    10881088 * @param size      How many bytes to read
     
    10941094 *
    10951095 */
    1096 errno_t ext4_read_directory(cap_call_handle_t callid, aoff64_t pos, size_t size,
     1096errno_t ext4_read_directory(cap_call_handle_t chandle, aoff64_t pos, size_t size,
    10971097    ext4_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
    10981098{
     
    11001100        errno_t rc = ext4_directory_iterator_init(&it, inode_ref, pos);
    11011101        if (rc != EOK) {
    1102                 async_answer_0(callid, rc);
     1102                async_answer_0(chandle, rc);
    11031103                return rc;
    11041104        }
     
    11291129                if (buf == NULL) {
    11301130                        ext4_directory_iterator_fini(&it);
    1131                         async_answer_0(callid, ENOMEM);
     1131                        async_answer_0(chandle, ENOMEM);
    11321132                        return ENOMEM;
    11331133                }
     
    11371137                found = true;
    11381138
    1139                 (void) async_data_read_finalize(callid, buf, name_size + 1);
     1139                (void) async_data_read_finalize(chandle, buf, name_size + 1);
    11401140                free(buf);
    11411141                break;
     
    11451145                if (rc != EOK) {
    11461146                        ext4_directory_iterator_fini(&it);
    1147                         async_answer_0(callid, rc);
     1147                        async_answer_0(chandle, rc);
    11481148                        return rc;
    11491149                }
     
    11681168                return EOK;
    11691169        } else {
    1170                 async_answer_0(callid, ENOENT);
     1170                async_answer_0(chandle, ENOENT);
    11711171                return ENOENT;
    11721172        }
     
    11751175/** Read data from file.
    11761176 *
    1177  * @param callid    IPC id of call (for communication)
     1177 * @param chandle    IPC id of call (for communication)
    11781178 * @param pos       Position to start reading from
    11791179 * @param size      How many bytes to read
     
    11851185 *
    11861186 */
    1187 errno_t ext4_read_file(cap_call_handle_t callid, aoff64_t pos, size_t size,
     1187errno_t ext4_read_file(cap_call_handle_t chandle, aoff64_t pos, size_t size,
    11881188    ext4_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
    11891189{
     
    11931193        if (pos >= file_size) {
    11941194                /* Read 0 bytes successfully */
    1195                 async_data_read_finalize(callid, NULL, 0);
     1195                async_data_read_finalize(chandle, NULL, 0);
    11961196                *rbytes = 0;
    11971197                return EOK;
     
    12131213            file_block, &fs_block);
    12141214        if (rc != EOK) {
    1215                 async_answer_0(callid, rc);
     1215                async_answer_0(chandle, rc);
    12161216                return rc;
    12171217        }
     
    12271227                buffer = malloc(bytes);
    12281228                if (buffer == NULL) {
    1229                         async_answer_0(callid, ENOMEM);
     1229                        async_answer_0(chandle, ENOMEM);
    12301230                        return ENOMEM;
    12311231                }
     
    12331233                memset(buffer, 0, bytes);
    12341234
    1235                 rc = async_data_read_finalize(callid, buffer, bytes);
     1235                rc = async_data_read_finalize(chandle, buffer, bytes);
    12361236                *rbytes = bytes;
    12371237
     
    12441244        rc = block_get(&block, inst->service_id, fs_block, BLOCK_FLAGS_NONE);
    12451245        if (rc != EOK) {
    1246                 async_answer_0(callid, rc);
     1246                async_answer_0(chandle, rc);
    12471247                return rc;
    12481248        }
    12491249
    12501250        assert(offset_in_block + bytes <= block_size);
    1251         rc = async_data_read_finalize(callid, block->data + offset_in_block, bytes);
     1251        rc = async_data_read_finalize(chandle, block->data + offset_in_block, bytes);
    12521252        if (rc != EOK) {
    12531253                block_put(block);
     
    12831283                return rc;
    12841284
    1285         cap_call_handle_t callid;
     1285        cap_call_handle_t chandle;
    12861286        size_t len;
    1287         if (!async_data_write_receive(&callid, &len)) {
     1287        if (!async_data_write_receive(&chandle, &len)) {
    12881288                rc = EINVAL;
    1289                 async_answer_0(callid, rc);
     1289                async_answer_0(chandle, rc);
    12901290                goto exit;
    12911291        }
     
    13111311            &fblock);
    13121312        if (rc != EOK) {
    1313                 async_answer_0(callid, rc);
     1313                async_answer_0(chandle, rc);
    13141314                goto exit;
    13151315        }
     
    13281328                                    &fblock, true);
    13291329                                if (rc != EOK) {
    1330                                         async_answer_0(callid, rc);
     1330                                        async_answer_0(chandle, rc);
    13311331                                        goto exit;
    13321332                                }
     
    13361336                            &fblock, false);
    13371337                        if (rc != EOK) {
    1338                                 async_answer_0(callid, rc);
     1338                                async_answer_0(chandle, rc);
    13391339                                goto exit;
    13401340                        }
     
    13421342                        rc = ext4_balloc_alloc_block(inode_ref, &fblock);
    13431343                        if (rc != EOK) {
    1344                                 async_answer_0(callid, rc);
     1344                                async_answer_0(chandle, rc);
    13451345                                goto exit;
    13461346                        }
     
    13501350                        if (rc != EOK) {
    13511351                                ext4_balloc_free_block(inode_ref, fblock);
    1352                                 async_answer_0(callid, rc);
     1352                                async_answer_0(chandle, rc);
    13531353                                goto exit;
    13541354                        }
     
    13631363        rc = block_get(&write_block, service_id, fblock, flags);
    13641364        if (rc != EOK) {
    1365                 async_answer_0(callid, rc);
     1365                async_answer_0(chandle, rc);
    13661366                goto exit;
    13671367        }
     
    13701370                memset(write_block->data, 0, block_size);
    13711371
    1372         rc = async_data_write_finalize(callid, write_block->data +
     1372        rc = async_data_write_finalize(chandle, write_block->data +
    13731373            (pos % block_size), bytes);
    13741374        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.