]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/tc_util.c
add generic size table for qdiscs
[mirror_iproute2.git] / tc / tc_util.c
index ba7c0c9dad4db33a735fa98728a10927edc686ce..ef14d8d96cd33442aaa0465d943963c109b6d2cd 100644 (file)
@@ -439,7 +439,7 @@ int action_a2n(char *arg, int *result)
        return 0;
 }
 
-int get_linklayer(unsigned int *val, const char *arg)
+int get_linklayer(unsigned *val, const char *arg)
 {
        int res;
 
@@ -456,6 +456,30 @@ int get_linklayer(unsigned int *val, const char *arg)
        return 0;
 }
 
+void print_linklayer(char *buf, int len, unsigned linklayer)
+{
+       switch (linklayer) {
+       case LINKLAYER_UNSPEC:
+               snprintf(buf, len, "%s", "unspec");
+               return;
+       case LINKLAYER_ETHERNET:
+               snprintf(buf, len, "%s", "ethernet");
+               return;
+       case LINKLAYER_ATM:
+               snprintf(buf, len, "%s", "atm");
+               return;
+       default:
+               snprintf(buf, len, "%s", "unknown");
+               return;
+       }
+}
+
+char *sprint_linklayer(unsigned linklayer, char *buf)
+{
+       print_linklayer(buf, SPRINT_BSIZE-1, linklayer);
+       return buf;
+}
+
 void print_tm(FILE * f, const struct tcf_t *tm)
 {
        int hz = get_user_hz();