Changeset 984a9ba in mainline for uspace/srv/fs/mfs/mfs_ops.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (6 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/mfs/mfs_ops.c

    r76f566d r984a9ba  
    839839        struct mfs_ino_info *ino_i;
    840840        size_t len, bytes = 0;
    841         cap_call_handle_t chandle;
     841        ipc_call_t call;
    842842
    843843        mnode = fn->data;
    844844        ino_i = mnode->ino_i;
    845845
    846         if (!async_data_read_receive(&chandle, &len)) {
     846        if (!async_data_read_receive(&call, &len)) {
    847847                rc = EINVAL;
    848848                goto out_error;
     
    871871
    872872                rc = mfs_node_put(fn);
    873                 async_answer_0(chandle, rc != EOK ? rc : ENOENT);
     873                async_answer_0(&call, rc != EOK ? rc : ENOENT);
    874874                return rc;
    875875        found:
    876                 async_data_read_finalize(chandle, d_info.d_name,
     876                async_data_read_finalize(&call, d_info.d_name,
    877877                    str_size(d_info.d_name) + 1);
    878878                bytes = ((pos - spos) + 1);
     
    883883                        /* Trying to read beyond the end of file */
    884884                        bytes = 0;
    885                         (void) async_data_read_finalize(chandle, NULL, 0);
     885                        (void) async_data_read_finalize(&call, NULL, 0);
    886886                        goto out_success;
    887887                }
     
    905905                        }
    906906                        memset(buf, 0, sizeof(sbi->block_size));
    907                         async_data_read_finalize(chandle,
     907                        async_data_read_finalize(&call,
    908908                            buf + pos % sbi->block_size, bytes);
    909909                        free(buf);
     
    915915                        goto out_error;
    916916
    917                 async_data_read_finalize(chandle, b->data +
     917                async_data_read_finalize(&call, b->data +
    918918                    pos % sbi->block_size, bytes);
    919919
     
    930930out_error:
    931931        tmp = mfs_node_put(fn);
    932         async_answer_0(chandle, tmp != EOK ? tmp : rc);
     932        async_answer_0(&call, tmp != EOK ? tmp : rc);
    933933        return tmp != EOK ? tmp : rc;
    934934}
     
    948948                return ENOENT;
    949949
    950         cap_call_handle_t chandle;
     950        ipc_call_t call;
    951951        size_t len;
    952952
    953         if (!async_data_write_receive(&chandle, &len)) {
     953        if (!async_data_write_receive(&call, &len)) {
    954954                r = EINVAL;
    955955                goto out_err;
     
    994994                memset(b->data, 0, sbi->block_size);
    995995
    996         async_data_write_finalize(chandle, b->data + (pos % bs), bytes);
     996        async_data_write_finalize(&call, b->data + (pos % bs), bytes);
    997997        b->dirty = true;
    998998
     
    10141014out_err:
    10151015        mfs_node_put(fn);
    1016         async_answer_0(chandle, r);
     1016        async_answer_0(&call, r);
    10171017        return r;
    10181018}
Note: See TracChangeset for help on using the changeset viewer.