Skip to content

Commit 96d7f83

Browse files
committed
xlat/gen.sh: introduce #Prefix directive
This directive is intended for other tools and is currently ignored by `gen.sh`, similar to #From and #Generated. * src/xlat/gen.sh: Introduce #Prefix. * src/xlat/README.md: Document it.
1 parent cb1f263 commit 96d7f83

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/xlat/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,22 @@ Annotates the xlat file with the source of the xlat constants. There could be
183183
several `#From` directives in a single xlat file. This directive is intended
184184
for other tools and is currently ignored by `gen.sh`.
185185

186+
### `#Prefix PREFIX1_ ... PREFIXn_`
187+
188+
Annotates the xlat file with the prefix pattern(s) to use when searching for
189+
constants in Linux headers. Multiple prefixes can be specified, separated by
190+
spaces. This directive is intended for other tools and is currently ignored
191+
by `gen.sh`.
192+
193+
**Example:**
194+
```
195+
#From include/uapi/linux/io_uring.h
196+
#Prefix IORING_REGISTER_ IORING_UNREGISTER_
197+
IORING_REGISTER_BUFFERS
198+
IORING_UNREGISTER_BUFFERS
199+
...
200+
```
201+
186202
### `#<anything else>`
187203

188204
Any other line starting with `#` is passed through verbatim. Allows custom

src/xlat/gen.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ gen_header()
218218
esac
219219

220220
case $line in
221-
'#From '*|'#Generated '*) # ignore
221+
'#From '*|'#Generated '*|'#Prefix '*) # ignore
222222
;;
223223
'#conditional')
224224
unconditional=
@@ -322,7 +322,7 @@ gen_header()
322322
esac
323323

324324
case ${line} in
325-
'#From '*|'#Generated '*) # ignore
325+
'#From '*|'#Generated '*|'#Prefix '*) # ignore
326326
;;
327327
'#conditional')
328328
unconditional=

0 commit comments

Comments
 (0)