1 .. SPDX-License-Identifier: BSD-3-Clause 2 3 ============================== 4 Netlink spec C code generation 5 ============================== 6 7 This document describes how Netlink specificat 8 C code (uAPI, policies etc.). It also defines 9 allowed in older families by the ``genetlink-c 10 to control the naming. 11 12 For brevity this document refers to ``name`` p 13 objects by the object type. For example ``$att 14 of ``name`` in an attribute, and ``$family`` i 15 family (the global ``name`` property). 16 17 The upper case is used to denote literal value 18 means the concatenation of ``$family``, a dash 19 ``CMD``. 20 21 The names of ``#defines`` and enum values are 22 and with dashes (``-``) replaced by underscore 23 24 If the constructed name is a C keyword, an ext 25 appended (``do`` -> ``do_``). 26 27 Globals 28 ======= 29 30 ``c-family-name`` controls the name of the ``# 31 name, default is ``$family-FAMILY-NAME``. 32 33 ``c-version-name`` controls the name of the `` 34 of the family, default is ``$family-FAMILY-VER 35 36 ``max-by-define`` selects if max values for en 37 ``#define`` rather than inside the enum. 38 39 Definitions 40 =========== 41 42 Constants 43 --------- 44 45 Every constant is rendered as a ``#define``. 46 The name of the constant is ``$family-$constan 47 is rendered as a string or integer according t 48 49 Enums and flags 50 --------------- 51 52 Enums are named ``$family-$enum``. The full na 53 or suppressed by specifying the ``enum-name`` 54 Default entry name is ``$family-$enum-$entry`` 55 If ``name-prefix`` is specified it replaces th 56 portion of the entry name. 57 58 Boolean ``render-max`` controls creation of th 59 (which are enabled by default for attribute en 60 61 Attributes 62 ========== 63 64 Each attribute set (excluding fractional sets) 65 66 Attribute enums are traditionally unnamed in n 67 If naming is desired ``enum-name`` can be used 68 69 The default attribute name prefix is ``$family 70 is the same as the name of the family and ``$f 71 differ. The prefix can be overridden by the `` 72 The rest of the section will refer to the pref 73 74 Attributes are named ``$pfx-$attribute``. 75 76 Attribute enums end with two special values `` 77 which are used for sizing attribute tables. 78 These two names can be specified directly with 79 and ``attr-max-name`` properties respectively. 80 81 If ``max-by-define`` is set to ``true`` at the 82 will be specified as a ``#define`` rather than 83 84 Operations 85 ========== 86 87 Operations are named ``$family-CMD-$operation` 88 If ``name-prefix`` is specified it replaces th 89 portion of the name. 90 91 Similarly to attribute enums operation enums e 92 attributes. For operations those attributes ca 93 ``cmd-cnt-name`` and ``cmd-max-name``. Max wil 94 is ``true``. 95 96 Multicast groups 97 ================ 98 99 Each multicast group gets a define rendered in 100 The name of the define is ``$family-MCGRP-$gro 101 with the ``c-define-name`` property. 102 103 Code generation 104 =============== 105 106 uAPI header is assumed to come from ``<linux/$ 107 search path. It can be changed using the ``uap
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.