aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorNecip Fazil Yildiran <necip@google.com>2020-08-10 14:43:38 +0000
committerDmitry Vyukov <dvyukov@google.com>2020-08-13 13:50:25 +0200
commitf5442bde55872d703f184f8617329f706bad8149 (patch)
tree14e121020d6aacd857b80351f01546818f19a74b /docs
parentee7cb8b69583db417b187b53f4765c3a403cd4cf (diff)
pkg, prog: add per-field direction attribute
Diffstat (limited to 'docs')
-rw-r--r--docs/syscall_descriptions.md7
-rw-r--r--docs/syscall_descriptions_syntax.md26
2 files changed, 27 insertions, 6 deletions
diff --git a/docs/syscall_descriptions.md b/docs/syscall_descriptions.md
index d3f8f5d17..3fe18b904 100644
--- a/docs/syscall_descriptions.md
+++ b/docs/syscall_descriptions.md
@@ -169,10 +169,9 @@ close(r0)
```
Syscall arguments are always `in`, return values are `out` and pointer indirections
-have explicit direction as `ptr` type attribute. Note: for pointer indirections
-the direction applies to the whole pointee, and it's not possible to specify the
-direction individually for struct fields at the moment
-(see [#245](https://github.com/google/syzkaller/issues/245)).
+have explicit direction as `ptr` type attribute. Also, it is possible to specify
+direction attribute individually for struct fields to account for more complex
+producer/consumer scenarious with structs that include both input/output resources.
<div id="values"/>
diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md
index 7f4033079..5af302de8 100644
--- a/docs/syscall_descriptions_syntax.md
+++ b/docs/syscall_descriptions_syntax.md
@@ -120,10 +120,14 @@ Structs are described as:
```
structname "{" "\n"
- (fieldname type "\n")+
+ (fieldname type ("(" fieldattribute* ")")? "\n")+
"}" ("[" attribute* "]")?
```
+Fields can have attributes specified in parentheses after the field, independent
+of their type. The only attribute is direction (`in/out/inout`). For the field for
+which it is specified, the direction attributes on the upper levels are overridden.
+
Structs can have attributes specified in square brackets after the struct.
Attributes are:
@@ -137,10 +141,12 @@ Unions are described as:
```
unionname "[" "\n"
- (fieldname type "\n")+
+ (fieldname type ("(" fieldattribute* ")")? "\n")+
"]" ("[" attribute* "]")?
```
+Field attributes are as defined for [structs](#structs).
+
Unions can have attributes specified in square brackets after the union.
Attributes are:
@@ -181,6 +187,22 @@ test_struct {
}
```
+For more complex producer/consumer scenarios, field attributes can be utilized.
+For example:
+
+```
+resource my_resource_1[int32]
+resource my_resource_2[int32]
+
+request_produce1_consume2(..., arg ptr[inout, test_struct])
+
+test_struct {
+ ...
+ field0 my_resource_1 (out)
+ field1 my_resource_2 (in)
+}
+```
+
## Type Aliases
Complex types that are often repeated can be given short type aliases using the