# HG changeset patch # User Paul Boddie # Date 1705270923 -3600 # Node ID d7faea6cb532394707f4abd33a50fde956e9e33d # Parent 764d7c541daa496365c354997c431d0907e8289a Introduced support for explicit capability receiving operations in clients, also utilising role-specific capability and dataspace import operations. diff -r 764d7c541daa -r d7faea6cb532 client.c --- a/client.c Thu Mar 23 00:32:22 2023 +0100 +++ b/client.c Sun Jan 14 23:22:03 2024 +0100 @@ -1,7 +1,7 @@ /* * Client code generation. * - * Copyright (C) 2019, 2020, 2021, 2022, 2023 Paul Boddie + * Copyright (C) 2019-2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -89,13 +89,6 @@ fprintf(fp, "\n ipc_message_new(&msg);\n"); - /* Generate expected output item requirements. */ - - if (output_items) - fprintf(fp, " err = ipc_message_expect(&msg, %d);\n" - " if (err)\n" - " return err;\n", output_items); - /* Populate input parameters in the message. Dereference function parameters acting as "inout" parameters. */ @@ -114,9 +107,9 @@ WORD_CLASS, fp); } - /* Do the same for items. */ + /* Do the same for items, also preparing to receive output items. */ - if (input_items) + if (input_items | output_items) { fputs("\n", fp); write_message_access(param, CLIENT_ROLE, GENERAL_FUNCTION_ROLE, IN_PARAMETER, diff -r 764d7c541daa -r d7faea6cb532 common.c --- a/common.c Thu Mar 23 00:32:22 2023 +0100 +++ b/common.c Sun Jan 14 23:22:03 2024 +0100 @@ -1,7 +1,7 @@ /* * Common routines. * - * Copyright (C) 2019, 2020, 2022 Paul Boddie + * Copyright (C) 2019, 2020, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -430,25 +430,24 @@ char *item_type_name(struct parameter *param, enum component_role component, int writing) { - if (param->cls == FPAGE_ITEM) - { - /* Permit the specification of receive window flexpage items. */ + /* Permit the specification of receive window flexpage items or the + expectation of a capability. */ + + int receiving = specify_receive_item(param, component, writing); - if (specify_receive_fpage(param, component, writing)) - return "receive_fpage"; - else - return "fpage"; - } + if (param->cls == FPAGE_ITEM) + return receiving ? "receive_fpage" : "fpage"; else - return "capability"; + return receiving ? "receive_capability" : "capability"; } -/* Return whether the parameter involves a receive window flexpage. */ +/* Return whether the parameter involves a receive window flexpage or the + expectation of a capability. */ -int specify_receive_fpage(struct parameter *param, - enum component_role component, int writing) +int specify_receive_item(struct parameter *param, + enum component_role component, int writing) { - return (param->cls == FPAGE_ITEM) && + return (param->cls & ITEM_CLASS) && (component == CLIENT_ROLE) && !(param->specifier & IN_PARAMETER) && (param->specifier & OUT_PARAMETER) && diff -r 764d7c541daa -r d7faea6cb532 common.h --- a/common.h Thu Mar 23 00:32:22 2023 +0100 +++ b/common.h Sun Jan 14 23:22:03 2024 +0100 @@ -1,7 +1,7 @@ /* * Common routines. * - * Copyright (C) 2019, 2020, 2022 Paul Boddie + * Copyright (C) 2019, 2020, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -91,7 +91,7 @@ char *access_name(struct parameter *param, enum component_role component, int writing); char *item_type_name(struct parameter *param, enum component_role component, int writing); -int specify_receive_fpage(struct parameter *param, enum component_role component, int writing); +int specify_receive_item(struct parameter *param, enum component_role component, int writing); char *reference_message(enum component_role component, enum function_role function); char *structure_prefix(enum specifier direction); int writing_to_message(enum component_role component, enum specifier direction); diff -r 764d7c541daa -r d7faea6cb532 message.c --- a/message.c Thu Mar 23 00:32:22 2023 +0100 +++ b/message.c Sun Jan 14 23:22:03 2024 +0100 @@ -1,7 +1,7 @@ /* * Generation of message structure access operations. * - * Copyright (C) 2019, 2022 Paul Boddie + * Copyright (C) 2019, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -79,12 +79,13 @@ for (index = 0; param != NULL; param = param->tail) { - /* Permit the specification of receive window flexpage input items for - "out fpage" parameters. */ + /* Permit the specification of receive window flexpage and returned + capability items for "out fpage" and "out cap" parameters, even when + processing inputs to an operation. */ if ((param->cls & cls) && ((param->specifier & direction) || - specify_receive_fpage(param, component, writing))) + specify_receive_item(param, component, writing))) { name = get_parameter_name(param->identifiers); access = access_name(param, component, writing); @@ -109,8 +110,17 @@ fprintf(fp, " ipc_message_add_%s(%smsg, %s%s);\n", suffix, addr, access, name); else - fprintf(fp, " ipc_message_import_%s(%smsg, %d, %s%s);\n", - suffix, addr, index, access, name); + { + /* For servers, update the buffer registers for future capabilities, + allocating new capability slots. */ + + if (component == SERVER_ROLE) + fprintf(fp, " ipc_message_import_and_expect_%s(%smsg, %d, %s%s);\n", + suffix, addr, index, access, name); + else + fprintf(fp, " ipc_message_import_%s(%smsg, %d, %s%s);\n", + suffix, addr, index, access, name); + } index++; break;