1.1 --- a/examples/filesystem.idl Sat Nov 30 01:04:30 2019 +0100
1.2 +++ b/examples/filesystem.idl Sat Nov 30 01:05:31 2019 +0100
1.3 @@ -3,14 +3,14 @@
1.4
1.5 interface Filesystem
1.6 {
1.7 - /* Present a filesystem and a memory region containing the mountpoint. */
1.8 -
1.9 - [opcode(0)] void mount(in cap fs, in cap ds);
1.10 + /* Present a memory region containing the mountpoint path and the filesystem
1.11 + reference. */
1.12
1.13 - /* Obtain a filesystem reference. */
1.14 + [opcode(0)] void mount(in cap ds, in cap fs);
1.15
1.16 - [opcode(1)] void getfs(in int flags, in cap ds, in cap irq,
1.17 - out size_t size, out cap fs);
1.18 + /* Obtain and propagate a filesystem reference. */
1.19 +
1.20 + [opcode(1), propagate(fs)] void getfs(in cap ds, out cap fs);
1.21
1.22 /* Obtain filesystem access for the given user details. */
1.23
2.1 --- a/server.c Sat Nov 30 01:04:30 2019 +0100
2.2 +++ b/server.c Sat Nov 30 01:05:31 2019 +0100
2.3 @@ -162,6 +162,11 @@
2.4
2.5 write_output_initialisation(param, fp, opname, output_words, output_items, GENERAL_FUNCTION_ROLE);
2.6
2.7 + /* Discard any propagated items. */
2.8 +
2.9 + if (output_items)
2.10 + write_propagated_items(param, GENERAL_FUNCTION_ROLE, fp, sig);
2.11 +
2.12 /* Return the success of the reply operation. */
2.13
2.14 fputs(server_function_body_epilogue, fp);
2.15 @@ -242,6 +247,11 @@
2.16
2.17 write_output_initialisation(param, fp, opname, output_words, output_items, COMPLETION_ROLE);
2.18
2.19 + /* Discard any propagated items. */
2.20 +
2.21 + if (output_items)
2.22 + write_propagated_items(param, COMPLETION_ROLE, fp, sig);
2.23 +
2.24 /* Send the response.
2.25 NOTE: The label 0 is employed but an error condition could be communicated. */
2.26
2.27 @@ -296,6 +306,29 @@
2.28 }
2.29 }
2.30
2.31 +/* Discard (or request the discarding) of propagated items. */
2.32 +
2.33 +void write_propagated_items(struct parameter *param,
2.34 + enum function_role function, FILE *fp,
2.35 + struct signature *sig)
2.36 +{
2.37 + char *name;
2.38 +
2.39 + for (; param != NULL; param = param->tail)
2.40 + {
2.41 + name = get_parameter_name(param->identifiers);
2.42 +
2.43 + /* Test for a "propagate" attribute having the parameter name as one of its
2.44 + values. */
2.45 +
2.46 + if (have_attribute_value(sig->attributes, "propagate", name))
2.47 + {
2.48 + fprintf(fp, server_function_body_discard,
2.49 + reference_message(SERVER_ROLE, function), name);
2.50 + }
2.51 + }
2.52 +}
2.53 +
2.54 /* Generate an invocation of the actual server operation. */
2.55
2.56 void write_server_function_call(struct parameter *param, FILE *fp,
3.1 --- a/server.h Sat Nov 30 01:04:30 2019 +0100
3.2 +++ b/server.h Sat Nov 30 01:05:31 2019 +0100
3.3 @@ -80,3 +80,7 @@
3.4 void write_server_function_call(struct parameter *param, FILE *fp,
3.5 struct interface *iface, struct signature *sig,
3.6 enum specifier specifier);
3.7 +
3.8 +void write_propagated_items(struct parameter *param,
3.9 + enum function_role function, FILE *fp,
3.10 + struct signature *sig);
4.1 --- a/templates.h Sat Nov 30 01:04:30 2019 +0100
4.2 +++ b/templates.h Sat Nov 30 01:05:31 2019 +0100
4.3 @@ -154,6 +154,9 @@
4.4 " if (err)\n" \
4.5 " return err;\n"
4.6
4.7 +#define server_function_body_discard \
4.8 +"\n ipc_message_discard_capability(%smsg, %s);\n"
4.9 +
4.10 #define server_function_body_epilogue \
4.11 "\n ipc_message_reply(msg);\n\n" \
4.12 " return l4_error(msg->tag);\n"