[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230126000235.1085551-4-kuba@kernel.org>
Date: Wed, 25 Jan 2023 16:02:35 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net-next 3/3] tools: ynl: store ops in ordered dict to avoid random ordering
When rendering code we should walk the ops in the order in which
they are declared in the spec. This is both more intuitive and
prevents code from jumping around when hashing in the dict changes.
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
tools/net/ynl/ynl-gen-c.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 9297cfacbe06..1aa872e582ab 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import argparse
+import collections
import jsonschema
import os
import yaml
@@ -793,7 +794,7 @@ import yaml
# list of all operations
self.msg_list = []
# dict of operations which have their own message type (have attributes)
- self.ops = dict()
+ self.ops = collections.OrderedDict()
self.attr_sets = dict()
self.attr_sets_list = []
--
2.39.1
Powered by blists - more mailing lists