Changeset 984a9ba in mainline for uspace/srv/fs/locfs/locfs_ops.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (7 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/locfs/locfs_ops.c

    r76f566d r984a9ba  
    478478{
    479479        if (index == 0) {
    480                 cap_call_handle_t chandle;
     480                ipc_call_t call;
    481481                size_t size;
    482                 if (!async_data_read_receive(&chandle, &size)) {
    483                         async_answer_0(chandle, EINVAL);
     482                if (!async_data_read_receive(&call, &size)) {
     483                        async_answer_0(&call, EINVAL);
    484484                        return EINVAL;
    485485                }
     
    500500
    501501                if (pos < count) {
    502                         async_data_read_finalize(chandle, desc[pos].name, str_size(desc[pos].name) + 1);
     502                        async_data_read_finalize(&call, desc[pos].name, str_size(desc[pos].name) + 1);
    503503                        free(desc);
    504504                        *rbytes = 1;
     
    515515
    516516                        if (pos < count) {
    517                                 async_data_read_finalize(chandle, desc[pos].name, str_size(desc[pos].name) + 1);
     517                                async_data_read_finalize(&call, desc[pos].name, str_size(desc[pos].name) + 1);
    518518                                free(desc);
    519519                                *rbytes = 1;
     
    524524                }
    525525
    526                 async_answer_0(chandle, ENOENT);
     526                async_answer_0(&call, ENOENT);
    527527                return ENOENT;
    528528        }
     
    532532        if (type == LOC_OBJECT_NAMESPACE) {
    533533                /* Namespace directory */
    534                 cap_call_handle_t chandle;
     534                ipc_call_t call;
    535535                size_t size;
    536                 if (!async_data_read_receive(&chandle, &size)) {
    537                         async_answer_0(chandle, EINVAL);
     536                if (!async_data_read_receive(&call, &size)) {
     537                        async_answer_0(&call, EINVAL);
    538538                        return EINVAL;
    539539                }
     
    543543
    544544                if (pos < count) {
    545                         async_data_read_finalize(chandle, desc[pos].name, str_size(desc[pos].name) + 1);
     545                        async_data_read_finalize(&call, desc[pos].name, str_size(desc[pos].name) + 1);
    546546                        free(desc);
    547547                        *rbytes = 1;
     
    550550
    551551                free(desc);
    552                 async_answer_0(chandle, ENOENT);
     552                async_answer_0(&call, ENOENT);
    553553                return ENOENT;
    554554        }
     
    568568                assert(dev->sess);
    569569
    570                 cap_call_handle_t chandle;
    571                 if (!async_data_read_receive(&chandle, NULL)) {
     570                ipc_call_t call;
     571                if (!async_data_read_receive(&call, NULL)) {
    572572                        fibril_mutex_unlock(&services_mutex);
    573                         async_answer_0(chandle, EINVAL);
     573                        async_answer_0(&call, EINVAL);
    574574                        return EINVAL;
    575575                }
     
    583583
    584584                /* Forward the IPC_M_DATA_READ request to the driver */
    585                 async_forward_fast(chandle, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     585                async_forward_fast(&call, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    586586
    587587                async_exchange_end(exch);
     
    632632                assert(dev->sess);
    633633
    634                 cap_call_handle_t chandle;
    635                 if (!async_data_write_receive(&chandle, NULL)) {
     634                ipc_call_t call;
     635                if (!async_data_write_receive(&call, NULL)) {
    636636                        fibril_mutex_unlock(&services_mutex);
    637                         async_answer_0(chandle, EINVAL);
     637                        async_answer_0(&call, EINVAL);
    638638                        return EINVAL;
    639639                }
     
    647647
    648648                /* Forward the IPC_M_DATA_WRITE request to the driver */
    649                 async_forward_fast(chandle, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     649                async_forward_fast(&call, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    650650
    651651                async_exchange_end(exch);
Note: See TracChangeset for help on using the changeset viewer.