[PATCH] typed config nodes

0 visualitzacions
Ves al primer missatge no llegit

Erik van der Kouwe

no llegida,
20 de gen. 2011, 5:09:1020/1/11
a V3VEE Development,Jack Lange
Dear all,

In Palacios on MINIX, the XML parsing has been moved out because it is considered unsuitable for code that runs at elevated privilege. For this reason I store the configuration in pre-parsed structs received from user-space. To be able to do this, I need the various nodes to have different types.

This patch introduces the following types for the nodes used in the XML config file:
typedef v3_cfg_tree_t v3_config_t;
typedef v3_cfg_tree_t v3_config_core_t;
typedef v3_cfg_tree_t v3_config_cores_t;
typedef v3_cfg_tree_t v3_config_device_t;
typedef v3_cfg_tree_t v3_config_frontend_t;
typedef v3_cfg_tree_t v3_config_paging_t;
typedef v3_cfg_tree_t v3_config_port_t;

Each use of v3_cfg_tree_t is replaced by the appropriate node type and fields are read using the following macro's:
#define V3_CFGDEV_VAL(tree, tag) (v3_cfg_val((tree), #tag))
#define V3_CFGFRE_VAL(tree, tag) (v3_cfg_val((tree), #tag))
#define V3_CFGPAG_VAL(tree, tag) (v3_cfg_val((tree), #tag))
#define V3_CFGDEV_FRONTEND(tree) (v3_cfg_subtree((tree), "frontend"))

After preprocessing, the code in my patch comes out essentially the same as it used to be. However, having different types and different access functions greatly simplifies the MINIX port, which defines these types and macro's differently. However, having the node types specified explicitly should also be a readability benefit for the code on other platforms.

Thanks in advance.

With kind regards,
Erik
palacios-typedconfig.patch
Respon a tots
Respon a l'autor
Reenvia
0 missatges nous