Changeset 984a9ba in mainline for uspace/srv/fs/exfat/exfat_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/exfat/exfat_ops.c

    r76f566d r984a9ba  
    13411341        nodep = EXFAT_NODE(fn);
    13421342
    1343         cap_call_handle_t chandle;
     1343        ipc_call_t call;
    13441344        size_t len;
    1345         if (!async_data_read_receive(&chandle, &len)) {
     1345        if (!async_data_read_receive(&call, &len)) {
    13461346                exfat_node_put(fn);
    1347                 async_answer_0(chandle, EINVAL);
     1347                async_answer_0(&call, EINVAL);
    13481348                return EINVAL;
    13491349        }
     
    13601360                        /* reading beyond the EOF */
    13611361                        bytes = 0;
    1362                         (void) async_data_read_finalize(chandle, NULL, 0);
     1362                        (void) async_data_read_finalize(&call, NULL, 0);
    13631363                } else {
    13641364                        bytes = min(len, BPS(bs) - pos % BPS(bs));
     
    13681368                        if (rc != EOK) {
    13691369                                exfat_node_put(fn);
    1370                                 async_answer_0(chandle, rc);
     1370                                async_answer_0(&call, rc);
    13711371                                return rc;
    13721372                        }
    1373                         (void) async_data_read_finalize(chandle,
     1373                        (void) async_data_read_finalize(&call,
    13741374                            b->data + pos % BPS(bs), bytes);
    13751375                        rc = block_put(b);
     
    13811381        } else {
    13821382                if (nodep->type != EXFAT_DIRECTORY) {
    1383                         async_answer_0(chandle, ENOTSUP);
     1383                        async_answer_0(&call, ENOTSUP);
    13841384                        return ENOTSUP;
    13851385                }
     
    14151415        err:
    14161416                (void) exfat_node_put(fn);
    1417                 async_answer_0(chandle, rc);
     1417                async_answer_0(&call, rc);
    14181418                return rc;
    14191419
     
    14231423                        goto err;
    14241424                rc = exfat_node_put(fn);
    1425                 async_answer_0(chandle, rc != EOK ? rc : ENOENT);
     1425                async_answer_0(&call, rc != EOK ? rc : ENOENT);
    14261426                *rbytes = 0;
    14271427                return rc != EOK ? rc : ENOENT;
     
    14321432                if (rc != EOK)
    14331433                        goto err;
    1434                 (void) async_data_read_finalize(chandle, name,
     1434                (void) async_data_read_finalize(&call, name,
    14351435                    str_size(name) + 1);
    14361436                bytes = (pos - spos) + 1;
     
    14851485        nodep = EXFAT_NODE(fn);
    14861486
    1487         cap_call_handle_t chandle;
     1487        ipc_call_t call;
    14881488        size_t len;
    1489         if (!async_data_write_receive(&chandle, &len)) {
     1489        if (!async_data_write_receive(&call, &len)) {
    14901490                (void) exfat_node_put(fn);
    1491                 async_answer_0(chandle, EINVAL);
     1491                async_answer_0(&call, EINVAL);
    14921492                return EINVAL;
    14931493        }
     
    15141514                        /* could not expand node */
    15151515                        (void) exfat_node_put(fn);
    1516                         async_answer_0(chandle, rc);
     1516                        async_answer_0(&call, rc);
    15171517                        return rc;
    15181518                }
     
    15331533        if (rc != EOK) {
    15341534                (void) exfat_node_put(fn);
    1535                 async_answer_0(chandle, rc);
    1536                 return rc;
    1537         }
    1538 
    1539         (void) async_data_write_finalize(chandle,
     1535                async_answer_0(&call, rc);
     1536                return rc;
     1537        }
     1538
     1539        (void) async_data_write_finalize(&call,
    15401540            b->data + pos % BPS(bs), bytes);
    15411541        b->dirty = true;                /* need to sync block */
Note: See TracChangeset for help on using the changeset viewer.