diff options
author | Thomas Graf <tgr@lsx.localdomain> | 2008-06-17 01:04:19 (GMT) |
---|---|---|
committer | Thomas Graf <tgr@lsx.localdomain> | 2008-06-17 01:04:19 (GMT) |
commit | 13ab2441ced84cfc093734b257c43fa468cb22fd (patch) | |
tree | 0dd70100367d6344871ba99cad6a7c9c2ec429bb | |
parent | ff05f2ffc3caea6c59b6c940aa80e1314783a070 (diff) | |
download | libnl-13ab2441ced84cfc093734b257c43fa468cb22fd.zip libnl-13ab2441ced84cfc093734b257c43fa468cb22fd.tar.gz libnl-13ab2441ced84cfc093734b257c43fa468cb22fd.tar.bz2 |
Remove XML dumping
Bloats the library, not frequently used
-rw-r--r-- | include/netlink/types.h | 1 | ||||
-rw-r--r-- | lib/genl/family.c | 4 | ||||
-rw-r--r-- | lib/route/addr.c | 65 | ||||
-rw-r--r-- | lib/route/link.c | 71 | ||||
-rw-r--r-- | lib/route/neigh.c | 55 | ||||
-rw-r--r-- | lib/route/rule.c | 52 | ||||
-rw-r--r-- | src/nl-list-caches.c | 1 | ||||
-rw-r--r-- | src/utils.c | 2 |
8 files changed, 0 insertions, 251 deletions
diff --git a/include/netlink/types.h b/include/netlink/types.h index f650976..2e0b9c3 100644 --- a/include/netlink/types.h +++ b/include/netlink/types.h @@ -22,7 +22,6 @@ enum nl_dump_type { NL_DUMP_LINE, /**< Dump object briefly on one line */ NL_DUMP_DETAILS, /**< Dump all attributes but no statistics */ NL_DUMP_STATS, /**< Dump all attributes including statistics */ - NL_DUMP_XML, /**< Dump all attribtes in XML format */ NL_DUMP_ENV, /**< Dump all attribtues as env variables */ __NL_DUMP_MAX, }; diff --git a/lib/genl/family.c b/lib/genl/family.c index 6be1a29..4c6c18d 100644 --- a/lib/genl/family.c +++ b/lib/genl/family.c @@ -268,10 +268,6 @@ struct nl_object_ops genl_family_ops = { [NL_DUMP_LINE] = family_dump_line, [NL_DUMP_DETAILS] = family_dump_details, [NL_DUMP_STATS] = family_dump_stats, -#if 0 - .oo_dump[NL_DUMP_XML] = addr_dump_xml, - .oo_dump[NL_DUMP_ENV] = addr_dump_env, -#endif }, .oo_compare = family_compare, .oo_id_attrs = FAMILY_ATTR_ID, diff --git a/lib/route/addr.c b/lib/route/addr.c index 0005011..b30c96d 100644 --- a/lib/route/addr.c +++ b/lib/route/addr.c @@ -380,70 +380,6 @@ static void addr_dump_stats(struct nl_object *obj, struct nl_dump_params *p) addr_dump_details(obj, p); } -static void addr_dump_xml(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_addr *addr = (struct rtnl_addr *) obj; - struct nl_cache *link_cache; - char buf[128]; - - nl_dump_line(p, "<address>\n"); - nl_dump_line(p, " <family>%s</family>\n", - nl_af2str(addr->a_family, buf, sizeof(buf))); - - nl_dump_line(p, " <local>%s</local>\n", - nl_addr2str(addr->a_local, buf, sizeof(buf))); - nl_dump_line(p, " <peer>%s</peer>\n", - nl_addr2str(addr->a_peer, buf, sizeof(buf))); - nl_dump_line(p, " <broadcast>%s</broadcast>\n", - nl_addr2str(addr->a_bcast, buf, sizeof(buf))); - nl_dump_line(p, " <multicast>%s</multicast>\n", - nl_addr2str(addr->a_multicast, buf, sizeof(buf))); - - link_cache = nl_cache_mngt_require("route/link"); - if (link_cache) - nl_dump_line(p, " <device>%s</device>\n", - rtnl_link_i2name(link_cache, addr->a_ifindex, - buf, sizeof(buf))); - else - nl_dump_line(p, " <device>%u</device>\n", addr->a_ifindex); - - nl_dump_line(p, " <scope>%s</scope>\n", - rtnl_scope2str(addr->a_scope, buf, sizeof(buf))); - - nl_dump_line(p, " <label>%s</label>\n", addr->a_label); - - rtnl_addr_flags2str(addr->a_flags, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, " <flags>%s</flags>\n", buf); - - if (addr->ce_mask & ADDR_ATTR_CACHEINFO) { - struct rtnl_addr_cacheinfo *ci = &addr->a_cacheinfo; - - nl_dump_line(p, " <cacheinfo>\n"); - if (ci->aci_valid == 0xFFFFFFFFU) - nl_dump_line(p, " <valid>forever</valid>\n"); - else - nl_dump_line(p, " <valid>%u</valid>\n", - ci->aci_valid); - - if (ci->aci_prefered == 0xFFFFFFFFU) - nl_dump_line(p, " <preferred>forever</preferred>\n"); - else - nl_dump_line(p, " <preferred>%s</preferred>\n", - ci->aci_prefered); - - nl_dump_line(p, " <created>%u</created>\n", - addr->a_cacheinfo.aci_cstamp); - - nl_dump_line(p, " <last-update>%u</last-update>\n", - addr->a_cacheinfo.aci_tstamp); - - nl_dump_line(p, " </cacheinfo>\n"); - } - - nl_dump_line(p, "</address>\n"); -} - static int addr_compare(struct nl_object *_a, struct nl_object *_b, uint32_t attrs, int flags) { @@ -967,7 +903,6 @@ static struct nl_object_ops addr_obj_ops = { [NL_DUMP_LINE] = addr_dump_line, [NL_DUMP_DETAILS] = addr_dump_details, [NL_DUMP_STATS] = addr_dump_stats, - [NL_DUMP_XML] = addr_dump_xml, }, .oo_compare = addr_compare, .oo_attrs2str = addr_attrs2str, diff --git a/lib/route/link.c b/lib/route/link.c index c2bd0d0..d2ae816 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -566,76 +566,6 @@ static void link_dump_stats(struct nl_object *obj, struct nl_dump_params *p) link->l_info_ops->io_dump[NL_DUMP_STATS](link, p); } -static void link_dump_xml(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_link *link = (struct rtnl_link *) obj; - struct nl_cache *cache = dp_cache(obj); - char buf[128]; - int i; - - nl_dump_line(p, "<link name=\"%s\" index=\"%u\">\n", - link->l_name, link->l_index); - nl_dump_line(p, " <family>%s</family>\n", - nl_af2str(link->l_family, buf, sizeof(buf))); - nl_dump_line(p, " <arptype>%s</arptype>\n", - nl_llproto2str(link->l_arptype, buf, sizeof(buf))); - nl_dump_line(p, " <address>%s</address>\n", - nl_addr2str(link->l_addr, buf, sizeof(buf))); - nl_dump_line(p, " <mtu>%u</mtu>\n", link->l_mtu); - nl_dump_line(p, " <txqlen>%u</txqlen>\n", link->l_txqlen); - nl_dump_line(p, " <weight>%u</weight>\n", link->l_weight); - - rtnl_link_flags2str(link->l_flags, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, " <flags>%s</flags>\n", buf); - - if (link->ce_mask & LINK_ATTR_QDISC) - nl_dump_line(p, " <qdisc>%s</qdisc>\n", link->l_qdisc); - - if (link->ce_mask & LINK_ATTR_LINK) { - struct rtnl_link *ll = rtnl_link_get(cache, link->l_link); - nl_dump_line(p, " <link>%s</link>\n", - ll ? ll->l_name : "none"); - if (ll) - rtnl_link_put(ll); - } - - if (link->ce_mask & LINK_ATTR_MASTER) { - struct rtnl_link *master = rtnl_link_get(cache, link->l_master); - nl_dump_line(p, " <master>%s</master>\n", - master ? master->l_name : "none"); - if (master) - rtnl_link_put(master); - } - - if (link->ce_mask & LINK_ATTR_BRD) - nl_dump_line(p, " <broadcast>%s</broadcast>\n", - nl_addr2str(link->l_bcast, buf, sizeof(buf))); - - if (link->ce_mask & LINK_ATTR_STATS) { - nl_dump_line(p, " <stats>\n"); - for (i = 0; i <= RTNL_LINK_STATS_MAX; i++) { - rtnl_link_stat2str(i, buf, sizeof(buf)); - nl_dump_line(p, " <%s>%" PRIu64 "</%s>\n", - buf, link->l_stats[i], buf); - } - nl_dump_line(p, " </stats>\n"); - } - - if (link->l_info_ops && link->l_info_ops->io_dump[NL_DUMP_XML]) { - nl_dump_line(p, " <info>\n"); - link->l_info_ops->io_dump[NL_DUMP_XML](link, p); - nl_dump_line(p, " </info>\n"); - } - - nl_dump_line(p, "</link>\n"); - -#if 0 - uint32_t l_change; /**< Change mask */ - struct rtnl_lifmap l_map; /**< Interface device mapping */ -#endif -} - static void link_dump_env(struct nl_object *obj, struct nl_dump_params *p) { struct rtnl_link *link = (struct rtnl_link *) obj; @@ -1500,7 +1430,6 @@ static struct nl_object_ops link_obj_ops = { [NL_DUMP_LINE] = link_dump_line, [NL_DUMP_DETAILS] = link_dump_details, [NL_DUMP_STATS] = link_dump_stats, - [NL_DUMP_XML] = link_dump_xml, [NL_DUMP_ENV] = link_dump_env, }, .oo_compare = link_compare, diff --git a/lib/route/neigh.c b/lib/route/neigh.c index 86cd35e..39ff2ea 100644 --- a/lib/route/neigh.c +++ b/lib/route/neigh.c @@ -383,60 +383,6 @@ static void neigh_dump_stats(struct nl_object *a, struct nl_dump_params *p) neigh_dump_details(a, p); } -static void neigh_dump_xml(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_neigh *neigh = (struct rtnl_neigh *) obj; - char buf[128]; - - nl_dump_line(p, "<neighbour>\n"); - nl_dump_line(p, " <family>%s</family>\n", - nl_af2str(neigh->n_family, buf, sizeof(buf))); - - if (neigh->ce_mask & NEIGH_ATTR_LLADDR) - nl_dump_line(p, " <lladdr>%s</lladdr>\n", - nl_addr2str(neigh->n_lladdr, buf, sizeof(buf))); - - if (neigh->ce_mask & NEIGH_ATTR_DST) - nl_dump_line(p, " <dst>%s</dst>\n", - nl_addr2str(neigh->n_dst, buf, sizeof(buf))); - - if (neigh->ce_mask & NEIGH_ATTR_IFINDEX) { - struct nl_cache *link_cache; - - link_cache = nl_cache_mngt_require("route/link"); - - if (link_cache) - nl_dump_line(p, " <device>%s</device>\n", - rtnl_link_i2name(link_cache, - neigh->n_ifindex, - buf, sizeof(buf))); - else - nl_dump_line(p, " <device>%u</device>\n", - neigh->n_ifindex); - } - - if (neigh->ce_mask & NEIGH_ATTR_PROBES) - nl_dump_line(p, " <probes>%u</probes>\n", neigh->n_probes); - - if (neigh->ce_mask & NEIGH_ATTR_TYPE) - nl_dump_line(p, " <type>%s</type>\n", - nl_rtntype2str(neigh->n_type, buf, sizeof(buf))); - - rtnl_neigh_flags2str(neigh->n_flags, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, " <flags>%s</flags>\n", buf); - - rtnl_neigh_state2str(neigh->n_state, buf, sizeof(buf)); - if (buf[0]) - nl_dump_line(p, " <state>%s</state>\n", buf); - - nl_dump_line(p, "</neighbour>\n"); - -#if 0 - struct rtnl_ncacheinfo n_cacheinfo; -#endif -} - static void neigh_dump_env(struct nl_object *obj, struct nl_dump_params *p) { struct rtnl_neigh *neigh = (struct rtnl_neigh *) obj; @@ -900,7 +846,6 @@ static struct nl_object_ops neigh_obj_ops = { [NL_DUMP_LINE] = neigh_dump_line, [NL_DUMP_DETAILS] = neigh_dump_details, [NL_DUMP_STATS] = neigh_dump_stats, - [NL_DUMP_XML] = neigh_dump_xml, [NL_DUMP_ENV] = neigh_dump_env, }, .oo_compare = neigh_compare, diff --git a/lib/route/rule.c b/lib/route/rule.c index 6b6347a..1f9ff9f 100644 --- a/lib/route/rule.c +++ b/lib/route/rule.c @@ -227,57 +227,6 @@ static void rule_dump_stats(struct nl_object *obj, struct nl_dump_params *p) rule_dump_details(obj, p); } -static void rule_dump_xml(struct nl_object *obj, struct nl_dump_params *p) -{ - struct rtnl_rule *rule = (struct rtnl_rule *) obj; - char buf[128]; - - nl_dump_line(p, "<rule>\n"); - - nl_dump_line(p, " <priority>%u</priority>\n", rule->r_prio); - nl_dump_line(p, " <family>%s</family>\n", - nl_af2str(rule->r_family, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_DST) - nl_dump_line(p, " <dst>%s</dst>\n", - nl_addr2str(rule->r_dst, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_DST_LEN) - nl_dump_line(p, " <dstlen>%u</dstlen>\n", rule->r_dst_len); - - if (rule->ce_mask & RULE_ATTR_SRC) - nl_dump_line(p, " <src>%s</src>\n", - nl_addr2str(rule->r_src, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_SRC_LEN) - nl_dump_line(p, " <srclen>%u</srclen>\n", rule->r_src_len); - - if (rule->ce_mask & RULE_ATTR_IIF) - nl_dump_line(p, " <iif>%s</iif>\n", rule->r_iif); - - if (rule->ce_mask & RULE_ATTR_TABLE) - nl_dump_line(p, " <table>%u</table>\n", rule->r_table); - - if (rule->ce_mask & RULE_ATTR_REALMS) - nl_dump_line(p, " <realms>%u</realms>\n", rule->r_realms); - - if (rule->ce_mask & RULE_ATTR_MARK) - nl_dump_line(p, " <mark>%" PRIx64 "</mark>\n", rule->r_mark); - - if (rule->ce_mask & RULE_ATTR_DSFIELD) - nl_dump_line(p, " <dsfield>%u</dsfield>\n", rule->r_dsfield); - - if (rule->ce_mask & RULE_ATTR_TYPE) - nl_dump_line(p, "<type>%s</type>\n", - nl_rtntype2str(rule->r_type, buf, sizeof(buf))); - - if (rule->ce_mask & RULE_ATTR_SRCMAP) - nl_dump_line(p, "<srcmap>%s</srcmap>\n", - nl_addr2str(rule->r_srcmap, buf, sizeof(buf))); - - nl_dump_line(p, "</rule>\n"); -} - static void rule_dump_env(struct nl_object *obj, struct nl_dump_params *p) { struct rtnl_rule *rule = (struct rtnl_rule *) obj; @@ -813,7 +762,6 @@ static struct nl_object_ops rule_obj_ops = { [NL_DUMP_LINE] = rule_dump_line, [NL_DUMP_DETAILS] = rule_dump_details, [NL_DUMP_STATS] = rule_dump_stats, - [NL_DUMP_XML] = rule_dump_xml, [NL_DUMP_ENV] = rule_dump_env, }, .oo_compare = rule_compare, diff --git a/src/nl-list-caches.c b/src/nl-list-caches.c index 281be00..e9e81c5 100644 --- a/src/nl-list-caches.c +++ b/src/nl-list-caches.c @@ -48,7 +48,6 @@ static void print(struct nl_cache_ops *ops, void *arg) "brief", "detailed", "stats", - "xml", "env", }; int i; diff --git a/src/utils.c b/src/utils.c index b73a143..5fa75e3 100644 --- a/src/utils.c +++ b/src/utils.c @@ -96,8 +96,6 @@ int nlt_parse_dumptype(const char *str) return NL_DUMP_DETAILS; else if (!strcasecmp(str, "stats")) return NL_DUMP_STATS; - else if (!strcasecmp(str, "xml")) - return NL_DUMP_XML; else if (!strcasecmp(str, "env")) return NL_DUMP_ENV; else |