From 4ffa6882a5eafa50625d0e4d49cdaafe69d7877c Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 31 Mar 2009 04:57:48 +0200 Subject: datatype: add/move size and byte order information into data types Add size and type information to non-basetype types and remove the now redundant information from the symbol tables. This will be used to determine size and byteorder of set members without analyzing the ruleset for incremental update operations. Signed-off-by: Patrick McHardy --- src/meta.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/meta.c') diff --git a/src/meta.c b/src/meta.c index a8f728af..c5168248 100644 --- a/src/meta.c +++ b/src/meta.c @@ -55,6 +55,8 @@ static const struct datatype realm_type = { .type = TYPE_REALM, .name = "realm", .desc = "routing realm", + .byteorder = BYTEORDER_HOST_ENDIAN, + .size = 4 * BITS_PER_BYTE, .basetype = &integer_type, .print = realm_type_print, .parse = realm_type_parse, @@ -87,6 +89,8 @@ static const struct datatype tchandle_type = { .type = TYPE_TC_HANDLE, .name = "tc_handle", .desc = "TC handle", + .byteorder = BYTEORDER_BIG_ENDIAN, + .size = 4 * BITS_PER_BYTE, .basetype = &integer_type, .print = tchandle_type_print, .parse = tchandle_type_parse, @@ -164,14 +168,14 @@ static const struct datatype ifindex_type = { .type = TYPE_IFINDEX, .name = "ifindex", .desc = "interface index", + .byteorder = BYTEORDER_HOST_ENDIAN, + .size = 4 * BITS_PER_BYTE, .basetype = &integer_type, .print = ifindex_type_print, .parse = ifindex_type_parse, }; static const struct symbol_table arphrd_tbl = { - .byteorder = BYTEORDER_HOST_ENDIAN, - .size = 2 * BITS_PER_BYTE, .symbols = { SYMBOL("ether", ARPHRD_ETHER), SYMBOL("ppp", ARPHRD_PPP), @@ -189,6 +193,8 @@ const struct datatype arphrd_type = { .type = TYPE_ARPHRD, .name = "arphrd", .desc = "hardware type", + .byteorder = BYTEORDER_HOST_ENDIAN, + .size = 2 * BITS_PER_BYTE, .basetype = &integer_type, .sym_tbl = &arphrd_tbl, }; @@ -227,6 +233,8 @@ static const struct datatype uid_type = { .type = TYPE_UID, .name = "uid", .desc = "user ID", + .byteorder = BYTEORDER_BIG_ENDIAN, + .size = sizeof(uid_t) * BITS_PER_BYTE, .basetype = &integer_type, .print = uid_type_print, .parse = uid_type_parse, @@ -266,6 +274,8 @@ static const struct datatype gid_type = { .type = TYPE_GID, .name = "gid", .desc = "group ID", + .byteorder = BYTEORDER_BIG_ENDIAN, + .size = sizeof(gid_t) * BITS_PER_BYTE, .basetype = &integer_type, .print = gid_type_print, .parse = gid_type_parse, -- cgit v1.2.3