Adding a general function get_linklayer() for parsing linklayer types.
Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
---
tc/tc_util.c | 18 ++++++++++++++++++
tc/tc_util.h | 2 ++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/tc/tc_util.c b/tc/tc_util.c
index cdbae42..f8472c5 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -435,6 +435,24 @@ int action_a2n(char *arg, int *result)
return 0;
}
+// Function for parsing linklayer type
+int get_linklayer(unsigned int *val, char *arg)
+{
+ int res;
+ if (matches(arg, "ethernet") == 0)
+ res = LINKLAYER_ETHERNET;
+ else if (matches(arg, "atm") == 0)
+ res = LINKLAYER_ATM;
+ else if (matches(arg, "adsl") == 0)
+ res = LINKLAYER_ATM;
+ else
+ return -1; /* Indicate error */
+
+ *val = res;
+ return 0;
+}
+
+
void print_tm(FILE * f, const struct tcf_t *tm)
{
int hz = get_user_hz();
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 120d6ce..5b8253a 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -62,6 +62,8 @@ extern char * sprint_time(__u32 time, char *buf);
extern char * sprint_ticks(__u32 ticks, char *buf);
extern char * sprint_percent(__u32 percent, char *buf);
+extern int get_linklayer(unsigned int *val, char *arg);
+
extern void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtattr **xstats);
extern void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtattr **xstats);
--
1.5.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Arjan van de Ven | [patch] Add basic sanity checks to the syscall execution patch |
| Rafael J. Wysocki | Re: Linux 2.6.25-rc2 |
| Andrew Morton | Re: 2.6.23-rc4-mm1 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| Linus Torvalds | Re: On Tabs and Spaces |
| Lars Hjemli | Re: kernel.org mirroring (Re: [GIT PULL] MMC update) |
| Eric Wong | Re: [RFC] Git config file reader in Perl (WIP) |
| Jakub Narebski | Re: GSoC 2008 - Mentors Wanted! |
| Karel Kulhavy | OpenBSD sticker considered cool by a layman |
| Richard Stallman | Real men don't attack straw men |
| Marco Peereboom | Re: Multi-Threaded SSH/SCP made by university of Puttsburgh |
| Douglas A. Tutty | lock(1) to lock all virtual terminals? |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| Brandon S. Allbery | Re: mkdir says "no space left on device" and more problems... |
| Arthur Recktenwald | rcmd: socket: Permission denied |
| massimo rossi | Re: SLS on Compaq Deskpro 66M (486-66/DX2 EISA [ugh])? |
