Changeset a46e56b in mainline for uspace/lib/drv/generic/remote_ahci.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/drv/generic/remote_ahci.c

    r3e242d2 ra46e56b  
    210210
    211211void remote_ahci_get_sata_device_name(ddf_fun_t *fun, void *iface,
    212     cap_call_handle_t callid, ipc_call_t *call)
     212    cap_call_handle_t chandle, ipc_call_t *call)
    213213{
    214214        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    215215
    216216        if (ahci_iface->get_sata_device_name == NULL) {
    217                 async_answer_0(callid, ENOTSUP);
     217                async_answer_0(chandle, ENOTSUP);
    218218                return;
    219219        }
     
    224224        char* sata_dev_name = malloc(sata_dev_name_length);
    225225        if (sata_dev_name == NULL) {
    226                 async_answer_0(callid, ENOMEM);
     226                async_answer_0(chandle, ENOMEM);
    227227                return;
    228228        }
     
    232232
    233233        size_t real_size;
    234         cap_call_handle_t cid;
    235         if ((async_data_read_receive(&cid, &real_size)) &&
     234        cap_call_handle_t call_handle;
     235        if ((async_data_read_receive(&call_handle, &real_size)) &&
    236236            (real_size == sata_dev_name_length))
    237                 async_data_read_finalize(cid, sata_dev_name, sata_dev_name_length);
     237                async_data_read_finalize(call_handle, sata_dev_name,
     238                    sata_dev_name_length);
    238239
    239240        free(sata_dev_name);
    240         async_answer_0(callid, ret);
     241        async_answer_0(chandle, ret);
    241242}
    242243
    243244static void remote_ahci_get_num_blocks(ddf_fun_t *fun, void *iface,
    244     cap_call_handle_t callid, ipc_call_t *call)
     245    cap_call_handle_t chandle, ipc_call_t *call)
    245246{
    246247        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    247248
    248249        if (ahci_iface->get_num_blocks == NULL) {
    249                 async_answer_0(callid, ENOTSUP);
     250                async_answer_0(chandle, ENOTSUP);
    250251                return;
    251252        }
     
    255256
    256257        if (ret != EOK)
    257                 async_answer_0(callid, ret);
     258                async_answer_0(chandle, ret);
    258259        else
    259                 async_answer_2(callid, EOK, HI(blocks), LO(blocks));
     260                async_answer_2(chandle, EOK, HI(blocks), LO(blocks));
    260261}
    261262
    262263static void remote_ahci_get_block_size(ddf_fun_t *fun, void *iface,
    263     cap_call_handle_t callid, ipc_call_t *call)
     264    cap_call_handle_t chandle, ipc_call_t *call)
    264265{
    265266        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    266267
    267268        if (ahci_iface->get_block_size == NULL) {
    268                 async_answer_0(callid, ENOTSUP);
     269                async_answer_0(chandle, ENOTSUP);
    269270                return;
    270271        }
     
    274275
    275276        if (ret != EOK)
    276                 async_answer_0(callid, ret);
     277                async_answer_0(chandle, ret);
    277278        else
    278                 async_answer_1(callid, EOK, blocks);
     279                async_answer_1(chandle, EOK, blocks);
    279280}
    280281
    281282void remote_ahci_read_blocks(ddf_fun_t *fun, void *iface,
    282     cap_call_handle_t callid, ipc_call_t *call)
     283    cap_call_handle_t chandle, ipc_call_t *call)
    283284{
    284285        const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
    285286
    286287        if (ahci_iface->read_blocks == NULL) {
    287                 async_answer_0(callid, ENOTSUP);
     288                async_answer_0(chandle, ENOTSUP);
    288289                return;
    289290        }
     
    292293        unsigned int flags;
    293294
    294         cap_call_handle_t cid;
    295         async_share_out_receive(&cid, &maxblock_size, &flags);
     295        cap_call_handle_t call_handle;
     296        async_share_out_receive(&call_handle, &maxblock_size, &flags);
    296297
    297298        void *buf;
    298         async_share_out_finalize(cid, &buf);
     299        async_share_out_finalize(call_handle, &buf);
    299300
    300301        const uint64_t blocknum =
     
    305306        const errno_t ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
    306307
    307         async_answer_0(callid, ret);
    308 }
    309 
    310 void remote_ahci_write_blocks(ddf_fun_t *fun, void *iface, cap_call_handle_t callid,
     308        async_answer_0(chandle, ret);
     309}
     310
     311void remote_ahci_write_blocks(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle,
    311312    ipc_call_t *call)
    312313{
     
    314315
    315316        if (ahci_iface->read_blocks == NULL) {
    316                 async_answer_0(callid, ENOTSUP);
     317                async_answer_0(chandle, ENOTSUP);
    317318                return;
    318319        }
     
    321322        unsigned int flags;
    322323
    323         cap_call_handle_t cid;
    324         async_share_out_receive(&cid, &maxblock_size, &flags);
     324        cap_call_handle_t call_handle;
     325        async_share_out_receive(&call_handle, &maxblock_size, &flags);
    325326
    326327        void *buf;
    327         async_share_out_finalize(cid, &buf);
     328        async_share_out_finalize(call_handle, &buf);
    328329
    329330        const uint64_t blocknum =
     
    334335        const errno_t ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
    335336
    336         async_answer_0(callid, ret);
     337        async_answer_0(chandle, ret);
    337338}
    338339
Note: See TracChangeset for help on using the changeset viewer.