Changeset 984a9ba in mainline for uspace/srv/vfs/vfs_register.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/vfs/vfs_register.c

    r76f566d r984a9ba  
    108108/** VFS_REGISTER protocol function.
    109109 *
    110  * @param req_handle  Call handle of the request.
    111  * @param request     Call structure with the request.
    112  *
    113  */
    114 void vfs_register(cap_call_handle_t req_handle, ipc_call_t *request)
     110 * @param req Call structure with the request.
     111 *
     112 */
     113void vfs_register(ipc_call_t *req)
    115114{
    116115        dprintf("Processing VFS_REGISTER request received from %zx.\n",
    117             request->in_phone_hash);
     116            req->in_phone_hash);
    118117
    119118        vfs_info_t *vfs_info;
     
    124123                dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n",
    125124                    rc);
    126                 async_answer_0(req_handle, rc);
     125                async_answer_0(req, rc);
    127126                return;
    128127        }
     
    134133        if (!fs_info) {
    135134                dprintf("Could not allocate memory for FS info.\n");
    136                 async_answer_0(req_handle, ENOMEM);
     135                async_answer_0(req, ENOMEM);
    137136                return;
    138137        }
     
    146145        if (!vfs_info_sane(&fs_info->vfs_info)) {
    147146                free(fs_info);
    148                 async_answer_0(req_handle, EINVAL);
     147                async_answer_0(req, EINVAL);
    149148                return;
    150149        }
     
    163162                fibril_mutex_unlock(&fs_list_lock);
    164163                free(fs_info);
    165                 async_answer_0(req_handle, EEXIST);
     164                async_answer_0(req, EEXIST);
    166165                return;
    167166        }
     
    184183                fibril_mutex_unlock(&fs_list_lock);
    185184                free(fs_info);
    186                 async_answer_0(req_handle, EINVAL);
     185                async_answer_0(req, EINVAL);
    187186                return;
    188187        }
     
    194193         */
    195194
     195        ipc_call_t call;
    196196        size_t size;
    197         cap_call_handle_t chandle;
    198         if (!async_share_in_receive(&chandle, &size)) {
     197        if (!async_share_in_receive(&call, &size)) {
    199198                dprintf("Unexpected call\n");
    200199                list_remove(&fs_info->fs_link);
     
    202201                async_hangup(fs_info->sess);
    203202                free(fs_info);
    204                 async_answer_0(chandle, EINVAL);
    205                 async_answer_0(req_handle, EINVAL);
     203                async_answer_0(&call, EINVAL);
     204                async_answer_0(req, EINVAL);
    206205                return;
    207206        }
     
    216215                async_hangup(fs_info->sess);
    217216                free(fs_info);
    218                 async_answer_0(chandle, EINVAL);
    219                 async_answer_0(req_handle, EINVAL);
     217                async_answer_0(&call, EINVAL);
     218                async_answer_0(req, EINVAL);
    220219                return;
    221220        }
     
    224223         * Commit to read-only sharing the PLB with the client.
    225224         */
    226         (void) async_share_in_finalize(chandle, plb,
     225        (void) async_share_in_finalize(&call, plb,
    227226            AS_AREA_READ | AS_AREA_CACHEABLE);
    228227
     
    235234         */
    236235        fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next);
    237         async_answer_1(req_handle, EOK, (sysarg_t) fs_info->fs_handle);
     236        async_answer_1(req, EOK, (sysarg_t) fs_info->fs_handle);
    238237
    239238        fibril_condvar_broadcast(&fs_list_cv);
Note: See TracChangeset for help on using the changeset viewer.