Changeset 984a9ba in mainline for uspace/srv/fs/fat/fat_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/fat/fat_ops.c

    r76f566d r984a9ba  
    12261226        nodep = FAT_NODE(fn);
    12271227
    1228         cap_call_handle_t chandle;
     1228        ipc_call_t call;
    12291229        size_t len;
    1230         if (!async_data_read_receive(&chandle, &len)) {
     1230        if (!async_data_read_receive(&call, &len)) {
    12311231                fat_node_put(fn);
    1232                 async_answer_0(chandle, EINVAL);
     1232                async_answer_0(&call, EINVAL);
    12331233                return EINVAL;
    12341234        }
     
    12451245                        /* reading beyond the EOF */
    12461246                        bytes = 0;
    1247                         (void) async_data_read_finalize(chandle, NULL, 0);
     1247                        (void) async_data_read_finalize(&call, NULL, 0);
    12481248                } else {
    12491249                        bytes = min(len, BPS(bs) - pos % BPS(bs));
     
    12531253                        if (rc != EOK) {
    12541254                                fat_node_put(fn);
    1255                                 async_answer_0(chandle, rc);
     1255                                async_answer_0(&call, rc);
    12561256                                return rc;
    12571257                        }
    1258                         (void) async_data_read_finalize(chandle,
     1258                        (void) async_data_read_finalize(&call,
    12591259                            b->data + pos % BPS(bs), bytes);
    12601260                        rc = block_put(b);
     
    12911291        err:
    12921292                (void) fat_node_put(fn);
    1293                 async_answer_0(chandle, rc);
     1293                async_answer_0(&call, rc);
    12941294                return rc;
    12951295
     
    12991299                        goto err;
    13001300                rc = fat_node_put(fn);
    1301                 async_answer_0(chandle, rc != EOK ? rc : ENOENT);
     1301                async_answer_0(&call, rc != EOK ? rc : ENOENT);
    13021302                *rbytes = 0;
    13031303                return rc != EOK ? rc : ENOENT;
     
    13081308                if (rc != EOK)
    13091309                        goto err;
    1310                 (void) async_data_read_finalize(chandle, name,
     1310                (void) async_data_read_finalize(&call, name,
    13111311                    str_size(name) + 1);
    13121312                bytes = (pos - spos) + 1;
     
    13381338        nodep = FAT_NODE(fn);
    13391339
    1340         cap_call_handle_t chandle;
     1340        ipc_call_t call;
    13411341        size_t len;
    1342         if (!async_data_write_receive(&chandle, &len)) {
     1342        if (!async_data_write_receive(&call, &len)) {
    13431343                (void) fat_node_put(fn);
    1344                 async_answer_0(chandle, EINVAL);
     1344                async_answer_0(&call, EINVAL);
    13451345                return EINVAL;
    13461346        }
     
    13701370                if (rc != EOK) {
    13711371                        (void) fat_node_put(fn);
    1372                         async_answer_0(chandle, rc);
     1372                        async_answer_0(&call, rc);
    13731373                        return rc;
    13741374                }
     
    13761376                if (rc != EOK) {
    13771377                        (void) fat_node_put(fn);
    1378                         async_answer_0(chandle, rc);
     1378                        async_answer_0(&call, rc);
    13791379                        return rc;
    13801380                }
    1381                 (void) async_data_write_finalize(chandle,
     1381                (void) async_data_write_finalize(&call,
    13821382                    b->data + pos % BPS(bs), bytes);
    13831383                b->dirty = true;                /* need to sync block */
     
    14091409                        /* could not allocate a chain of nclsts clusters */
    14101410                        (void) fat_node_put(fn);
    1411                         async_answer_0(chandle, rc);
     1411                        async_answer_0(&call, rc);
    14121412                        return rc;
    14131413                }
     
    14171417                        (void) fat_free_clusters(bs, service_id, mcl);
    14181418                        (void) fat_node_put(fn);
    1419                         async_answer_0(chandle, rc);
     1419                        async_answer_0(&call, rc);
    14201420                        return rc;
    14211421                }
     
    14251425                        (void) fat_free_clusters(bs, service_id, mcl);
    14261426                        (void) fat_node_put(fn);
    1427                         async_answer_0(chandle, rc);
     1427                        async_answer_0(&call, rc);
    14281428                        return rc;
    14291429                }
    1430                 (void) async_data_write_finalize(chandle,
     1430                (void) async_data_write_finalize(&call,
    14311431                    b->data + pos % BPS(bs), bytes);
    14321432                b->dirty = true;                /* need to sync block */
Note: See TracChangeset for help on using the changeset viewer.